fix: do not apply system theme on launch
Closes PrismLauncher/PrismLauncher#490 Regression introduced by PrismLauncher/PrismLauncher#249 Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
ed085630db
commit
a988111507
@ -830,9 +830,7 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv)
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
{
|
applyCurrentlySelectedTheme(true);
|
||||||
applyCurrentlySelectedTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateCapabilities();
|
updateCapabilities();
|
||||||
|
|
||||||
@ -1107,9 +1105,9 @@ QList<ITheme*> Application::getValidApplicationThemes()
|
|||||||
return m_themeManager->getValidApplicationThemes();
|
return m_themeManager->getValidApplicationThemes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::applyCurrentlySelectedTheme()
|
void Application::applyCurrentlySelectedTheme(bool initial)
|
||||||
{
|
{
|
||||||
m_themeManager->applyCurrentlySelectedTheme();
|
m_themeManager->applyCurrentlySelectedTheme(initial);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setApplicationTheme(const QString& name)
|
void Application::setApplicationTheme(const QString& name)
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
void setIconTheme(const QString& name);
|
void setIconTheme(const QString& name);
|
||||||
|
|
||||||
void applyCurrentlySelectedTheme();
|
void applyCurrentlySelectedTheme(bool initial = false);
|
||||||
|
|
||||||
QList<ITheme*> getValidApplicationThemes();
|
QList<ITheme*> getValidApplicationThemes();
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
|
||||||
void ITheme::apply()
|
void ITheme::apply(bool)
|
||||||
{
|
{
|
||||||
APPLICATION->setStyleSheet(QString());
|
APPLICATION->setStyleSheet(QString());
|
||||||
QApplication::setStyle(QStyleFactory::create(qtTheme()));
|
QApplication::setStyle(QStyleFactory::create(qtTheme()));
|
||||||
|
@ -41,7 +41,7 @@ class QStyle;
|
|||||||
class ITheme {
|
class ITheme {
|
||||||
public:
|
public:
|
||||||
virtual ~ITheme() {}
|
virtual ~ITheme() {}
|
||||||
virtual void apply();
|
virtual void apply(bool initial);
|
||||||
virtual QString id() = 0;
|
virtual QString id() = 0;
|
||||||
virtual QString name() = 0;
|
virtual QString name() = 0;
|
||||||
virtual bool hasStyleSheet() = 0;
|
virtual bool hasStyleSheet() = 0;
|
||||||
|
@ -60,9 +60,13 @@ SystemTheme::SystemTheme()
|
|||||||
themeDebugLog() << "System theme not found, defaulted to Fusion";
|
themeDebugLog() << "System theme not found, defaulted to Fusion";
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemTheme::apply()
|
void SystemTheme::apply(bool initial)
|
||||||
{
|
{
|
||||||
ITheme::apply();
|
// See https://github.com/MultiMC/Launcher/issues/1790
|
||||||
|
// or https://github.com/PrismLauncher/PrismLauncher/issues/490
|
||||||
|
if (initial)
|
||||||
|
return;
|
||||||
|
ITheme::apply(initial);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SystemTheme::id()
|
QString SystemTheme::id()
|
||||||
|
@ -40,7 +40,7 @@ class SystemTheme : public ITheme {
|
|||||||
public:
|
public:
|
||||||
SystemTheme();
|
SystemTheme();
|
||||||
virtual ~SystemTheme() {}
|
virtual ~SystemTheme() {}
|
||||||
void apply() override;
|
void apply(bool initial) override;
|
||||||
|
|
||||||
QString id() override;
|
QString id() override;
|
||||||
QString name() override;
|
QString name() override;
|
||||||
|
@ -116,22 +116,22 @@ void ThemeManager::setIconTheme(const QString& name)
|
|||||||
QIcon::setThemeName(name);
|
QIcon::setThemeName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::applyCurrentlySelectedTheme()
|
void ThemeManager::applyCurrentlySelectedTheme(bool initial)
|
||||||
{
|
{
|
||||||
setIconTheme(APPLICATION->settings()->get("IconTheme").toString());
|
setIconTheme(APPLICATION->settings()->get("IconTheme").toString());
|
||||||
themeDebugLog() << "<> Icon theme set.";
|
themeDebugLog() << "<> Icon theme set.";
|
||||||
setApplicationTheme(APPLICATION->settings()->get("ApplicationTheme").toString());
|
setApplicationTheme(APPLICATION->settings()->get("ApplicationTheme").toString(), initial);
|
||||||
themeDebugLog() << "<> Application theme set.";
|
themeDebugLog() << "<> Application theme set.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeManager::setApplicationTheme(const QString& name)
|
void ThemeManager::setApplicationTheme(const QString& name, bool initial)
|
||||||
{
|
{
|
||||||
auto systemPalette = qApp->palette();
|
auto systemPalette = qApp->palette();
|
||||||
auto themeIter = m_themes.find(name);
|
auto themeIter = m_themes.find(name);
|
||||||
if (themeIter != m_themes.end()) {
|
if (themeIter != m_themes.end()) {
|
||||||
auto& theme = themeIter->second;
|
auto& theme = themeIter->second;
|
||||||
themeDebugLog() << "applying theme" << theme->name();
|
themeDebugLog() << "applying theme" << theme->name();
|
||||||
theme->apply();
|
theme->apply(initial);
|
||||||
} else {
|
} else {
|
||||||
themeWarningLog() << "Tried to set invalid theme:" << name;
|
themeWarningLog() << "Tried to set invalid theme:" << name;
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@ class ThemeManager {
|
|||||||
|
|
||||||
QList<ITheme*> getValidApplicationThemes();
|
QList<ITheme*> getValidApplicationThemes();
|
||||||
void setIconTheme(const QString& name);
|
void setIconTheme(const QString& name);
|
||||||
void applyCurrentlySelectedTheme();
|
void applyCurrentlySelectedTheme(bool initial = false);
|
||||||
void setApplicationTheme(const QString& name);
|
void setApplicationTheme(const QString& name, bool initial = false);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the cat based on selected cat and with events (Birthday, XMas, etc.)
|
/// Returns the cat based on selected cat and with events (Birthday, XMas, etc.)
|
||||||
|
Loading…
Reference in New Issue
Block a user