[Backport release-9.x] Use correct colours for all system themes (#3539)
This commit is contained in:
commit
1a06e34fe4
@ -40,18 +40,18 @@
|
|||||||
#include "HintOverrideProxyStyle.h"
|
#include "HintOverrideProxyStyle.h"
|
||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
|
|
||||||
SystemTheme::SystemTheme(const QString& styleName, const QPalette& palette, bool isDefaultTheme)
|
SystemTheme::SystemTheme(const QString& styleName, bool isDefaultTheme)
|
||||||
{
|
{
|
||||||
themeName = isDefaultTheme ? "system" : styleName;
|
themeName = isDefaultTheme ? "system" : styleName;
|
||||||
widgetTheme = styleName;
|
widgetTheme = styleName;
|
||||||
colorPalette = palette;
|
colorPalette = QStyleFactory::create(styleName)->standardPalette();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemTheme::apply(bool initial)
|
void SystemTheme::apply(bool initial)
|
||||||
{
|
{
|
||||||
// See https://github.com/MultiMC/Launcher/issues/1790
|
// See https://github.com/MultiMC/Launcher/issues/1790
|
||||||
// or https://github.com/PrismLauncher/PrismLauncher/issues/490
|
// or https://github.com/PrismLauncher/PrismLauncher/issues/490
|
||||||
if (initial) {
|
if (initial && themeName == "system") {
|
||||||
QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme())));
|
QApplication::setStyle(new HintOverrideProxyStyle(QStyleFactory::create(qtTheme())));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
|
|
||||||
class SystemTheme : public ITheme {
|
class SystemTheme : public ITheme {
|
||||||
public:
|
public:
|
||||||
SystemTheme(const QString& styleName, const QPalette& palette, bool isDefaultTheme);
|
SystemTheme(const QString& styleName, bool isDefaultTheme);
|
||||||
virtual ~SystemTheme() {}
|
virtual ~SystemTheme() {}
|
||||||
void apply(bool initial) override;
|
void apply(bool initial) override;
|
||||||
|
|
||||||
|
@ -44,8 +44,6 @@ ThemeManager::ThemeManager()
|
|||||||
m_defaultStyle = style->objectName();
|
m_defaultStyle = style->objectName();
|
||||||
themeDebugLog() << "System theme seems to be:" << m_defaultStyle;
|
themeDebugLog() << "System theme seems to be:" << m_defaultStyle;
|
||||||
|
|
||||||
m_defaultPalette = QApplication::palette();
|
|
||||||
|
|
||||||
initializeThemes();
|
initializeThemes();
|
||||||
initializeCatPacks();
|
initializeCatPacks();
|
||||||
}
|
}
|
||||||
@ -128,7 +126,7 @@ void ThemeManager::initializeIcons()
|
|||||||
void ThemeManager::initializeWidgets()
|
void ThemeManager::initializeWidgets()
|
||||||
{
|
{
|
||||||
themeDebugLog() << "<> Initializing Widget Themes";
|
themeDebugLog() << "<> Initializing Widget Themes";
|
||||||
themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique<SystemTheme>(m_defaultStyle, m_defaultPalette, true));
|
themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique<SystemTheme>(m_defaultStyle, true));
|
||||||
auto darkThemeId = addTheme(std::make_unique<DarkTheme>());
|
auto darkThemeId = addTheme(std::make_unique<DarkTheme>());
|
||||||
themeDebugLog() << "Loading Built-in Theme:" << darkThemeId;
|
themeDebugLog() << "Loading Built-in Theme:" << darkThemeId;
|
||||||
themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique<BrightTheme>());
|
themeDebugLog() << "Loading Built-in Theme:" << addTheme(std::make_unique<BrightTheme>());
|
||||||
@ -141,7 +139,7 @@ void ThemeManager::initializeWidgets()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
themeDebugLog() << "Loading System Theme:" << addTheme(std::make_unique<SystemTheme>(st, m_defaultPalette, false));
|
themeDebugLog() << "Loading System Theme:" << addTheme(std::make_unique<SystemTheme>(st, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: need some way to differentiate same name themes in different subdirectories
|
// TODO: need some way to differentiate same name themes in different subdirectories
|
||||||
|
@ -69,7 +69,6 @@ class ThemeManager {
|
|||||||
QDir m_catPacksFolder{ "catpacks" };
|
QDir m_catPacksFolder{ "catpacks" };
|
||||||
std::map<QString, std::unique_ptr<CatPack>> m_catPacks;
|
std::map<QString, std::unique_ptr<CatPack>> m_catPacks;
|
||||||
QString m_defaultStyle;
|
QString m_defaultStyle;
|
||||||
QPalette m_defaultPalette;
|
|
||||||
LogColors m_logColors;
|
LogColors m_logColors;
|
||||||
|
|
||||||
void initializeThemes();
|
void initializeThemes();
|
||||||
|
Loading…
Reference in New Issue
Block a user