diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-11-02 01:27:12 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-11-02 01:27:12 +0100 |
commit | 2d2ef05d8c5d476a17ef30609ed055ec0aa75609 (patch) | |
tree | 712f3b6a66af6ded95f71523ee9ce9a04b3d2305 /src | |
parent | filesystem: Cache RegisteredCacheUnion instead of constructing on demand (diff) | |
download | yuzu-2d2ef05d8c5d476a17ef30609ed055ec0aa75609.tar yuzu-2d2ef05d8c5d476a17ef30609ed055ec0aa75609.tar.gz yuzu-2d2ef05d8c5d476a17ef30609ed055ec0aa75609.tar.bz2 yuzu-2d2ef05d8c5d476a17ef30609ed055ec0aa75609.tar.lz yuzu-2d2ef05d8c5d476a17ef30609ed055ec0aa75609.tar.xz yuzu-2d2ef05d8c5d476a17ef30609ed055ec0aa75609.tar.zst yuzu-2d2ef05d8c5d476a17ef30609ed055ec0aa75609.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/yuzu/configuration/config.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_gamelist.cpp | 2 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_gamelist.ui | 223 | ||||
-rw-r--r-- | src/yuzu/game_list.cpp | 33 | ||||
-rw-r--r-- | src/yuzu/game_list_worker.cpp | 24 | ||||
-rw-r--r-- | src/yuzu/ui_settings.h | 1 |
6 files changed, 166 insertions, 119 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index d4fd60a73..526cf6c10 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -162,6 +162,7 @@ void Config::ReadValues() { qt_config->beginGroup("UIGameList"); UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool(); + UISettings::values.show_add_ons = qt_config->value("show_add_ons", true).toBool(); UISettings::values.icon_size = qt_config->value("icon_size", 64).toUInt(); UISettings::values.row_1_text_id = qt_config->value("row_1_text_id", 3).toUInt(); UISettings::values.row_2_text_id = qt_config->value("row_2_text_id", 2).toUInt(); @@ -298,6 +299,7 @@ void Config::SaveValues() { qt_config->beginGroup("UIGameList"); qt_config->setValue("show_unknown", UISettings::values.show_unknown); + qt_config->setValue("show_add_ons", UISettings::values.show_add_ons); qt_config->setValue("icon_size", UISettings::values.icon_size); qt_config->setValue("row_1_text_id", UISettings::values.row_1_text_id); qt_config->setValue("row_2_text_id", UISettings::values.row_2_text_id); diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_gamelist.cpp index 8743ce982..639d5df0f 100644 --- a/src/yuzu/configuration/configure_gamelist.cpp +++ b/src/yuzu/configuration/configure_gamelist.cpp @@ -42,6 +42,7 @@ ConfigureGameList::~ConfigureGameList() = default; void ConfigureGameList::applyConfiguration() { UISettings::values.show_unknown = ui->show_unknown->isChecked(); + UISettings::values.show_add_ons = ui->show_add_ons->isChecked(); UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); @@ -50,6 +51,7 @@ void ConfigureGameList::applyConfiguration() { void ConfigureGameList::setConfiguration() { ui->show_unknown->setChecked(UISettings::values.show_unknown); + ui->show_add_ons->setChecked(UISettings::values.show_add_ons); ui->icon_size_combobox->setCurrentIndex( ui->icon_size_combobox->findData(UISettings::values.icon_size)); ui->row_1_text_combobox->setCurrentIndex( diff --git a/src/yuzu/configuration/configure_gamelist.ui b/src/yuzu/configuration/configure_gamelist.ui index 7471fdb60..7a69377e7 100644 --- a/src/yuzu/configuration/configure_gamelist.ui +++ b/src/yuzu/configuration/configure_gamelist.ui @@ -1,126 +1,133 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>ConfigureGameList</class> - <widget class="QWidget" name="ConfigureGeneral"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>300</width> - <height>377</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> - <layout class="QHBoxLayout" name="HorizontalLayout"> - <item> - <layout class="QVBoxLayout" name="VerticalLayout"> + <widget class="QWidget" name="ConfigureGameList"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>300</width> + <height>377</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="HorizontalLayout"> + <item> + <layout class="QVBoxLayout" name="VerticalLayout"> + <item> + <widget class="QGroupBox" name="GeneralGroupBox"> + <property name="title"> + <string>General</string> + </property> + <layout class="QHBoxLayout" name="GeneralHorizontalLayout"> + <item> + <layout class="QVBoxLayout" name="GeneralVerticalLayout"> <item> - <widget class="QGroupBox" name="GeneralGroupBox"> - <property name="title"> - <string>General</string> - </property> - <layout class="QHBoxLayout" name="GeneralHorizontalLayout"> - <item> - <layout class="QVBoxLayout" name="GeneralVerticalLayout"> - <item> - <widget class="QCheckBox" name="show_unknown"> - <property name="text"> - <string>Show files with type 'Unknown'</string> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </widget> + <widget class="QCheckBox" name="show_unknown"> + <property name="text"> + <string>Show files with type 'Unknown'</string> + </property> + </widget> </item> <item> - <widget class="QGroupBox" name="IconSizeGroupBox"> - <property name="title"> - <string>Icon Size</string> - </property> - <layout class="QHBoxLayout" name="icon_size_qhbox_layout"> - <item> - <layout class="QVBoxLayout" name="icon_size_qvbox_layout"> - <item> - <layout class="QHBoxLayout" name="icon_size_qhbox_layout_2"> - <item> - <widget class="QLabel" name="icon_size_label"> - <property name="text"> - <string>Icon Size:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="icon_size_combobox"/> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> + <widget class="QCheckBox" name="show_add_ons"> + <property name="text"> + <string>Show Add-Ons Column</string> + </property> + </widget> </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="IconSizeGroupBox"> + <property name="title"> + <string>Icon Size</string> + </property> + <layout class="QHBoxLayout" name="icon_size_qhbox_layout"> + <item> + <layout class="QVBoxLayout" name="icon_size_qvbox_layout"> <item> - <widget class="QGroupBox" name="RowGroupBox"> - <property name="title"> - <string>Row Text</string> + <layout class="QHBoxLayout" name="icon_size_qhbox_layout_2"> + <item> + <widget class="QLabel" name="icon_size_label"> + <property name="text"> + <string>Icon Size:</string> </property> - <layout class="QHBoxLayout" name="RowHorizontalLayout"> - <item> - <layout class="QVBoxLayout" name="RowVerticalLayout"> - <item> - <layout class="QHBoxLayout" name="row_1_qhbox_layout"> - <item> - <widget class="QLabel" name="row_1_label"> - <property name="text"> - <string>Row 1 Text:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="row_1_text_combobox"/> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="row_2_qhbox_layout"> - <item> - <widget class="QLabel" name="row_2_label"> - <property name="text"> - <string>Row 2 Text:</string> - </property> - </widget> - </item> - <item> - <widget class="QComboBox" name="row_2_text_combobox"/> - </item> - </layout> - </item> - </layout> - </item> - </layout> - </widget> + </widget> + </item> + <item> + <widget class="QComboBox" name="icon_size_combobox"/> + </item> + </layout> </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="RowGroupBox"> + <property name="title"> + <string>Row Text</string> + </property> + <layout class="QHBoxLayout" name="RowHorizontalLayout"> + <item> + <layout class="QVBoxLayout" name="RowVerticalLayout"> <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> + <layout class="QHBoxLayout" name="row_1_qhbox_layout"> + <item> + <widget class="QLabel" name="row_1_label"> + <property name="text"> + <string>Row 1 Text:</string> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> + </widget> + </item> + <item> + <widget class="QComboBox" name="row_1_text_combobox"/> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="row_2_qhbox_layout"> + <item> + <widget class="QLabel" name="row_2_label"> + <property name="text"> + <string>Row 2 Text:</string> </property> - </spacer> + </widget> + </item> + <item> + <widget class="QComboBox" name="row_2_text_combobox"/> + </item> + </layout> </item> - </layout> - </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> </layout> - </widget> + </item> + </layout> + </widget> <resources/> <connections/> </ui> diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index a5a4aa432..11a8c390b 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -215,12 +215,18 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent) tree_view->setUniformRowHeights(true); tree_view->setContextMenuPolicy(Qt::CustomContextMenu); - item_model->insertColumns(0, COLUMN_COUNT); + item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); - item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); - item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); - item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); + + if (UISettings::values.show_add_ons) { + item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); + item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); + item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); + } else { + item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); + item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); + } connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry); connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); @@ -394,6 +400,25 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) { } tree_view->setEnabled(false); + + // Update the columns in case UISettings has changed + item_model->removeColumns(0, item_model->columnCount()); + item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); + item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); + item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); + + if (UISettings::values.show_add_ons) { + item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); + item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); + item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); + } else { + item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); + item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); + item_model->removeColumns(COLUMN_COUNT - 1, 1); + } + + LoadInterfaceLayout(); + // Delete any rows that might already exist if we're repopulating item_model->removeRows(0, item_model->rowCount()); diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 3d865a12d..362902e46 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -123,17 +123,22 @@ void GameListWorker::AddInstalledTitlesToGameList() { if (it != compatibility_list.end()) compatibility = it->second.first; - emit EntryReady({ + QList<QStandardItem*> list{ new GameListItemPath( FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name), QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), program_id), new GameListItemCompat(compatibility), - new GameListItem(FormatPatchNameVersions(patch, *loader)), new GameListItem( QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), new GameListItemSize(file->GetSize()), - }); + }; + + if (UISettings::values.show_add_ons) { + list.insert(2, new GameListItem(FormatPatchNameVersions(patch, *loader))); + } + + emit EntryReady(list); } const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, @@ -216,18 +221,23 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign if (it != compatibility_list.end()) compatibility = it->second.first; - emit EntryReady({ + QList<QStandardItem*> list{ new GameListItemPath( FormatGameName(physical_name), icon, QString::fromStdString(name), QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), program_id), new GameListItemCompat(compatibility), new GameListItem( - FormatPatchNameVersions(patch, *loader, loader->IsRomFSUpdatable())), - new GameListItem( QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), new GameListItemSize(FileUtil::GetSize(physical_name)), - }); + }; + + if (UISettings::values.show_add_ons) { + list.insert(2, new GameListItem(FormatPatchNameVersions( + patch, *loader, loader->IsRomFSUpdatable()))); + } + + emit EntryReady(std::move(list)); } else if (is_dir && recursion > 0) { watch_list.append(QString::fromStdString(physical_name)); AddFstEntriesToGameList(physical_name, recursion - 1); diff --git a/src/yuzu/ui_settings.h b/src/yuzu/ui_settings.h index 2e617d52a..32a0d813c 100644 --- a/src/yuzu/ui_settings.h +++ b/src/yuzu/ui_settings.h @@ -59,6 +59,7 @@ struct Values { // Game List bool show_unknown; + bool show_add_ons; uint32_t icon_size; uint8_t row_1_text_id; uint8_t row_2_text_id; |