diff options
author | lat9nq <lat9nq@virginia.edu> | 2020-07-14 01:22:41 +0200 |
---|---|---|
committer | lat9nq <lat9nq@virginia.edu> | 2020-07-19 19:26:55 +0200 |
commit | da65b92f9e9992413938bb084949367822b890c8 (patch) | |
tree | 4ed34575261a37458ba823f29324e8fa52631029 /src | |
parent | configuration_shared: Use a highlight instead of background color (diff) | |
download | yuzu-da65b92f9e9992413938bb084949367822b890c8.tar yuzu-da65b92f9e9992413938bb084949367822b890c8.tar.gz yuzu-da65b92f9e9992413938bb084949367822b890c8.tar.bz2 yuzu-da65b92f9e9992413938bb084949367822b890c8.tar.lz yuzu-da65b92f9e9992413938bb084949367822b890c8.tar.xz yuzu-da65b92f9e9992413938bb084949367822b890c8.tar.zst yuzu-da65b92f9e9992413938bb084949367822b890c8.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/yuzu/configuration/configuration_shared.cpp | 32 | ||||
-rw-r--r-- | src/yuzu/configuration/configuration_shared.h | 6 | ||||
-rw-r--r-- | src/yuzu/configuration/configure_general.cpp | 5 |
3 files changed, 27 insertions, 16 deletions
diff --git a/src/yuzu/configuration/configuration_shared.cpp b/src/yuzu/configuration/configuration_shared.cpp index 78dd76c6e..08d67facd 100644 --- a/src/yuzu/configuration/configuration_shared.cpp +++ b/src/yuzu/configuration/configuration_shared.cpp @@ -5,6 +5,7 @@ #include <QCheckBox> #include <QComboBox> #include <QObject> +#include <QString> #include "core/settings.h" #include "yuzu/configuration/configuration_shared.h" #include "yuzu/configuration/configure_per_game.h" @@ -85,30 +86,37 @@ void ConfigurationShared::SetPerGameSetting( ConfigurationShared::USE_GLOBAL_OFFSET); } -void ConfigurationShared::SetHighlight(QWidget* widget, bool highlighted) { +void ConfigurationShared::SetHighlight(QWidget* widget, const std::string& name, bool highlighted) { if (highlighted) { - widget->setStyleSheet(QStringLiteral("border:2px solid;border-color:rgba(0,203,255,0.5);")); + widget->setStyleSheet( + QStringLiteral("QWidget#%1 { border:2px solid;border-color:rgba(0,203,255,0.5) }") + .arg(QString::fromStdString(name))); } else { - widget->setStyleSheet(QStringLiteral("border:2px solid;border-color:rgba(0,0,0,0);")); + widget->setStyleSheet( + QStringLiteral("QWidget#%1 { border:2px solid;border-color:rgba(0,0,0,0) }") + .arg(QString::fromStdString(name))); } widget->show(); } -void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, Settings::Setting<bool>& setting, +void ConfigurationShared::SetColoredTristate(QCheckBox* checkbox, const std::string& name, + const Settings::Setting<bool>& setting, ConfigurationShared::CheckState& tracker) { if (setting.UsingGlobal()) { tracker = CheckState::Global; } else { tracker = (setting.GetValue() == setting.GetValue(true)) ? CheckState::On : CheckState::Off; } - SetHighlight(checkbox, tracker != CheckState::Global); - QObject::connect(checkbox, &QCheckBox::clicked, checkbox, [checkbox, setting, &tracker]() { - tracker = static_cast<ConfigurationShared::CheckState>((tracker + 1) % CheckState::Count); - if (tracker == CheckState::Global) { - checkbox->setChecked(setting.GetValue(true)); - } - SetHighlight(checkbox, tracker != CheckState::Global); - }); + SetHighlight(checkbox, name, tracker != CheckState::Global); + QObject::connect( + checkbox, &QCheckBox::clicked, checkbox, [checkbox, name, setting, &tracker]() { + tracker = + static_cast<ConfigurationShared::CheckState>((tracker + 1) % CheckState::Count); + if (tracker == CheckState::Global) { + checkbox->setChecked(setting.GetValue(true)); + } + SetHighlight(checkbox, name, tracker != CheckState::Global); + }); } void ConfigurationShared::InsertGlobalItem(QComboBox* combobox) { diff --git a/src/yuzu/configuration/configuration_shared.h b/src/yuzu/configuration/configuration_shared.h index 88709446c..b2bd971c8 100644 --- a/src/yuzu/configuration/configuration_shared.h +++ b/src/yuzu/configuration/configuration_shared.h @@ -25,6 +25,8 @@ enum CheckState { struct Trackers { CheckState use_frame_limit; CheckState use_multi_core; + + CheckState enable_audio_stretching; } extern trackers; // Global-aware apply and set functions @@ -45,8 +47,8 @@ void SetPerGameSetting(QComboBox* combobox, void SetPerGameSetting(QComboBox* combobox, const Settings::Setting<Settings::GPUAccuracy>* setting); -void SetHighlight(QWidget* widget, bool highlighted); -void SetColoredTristate(QCheckBox* checkbox, Settings::Setting<bool>& setting, +void SetHighlight(QWidget* widget, const std::string& name, bool highlighted); +void SetColoredTristate(QCheckBox* checkbox, const std::string& name, const Settings::Setting<bool>& setting, ConfigurationShared::CheckState& tracker); void InsertGlobalItem(QComboBox* combobox); diff --git a/src/yuzu/configuration/configure_general.cpp b/src/yuzu/configuration/configure_general.cpp index e3ddbc294..b4c288ca4 100644 --- a/src/yuzu/configuration/configure_general.cpp +++ b/src/yuzu/configuration/configure_general.cpp @@ -108,10 +108,11 @@ void ConfigureGeneral::SetupPerGameUI() { ui->toggle_background_pause->setVisible(false); ui->toggle_hide_mouse->setVisible(false); - ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, + ConfigurationShared::SetColoredTristate(ui->toggle_frame_limit, "toggle_frame_limit", Settings::values.use_frame_limit, ConfigurationShared::trackers.use_frame_limit); - ConfigurationShared::SetColoredTristate(ui->use_multi_core, Settings::values.use_multi_core, + ConfigurationShared::SetColoredTristate(ui->use_multi_core, "use_multi_core", + Settings::values.use_multi_core, ConfigurationShared::trackers.use_multi_core); connect(ui->toggle_frame_limit, &QCheckBox::clicked, ui->frame_limit, [this]() { |