mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-15 22:54:00 +00:00
uisettings: Add enumeration type for themes
Eliminates the usage of a magic number to indicate the default index of the themes array,
This commit is contained in:
parent
789af19c60
commit
78e233c460
2 changed files with 17 additions and 3 deletions
|
@ -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<size_t>(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<size_t>(UISettings::Theme::DarkColorful)].second));
|
||||
WriteBasicSetting(UISettings::values.enable_discord_presence);
|
||||
WriteBasicSetting(UISettings::values.select_user_on_boot);
|
||||
|
||||
|
|
|
@ -29,6 +29,15 @@ struct Shortcut {
|
|||
ContextualShortcut shortcut;
|
||||
};
|
||||
|
||||
enum class Theme {
|
||||
Default,
|
||||
DefaultColorful,
|
||||
Dark,
|
||||
DarkColorful,
|
||||
MidnightBlue,
|
||||
MidnightBlueColorful,
|
||||
};
|
||||
|
||||
using Themes = std::array<std::pair<const char*, const char*>, 6>;
|
||||
extern const Themes themes;
|
||||
|
||||
|
|
Loading…
Reference in a new issue