From ce734f8a0db09feaba1874697a549385574a7790 Mon Sep 17 00:00:00 2001 From: JordanTheToaster Date: Tue, 30 Apr 2024 13:05:26 +0100 Subject: [PATCH] Qt: Add Classic Windows as theme option But it'll bug out when switching between windows11/windowsvista. Restart to fix. --- pcsx2-qt/Settings/InterfaceSettingsWidget.cpp | 6 ++++++ pcsx2-qt/Themes.cpp | 17 +++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/pcsx2-qt/Settings/InterfaceSettingsWidget.cpp b/pcsx2-qt/Settings/InterfaceSettingsWidget.cpp index f02b266723..7160381e45 100644 --- a/pcsx2-qt/Settings/InterfaceSettingsWidget.cpp +++ b/pcsx2-qt/Settings/InterfaceSettingsWidget.cpp @@ -11,6 +11,9 @@ const char* InterfaceSettingsWidget::THEME_NAMES[] = { QT_TRANSLATE_NOOP("InterfaceSettingsWidget", "Native"), //: Ignore what Crowdin says in this string about "[Light]/[Dark]" being untouchable here, these are not variables in this case and must be translated. +#ifdef _WIN32 + QT_TRANSLATE_NOOP("MainWindow", "Classic Windows"), +#endif QT_TRANSLATE_NOOP("InterfaceSettingsWidget", "Fusion [Light/Dark]"), //: Ignore what Crowdin says in this string about "[Light]/[Dark]" being untouchable here, these are not variables in this case and must be translated. QT_TRANSLATE_NOOP("InterfaceSettingsWidget", "Dark Fusion (Gray) [Dark]"), @@ -42,6 +45,9 @@ const char* InterfaceSettingsWidget::THEME_NAMES[] = { const char* InterfaceSettingsWidget::THEME_VALUES[] = { "", +#ifdef _WIN32 + "windowsvista", +#endif "fusion", "darkfusion", "darkfusionblue", diff --git a/pcsx2-qt/Themes.cpp b/pcsx2-qt/Themes.cpp index f491a1f3bc..a84a27d20b 100644 --- a/pcsx2-qt/Themes.cpp +++ b/pcsx2-qt/Themes.cpp @@ -47,14 +47,22 @@ void QtHost::SetStyleFromSettings() { const std::string theme(Host::GetBaseStringSettingValue("UI", "Theme", GetDefaultThemeName())); + // setPalette() shouldn't be necessary, as the documentation claims that setStyle() resets the palette, but it + // is here, to work around a bug in 6.4.x and 6.5.x where the palette doesn't restore after changing themes. + qApp->setPalette(QPalette()); + if (theme == "fusion") { - // setPalette() shouldn't be necessary, as the documentation claims that setStyle() resets the palette, but it - // is here, to work around a bug in 6.4.x and 6.5.x where the palette doesn't restore after changing themes. - qApp->setPalette(QPalette()); qApp->setStyle(QStyleFactory::create("Fusion")); qApp->setStyleSheet(QString()); } +#ifdef _WIN32 + else if (theme == "windowsvista") + { + qApp->setStyle(QStyleFactory::create("windowsvista")); + qApp->setStyleSheet(QString()); + } +#endif else if (theme == "darkfusion") { // adapted from https://gist.github.com/QuantumCD/6245215 @@ -481,9 +489,6 @@ void QtHost::SetStyleFromSettings() } else { - // setPalette() shouldn't be necessary, as the documentation claims that setStyle() resets the palette, but it - // is here, to work around a bug in 6.4.x and 6.5.x where the palette doesn't restore after changing themes. - qApp->setPalette(QPalette()); qApp->setStyle(s_unthemed_style_name); qApp->setStyleSheet(QString()); }