From fa4723ffb42507633394eb12a5c6511a4caf0f37 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 5 Aug 2017 10:28:53 +0200 Subject: [PATCH] DolphinQt2: Rename "Table"/"List" to "List View"/"Grid View" Sentret_C posted this comment on Transifex recently: "What Dolphin refers to as "Table View" and "List View" are similar to "List View" and "Grid View" in Steam, and I think the Steam names describe them better." I agree with that, so here's a commit that changes the names. --- Source/Core/DolphinQt2/CMakeLists.txt | 2 +- Source/Core/DolphinQt2/DolphinQt2.vcxproj | 6 +- Source/Core/DolphinQt2/GameList/GameList.cpp | 118 +++++++++--------- Source/Core/DolphinQt2/GameList/GameList.h | 18 +-- .../DolphinQt2/GameList/GridProxyModel.cpp | 42 +++++++ .../Core/DolphinQt2/GameList/GridProxyModel.h | 19 +++ .../DolphinQt2/GameList/ListProxyModel.cpp | 30 +---- .../Core/DolphinQt2/GameList/ListProxyModel.h | 6 +- .../DolphinQt2/GameList/TableProxyModel.cpp | 16 --- .../DolphinQt2/GameList/TableProxyModel.h | 17 --- Source/Core/DolphinQt2/MainWindow.cpp | 2 +- Source/Core/DolphinQt2/MenuBar.cpp | 26 ++-- Source/Core/DolphinQt2/MenuBar.h | 4 +- Source/Core/DolphinQt2/Settings.cpp | 4 +- Source/Core/DolphinQt2/Settings.h | 2 +- 15 files changed, 155 insertions(+), 157 deletions(-) create mode 100644 Source/Core/DolphinQt2/GameList/GridProxyModel.cpp create mode 100644 Source/Core/DolphinQt2/GameList/GridProxyModel.h delete mode 100644 Source/Core/DolphinQt2/GameList/TableProxyModel.cpp delete mode 100644 Source/Core/DolphinQt2/GameList/TableProxyModel.h diff --git a/Source/Core/DolphinQt2/CMakeLists.txt b/Source/Core/DolphinQt2/CMakeLists.txt index 4c9b147f5e..608caaea8b 100644 --- a/Source/Core/DolphinQt2/CMakeLists.txt +++ b/Source/Core/DolphinQt2/CMakeLists.txt @@ -63,8 +63,8 @@ set(SRCS GameList/GameList.cpp GameList/GameListModel.cpp GameList/GameTracker.cpp + GameList/GridProxyModel.cpp GameList/ListProxyModel.cpp - GameList/TableProxyModel.cpp QtUtils/BlockUserInputFilter.cpp QtUtils/DoubleClickEventFilter.cpp QtUtils/ElidedButton.cpp diff --git a/Source/Core/DolphinQt2/DolphinQt2.vcxproj b/Source/Core/DolphinQt2/DolphinQt2.vcxproj index 6a16f8d4c3..347a5c9a5e 100644 --- a/Source/Core/DolphinQt2/DolphinQt2.vcxproj +++ b/Source/Core/DolphinQt2/DolphinQt2.vcxproj @@ -84,8 +84,8 @@ + - @@ -126,8 +126,8 @@ + - @@ -181,8 +181,8 @@ + - diff --git a/Source/Core/DolphinQt2/GameList/GameList.cpp b/Source/Core/DolphinQt2/GameList/GameList.cpp index 3c9bcc5aca..b20629945f 100644 --- a/Source/Core/DolphinQt2/GameList/GameList.cpp +++ b/Source/Core/DolphinQt2/GameList/GameList.cpp @@ -25,8 +25,8 @@ #include "DolphinQt2/Config/PropertiesDialog.h" #include "DolphinQt2/GameList/GameList.h" +#include "DolphinQt2/GameList/GridProxyModel.h" #include "DolphinQt2/GameList/ListProxyModel.h" -#include "DolphinQt2/GameList/TableProxyModel.h" #include "DolphinQt2/QtUtils/DoubleClickEventFilter.h" #include "DolphinQt2/Settings.h" @@ -35,59 +35,59 @@ static bool CompressCB(const std::string&, float, void*); GameList::GameList(QWidget* parent) : QStackedWidget(parent) { m_model = new GameListModel(this); - m_table_proxy = new TableProxyModel(this); - m_table_proxy->setSortCaseSensitivity(Qt::CaseInsensitive); - m_table_proxy->setSortRole(Qt::InitialSortOrderRole); - m_table_proxy->setSourceModel(m_model); m_list_proxy = new ListProxyModel(this); + m_list_proxy->setSortCaseSensitivity(Qt::CaseInsensitive); + m_list_proxy->setSortRole(Qt::InitialSortOrderRole); m_list_proxy->setSourceModel(m_model); + m_grid_proxy = new GridProxyModel(this); + m_grid_proxy->setSourceModel(m_model); - MakeTableView(); MakeListView(); + MakeGridView(); MakeEmptyView(); - connect(m_table, &QTableView::doubleClicked, this, &GameList::GameSelected); - connect(m_list, &QListView::doubleClicked, this, &GameList::GameSelected); + connect(m_list, &QTableView::doubleClicked, this, &GameList::GameSelected); + connect(m_grid, &QListView::doubleClicked, this, &GameList::GameSelected); connect(&Settings::Instance(), &Settings::PathAdded, m_model, &GameListModel::DirectoryAdded); connect(&Settings::Instance(), &Settings::PathRemoved, m_model, &GameListModel::DirectoryRemoved); connect(m_model, &QAbstractItemModel::rowsInserted, this, &GameList::ConsiderViewChange); connect(m_model, &QAbstractItemModel::rowsRemoved, this, &GameList::ConsiderViewChange); - addWidget(m_table); addWidget(m_list); + addWidget(m_grid); addWidget(m_empty); - m_prefer_table = Settings::Instance().GetPreferredView(); + m_prefer_list = Settings::Instance().GetPreferredView(); ConsiderViewChange(); } -void GameList::MakeTableView() +void GameList::MakeListView() { - m_table = new QTableView(this); - m_table->setModel(m_table_proxy); + m_list = new QTableView(this); + m_list->setModel(m_list_proxy); - m_table->setSelectionMode(QAbstractItemView::SingleSelection); - m_table->setSelectionBehavior(QAbstractItemView::SelectRows); - m_table->setAlternatingRowColors(true); - m_table->setShowGrid(false); - m_table->setSortingEnabled(true); - m_table->setCurrentIndex(QModelIndex()); - m_table->setContextMenuPolicy(Qt::CustomContextMenu); - m_table->setWordWrap(false); + m_list->setSelectionMode(QAbstractItemView::SingleSelection); + m_list->setSelectionBehavior(QAbstractItemView::SelectRows); + m_list->setAlternatingRowColors(true); + m_list->setShowGrid(false); + m_list->setSortingEnabled(true); + m_list->setCurrentIndex(QModelIndex()); + m_list->setContextMenuPolicy(Qt::CustomContextMenu); + m_list->setWordWrap(false); - connect(m_table, &QTableView::customContextMenuRequested, this, &GameList::ShowContextMenu); + connect(m_list, &QTableView::customContextMenuRequested, this, &GameList::ShowContextMenu); - m_table->setColumnHidden(GameListModel::COL_PLATFORM, !SConfig::GetInstance().m_showSystemColumn); - m_table->setColumnHidden(GameListModel::COL_ID, !SConfig::GetInstance().m_showIDColumn); - m_table->setColumnHidden(GameListModel::COL_BANNER, !SConfig::GetInstance().m_showBannerColumn); - m_table->setColumnHidden(GameListModel::COL_TITLE, !SConfig::GetInstance().m_showTitleColumn); - m_table->setColumnHidden(GameListModel::COL_DESCRIPTION, - !SConfig::GetInstance().m_showDescriptionColumn); - m_table->setColumnHidden(GameListModel::COL_MAKER, !SConfig::GetInstance().m_showMakerColumn); - m_table->setColumnHidden(GameListModel::COL_SIZE, !SConfig::GetInstance().m_showSizeColumn); - m_table->setColumnHidden(GameListModel::COL_COUNTRY, !SConfig::GetInstance().m_showRegionColumn); - m_table->setColumnHidden(GameListModel::COL_RATING, !SConfig::GetInstance().m_showStateColumn); + m_list->setColumnHidden(GameListModel::COL_PLATFORM, !SConfig::GetInstance().m_showSystemColumn); + m_list->setColumnHidden(GameListModel::COL_ID, !SConfig::GetInstance().m_showIDColumn); + m_list->setColumnHidden(GameListModel::COL_BANNER, !SConfig::GetInstance().m_showBannerColumn); + m_list->setColumnHidden(GameListModel::COL_TITLE, !SConfig::GetInstance().m_showTitleColumn); + m_list->setColumnHidden(GameListModel::COL_DESCRIPTION, + !SConfig::GetInstance().m_showDescriptionColumn); + m_list->setColumnHidden(GameListModel::COL_MAKER, !SConfig::GetInstance().m_showMakerColumn); + m_list->setColumnHidden(GameListModel::COL_SIZE, !SConfig::GetInstance().m_showSizeColumn); + m_list->setColumnHidden(GameListModel::COL_COUNTRY, !SConfig::GetInstance().m_showRegionColumn); + m_list->setColumnHidden(GameListModel::COL_RATING, !SConfig::GetInstance().m_showStateColumn); - QHeaderView* hor_header = m_table->horizontalHeader(); + QHeaderView* hor_header = m_list->horizontalHeader(); connect(hor_header, &QHeaderView::sortIndicatorChanged, this, &GameList::OnHeaderViewChanged); connect(hor_header, &QHeaderView::sectionResized, this, &GameList::OnHeaderViewChanged); @@ -107,8 +107,8 @@ void GameList::MakeTableView() hor_header->setSectionResizeMode(GameListModel::COL_DESCRIPTION, QHeaderView::Stretch); hor_header->setSectionResizeMode(GameListModel::COL_RATING, QHeaderView::ResizeToContents); - m_table->verticalHeader()->hide(); - m_table->setFrameStyle(QFrame::NoFrame); + m_list->verticalHeader()->hide(); + m_list->setFrameStyle(QFrame::NoFrame); } void GameList::MakeEmptyView() @@ -128,16 +128,16 @@ void GameList::MakeEmptyView() }); } -void GameList::MakeListView() +void GameList::MakeGridView() { - m_list = new QListView(this); - m_list->setModel(m_list_proxy); - m_list->setViewMode(QListView::IconMode); - m_list->setResizeMode(QListView::Adjust); - m_list->setUniformItemSizes(true); - m_list->setContextMenuPolicy(Qt::CustomContextMenu); - m_list->setFrameStyle(QFrame::NoFrame); - connect(m_list, &QTableView::customContextMenuRequested, this, &GameList::ShowContextMenu); + m_grid = new QListView(this); + m_grid->setModel(m_grid_proxy); + m_grid->setViewMode(QListView::IconMode); + m_grid->setResizeMode(QListView::Adjust); + m_grid->setUniformItemSizes(true); + m_grid->setContextMenuPolicy(Qt::CustomContextMenu); + m_grid->setFrameStyle(QFrame::NoFrame); + connect(m_grid, &QTableView::customContextMenuRequested, this, &GameList::ShowContextMenu); } void GameList::ShowContextMenu(const QPoint&) @@ -383,16 +383,16 @@ QString GameList::GetSelectedGame() const { QAbstractItemView* view; QSortFilterProxyModel* proxy; - if (currentWidget() == m_table) - { - view = m_table; - proxy = m_table_proxy; - } - else + if (currentWidget() == m_list) { view = m_list; proxy = m_list_proxy; } + else + { + view = m_grid; + proxy = m_grid_proxy; + } QItemSelectionModel* sel_model = view->selectionModel(); if (sel_model->hasSelection()) { @@ -402,10 +402,10 @@ QString GameList::GetSelectedGame() const return QStringLiteral(""); } -void GameList::SetPreferredView(bool table) +void GameList::SetPreferredView(bool list) { - m_prefer_table = table; - Settings::Instance().SetPreferredView(table); + m_prefer_list = list; + Settings::Instance().SetPreferredView(list); ConsiderViewChange(); } @@ -413,10 +413,10 @@ void GameList::ConsiderViewChange() { if (m_model->rowCount(QModelIndex()) > 0) { - if (m_prefer_table) - setCurrentWidget(m_table); - else + if (m_prefer_list) setCurrentWidget(m_list); + else + setCurrentWidget(m_grid); } else { @@ -444,13 +444,13 @@ void GameList::OnColumnVisibilityToggled(const QString& row, bool visible) {tr("Title"), GameListModel::COL_TITLE}, {tr("State"), GameListModel::COL_RATING}}; - m_table->setColumnHidden(rowname_to_col_index[row], !visible); + m_list->setColumnHidden(rowname_to_col_index[row], !visible); } void GameList::OnGameListVisibilityChanged() { - m_table_proxy->invalidate(); m_list_proxy->invalidate(); + m_grid_proxy->invalidate(); } static bool CompressCB(const std::string& text, float percent, void* ptr) @@ -466,5 +466,5 @@ static bool CompressCB(const std::string& text, float percent, void* ptr) void GameList::OnHeaderViewChanged() { QSettings().setValue(QStringLiteral("tableheader/state"), - m_table->horizontalHeader()->saveState()); + m_list->horizontalHeader()->saveState()); } diff --git a/Source/Core/DolphinQt2/GameList/GameList.h b/Source/Core/DolphinQt2/GameList/GameList.h index 1aab2a3299..8a02eecd9c 100644 --- a/Source/Core/DolphinQt2/GameList/GameList.h +++ b/Source/Core/DolphinQt2/GameList/GameList.h @@ -21,9 +21,9 @@ public: explicit GameList(QWidget* parent = nullptr); QString GetSelectedGame() const; - void SetTableView() { SetPreferredView(true); } - void SetListView() { SetPreferredView(false); } - void SetViewColumn(int col, bool view) { m_table->setColumnHidden(col, !view); } + void SetListView() { SetPreferredView(true); } + void SetGridView() { SetPreferredView(false); } + void SetViewColumn(int col, bool view) { m_list->setColumnHidden(col, !view); } void OnColumnVisibilityToggled(const QString& row, bool visible); void OnGameListVisibilityChanged(); @@ -46,21 +46,21 @@ private: void CompressISO(); void OnHeaderViewChanged(); - void MakeTableView(); void MakeListView(); + void MakeGridView(); void MakeEmptyView(); // We only have two views, just use a bool to distinguish. - void SetPreferredView(bool table); + void SetPreferredView(bool list); void ConsiderViewChange(); GameListModel* m_model; - QSortFilterProxyModel* m_table_proxy; QSortFilterProxyModel* m_list_proxy; + QSortFilterProxyModel* m_grid_proxy; - QListView* m_list; - QTableView* m_table; + QListView* m_grid; + QTableView* m_list; QLabel* m_empty; - bool m_prefer_table; + bool m_prefer_list; protected: void keyReleaseEvent(QKeyEvent* event) override; diff --git a/Source/Core/DolphinQt2/GameList/GridProxyModel.cpp b/Source/Core/DolphinQt2/GameList/GridProxyModel.cpp new file mode 100644 index 0000000000..e48d4a337b --- /dev/null +++ b/Source/Core/DolphinQt2/GameList/GridProxyModel.cpp @@ -0,0 +1,42 @@ +// Copyright 2015 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include + +#include "DolphinQt2/GameList/GameListModel.h" +#include "DolphinQt2/GameList/GridProxyModel.h" + +const QSize LARGE_BANNER_SIZE(144, 48); + +GridProxyModel::GridProxyModel(QObject* parent) : QSortFilterProxyModel(parent) +{ + setSortCaseSensitivity(Qt::CaseInsensitive); + sort(GameListModel::COL_TITLE); +} + +QVariant GridProxyModel::data(const QModelIndex& i, int role) const +{ + QModelIndex source_index = mapToSource(i); + if (role == Qt::DisplayRole) + { + return sourceModel()->data(sourceModel()->index(source_index.row(), GameListModel::COL_TITLE), + Qt::DisplayRole); + } + else if (role == Qt::DecorationRole) + { + auto pixmap = sourceModel() + ->data(sourceModel()->index(source_index.row(), GameListModel::COL_BANNER), + Qt::DecorationRole) + .value(); + return pixmap.scaled(LARGE_BANNER_SIZE * pixmap.devicePixelRatio(), Qt::KeepAspectRatio, + Qt::SmoothTransformation); + } + return QVariant(); +} + +bool GridProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const +{ + GameListModel* glm = qobject_cast(sourceModel()); + return glm->ShouldDisplayGameListItem(source_row); +} diff --git a/Source/Core/DolphinQt2/GameList/GridProxyModel.h b/Source/Core/DolphinQt2/GameList/GridProxyModel.h new file mode 100644 index 0000000000..995ae83358 --- /dev/null +++ b/Source/Core/DolphinQt2/GameList/GridProxyModel.h @@ -0,0 +1,19 @@ +// Copyright 2015 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include + +// This subclass of QSortFilterProxyModel transforms the raw data into a +// single-column large icon + name to be displayed in a QListView. +class GridProxyModel final : public QSortFilterProxyModel +{ + Q_OBJECT + +public: + explicit GridProxyModel(QObject* parent = nullptr); + QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; + bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; +}; diff --git a/Source/Core/DolphinQt2/GameList/ListProxyModel.cpp b/Source/Core/DolphinQt2/GameList/ListProxyModel.cpp index 1dcc7b5b38..bf4b32ba59 100644 --- a/Source/Core/DolphinQt2/GameList/ListProxyModel.cpp +++ b/Source/Core/DolphinQt2/GameList/ListProxyModel.cpp @@ -1,38 +1,12 @@ -// Copyright 2015 Dolphin Emulator Project +// Copyright 2017 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. -#include - -#include "DolphinQt2/GameList/GameListModel.h" #include "DolphinQt2/GameList/ListProxyModel.h" - -const QSize LARGE_BANNER_SIZE(144, 48); +#include "DolphinQt2/GameList/GameListModel.h" ListProxyModel::ListProxyModel(QObject* parent) : QSortFilterProxyModel(parent) { - setSortCaseSensitivity(Qt::CaseInsensitive); - sort(GameListModel::COL_TITLE); -} - -QVariant ListProxyModel::data(const QModelIndex& i, int role) const -{ - QModelIndex source_index = mapToSource(i); - if (role == Qt::DisplayRole) - { - return sourceModel()->data(sourceModel()->index(source_index.row(), GameListModel::COL_TITLE), - Qt::DisplayRole); - } - else if (role == Qt::DecorationRole) - { - auto pixmap = sourceModel() - ->data(sourceModel()->index(source_index.row(), GameListModel::COL_BANNER), - Qt::DecorationRole) - .value(); - return pixmap.scaled(LARGE_BANNER_SIZE * pixmap.devicePixelRatio(), Qt::KeepAspectRatio, - Qt::SmoothTransformation); - } - return QVariant(); } bool ListProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const diff --git a/Source/Core/DolphinQt2/GameList/ListProxyModel.h b/Source/Core/DolphinQt2/GameList/ListProxyModel.h index 3d984e828e..c73214040b 100644 --- a/Source/Core/DolphinQt2/GameList/ListProxyModel.h +++ b/Source/Core/DolphinQt2/GameList/ListProxyModel.h @@ -1,4 +1,4 @@ -// Copyright 2015 Dolphin Emulator Project +// Copyright 2017 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. @@ -6,14 +6,12 @@ #include -// This subclass of QSortFilterProxyModel transforms the raw data into a -// single-column large icon + name to be displayed in a QListView. +// This subclass of QSortFilterProxyModel allows the data to be filtered by the view. class ListProxyModel final : public QSortFilterProxyModel { Q_OBJECT public: explicit ListProxyModel(QObject* parent = nullptr); - QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; }; diff --git a/Source/Core/DolphinQt2/GameList/TableProxyModel.cpp b/Source/Core/DolphinQt2/GameList/TableProxyModel.cpp deleted file mode 100644 index 30b1b6d093..0000000000 --- a/Source/Core/DolphinQt2/GameList/TableProxyModel.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#include "DolphinQt2/GameList/TableProxyModel.h" -#include "DolphinQt2/GameList/GameListModel.h" - -TableProxyModel::TableProxyModel(QObject* parent) : QSortFilterProxyModel(parent) -{ -} - -bool TableProxyModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const -{ - GameListModel* glm = qobject_cast(sourceModel()); - return glm->ShouldDisplayGameListItem(source_row); -} diff --git a/Source/Core/DolphinQt2/GameList/TableProxyModel.h b/Source/Core/DolphinQt2/GameList/TableProxyModel.h deleted file mode 100644 index 72a8d1c0ba..0000000000 --- a/Source/Core/DolphinQt2/GameList/TableProxyModel.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 Dolphin Emulator Project -// Licensed under GPLv2+ -// Refer to the license.txt file included. - -#pragma once - -#include - -// This subclass of QSortFilterProxyModel allows the data to be filtered by the view. -class TableProxyModel final : public QSortFilterProxyModel -{ - Q_OBJECT - -public: - explicit TableProxyModel(QObject* parent = nullptr); - bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override; -}; diff --git a/Source/Core/DolphinQt2/MainWindow.cpp b/Source/Core/DolphinQt2/MainWindow.cpp index 8801e39be3..cb49592b1e 100644 --- a/Source/Core/DolphinQt2/MainWindow.cpp +++ b/Source/Core/DolphinQt2/MainWindow.cpp @@ -197,8 +197,8 @@ void MainWindow::ConnectMenuBar() connect(m_menu_bar, &MenuBar::BootWiiSystemMenu, this, &MainWindow::BootWiiSystemMenu); // View - connect(m_menu_bar, &MenuBar::ShowTable, m_game_list, &GameList::SetTableView); connect(m_menu_bar, &MenuBar::ShowList, m_game_list, &GameList::SetListView); + connect(m_menu_bar, &MenuBar::ShowGrid, m_game_list, &GameList::SetGridView); connect(m_menu_bar, &MenuBar::ColumnVisibilityToggled, m_game_list, &GameList::OnColumnVisibilityToggled); diff --git a/Source/Core/DolphinQt2/MenuBar.cpp b/Source/Core/DolphinQt2/MenuBar.cpp index a84219fd81..8008997abf 100644 --- a/Source/Core/DolphinQt2/MenuBar.cpp +++ b/Source/Core/DolphinQt2/MenuBar.cpp @@ -215,7 +215,7 @@ void MenuBar::AddViewMenu() AddGameListTypeSection(view_menu); view_menu->addSeparator(); - AddTableColumnsMenu(view_menu); + AddListColumnsMenu(view_menu); view_menu->addSeparator(); AddShowPlatformsMenu(view_menu); AddShowRegionsMenu(view_menu); @@ -253,27 +253,25 @@ void MenuBar::AddHelpMenu() void MenuBar::AddGameListTypeSection(QMenu* view_menu) { - // i18n: When this option is enabled, the game list is displayed as a table - QAction* table_view = view_menu->addAction(tr("Table")); - table_view->setCheckable(true); - - // i18n: When this option is enabled, the game list is displayed as a list - QAction* list_view = view_menu->addAction(tr("List")); + QAction* list_view = view_menu->addAction(tr("List View")); list_view->setCheckable(true); + QAction* grid_view = view_menu->addAction(tr("Grid View")); + grid_view->setCheckable(true); + QActionGroup* list_group = new QActionGroup(this); - list_group->addAction(table_view); list_group->addAction(list_view); + list_group->addAction(grid_view); - bool prefer_table = Settings::Instance().GetPreferredView(); - table_view->setChecked(prefer_table); - list_view->setChecked(!prefer_table); + bool prefer_list = Settings::Instance().GetPreferredView(); + list_view->setChecked(prefer_list); + grid_view->setChecked(!prefer_list); - connect(table_view, &QAction::triggered, this, &MenuBar::ShowTable); connect(list_view, &QAction::triggered, this, &MenuBar::ShowList); + connect(grid_view, &QAction::triggered, this, &MenuBar::ShowGrid); } -void MenuBar::AddTableColumnsMenu(QMenu* view_menu) +void MenuBar::AddListColumnsMenu(QMenu* view_menu) { static const QMap columns{ {tr("Platform"), &SConfig::GetInstance().m_showSystemColumn}, @@ -287,7 +285,7 @@ void MenuBar::AddTableColumnsMenu(QMenu* view_menu) {tr("State"), &SConfig::GetInstance().m_showStateColumn}}; QActionGroup* column_group = new QActionGroup(this); - QMenu* cols_menu = view_menu->addMenu(tr("Table Columns")); + QMenu* cols_menu = view_menu->addMenu(tr("List Columns")); column_group->setExclusive(false); for (const auto& key : columns.keys()) diff --git a/Source/Core/DolphinQt2/MenuBar.h b/Source/Core/DolphinQt2/MenuBar.h index 2843f17d67..bb247f9bcb 100644 --- a/Source/Core/DolphinQt2/MenuBar.h +++ b/Source/Core/DolphinQt2/MenuBar.h @@ -60,8 +60,8 @@ signals: void ConfigureHotkeys(); // View - void ShowTable(); void ShowList(); + void ShowGrid(); void ColumnVisibilityToggled(const QString& row, bool visible); void GameListPlatformVisibilityToggled(const QString& row, bool visible); void GameListRegionVisibilityToggled(const QString& row, bool visible); @@ -78,7 +78,7 @@ private: void AddViewMenu(); void AddGameListTypeSection(QMenu* view_menu); - void AddTableColumnsMenu(QMenu* view_menu); + void AddListColumnsMenu(QMenu* view_menu); void AddShowPlatformsMenu(QMenu* view_menu); void AddShowRegionsMenu(QMenu* view_menu); diff --git a/Source/Core/DolphinQt2/Settings.cpp b/Source/Core/DolphinQt2/Settings.cpp index 4e88f3d427..99632fa78b 100644 --- a/Source/Core/DolphinQt2/Settings.cpp +++ b/Source/Core/DolphinQt2/Settings.cpp @@ -77,9 +77,9 @@ bool Settings::GetPreferredView() const return QSettings().value(QStringLiteral("PreferredView"), true).toBool(); } -void Settings::SetPreferredView(bool table) +void Settings::SetPreferredView(bool list) { - QSettings().setValue(QStringLiteral("PreferredView"), table); + QSettings().setValue(QStringLiteral("PreferredView"), list); } int Settings::GetStateSlot() const diff --git a/Source/Core/DolphinQt2/Settings.h b/Source/Core/DolphinQt2/Settings.h index 0ed8d9d74e..be9e32dec4 100644 --- a/Source/Core/DolphinQt2/Settings.h +++ b/Source/Core/DolphinQt2/Settings.h @@ -41,7 +41,7 @@ public: void AddPath(const QString& path); void RemovePath(const QString& path); bool GetPreferredView() const; - void SetPreferredView(bool table); + void SetPreferredView(bool list); // Emulation int GetStateSlot() const;