From d0e4f1c6f43f51df8fdc8a056801a297c2706d56 Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Fri, 24 Jan 2020 00:15:51 +0100 Subject: [PATCH] yuzu/configuration: create UI tab and move gamelist settings there --- src/yuzu/CMakeLists.txt | 6 +- src/yuzu/configuration/configure.ui | 6 +- src/yuzu/configuration/configure_dialog.cpp | 6 +- src/yuzu/configuration/configure_general.cpp | 8 --- src/yuzu/configuration/configure_general.ui | 37 ++---------- ...onfigure_gamelist.cpp => configure_ui.cpp} | 48 ++++++++------- .../{configure_gamelist.h => configure_ui.h} | 10 ++-- ...{configure_gamelist.ui => configure_ui.ui} | 59 ++++++++++--------- 8 files changed, 76 insertions(+), 104 deletions(-) rename src/yuzu/configuration/{configure_gamelist.cpp => configure_ui.cpp} (75%) rename src/yuzu/configuration/{configure_gamelist.h => configure_ui.h} (73%) rename src/yuzu/configuration/{configure_gamelist.ui => configure_ui.ui} (79%) diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index 11ae1e66e4..a3fb91d295 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -36,9 +36,6 @@ add_executable(yuzu configuration/configure_filesystem.cpp configuration/configure_filesystem.h configuration/configure_filesystem.ui - configuration/configure_gamelist.cpp - configuration/configure_gamelist.h - configuration/configure_gamelist.ui configuration/configure_general.cpp configuration/configure_general.h configuration/configure_general.ui @@ -75,6 +72,9 @@ add_executable(yuzu configuration/configure_touchscreen_advanced.cpp configuration/configure_touchscreen_advanced.h configuration/configure_touchscreen_advanced.ui + configuration/configure_ui.cpp + configuration/configure_ui.h + configuration/configure_ui.ui configuration/configure_web.cpp configuration/configure_web.h configuration/configure_web.ui diff --git a/src/yuzu/configuration/configure.ui b/src/yuzu/configuration/configure.ui index 372427ae20..67b990f1af 100644 --- a/src/yuzu/configuration/configure.ui +++ b/src/yuzu/configuration/configure.ui @@ -48,7 +48,7 @@ General - + Game List @@ -166,9 +166,9 @@ 1 - ConfigureGameList + ConfigureUi QWidget -
configuration/configure_gamelist.h
+
configuration/configure_ui.h
1
diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 8497eaa144..db3b193529 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -34,7 +34,7 @@ void ConfigureDialog::SetConfiguration() {} void ConfigureDialog::ApplyConfiguration() { ui->generalTab->ApplyConfiguration(); - ui->gameListTab->ApplyConfiguration(); + ui->uiTab->ApplyConfiguration(); ui->systemTab->ApplyConfiguration(); ui->profileManagerTab->ApplyConfiguration(); ui->filesystemTab->applyConfiguration(); @@ -74,7 +74,7 @@ Q_DECLARE_METATYPE(QList); void ConfigureDialog::PopulateSelectionList() { const std::array>, 5> items{ - {{tr("General"), {ui->generalTab, ui->webTab, ui->debugTab, ui->gameListTab}}, + {{tr("General"), {ui->generalTab, ui->webTab, ui->debugTab, ui->uiTab}}, {tr("System"), {ui->systemTab, ui->profileManagerTab, ui->serviceTab, ui->filesystemTab}}, {tr("Graphics"), {ui->graphicsTab}}, {tr("Audio"), {ui->audioTab}}, @@ -108,7 +108,7 @@ void ConfigureDialog::UpdateVisibleTabs() { {ui->audioTab, tr("Audio")}, {ui->debugTab, tr("Debug")}, {ui->webTab, tr("Web")}, - {ui->gameListTab, tr("Game List")}, + {ui->uiTab, tr("UI")}, {ui->filesystemTab, tr("Filesystem")}, {ui->serviceTab, tr("Services")}, }; diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 34e1d7fead..5ef9271145 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -15,11 +15,6 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) ui->setupUi(this); - for (const auto& theme : UISettings::themes) { - ui->theme_combobox->addItem(QString::fromUtf8(theme.first), - QString::fromUtf8(theme.second)); - } - SetConfiguration(); connect(ui->toggle_frame_limit, &QCheckBox::toggled, ui->frame_limit, &QSpinBox::setEnabled); @@ -30,7 +25,6 @@ ConfigureGeneral::~ConfigureGeneral() = default; void ConfigureGeneral::SetConfiguration() { ui->toggle_check_exit->setChecked(UISettings::values.confirm_before_closing); ui->toggle_user_on_boot->setChecked(UISettings::values.select_user_on_boot); - ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); ui->toggle_background_pause->setChecked(UISettings::values.pause_when_in_background); ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit); @@ -41,8 +35,6 @@ void ConfigureGeneral::SetConfiguration() { void ConfigureGeneral::ApplyConfiguration() { UISettings::values.confirm_before_closing = ui->toggle_check_exit->isChecked(); UISettings::values.select_user_on_boot = ui->toggle_user_on_boot->isChecked(); - UISettings::values.theme = - ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); UISettings::values.pause_when_in_background = ui->toggle_background_pause->isChecked(); Settings::values.use_frame_limit = ui->toggle_frame_limit->isChecked(); diff --git a/src/yuzu/configuration/configure_general.ui b/src/yuzu/configuration/configure_general.ui index 26b3486ffd..857119bb3b 100644 --- a/src/yuzu/configuration/configure_general.ui +++ b/src/yuzu/configuration/configure_general.ui @@ -65,39 +65,12 @@
- - - - Pause emulation when in background - - - - - - -
- - - - - Theme - - - - - - - - - Theme: - - - - - - - + + + Pause emulation when in background + + diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_ui.cpp similarity index 75% rename from src/yuzu/configuration/configure_gamelist.cpp rename to src/yuzu/configuration/configure_ui.cpp index e43e84d39b..c4a84cc674 100644 --- a/src/yuzu/configuration/configure_gamelist.cpp +++ b/src/yuzu/configuration/configure_ui.cpp @@ -7,8 +7,8 @@ #include "common/common_types.h" #include "core/settings.h" -#include "ui_configure_gamelist.h" -#include "yuzu/configuration/configure_gamelist.h" +#include "ui_configure_ui.h" +#include "yuzu/configuration/configure_ui.h" #include "yuzu/uisettings.h" namespace { @@ -26,35 +26,40 @@ constexpr std::array row_text_names{ }; } // Anonymous namespace -ConfigureGameList::ConfigureGameList(QWidget* parent) - : QWidget(parent), ui(new Ui::ConfigureGameList) { +ConfigureUi::ConfigureUi(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureUi) { ui->setupUi(this); + for (const auto& theme : UISettings::themes) { + ui->theme_combobox->addItem(QString::fromUtf8(theme.first), + QString::fromUtf8(theme.second)); + } + InitializeIconSizeComboBox(); InitializeRowComboBoxes(); SetConfiguration(); // Force game list reload if any of the relevant settings are changed. - connect(ui->show_unknown, &QCheckBox::stateChanged, this, - &ConfigureGameList::RequestGameListUpdate); + connect(ui->show_unknown, &QCheckBox::stateChanged, this, &ConfigureUi::RequestGameListUpdate); connect(ui->icon_size_combobox, QOverload::of(&QComboBox::currentIndexChanged), this, - &ConfigureGameList::RequestGameListUpdate); + &ConfigureUi::RequestGameListUpdate); connect(ui->row_1_text_combobox, QOverload::of(&QComboBox::currentIndexChanged), this, - &ConfigureGameList::RequestGameListUpdate); + &ConfigureUi::RequestGameListUpdate); connect(ui->row_2_text_combobox, QOverload::of(&QComboBox::currentIndexChanged), this, - &ConfigureGameList::RequestGameListUpdate); + &ConfigureUi::RequestGameListUpdate); // Update text ComboBoxes after user interaction. connect(ui->row_1_text_combobox, QOverload::of(&QComboBox::activated), - [=]() { ConfigureGameList::UpdateSecondRowComboBox(); }); + [=]() { ConfigureUi::UpdateSecondRowComboBox(); }); connect(ui->row_2_text_combobox, QOverload::of(&QComboBox::activated), - [=]() { ConfigureGameList::UpdateFirstRowComboBox(); }); + [=]() { ConfigureUi::UpdateFirstRowComboBox(); }); } -ConfigureGameList::~ConfigureGameList() = default; +ConfigureUi::~ConfigureUi() = default; -void ConfigureGameList::ApplyConfiguration() { +void ConfigureUi::ApplyConfiguration() { + UISettings::values.theme = + ui->theme_combobox->itemData(ui->theme_combobox->currentIndex()).toString(); 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(); @@ -63,18 +68,19 @@ void ConfigureGameList::ApplyConfiguration() { Settings::Apply(); } -void ConfigureGameList::RequestGameListUpdate() { +void ConfigureUi::RequestGameListUpdate() { UISettings::values.is_game_list_reload_pending.exchange(true); } -void ConfigureGameList::SetConfiguration() { +void ConfigureUi::SetConfiguration() { + ui->theme_combobox->setCurrentIndex(ui->theme_combobox->findData(UISettings::values.theme)); 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)); } -void ConfigureGameList::changeEvent(QEvent* event) { +void ConfigureUi::changeEvent(QEvent* event) { if (event->type() == QEvent::LanguageChange) { RetranslateUI(); } @@ -82,7 +88,7 @@ void ConfigureGameList::changeEvent(QEvent* event) { QWidget::changeEvent(event); } -void ConfigureGameList::RetranslateUI() { +void ConfigureUi::RetranslateUI() { ui->retranslateUi(this); for (int i = 0; i < ui->icon_size_combobox->count(); i++) { @@ -97,18 +103,18 @@ void ConfigureGameList::RetranslateUI() { } } -void ConfigureGameList::InitializeIconSizeComboBox() { +void ConfigureUi::InitializeIconSizeComboBox() { for (const auto& size : default_icon_sizes) { ui->icon_size_combobox->addItem(QString::fromUtf8(size.second), size.first); } } -void ConfigureGameList::InitializeRowComboBoxes() { +void ConfigureUi::InitializeRowComboBoxes() { UpdateFirstRowComboBox(true); UpdateSecondRowComboBox(true); } -void ConfigureGameList::UpdateFirstRowComboBox(bool init) { +void ConfigureUi::UpdateFirstRowComboBox(bool init) { const int currentIndex = init ? UISettings::values.row_1_text_id : ui->row_1_text_combobox->findData(ui->row_1_text_combobox->currentData()); @@ -127,7 +133,7 @@ void ConfigureGameList::UpdateFirstRowComboBox(bool init) { ui->row_1_text_combobox->findData(ui->row_2_text_combobox->currentData())); } -void ConfigureGameList::UpdateSecondRowComboBox(bool init) { +void ConfigureUi::UpdateSecondRowComboBox(bool init) { const int currentIndex = init ? UISettings::values.row_2_text_id : ui->row_2_text_combobox->findData(ui->row_2_text_combobox->currentData()); diff --git a/src/yuzu/configuration/configure_gamelist.h b/src/yuzu/configuration/configure_ui.h similarity index 73% rename from src/yuzu/configuration/configure_gamelist.h rename to src/yuzu/configuration/configure_ui.h index ecd3fa1747..d471afe99f 100644 --- a/src/yuzu/configuration/configure_gamelist.h +++ b/src/yuzu/configuration/configure_ui.h @@ -8,15 +8,15 @@ #include namespace Ui { -class ConfigureGameList; +class ConfigureUi; } -class ConfigureGameList : public QWidget { +class ConfigureUi : public QWidget { Q_OBJECT public: - explicit ConfigureGameList(QWidget* parent = nullptr); - ~ConfigureGameList() override; + explicit ConfigureUi(QWidget* parent = nullptr); + ~ConfigureUi() override; void ApplyConfiguration(); @@ -34,5 +34,5 @@ private: void UpdateFirstRowComboBox(bool init = false); void UpdateSecondRowComboBox(bool init = false); - std::unique_ptr ui; + std::unique_ptr ui; }; diff --git a/src/yuzu/configuration/configure_gamelist.ui b/src/yuzu/configuration/configure_ui.ui similarity index 79% rename from src/yuzu/configuration/configure_gamelist.ui rename to src/yuzu/configuration/configure_ui.ui index 7a69377e7d..aa36bd1127 100644 --- a/src/yuzu/configuration/configure_gamelist.ui +++ b/src/yuzu/configuration/configure_ui.ui @@ -1,7 +1,7 @@ - ConfigureGameList - + ConfigureUi + 0 @@ -21,7 +21,34 @@ General - + + + + + + + + + Theme: + + + + + + + + + + + + + + + + + Game List + + @@ -38,19 +65,6 @@ - - - - - - - - - Icon Size - - - - @@ -65,19 +79,6 @@ - - - - - - - - - Row Text - - - -