1
0
Fork 0
forked from suyu/suyu

review pass on CheckDarkMode function

This commit is contained in:
Kyle Kienapfel 2022-08-12 06:10:18 -07:00
parent cfbd70d03b
commit d4b1095173
2 changed files with 4 additions and 4 deletions

View file

@ -257,7 +257,7 @@ static QString PrettyProductName() {
return QSysInfo::prettyProductName(); return QSysInfo::prettyProductName();
} }
bool GMainWindow::check_dark_mode() { bool GMainWindow::CheckDarkMode() {
#ifdef __linux__ #ifdef __linux__
const QPalette test_palette(qApp->palette()); const QPalette test_palette(qApp->palette());
const QColor text_color = test_palette.color(QPalette::Active, QPalette::Text); const QColor text_color = test_palette.color(QPalette::Active, QPalette::Text);
@ -287,7 +287,7 @@ GMainWindow::GMainWindow(bool has_broken_vulkan)
statusBar()->hide(); statusBar()->hide();
// Check dark mode before a theme is loaded // Check dark mode before a theme is loaded
os_dark_mode = check_dark_mode(); os_dark_mode = CheckDarkMode();
startup_icon_theme = QIcon::themeName(); startup_icon_theme = QIcon::themeName();
// fallback can only be set once, colorful theme icons are okay on both light/dark // fallback can only be set once, colorful theme icons are okay on both light/dark
QIcon::setFallbackThemeName(QStringLiteral("colorful")); QIcon::setFallbackThemeName(QStringLiteral("colorful"));
@ -3979,7 +3979,7 @@ void GMainWindow::UpdateUITheme() {
QIcon::setThemeName(current_theme == QStringLiteral("colorful") ? current_theme QIcon::setThemeName(current_theme == QStringLiteral("colorful") ? current_theme
: startup_icon_theme); : startup_icon_theme);
QIcon::setThemeSearchPaths(theme_paths); QIcon::setThemeSearchPaths(theme_paths);
if (check_dark_mode()) { if (CheckDarkMode()) {
current_theme = QStringLiteral("default_dark"); current_theme = QStringLiteral("default_dark");
} }
} else { } else {

View file

@ -348,6 +348,7 @@ private:
void OpenURL(const QUrl& url); void OpenURL(const QUrl& url);
void LoadTranslation(); void LoadTranslation();
void OpenPerGameConfiguration(u64 title_id, const std::string& file_name); void OpenPerGameConfiguration(u64 title_id, const std::string& file_name);
bool CheckDarkMode();
QString GetTasStateDescription() const; QString GetTasStateDescription() const;
@ -395,7 +396,6 @@ private:
QString startup_icon_theme; QString startup_icon_theme;
bool os_dark_mode = false; bool os_dark_mode = false;
bool check_dark_mode();
// FS // FS
std::shared_ptr<FileSys::VfsFilesystem> vfs; std::shared_ptr<FileSys::VfsFilesystem> vfs;