From ece22fcbc7f120dd2929c60545b81f0e3211c028 Mon Sep 17 00:00:00 2001 From: Piplup <100526773+piplup55@users.noreply.github.com> Date: Fri, 4 Nov 2022 06:30:39 +0000 Subject: [PATCH] UI: Add options to hide extra columns (#9093) UI change that allows the user to hide the size and or file types columns --- src/yuzu/configuration/config.cpp | 4 ++++ src/yuzu/configuration/configure_ui.cpp | 6 ++++++ src/yuzu/configuration/configure_ui.ui | 16 +++++++++++++++- src/yuzu/game_list.cpp | 2 ++ src/yuzu/uisettings.h | 4 ++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 927dd1069..343f3b8e5 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -820,6 +820,8 @@ void Config::ReadUIGamelistValues() { ReadBasicSetting(UISettings::values.show_add_ons); ReadBasicSetting(UISettings::values.show_compat); + ReadBasicSetting(UISettings::values.show_size); + ReadBasicSetting(UISettings::values.show_types); ReadBasicSetting(UISettings::values.game_icon_size); ReadBasicSetting(UISettings::values.folder_icon_size); ReadBasicSetting(UISettings::values.row_1_text_id); @@ -1416,6 +1418,8 @@ void Config::SaveUIGamelistValues() { WriteBasicSetting(UISettings::values.show_add_ons); WriteBasicSetting(UISettings::values.show_compat); + WriteBasicSetting(UISettings::values.show_size); + WriteBasicSetting(UISettings::values.show_types); WriteBasicSetting(UISettings::values.game_icon_size); WriteBasicSetting(UISettings::values.folder_icon_size); WriteBasicSetting(UISettings::values.row_1_text_id); diff --git a/src/yuzu/configuration/configure_ui.cpp b/src/yuzu/configuration/configure_ui.cpp index 92e6da6ee..2ebb80302 100644 --- a/src/yuzu/configuration/configure_ui.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -73,6 +73,8 @@ ConfigureUi::ConfigureUi(Core::System& system_, QWidget* parent) // Force game list reload if any of the relevant settings are changed. connect(ui->show_add_ons, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate); connect(ui->show_compat, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate); + connect(ui->show_size, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate); + connect(ui->show_types, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate); connect(ui->game_icon_size_combobox, QOverload::of(&QComboBox::currentIndexChanged), this, &ConfigureUi::RequestGameListUpdate); connect(ui->folder_icon_size_combobox, QOverload::of(&QComboBox::currentIndexChanged), @@ -111,6 +113,8 @@ void ConfigureUi::ApplyConfiguration() { ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); UISettings::values.show_add_ons = ui->show_add_ons->isChecked(); UISettings::values.show_compat = ui->show_compat->isChecked(); + UISettings::values.show_size = ui->show_size->isChecked(); + UISettings::values.show_types = ui->show_types->isChecked(); UISettings::values.game_icon_size = ui->game_icon_size_combobox->currentData().toUInt(); UISettings::values.folder_icon_size = ui->folder_icon_size_combobox->currentData().toUInt(); UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); @@ -132,6 +136,8 @@ void ConfigureUi::SetConfiguration() { ui->language_combobox->findData(UISettings::values.language)); ui->show_add_ons->setChecked(UISettings::values.show_add_ons.GetValue()); ui->show_compat->setChecked(UISettings::values.show_compat.GetValue()); + ui->show_size->setChecked(UISettings::values.show_size.GetValue()); + ui->show_types->setChecked(UISettings::values.show_types.GetValue()); ui->game_icon_size_combobox->setCurrentIndex( ui->game_icon_size_combobox->findData(UISettings::values.game_icon_size.GetValue())); ui->folder_icon_size_combobox->setCurrentIndex( diff --git a/src/yuzu/configuration/configure_ui.ui b/src/yuzu/configuration/configure_ui.ui index f0b719ba3..10bb27312 100644 --- a/src/yuzu/configuration/configure_ui.ui +++ b/src/yuzu/configuration/configure_ui.ui @@ -7,7 +7,7 @@ 0 0 363 - 507 + 562 @@ -90,6 +90,20 @@ + + + + Show Size Column + + + + + + + Show File Types Column + + + diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index d6adfca16..5c33c1b0f 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp @@ -788,6 +788,8 @@ void GameList::PopulateAsync(QVector& game_dirs) { // Update the columns in case UISettings has changed tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); tree_view->setColumnHidden(COLUMN_COMPATIBILITY, !UISettings::values.show_compat); + tree_view->setColumnHidden(COLUMN_FILE_TYPE, !UISettings::values.show_types); + tree_view->setColumnHidden(COLUMN_SIZE, !UISettings::values.show_size); // Delete any rows that might already exist if we're repopulating item_model->removeRows(0, item_model->rowCount()); diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 4f5b2a99d..452038cd9 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -132,6 +132,10 @@ struct Values { // Compatibility List Settings::Setting show_compat{false, "show_compat"}; + // Size & File Types Column + Settings::Setting show_size{true, "show_size"}; + Settings::Setting show_types{true, "show_types"}; + bool configuration_applied; bool reset_to_defaults; Settings::Setting disable_web_applet{true, "disable_web_applet"};