diff options
author | Petr Mrázek <peterix@gmail.com> | 2017-01-15 22:56:03 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2017-01-15 22:56:03 +0100 |
commit | 944ff256b2d9e271632efacd6e8dd1ea542e869f (patch) | |
tree | af7fc0041d8cc28d86577c9ffa6fc438a21b9a0b /application/themes | |
parent | 71584fb8ccda914997f11044e819470d93cc3561 (diff) | |
download | MultiMC-944ff256b2d9e271632efacd6e8dd1ea542e869f.tar MultiMC-944ff256b2d9e271632efacd6e8dd1ea542e869f.tar.gz MultiMC-944ff256b2d9e271632efacd6e8dd1ea542e869f.tar.lz MultiMC-944ff256b2d9e271632efacd6e8dd1ea542e869f.tar.xz MultiMC-944ff256b2d9e271632efacd6e8dd1ea542e869f.zip |
NOISSUE add hack for system themes. Maybe it works?
Diffstat (limited to 'application/themes')
-rw-r--r-- | application/themes/BrightTheme.cpp | 10 | ||||
-rw-r--r-- | application/themes/BrightTheme.h | 2 | ||||
-rw-r--r-- | application/themes/CustomTheme.cpp | 10 | ||||
-rw-r--r-- | application/themes/CustomTheme.h | 2 | ||||
-rw-r--r-- | application/themes/DarkTheme.cpp | 10 | ||||
-rw-r--r-- | application/themes/DarkTheme.h | 2 | ||||
-rw-r--r-- | application/themes/ITheme.h | 4 | ||||
-rw-r--r-- | application/themes/SystemTheme.cpp | 16 | ||||
-rw-r--r-- | application/themes/SystemTheme.h | 2 |
9 files changed, 58 insertions, 0 deletions
diff --git a/application/themes/BrightTheme.cpp b/application/themes/BrightTheme.cpp index a7cfa010..2763c982 100644 --- a/application/themes/BrightTheme.cpp +++ b/application/themes/BrightTheme.cpp @@ -10,6 +10,11 @@ QString BrightTheme::name() return QObject::tr("Bright"); } +bool BrightTheme::hasColorScheme() +{ + return true; +} + QPalette BrightTheme::colorScheme() { QPalette brightPalette; @@ -39,6 +44,11 @@ QColor BrightTheme::fadeColor() return QColor(239,240,241); } +bool BrightTheme::hasStyleSheet() +{ + return false; +} + QString BrightTheme::appStyleSheet() { return QString(); diff --git a/application/themes/BrightTheme.h b/application/themes/BrightTheme.h index 814aa6de..31b31b2d 100644 --- a/application/themes/BrightTheme.h +++ b/application/themes/BrightTheme.h @@ -9,7 +9,9 @@ public: QString id() override; QString name() override; + bool hasStyleSheet() override; QString appStyleSheet() override; + bool hasColorScheme() override; QPalette colorScheme() override; double fadeAmount() override; QColor fadeColor() override; diff --git a/application/themes/CustomTheme.cpp b/application/themes/CustomTheme.cpp index 70d55211..a6c7bf8c 100644 --- a/application/themes/CustomTheme.cpp +++ b/application/themes/CustomTheme.cpp @@ -208,11 +208,21 @@ QString CustomTheme::name() return m_name; } +bool CustomTheme::hasColorScheme() +{ + return true; +} + QPalette CustomTheme::colorScheme() { return m_palette; } +bool CustomTheme::hasStyleSheet() +{ + return true; +} + QString CustomTheme::appStyleSheet() { return m_styleSheet; diff --git a/application/themes/CustomTheme.h b/application/themes/CustomTheme.h index e5d3625c..9023b13e 100644 --- a/application/themes/CustomTheme.h +++ b/application/themes/CustomTheme.h @@ -10,7 +10,9 @@ public: QString id() override; QString name() override; + bool hasStyleSheet() override; QString appStyleSheet() override; + bool hasColorScheme() override; QPalette colorScheme() override; double fadeAmount() override; QColor fadeColor() override; diff --git a/application/themes/DarkTheme.cpp b/application/themes/DarkTheme.cpp index 2bcb4cd7..cf4a81e1 100644 --- a/application/themes/DarkTheme.cpp +++ b/application/themes/DarkTheme.cpp @@ -10,6 +10,11 @@ QString DarkTheme::name() return QObject::tr("Dark"); } +bool DarkTheme::hasColorScheme() +{ + return true; +} + QPalette DarkTheme::colorScheme() { QPalette darkPalette; @@ -39,6 +44,11 @@ QColor DarkTheme::fadeColor() return QColor(49,54,59); } +bool DarkTheme::hasStyleSheet() +{ + return true; +} + QString DarkTheme::appStyleSheet() { return "QToolTip { color: #ffffff; background-color: #2a82da; border: 1px solid white; }"; diff --git a/application/themes/DarkTheme.h b/application/themes/DarkTheme.h index 142f7860..f3c18e22 100644 --- a/application/themes/DarkTheme.h +++ b/application/themes/DarkTheme.h @@ -9,7 +9,9 @@ public: QString id() override; QString name() override; + bool hasStyleSheet() override; QString appStyleSheet() override; + bool hasColorScheme() override; QPalette colorScheme() override; double fadeAmount() override; QColor fadeColor() override; diff --git a/application/themes/ITheme.h b/application/themes/ITheme.h index 8070efb1..0360c445 100644 --- a/application/themes/ITheme.h +++ b/application/themes/ITheme.h @@ -2,14 +2,18 @@ #include <QString> #include <QPalette> +class QStyle; + class ITheme { public: virtual ~ITheme() {} virtual QString id() = 0; virtual QString name() = 0; + virtual bool hasStyleSheet() = 0; virtual QString appStyleSheet() = 0; virtual QString qtTheme() = 0; + virtual bool hasColorScheme() = 0; virtual QPalette colorScheme() = 0; virtual QColor fadeColor() = 0; virtual double fadeAmount() = 0; diff --git a/application/themes/SystemTheme.cpp b/application/themes/SystemTheme.cpp index f7a68061..1e0146f7 100644 --- a/application/themes/SystemTheme.cpp +++ b/application/themes/SystemTheme.cpp @@ -21,6 +21,7 @@ SystemTheme::SystemTheme() } // fall back to fusion if we can't find the current theme. systemTheme = "Fusion"; + qWarning() << "System theme not found, defaulted to Fusion"; } QString SystemTheme::id() @@ -57,3 +58,18 @@ QColor SystemTheme::fadeColor() { return QColor(128,128,128); } + +bool SystemTheme::hasStyleSheet() +{ + return false; +} + +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 e4a84bca..e8034efc 100644 --- a/application/themes/SystemTheme.h +++ b/application/themes/SystemTheme.h @@ -11,7 +11,9 @@ public: QString id() override; QString name() override; QString qtTheme() override; + bool hasStyleSheet() override; QString appStyleSheet() override; + bool hasColorScheme() override; QPalette colorScheme() override; double fadeAmount() override; QColor fadeColor() override; |