summaryrefslogtreecommitdiffstats
path: root/application/themes
diff options
context:
space:
mode:
Diffstat (limited to 'application/themes')
-rw-r--r--application/themes/ITheme.cpp21
-rw-r--r--application/themes/ITheme.h1
-rw-r--r--application/themes/SystemTheme.cpp27
-rw-r--r--application/themes/SystemTheme.h1
4 files changed, 39 insertions, 11 deletions
diff --git a/application/themes/ITheme.cpp b/application/themes/ITheme.cpp
index aefcc381..b1cecf57 100644
--- a/application/themes/ITheme.cpp
+++ b/application/themes/ITheme.cpp
@@ -1,5 +1,26 @@
#include "ITheme.h"
#include "rainbow.h"
+#include <QStyleFactory>
+#include <QDir>
+#include "MultiMC.h"
+
+void ITheme::apply(bool)
+{
+ QApplication::setStyle(QStyleFactory::create(qtTheme()));
+ if(hasColorScheme())
+ {
+ QApplication::setPalette(colorScheme());
+ }
+ if(hasStyleSheet())
+ {
+ MMC->setStyleSheet(appStyleSheet());
+ }
+ else
+ {
+ MMC->setStyleSheet(QString());
+ }
+ QDir::setSearchPaths("theme", searchPaths());
+}
QPalette ITheme::fadeInactive(QPalette in, qreal bias, QColor color)
{
diff --git a/application/themes/ITheme.h b/application/themes/ITheme.h
index 0360c445..b75001c2 100644
--- a/application/themes/ITheme.h
+++ b/application/themes/ITheme.h
@@ -8,6 +8,7 @@ class ITheme
{
public:
virtual ~ITheme() {}
+ virtual void apply(bool initial);
virtual QString id() = 0;
virtual QString name() = 0;
virtual bool hasStyleSheet() = 0;
diff --git a/application/themes/SystemTheme.cpp b/application/themes/SystemTheme.cpp
index 1e0146f7..069b0b1b 100644
--- a/application/themes/SystemTheme.cpp
+++ b/application/themes/SystemTheme.cpp
@@ -24,6 +24,16 @@ SystemTheme::SystemTheme()
qWarning() << "System theme not found, defaulted to Fusion";
}
+void SystemTheme::apply(bool initial)
+{
+ // if we are applying the system theme as the first theme, just don't touch anything. it's for the better...
+ if(initial)
+ {
+ return;
+ }
+ ITheme::apply(initial);
+}
+
QString SystemTheme::id()
{
return "system";
@@ -50,14 +60,14 @@ QString SystemTheme::appStyleSheet()
}
double SystemTheme::fadeAmount()
- {
- return 0.5;
- }
+{
+ return 0.5;
+}
QColor SystemTheme::fadeColor()
- {
- return QColor(128,128,128);
- }
+{
+ return QColor(128,128,128);
+}
bool SystemTheme::hasStyleSheet()
{
@@ -66,10 +76,5 @@ bool SystemTheme::hasStyleSheet()
bool SystemTheme::hasColorScheme()
{
- // FIXME: horrible hack to work around Qt's sketchy theming APIs
-#if defined(Q_OS_LINUX)
return true;
-#else
- return false;
-#endif
}
diff --git a/application/themes/SystemTheme.h b/application/themes/SystemTheme.h
index e8034efc..18291b68 100644
--- a/application/themes/SystemTheme.h
+++ b/application/themes/SystemTheme.h
@@ -7,6 +7,7 @@ class SystemTheme: public ITheme
public:
SystemTheme();
virtual ~SystemTheme() {}
+ void apply(bool initial) override;
QString id() override;
QString name() override;