From 789af19c60eb95238292ba273ccbf6aa96ac9682 Mon Sep 17 00:00:00 2001 From: gidoly <66776795+gidoly@users.noreply.github.com> Date: Sun, 16 Jan 2022 12:51:26 +0900 Subject: [PATCH 1/2] config: Change default theme to Dark Colorful --- src/yuzu/configuration/config.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 99a7397fc7..1b35f84884 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -743,7 +743,7 @@ void Config::ReadUIValues() { qt_config->beginGroup(QStringLiteral("UI")); UISettings::values.theme = - ReadSetting(QStringLiteral("theme"), QString::fromUtf8(UISettings::themes[0].second)) + ReadSetting(QStringLiteral("theme"), QString::fromUtf8(UISettings::themes[3].second)) .toString(); ReadBasicSetting(UISettings::values.enable_discord_presence); ReadBasicSetting(UISettings::values.select_user_on_boot); @@ -1271,7 +1271,7 @@ void Config::SaveUIValues() { qt_config->beginGroup(QStringLiteral("UI")); WriteSetting(QStringLiteral("theme"), UISettings::values.theme, - QString::fromUtf8(UISettings::themes[0].second)); + QString::fromUtf8(UISettings::themes[3].second)); WriteBasicSetting(UISettings::values.enable_discord_presence); WriteBasicSetting(UISettings::values.select_user_on_boot); From 78e233c4600a13caee1cbb41d495b168fc6e1e79 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Mon, 17 Jan 2022 02:46:30 -0500 Subject: [PATCH 2/2] uisettings: Add enumeration type for themes Eliminates the usage of a magic number to indicate the default index of the themes array, --- src/yuzu/configuration/config.cpp | 11 ++++++++--- src/yuzu/uisettings.h | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 1b35f84884..33d50667ad 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -743,7 +743,10 @@ void Config::ReadUIValues() { qt_config->beginGroup(QStringLiteral("UI")); UISettings::values.theme = - ReadSetting(QStringLiteral("theme"), QString::fromUtf8(UISettings::themes[3].second)) + ReadSetting( + QStringLiteral("theme"), + QString::fromUtf8( + UISettings::themes[static_cast(UISettings::Theme::DarkColorful)].second)) .toString(); ReadBasicSetting(UISettings::values.enable_discord_presence); ReadBasicSetting(UISettings::values.select_user_on_boot); @@ -1270,8 +1273,10 @@ void Config::SaveSystemValues() { void Config::SaveUIValues() { qt_config->beginGroup(QStringLiteral("UI")); - WriteSetting(QStringLiteral("theme"), UISettings::values.theme, - QString::fromUtf8(UISettings::themes[3].second)); + WriteSetting( + QStringLiteral("theme"), UISettings::values.theme, + QString::fromUtf8( + UISettings::themes[static_cast(UISettings::Theme::DarkColorful)].second)); WriteBasicSetting(UISettings::values.enable_discord_presence); WriteBasicSetting(UISettings::values.select_user_on_boot); diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 402c4556d6..f7298ddadc 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -29,6 +29,15 @@ struct Shortcut { ContextualShortcut shortcut; }; +enum class Theme { + Default, + DefaultColorful, + Dark, + DarkColorful, + MidnightBlue, + MidnightBlueColorful, +}; + using Themes = std::array, 6>; extern const Themes themes;