UI: Add options to hide extra columns (#9093)

UI change that allows the user to hide the size and or file types columns
This commit is contained in:
Piplup 2022-11-04 06:30:39 +00:00 committed by GitHub
parent 38e4382f53
commit ece22fcbc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 1 deletions

View File

@ -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);

View File

@ -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<int>::of(&QComboBox::currentIndexChanged), this,
&ConfigureUi::RequestGameListUpdate);
connect(ui->folder_icon_size_combobox, QOverload<int>::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(

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>363</width>
<height>507</height>
<height>562</height>
</rect>
</property>
<property name="windowTitle">
@ -90,6 +90,20 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="show_size">
<property name="text">
<string>Show Size Column</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="show_types">
<property name="text">
<string>Show File Types Column</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="game_icon_size_qhbox_layout_2">
<item>

View File

@ -788,6 +788,8 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& 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());

View File

@ -132,6 +132,10 @@ struct Values {
// Compatibility List
Settings::Setting<bool> show_compat{false, "show_compat"};
// Size & File Types Column
Settings::Setting<bool> show_size{true, "show_size"};
Settings::Setting<bool> show_types{true, "show_types"};
bool configuration_applied;
bool reset_to_defaults;
Settings::Setting<bool> disable_web_applet{true, "disable_web_applet"};