diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index bb47c39336..f9becab6e9 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -4,17 +4,20 @@ #include #include +#include +#include #include "core/settings.h" #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_per_game.h" void ConfigurationShared::ApplyPerGameSetting(Settings::Setting* setting, - const QCheckBox* checkbox) { - if (checkbox->checkState() == Qt::PartiallyChecked) { + const QCheckBox* checkbox, + const CheckState& tracker) { + if (tracker == CheckState::Global) { setting->SetGlobal(true); } else { setting->SetGlobal(false); - setting->SetValue(checkbox->checkState() == Qt::Checked); + setting->SetValue(checkbox->checkState()); } } @@ -69,8 +72,69 @@ void ConfigurationShared::SetPerGameSetting( ConfigurationShared::USE_GLOBAL_OFFSET); } -void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { - const QString use_global_text = ConfigurePerGame::tr("Use global configuration"); +void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name, bool highlighted) { + if (highlighted) { + widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,203,255,0.5) }") + .arg(QString::fromStdString(name))); + } else { + widget->setStyleSheet(QStringLiteral("QWidget#%1 { background-color:rgba(0,0,0,0) }") + .arg(QString::fromStdString(name))); + } + widget->show(); +} + +void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, + const Settings::Setting& setting, + CheckState& tracker) { + if (setting.UsingGlobal()) { + tracker = CheckState::Global; + } else { + tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + QObject::connect(checkbox, &QCheckBox::clicked, checkbox, + [checkbox, name, setting, &tracker]() { + tracker = static_cast((static_cast(tracker) + 1) % + static_cast(CheckState::Count)); + if (tracker == CheckState::Global) { + checkbox->setChecked(setting.GetValue(true)); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); +} + +void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, + bool global, bool state, bool global_state, + CheckState& tracker) { + if (global) { + tracker = CheckState::Global; + } else { + tracker = (state == global_state) ? CheckState::On : CheckState::Off; + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + QObject::connect(checkbox, &QCheckBox::clicked, checkbox, + [checkbox, name, global_state, &tracker]() { + tracker = static_cast((static_cast(tracker) + 1) % + static_cast(CheckState::Count)); + if (tracker == CheckState::Global) { + checkbox->setChecked(global_state); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); +} + +void ConfigurationShared::SetColoredComboBox(QComboBox* combobox, QWidget* target, + const std::string& target_name, int global) { + InsertGlobalItem(combobox, global); + QObject::connect(combobox, static_cast(&QComboBox::activated), target, + [target, target_name](int index) { + ConfigurationShared::SetHighlight(target, target_name, index != 0); + }); +} + +void ConfigurationShared::InsertGlobalItem(QComboBox* combobox, int global_index) { + const QString use_global_text = + ConfigurePerGame::tr("Use global configuration (%1)").arg(combobox->itemText(global_index)); combobox->insertItem(ConfigurationShared::USE_GLOBAL_INDEX, use_global_text); combobox->insertSeparator(ConfigurationShared::USE_GLOBAL_SEPARATOR_INDEX); } diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index b11b1b9502..003148c68d 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -15,9 +15,17 @@ constexpr int USE_GLOBAL_INDEX = 0; constexpr int USE_GLOBAL_SEPARATOR_INDEX = 1; constexpr int USE_GLOBAL_OFFSET = 2; +enum class CheckState { + Off, + On, + Global, + Count, +}; + // Global-aware apply and set functions -void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox); +void ApplyPerGameSetting(Settings::Setting* setting, const QCheckBox* checkbox, + const CheckState& tracker); void ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox); void ApplyPerGameSetting(Settings::Setting* setting, const QComboBox* combobox); @@ -31,6 +39,14 @@ void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox, const Settings::Setting* setting); -void InsertGlobalItem(QComboBox* combobox); +void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, + const Settings::Setting& setting, CheckState& tracker); +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, bool global, bool state, + bool global_state, CheckState& tracker); +void SetColoredComboBox(QComboBox* combobox, QWidget* target, const std::string& target_name, + int global); + +void InsertGlobalItem(QComboBox* combobox, int global_index); } // namespace ConfigurationShared diff --git a/src/yuzu/configuration/configure_audio.cpp b/src/yuzu/configuration/configure_audio.cpp index cc021beecc..fea632531f 100644 --- a/src/yuzu/configuration/configure_audio.cpp +++ b/src/yuzu/configuration/configure_audio.cpp @@ -49,12 +49,9 @@ void ConfigureAudio::SetConfiguration() { ui->volume_slider->setValue(Settings::values.volume.GetValue() * ui->volume_slider->maximum()); - if (Settings::configuring_global) { - ui->toggle_audio_stretching->setChecked( - Settings::values.enable_audio_stretching.GetValue()); - } else { - ConfigurationShared::SetPerGameSetting(ui->toggle_audio_stretching, - &Settings::values.enable_audio_stretching); + ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching.GetValue()); + + if (!Settings::configuring_global) { if (Settings::values.volume.UsingGlobal()) { ui->volume_combo_box->setCurrentIndex(0); ui->volume_slider->setEnabled(false); @@ -62,6 +59,8 @@ void ConfigureAudio::SetConfiguration() { ui->volume_combo_box->setCurrentIndex(1); ui->volume_slider->setEnabled(true); } + ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout", + !Settings::values.volume.UsingGlobal()); } SetVolumeIndicatorText(ui->volume_slider->sliderPosition()); } @@ -120,7 +119,8 @@ void ConfigureAudio::ApplyConfiguration() { } } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.enable_audio_stretching, - ui->toggle_audio_stretching); + ui->toggle_audio_stretching, + enable_audio_stretching); if (ui->volume_combo_box->currentIndex() == 0) { Settings::values.volume.SetGlobal(true); } else { @@ -173,9 +173,14 @@ void ConfigureAudio::SetupPerGameUI() { return; } - ui->toggle_audio_stretching->setTristate(true); + ConfigurationShared::SetColoredTristate(ui->toggle_audio_stretching, "toggle_audio_stretching", + Settings::values.enable_audio_stretching, + enable_audio_stretching); connect(ui->volume_combo_box, static_cast(&QComboBox::activated), - this, [this](int index) { ui->volume_slider->setEnabled(index == 1); }); + this, [this](int index) { + ui->volume_slider->setEnabled(index == 1); + ConfigurationShared::SetHighlight(ui->volume_layout, "volume_layout", index == 1); + }); ui->output_sink_combo_box->setVisible(false); ui->output_sink_label->setVisible(false); diff --git a/src/yuzu/configuration/configure_audio.h b/src/yuzu/configuration/configure_audio.h index d84f4a682b..9dbd3d93ee 100644 --- a/src/yuzu/configuration/configure_audio.h +++ b/src/yuzu/configuration/configure_audio.h @@ -7,6 +7,10 @@ #include #include +namespace ConfigurationShared { +enum class CheckState; +} + namespace Ui { class ConfigureAudio; } @@ -37,4 +41,6 @@ private: void SetupPerGameUI(); std::unique_ptr ui; + + ConfigurationShared::CheckState enable_audio_stretching; }; diff --git a/src/yuzu/configuration/configure_audio.ui b/src/yuzu/configuration/configure_audio.ui index 862ccb9886..9bd0cca96d 100644 --- a/src/yuzu/configuration/configure_audio.ui +++ b/src/yuzu/configuration/configure_audio.ui @@ -56,80 +56,91 @@ - - - 0 - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + Use global volume + + + + + Set volume: + + + + + + - Use global volume + Volume: + + + + + + + Qt::Horizontal + + + + 30 + 20 + + + + + + + + + 0 + 0 + + + + 100 + + + 10 + + + Qt::Horizontal + + + + + + + + 32 + 0 + - - - Set volume: + 0 % - - - - - - - Volume: - - - - - - - Qt::Horizontal - - - - 30 - 20 - - - - - - - - - 0 - 0 - - - - 100 - - - 10 - - - Qt::Horizontal - - - - - - - - 32 - 0 - - - - 0 % - - - Qt::AlignCenter - - - - + + Qt::AlignCenter + + + + + diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index 20316c9cca..c0dbd9855d 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -19,9 +19,10 @@ ConfigureGeneral::ConfigureGeneral(QWidget* parent) SetConfiguration(); - connect(ui->toggle_frame_limit, &QCheckBox::stateChanged, ui->frame_limit, [this]() { - ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked); - }); + if (Settings::configuring_global) { + connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, + [this]() { ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked()); }); + } } ConfigureGeneral::~ConfigureGeneral() = default; @@ -40,17 +41,12 @@ void ConfigureGeneral::SetConfiguration() { ui->toggle_frame_limit->setChecked(Settings::values.use_frame_limit.GetValue()); ui->frame_limit->setValue(Settings::values.frame_limit.GetValue()); - if (!Settings::configuring_global) { - if (Settings::values.use_multi_core.UsingGlobal()) { - ui->use_multi_core->setCheckState(Qt::PartiallyChecked); - } - if (Settings::values.use_frame_limit.UsingGlobal()) { - ui->toggle_frame_limit->setCheckState(Qt::PartiallyChecked); - } + if (Settings::configuring_global) { + ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue()); + } else { + ui->frame_limit->setEnabled(Settings::values.use_frame_limit.GetValue() && + use_frame_limit != ConfigurationShared::CheckState::Global); } - - ui->frame_limit->setEnabled(ui->toggle_frame_limit->checkState() == Qt::Checked && - ui->toggle_frame_limit->isEnabled()); } void ConfigureGeneral::ApplyConfiguration() { @@ -71,9 +67,9 @@ void ConfigureGeneral::ApplyConfiguration() { } } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_multi_core, - ui->use_multi_core); + ui->use_multi_core, use_multi_core); - bool global_frame_limit = ui->toggle_frame_limit->checkState() == Qt::PartiallyChecked; + bool global_frame_limit = use_frame_limit == ConfigurationShared::CheckState::Global; Settings::values.use_frame_limit.SetGlobal(global_frame_limit); Settings::values.frame_limit.SetGlobal(global_frame_limit); if (!global_frame_limit) { @@ -109,6 +105,13 @@ void ConfigureGeneral::SetupPerGameUI() { ui->toggle_background_pause->setVisible(false); ui->toggle_hide_mouse->setVisible(false); - ui->toggle_frame_limit->setTristate(true); - ui->use_multi_core->setTristate(true); + ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, "toggle_frame_limit", + Settings::values.use_frame_limit, use_frame_limit); + ConfigurationShared::SetColoredTristate(ui->use_multi_core, "use_multi_core", + Settings::values.use_multi_core, use_multi_core); + + connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { + ui->frame_limit->setEnabled(ui->toggle_frame_limit->isChecked() && + (use_frame_limit != ConfigurationShared::CheckState::Global)); + }); } diff --git a/src/yuzu/configuration/configure_general.h b/src/yuzu/configuration/configure_general.h index 9c785c22e2..323ffbd8f9 100644 --- a/src/yuzu/configuration/configure_general.h +++ b/src/yuzu/configuration/configure_general.h @@ -7,6 +7,10 @@ #include #include +namespace ConfigurationShared { +enum class CheckState; +} + class HotkeyRegistry; namespace Ui { @@ -31,4 +35,7 @@ private: void SetupPerGameUI(); std::unique_ptr ui; + + ConfigurationShared::CheckState use_frame_limit; + ConfigurationShared::CheckState use_multi_core; }; diff --git a/src/yuzu/configuration/configure_graphics.cpp b/src/yuzu/configuration/configure_graphics.cpp index cb4706bd6b..3e42531c31 100644 --- a/src/yuzu/configuration/configure_graphics.cpp +++ b/src/yuzu/configuration/configure_graphics.cpp @@ -31,8 +31,14 @@ ConfigureGraphics::ConfigureGraphics(QWidget* parent) SetConfiguration(); - connect(ui->api, qOverload(&QComboBox::currentIndexChanged), this, - [this] { UpdateDeviceComboBox(); }); + connect(ui->api, qOverload(&QComboBox::currentIndexChanged), this, [this] { + UpdateDeviceComboBox(); + if (!Settings::configuring_global) { + ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", + ui->api->currentIndex() != + ConfigurationShared::USE_GLOBAL_INDEX); + } + }); connect(ui->device, qOverload(&QComboBox::activated), this, [this](int device) { UpdateDeviceSelection(device); }); @@ -65,25 +71,26 @@ void ConfigureGraphics::SetConfiguration() { ui->api->setEnabled(runtime_lock); ui->use_asynchronous_gpu_emulation->setEnabled(runtime_lock); ui->use_disk_shader_cache->setEnabled(runtime_lock); + ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue()); + ui->use_asynchronous_gpu_emulation->setChecked( + Settings::values.use_asynchronous_gpu_emulation.GetValue()); if (Settings::configuring_global) { ui->api->setCurrentIndex(static_cast(Settings::values.renderer_backend.GetValue())); ui->aspect_ratio_combobox->setCurrentIndex(Settings::values.aspect_ratio.GetValue()); - ui->use_disk_shader_cache->setChecked(Settings::values.use_disk_shader_cache.GetValue()); - ui->use_asynchronous_gpu_emulation->setChecked( - Settings::values.use_asynchronous_gpu_emulation.GetValue()); } else { - ConfigurationShared::SetPerGameSetting(ui->use_disk_shader_cache, - &Settings::values.use_disk_shader_cache); - ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_gpu_emulation, - &Settings::values.use_asynchronous_gpu_emulation); - ConfigurationShared::SetPerGameSetting(ui->api, &Settings::values.renderer_backend); + ConfigurationShared::SetHighlight(ui->api_layout, "api_layout", + !Settings::values.renderer_backend.UsingGlobal()); ConfigurationShared::SetPerGameSetting(ui->aspect_ratio_combobox, &Settings::values.aspect_ratio); ui->bg_combobox->setCurrentIndex(Settings::values.bg_red.UsingGlobal() ? 0 : 1); ui->bg_button->setEnabled(!Settings::values.bg_red.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->ar_label, "ar_label", + !Settings::values.aspect_ratio.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", + !Settings::values.bg_red.UsingGlobal()); } UpdateBackgroundColorButton(QColor::fromRgbF(Settings::values.bg_red.GetValue(), @@ -135,9 +142,10 @@ void ConfigureGraphics::ApplyConfiguration() { ui->aspect_ratio_combobox); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_disk_shader_cache, - ui->use_disk_shader_cache); + ui->use_disk_shader_cache, use_disk_shader_cache); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_gpu_emulation, - ui->use_asynchronous_gpu_emulation); + ui->use_asynchronous_gpu_emulation, + use_asynchronous_gpu_emulation); if (ui->bg_combobox->currentIndex() == ConfigurationShared::USE_GLOBAL_INDEX) { Settings::values.bg_red.SetGlobal(true); @@ -241,10 +249,20 @@ void ConfigureGraphics::SetupPerGameUI() { } connect(ui->bg_combobox, static_cast(&QComboBox::activated), this, - [this](int index) { ui->bg_button->setEnabled(index == 1); }); + [this](int index) { + ui->bg_button->setEnabled(index == 1); + ConfigurationShared::SetHighlight(ui->bg_layout, "bg_layout", index == 1); + }); - ui->use_disk_shader_cache->setTristate(true); - ui->use_asynchronous_gpu_emulation->setTristate(true); - ConfigurationShared::InsertGlobalItem(ui->aspect_ratio_combobox); - ConfigurationShared::InsertGlobalItem(ui->api); + ConfigurationShared::SetColoredTristate(ui->use_disk_shader_cache, "use_disk_shader_cache", + Settings::values.use_disk_shader_cache, + use_disk_shader_cache); + ConfigurationShared::SetColoredTristate( + ui->use_asynchronous_gpu_emulation, "use_asynchronous_gpu_emulation", + Settings::values.use_asynchronous_gpu_emulation, use_asynchronous_gpu_emulation); + + ConfigurationShared::SetColoredComboBox(ui->aspect_ratio_combobox, ui->ar_label, "ar_label", + Settings::values.aspect_ratio.GetValue(true)); + ConfigurationShared::InsertGlobalItem( + ui->api, static_cast(Settings::values.renderer_backend.GetValue(true))); } diff --git a/src/yuzu/configuration/configure_graphics.h b/src/yuzu/configuration/configure_graphics.h index 24f01c7395..b4961f7192 100644 --- a/src/yuzu/configuration/configure_graphics.h +++ b/src/yuzu/configuration/configure_graphics.h @@ -10,6 +10,10 @@ #include #include "core/settings.h" +namespace ConfigurationShared { +enum class CheckState; +} + namespace Ui { class ConfigureGraphics; } @@ -42,6 +46,9 @@ private: std::unique_ptr ui; QColor bg_color; + ConfigurationShared::CheckState use_disk_shader_cache; + ConfigurationShared::CheckState use_asynchronous_gpu_emulation; + std::vector vulkan_devices; u32 vulkan_device{}; }; diff --git a/src/yuzu/configuration/configure_graphics.ui b/src/yuzu/configuration/configure_graphics.ui index 62418fc142..62aa337e7c 100644 --- a/src/yuzu/configuration/configure_graphics.ui +++ b/src/yuzu/configuration/configure_graphics.ui @@ -6,7 +6,7 @@ 0 0 - 400 + 437 321 @@ -23,43 +23,56 @@ - - - - - API: - - - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + 6 + + + - OpenGL + API: - - + + + + + + + OpenGL + + + + + Vulkan + + + + + + - Vulkan + Device: - - - - - - - - - - - Device: - - - - - - - + + + + + + + @@ -85,96 +98,133 @@ - - - - - Aspect Ratio: - - - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + - Default (16:9) + Aspect Ratio: - - - - Force 4:3 - - - - - Force 21:9 - - - - - Stretch to Window - - - - - + + + + + + + Default (16:9) + + + + + Force 4:3 + + + + + Force 21:9 + + + + + Stretch to Window + + + + + + - - - - - Use global background color - - - 0 - - - 10 - - - + + + + 0 + 0 + + + + + 6 + + + 0 + + + 0 + + + 0 + + + 0 + + + + Use global background color - - - - Set background color: + + 0 - - - - - - - Background Color: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 40 - 16777215 - - - - - + + 10 + + + + Use global background color + + + + + Set background color: + + + + + + + + Background Color: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 40 + 16777215 + + + + + + diff --git a/src/yuzu/configuration/configure_graphics_advanced.cpp b/src/yuzu/configuration/configure_graphics_advanced.cpp index ce30188cd1..8b9180811d 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.cpp +++ b/src/yuzu/configuration/configure_graphics_advanced.cpp @@ -28,32 +28,25 @@ void ConfigureGraphicsAdvanced::SetConfiguration() { ui->force_30fps_mode->setEnabled(runtime_lock); ui->anisotropic_filtering_combobox->setEnabled(runtime_lock); + ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue()); + ui->use_assembly_shaders->setChecked(Settings::values.use_assembly_shaders.GetValue()); + ui->use_asynchronous_shaders->setChecked(Settings::values.use_asynchronous_shaders.GetValue()); + ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); + ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode.GetValue()); + if (Settings::configuring_global) { ui->gpu_accuracy->setCurrentIndex( static_cast(Settings::values.gpu_accuracy.GetValue())); - ui->use_vsync->setChecked(Settings::values.use_vsync.GetValue()); - ui->use_assembly_shaders->setChecked(Settings::values.use_assembly_shaders.GetValue()); - ui->use_asynchronous_shaders->setChecked( - Settings::values.use_asynchronous_shaders.GetValue()); - ui->use_fast_gpu_time->setChecked(Settings::values.use_fast_gpu_time.GetValue()); - ui->force_30fps_mode->setChecked(Settings::values.force_30fps_mode.GetValue()); ui->anisotropic_filtering_combobox->setCurrentIndex( Settings::values.max_anisotropy.GetValue()); } else { ConfigurationShared::SetPerGameSetting(ui->gpu_accuracy, &Settings::values.gpu_accuracy); - ConfigurationShared::SetPerGameSetting(ui->use_vsync, &Settings::values.use_vsync); - ConfigurationShared::SetPerGameSetting(ui->use_assembly_shaders, - &Settings::values.use_assembly_shaders); - ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_shaders, - &Settings::values.use_asynchronous_shaders); - ConfigurationShared::SetPerGameSetting(ui->use_asynchronous_shaders, - &Settings::values.use_asynchronous_shaders); - ConfigurationShared::SetPerGameSetting(ui->use_fast_gpu_time, - &Settings::values.use_fast_gpu_time); - ConfigurationShared::SetPerGameSetting(ui->force_30fps_mode, - &Settings::values.force_30fps_mode); ConfigurationShared::SetPerGameSetting(ui->anisotropic_filtering_combobox, &Settings::values.max_anisotropy); + ConfigurationShared::SetHighlight(ui->label_gpu_accuracy, "label_gpu_accuracy", + !Settings::values.gpu_accuracy.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->af_label, "af_label", + !Settings::values.max_anisotropy.UsingGlobal()); } } @@ -95,17 +88,17 @@ void ConfigureGraphicsAdvanced::ApplyConfiguration() { } else { ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync); + ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_vsync, ui->use_vsync, + use_vsync); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_assembly_shaders, - ui->use_assembly_shaders); + ui->use_assembly_shaders, use_assembly_shaders); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, - ui->use_asynchronous_shaders); - ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_asynchronous_shaders, - ui->use_asynchronous_shaders); + ui->use_asynchronous_shaders, + use_asynchronous_shaders); ConfigurationShared::ApplyPerGameSetting(&Settings::values.use_fast_gpu_time, - ui->use_fast_gpu_time); + ui->use_fast_gpu_time, use_fast_gpu_time); ConfigurationShared::ApplyPerGameSetting(&Settings::values.force_30fps_mode, - ui->force_30fps_mode); + ui->force_30fps_mode, force_30fps_mode); ConfigurationShared::ApplyPerGameSetting(&Settings::values.max_anisotropy, ui->anisotropic_filtering_combobox); @@ -146,11 +139,22 @@ void ConfigureGraphicsAdvanced::SetupPerGameUI() { return; } - ConfigurationShared::InsertGlobalItem(ui->gpu_accuracy); - ui->use_vsync->setTristate(true); - ui->use_assembly_shaders->setTristate(true); - ui->use_asynchronous_shaders->setTristate(true); - ui->use_fast_gpu_time->setTristate(true); - ui->force_30fps_mode->setTristate(true); - ConfigurationShared::InsertGlobalItem(ui->anisotropic_filtering_combobox); + ConfigurationShared::SetColoredTristate(ui->use_vsync, "use_vsync", Settings::values.use_vsync, + use_vsync); + ConfigurationShared::SetColoredTristate(ui->use_assembly_shaders, "use_assembly_shaders", + Settings::values.use_assembly_shaders, + use_assembly_shaders); + ConfigurationShared::SetColoredTristate( + ui->use_asynchronous_shaders, "use_asynchronous_shaders", + Settings::values.use_asynchronous_shaders, use_asynchronous_shaders); + ConfigurationShared::SetColoredTristate(ui->use_fast_gpu_time, "use_fast_gpu_time", + Settings::values.use_fast_gpu_time, use_fast_gpu_time); + ConfigurationShared::SetColoredTristate(ui->force_30fps_mode, "force_30fps_mode", + Settings::values.force_30fps_mode, force_30fps_mode); + ConfigurationShared::SetColoredComboBox( + ui->gpu_accuracy, ui->label_gpu_accuracy, "label_gpu_accuracy", + static_cast(Settings::values.gpu_accuracy.GetValue(true))); + ConfigurationShared::SetColoredComboBox( + ui->anisotropic_filtering_combobox, ui->af_label, "af_label", + static_cast(Settings::values.max_anisotropy.GetValue(true))); } diff --git a/src/yuzu/configuration/configure_graphics_advanced.h b/src/yuzu/configuration/configure_graphics_advanced.h index c043588ff3..3c4f6f7bbc 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.h +++ b/src/yuzu/configuration/configure_graphics_advanced.h @@ -7,6 +7,10 @@ #include #include +namespace ConfigurationShared { +enum class CheckState; +} + namespace Ui { class ConfigureGraphicsAdvanced; } @@ -29,4 +33,10 @@ private: void SetupPerGameUI(); std::unique_ptr ui; + + ConfigurationShared::CheckState use_vsync; + ConfigurationShared::CheckState use_assembly_shaders; + ConfigurationShared::CheckState use_asynchronous_shaders; + ConfigurationShared::CheckState use_fast_gpu_time; + ConfigurationShared::CheckState force_30fps_mode; }; diff --git a/src/yuzu/configuration/configure_graphics_advanced.ui b/src/yuzu/configuration/configure_graphics_advanced.ui index 71e7dfe5e9..6a0d29c272 100644 --- a/src/yuzu/configuration/configure_graphics_advanced.ui +++ b/src/yuzu/configuration/configure_graphics_advanced.ui @@ -6,7 +6,7 @@ 0 0 - 400 + 404 321 @@ -23,34 +23,48 @@ - - - - - Accuracy Level: - - - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + - Normal + Accuracy Level: - - - - High - - - - - Extreme(very slow) - - - - - + + + + + + + Normal + + + + + High + + + + + Extreme(very slow) + + + + + + @@ -97,44 +111,58 @@ - - - - - Anisotropic Filtering: - - - - - - + + + + 0 + + + 0 + + + 0 + + + 0 + + + - Default + Anisotropic Filtering: - - - - 2x - - - - - 4x - - - - - 8x - - - - - 16x - - - - - + + + + + + + Default + + + + + 2x + + + + + 4x + + + + + 8x + + + + + 16x + + + + + + diff --git a/src/yuzu/configuration/configure_system.cpp b/src/yuzu/configuration/configure_system.cpp index 68e02738ba..0c4daf1477 100644 --- a/src/yuzu/configuration/configure_system.cpp +++ b/src/yuzu/configuration/configure_system.cpp @@ -67,21 +67,21 @@ void ConfigureSystem::SetConfiguration() { const auto rtc_time = Settings::values.custom_rtc.GetValue().value_or( std::chrono::seconds(QDateTime::currentSecsSinceEpoch())); + ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); + ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() && + Settings::values.rng_seed.UsingGlobal()); + ui->rng_seed_edit->setText(rng_seed); + + ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value()); + ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() && + Settings::values.rng_seed.UsingGlobal()); + ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); + if (Settings::configuring_global) { ui->combo_language->setCurrentIndex(Settings::values.language_index.GetValue()); ui->combo_region->setCurrentIndex(Settings::values.region_index.GetValue()); ui->combo_time_zone->setCurrentIndex(Settings::values.time_zone_index.GetValue()); ui->combo_sound->setCurrentIndex(Settings::values.sound_index.GetValue()); - - ui->rng_seed_checkbox->setChecked(Settings::values.rng_seed.GetValue().has_value()); - ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value() && - Settings::values.rng_seed.UsingGlobal()); - ui->rng_seed_edit->setText(rng_seed); - - ui->custom_rtc_checkbox->setChecked(Settings::values.custom_rtc.GetValue().has_value()); - ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value() && - Settings::values.rng_seed.UsingGlobal()); - ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); } else { ConfigurationShared::SetPerGameSetting(ui->combo_language, &Settings::values.language_index); @@ -90,27 +90,14 @@ void ConfigureSystem::SetConfiguration() { &Settings::values.time_zone_index); ConfigurationShared::SetPerGameSetting(ui->combo_sound, &Settings::values.sound_index); - if (Settings::values.rng_seed.UsingGlobal()) { - ui->rng_seed_checkbox->setCheckState(Qt::PartiallyChecked); - } else { - ui->rng_seed_checkbox->setCheckState( - Settings::values.rng_seed.GetValue().has_value() ? Qt::Checked : Qt::Unchecked); - ui->rng_seed_edit->setEnabled(Settings::values.rng_seed.GetValue().has_value()); - if (Settings::values.rng_seed.GetValue().has_value()) { - ui->rng_seed_edit->setText(rng_seed); - } - } - - if (Settings::values.custom_rtc.UsingGlobal()) { - ui->custom_rtc_checkbox->setCheckState(Qt::PartiallyChecked); - } else { - ui->custom_rtc_checkbox->setCheckState( - Settings::values.custom_rtc.GetValue().has_value() ? Qt::Checked : Qt::Unchecked); - ui->custom_rtc_edit->setEnabled(Settings::values.custom_rtc.GetValue().has_value()); - if (Settings::values.custom_rtc.GetValue().has_value()) { - ui->custom_rtc_edit->setDateTime(QDateTime::fromSecsSinceEpoch(rtc_time.count())); - } - } + ConfigurationShared::SetHighlight(ui->label_language, "label_language", + !Settings::values.language_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_region, "label_region", + !Settings::values.region_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_timezone, "label_timezone", + !Settings::values.time_zone_index.UsingGlobal()); + ConfigurationShared::SetHighlight(ui->label_sound, "label_sound", + !Settings::values.sound_index.UsingGlobal()); } } @@ -161,37 +148,44 @@ void ConfigureSystem::ApplyConfiguration() { ui->combo_time_zone); ConfigurationShared::ApplyPerGameSetting(&Settings::values.sound_index, ui->combo_sound); - switch (ui->rng_seed_checkbox->checkState()) { - case Qt::Checked: + switch (use_rng_seed) { + case ConfigurationShared::CheckState::On: + case ConfigurationShared::CheckState::Off: Settings::values.rng_seed.SetGlobal(false); - Settings::values.rng_seed.SetValue(ui->rng_seed_edit->text().toULongLong(nullptr, 16)); + if (ui->rng_seed_checkbox->isChecked()) { + Settings::values.rng_seed.SetValue( + ui->rng_seed_edit->text().toULongLong(nullptr, 16)); + } else { + Settings::values.rng_seed.SetValue(std::nullopt); + } break; - case Qt::Unchecked: - Settings::values.rng_seed.SetGlobal(false); - Settings::values.rng_seed.SetValue(std::nullopt); - break; - case Qt::PartiallyChecked: + case ConfigurationShared::CheckState::Global: Settings::values.rng_seed.SetGlobal(false); Settings::values.rng_seed.SetValue(std::nullopt); Settings::values.rng_seed.SetGlobal(true); break; + case ConfigurationShared::CheckState::Count: + break; } - switch (ui->custom_rtc_checkbox->checkState()) { - case Qt::Checked: + switch (use_custom_rtc) { + case ConfigurationShared::CheckState::On: + case ConfigurationShared::CheckState::Off: Settings::values.custom_rtc.SetGlobal(false); - Settings::values.custom_rtc.SetValue( - std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); + if (ui->custom_rtc_checkbox->isChecked()) { + Settings::values.custom_rtc.SetValue( + std::chrono::seconds(ui->custom_rtc_edit->dateTime().toSecsSinceEpoch())); + } else { + Settings::values.custom_rtc.SetValue(std::nullopt); + } break; - case Qt::Unchecked: - Settings::values.custom_rtc.SetGlobal(false); - Settings::values.custom_rtc.SetValue(std::nullopt); - break; - case Qt::PartiallyChecked: + case ConfigurationShared::CheckState::Global: Settings::values.custom_rtc.SetGlobal(false); Settings::values.custom_rtc.SetValue(std::nullopt); Settings::values.custom_rtc.SetGlobal(true); break; + case ConfigurationShared::CheckState::Count: + break; } } @@ -229,10 +223,23 @@ void ConfigureSystem::SetupPerGameUI() { return; } - ConfigurationShared::InsertGlobalItem(ui->combo_language); - ConfigurationShared::InsertGlobalItem(ui->combo_region); - ConfigurationShared::InsertGlobalItem(ui->combo_time_zone); - ConfigurationShared::InsertGlobalItem(ui->combo_sound); - ui->rng_seed_checkbox->setTristate(true); - ui->custom_rtc_checkbox->setTristate(true); + ConfigurationShared::SetColoredComboBox(ui->combo_language, ui->label_language, + "label_language", + Settings::values.language_index.GetValue(true)); + ConfigurationShared::SetColoredComboBox(ui->combo_region, ui->label_region, "label_region", + Settings::values.region_index.GetValue(true)); + ConfigurationShared::SetColoredComboBox(ui->combo_time_zone, ui->label_timezone, + "label_timezone", + Settings::values.time_zone_index.GetValue(true)); + ConfigurationShared::SetColoredComboBox(ui->combo_sound, ui->label_sound, "label_sound", + Settings::values.sound_index.GetValue(true)); + + ConfigurationShared::SetColoredTristate( + ui->rng_seed_checkbox, "rng_seed_checkbox", Settings::values.rng_seed.UsingGlobal(), + Settings::values.rng_seed.GetValue().has_value(), + Settings::values.rng_seed.GetValue(true).has_value(), use_rng_seed); + ConfigurationShared::SetColoredTristate( + ui->custom_rtc_checkbox, "custom_rtc_checkbox", Settings::values.custom_rtc.UsingGlobal(), + Settings::values.custom_rtc.GetValue().has_value(), + Settings::values.custom_rtc.GetValue(true).has_value(), use_custom_rtc); } diff --git a/src/yuzu/configuration/configure_system.h b/src/yuzu/configuration/configure_system.h index f317ef8b5e..fc5cd29457 100644 --- a/src/yuzu/configuration/configure_system.h +++ b/src/yuzu/configuration/configure_system.h @@ -9,6 +9,10 @@ #include #include +namespace ConfigurationShared { +enum class CheckState; +} + namespace Ui { class ConfigureSystem; } @@ -41,4 +45,7 @@ private: int region_index = 0; int time_zone_index = 0; int sound_index = 0; + + ConfigurationShared::CheckState use_rng_seed; + ConfigurationShared::CheckState use_custom_rtc; }; diff --git a/src/yuzu/configuration/configure_system.ui b/src/yuzu/configuration/configure_system.ui index 9c8cca6dc8..53b95658b8 100644 --- a/src/yuzu/configuration/configure_system.ui +++ b/src/yuzu/configuration/configure_system.ui @@ -21,490 +21,494 @@ System Settings - - - - - Sound output mode - - - - - - - Console ID: - - - - - - - Note: this can be overridden when region setting is auto-select - - - - Japanese (日本語) - - - - - English - - - - - French (français) - - - - - German (Deutsch) - - - - - Italian (italiano) - - - - - Spanish (español) - - - - - Chinese - - - - - Korean (한국어) - - - - - Dutch (Nederlands) - - - - - Portuguese (português) - - - - - Russian (Русский) - - - - - Taiwanese - - - - - British English - - - - - Canadian French - - - - - Latin American Spanish - - - - - Simplified Chinese - - - - - Traditional Chinese (正體中文) - - - - - - - - Region: - - - - - - - - Japan - - - - - USA - - - - - Europe - - - - - Australia - - - - - China - - - - - Korea - - - - - Taiwan - - - - - - - - Time Zone: - - - - - - - - Auto - - - - - Default - - - - - CET - - - - - CST6CDT - - - - - Cuba - - - - - EET - - - - - Egypt - - - - - Eire - - - - - EST - - - - - EST5EDT - - - - - GB - - - - - GB-Eire - - - - - GMT - - - - - GMT+0 - - - - - GMT-0 - - - - - GMT0 - - - - - Greenwich - - - - - Hongkong - - - - - HST - - - - - Iceland - - - - - Iran - - - - - Israel - - - - - Jamaica - - - - - Japan - - - - - Kwajalein - - - - - Libya - - - - - MET - - - - - MST - - - - - MST7MDT - - - - - Navajo - - - - - NZ - - - - - NZ-CHAT - - - - - Poland - - - - - Portugal - - - - - PRC - - - - - PST8PDT - - - - - ROC - - - - - ROK - - - - - Singapore - - - - - Turkey - - - - - UCT - - - - - Universal - - - - - UTC - - - - - W-SU - - - - - WET - - - - - Zulu - - - - - - - - RNG Seed - - - - - - - - Mono - - - - - Stereo - - - - - Surround - - - - - - - - Language - - - - - - - - 0 - 0 - - - - Qt::RightToLeft - - - Regenerate - - - - - - - Custom RTC - - - - - - - - 1970 - 1 - 1 - - - - d MMM yyyy h:mm:ss AP - - - - - - - - 0 - 0 - - - - - Lucida Console - - - - HHHHHHHH - - - 8 - - + + + + + + + Region: + + + + + + + + Auto + + + + + Default + + + + + CET + + + + + CST6CDT + + + + + Cuba + + + + + EET + + + + + Egypt + + + + + Eire + + + + + EST + + + + + EST5EDT + + + + + GB + + + + + GB-Eire + + + + + GMT + + + + + GMT+0 + + + + + GMT-0 + + + + + GMT0 + + + + + Greenwich + + + + + Hongkong + + + + + HST + + + + + Iceland + + + + + Iran + + + + + Israel + + + + + Jamaica + + + + + Japan + + + + + Kwajalein + + + + + Libya + + + + + MET + + + + + MST + + + + + MST7MDT + + + + + Navajo + + + + + NZ + + + + + NZ-CHAT + + + + + Poland + + + + + Portugal + + + + + PRC + + + + + PST8PDT + + + + + ROC + + + + + ROK + + + + + Singapore + + + + + Turkey + + + + + UCT + + + + + Universal + + + + + UTC + + + + + W-SU + + + + + WET + + + + + Zulu + + + + + + + + + Japan + + + + + USA + + + + + Europe + + + + + Australia + + + + + China + + + + + Korea + + + + + Taiwan + + + + + + + + Time Zone: + + + + + + + Note: this can be overridden when region setting is auto-select + + + + Japanese (日本語) + + + + + English + + + + + French (français) + + + + + German (Deutsch) + + + + + Italian (italiano) + + + + + Spanish (español) + + + + + Chinese + + + + + Korean (한국어) + + + + + Dutch (Nederlands) + + + + + Portuguese (português) + + + + + Russian (Русский) + + + + + Taiwanese + + + + + British English + + + + + Canadian French + + + + + Latin American Spanish + + + + + Simplified Chinese + + + + + Traditional Chinese (正體中文) + + + + + + + + Custom RTC + + + + + + + Language + + + + + + + RNG Seed + + + + + + + + Mono + + + + + Stereo + + + + + Surround + + + + + + + + Console ID: + + + + + + + Sound output mode + + + + + + + + 1970 + 1 + 1 + + + + d MMM yyyy h:mm:ss AP + + + + + + + + 0 + 0 + + + + + Lucida Console + + + + HHHHHHHH + + + 8 + + + + + + + + 0 + 0 + + + + Qt::RightToLeft + + + Regenerate + + + +