From 4b7b7d217cc4b72e3af78aca8c4f5c6cecda36b0 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Thu, 25 Nov 2021 11:41:27 +0100 Subject: [PATCH] early-access version 2241 --- README.md | 2 +- src/yuzu/main.cpp | 54 +++++++++++++++++++++-------------------- src/yuzu/uisettings.cpp | 4 +-- 3 files changed, 31 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index b8558c23f..e77103a07 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 2240. +This is the source code for early-access 2241. ## Legal Notice diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 09ea21f5e..523f33629 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -3481,36 +3481,38 @@ void GMainWindow::filterBarSetChecked(bool state) { } void GMainWindow::UpdateUITheme() { - const QString default_icons = QStringLiteral("default"); - const QString& current_theme = UISettings::values.theme; - const bool is_default_theme = current_theme == QString::fromUtf8(UISettings::themes[0].second); + const QString default_theme = QStringLiteral("default"); + QString current_theme = UISettings::values.theme; QStringList theme_paths(default_theme_paths); - if (is_default_theme || current_theme.isEmpty()) { - const QString theme_uri(QStringLiteral(":default/style.qss")); - QFile f(theme_uri); - if (f.open(QFile::ReadOnly | QFile::Text)) { - QTextStream ts(&f); - qApp->setStyleSheet(ts.readAll()); - setStyleSheet(ts.readAll()); - } else { - qApp->setStyleSheet({}); - setStyleSheet({}); - } - QIcon::setThemeName(default_icons); - } else { - const QString theme_uri(QLatin1Char{':'} + current_theme + QStringLiteral("/style.qss")); - QFile f(theme_uri); - if (f.open(QFile::ReadOnly | QFile::Text)) { - QTextStream ts(&f); - qApp->setStyleSheet(ts.readAll()); - setStyleSheet(ts.readAll()); - } else { - LOG_ERROR(Frontend, "Unable to set style, stylesheet file not found"); - } - QIcon::setThemeName(current_theme); + if (current_theme.isEmpty()) { + current_theme = default_theme; } + if (current_theme != default_theme) { + QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)}; + QFile f(theme_uri); + if (!f.open(QFile::ReadOnly | QFile::Text)) { + LOG_ERROR(Frontend, "Unable to open style \"{}\", fallback to the default theme", + UISettings::values.theme.toStdString()); + current_theme = default_theme; + } + } + + QString theme_uri{QStringLiteral(":%1/style.qss").arg(current_theme)}; + QFile f(theme_uri); + if (f.open(QFile::ReadOnly | QFile::Text)) { + QTextStream ts(&f); + qApp->setStyleSheet(ts.readAll()); + setStyleSheet(ts.readAll()); + } else { + LOG_ERROR(Frontend, "Unable to set style \"{}\", stylesheet file not found", + UISettings::values.theme.toStdString()); + qApp->setStyleSheet({}); + setStyleSheet({}); + } + + QIcon::setThemeName(current_theme); QIcon::setThemeSearchPaths(theme_paths); } diff --git a/src/yuzu/uisettings.cpp b/src/yuzu/uisettings.cpp index 37499fc85..21683576c 100755 --- a/src/yuzu/uisettings.cpp +++ b/src/yuzu/uisettings.cpp @@ -7,8 +7,8 @@ namespace UISettings { const Themes themes{{ - {"Light", "default"}, - {"Light Colorful", "colorful"}, + {"Default", "default"}, + {"Default Colorful", "colorful"}, {"Dark", "qdarkstyle"}, {"Dark Colorful", "colorful_dark"}, {"Midnight Blue", "qdarkstyle_midnight_blue"},