summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-10-22 01:43:36 +0200
committerPetr Mrázek <peterix@gmail.com>2016-10-22 01:43:36 +0200
commitbbe139dce51a7965394c800cac974946820d3869 (patch)
treeaa271175a3df6ada20932e4cf898c723b1238775 /application
parent872cfe036d9472739939ad401dbe9511193d62ca (diff)
downloadMultiMC-bbe139dce51a7965394c800cac974946820d3869.tar
MultiMC-bbe139dce51a7965394c800cac974946820d3869.tar.gz
MultiMC-bbe139dce51a7965394c800cac974946820d3869.tar.lz
MultiMC-bbe139dce51a7965394c800cac974946820d3869.tar.xz
MultiMC-bbe139dce51a7965394c800cac974946820d3869.zip
GH-903 force Dark theme to use Fusion Qt style
Themes now include Qt styles.
Diffstat (limited to 'application')
-rw-r--r--application/MultiMC.cpp3
-rw-r--r--application/themes/DarkTheme.cpp5
-rw-r--r--application/themes/DarkTheme.h1
-rw-r--r--application/themes/ITheme.h1
-rw-r--r--application/themes/SystemTheme.cpp23
-rw-r--r--application/themes/SystemTheme.h1
6 files changed, 32 insertions, 2 deletions
diff --git a/application/MultiMC.cpp b/application/MultiMC.cpp
index 093d03b4..6d671bd4 100644
--- a/application/MultiMC.cpp
+++ b/application/MultiMC.cpp
@@ -22,6 +22,7 @@
#include <QMessageBox>
#include <QStringList>
#include <QDebug>
+#include <QStyleFactory>
#include "InstanceList.h"
#include <minecraft/auth/MojangAccountList.h>
@@ -982,9 +983,9 @@ void MultiMC::setApplicationTheme(const QString& name)
if(themeIter != m_themes.end())
{
auto & theme = (*themeIter).second;
+ setStyle(QStyleFactory::create(theme->qtTheme()));
setPalette(theme->colorScheme());
setStyleSheet(theme->appStyleSheet());
- //setStyle(QStyleFactory::create("Fusion"));
}
else
{
diff --git a/application/themes/DarkTheme.cpp b/application/themes/DarkTheme.cpp
index 7445dedf..497be1f4 100644
--- a/application/themes/DarkTheme.cpp
+++ b/application/themes/DarkTheme.cpp
@@ -10,6 +10,11 @@ QString DarkTheme::name()
return QObject::tr("Dark");
}
+QString DarkTheme::qtTheme()
+{
+ return "Fusion";
+}
+
QPalette DarkTheme::colorScheme()
{
QPalette darkPalette;
diff --git a/application/themes/DarkTheme.h b/application/themes/DarkTheme.h
index 11e621a6..8552851d 100644
--- a/application/themes/DarkTheme.h
+++ b/application/themes/DarkTheme.h
@@ -7,6 +7,7 @@ class DarkTheme: public ITheme
public:
virtual ~DarkTheme() {}
+ QString qtTheme() override;
QString id() override;
QString name() override;
QString appStyleSheet() override;
diff --git a/application/themes/ITheme.h b/application/themes/ITheme.h
index 8e0836eb..969969be 100644
--- a/application/themes/ITheme.h
+++ b/application/themes/ITheme.h
@@ -9,5 +9,6 @@ public:
virtual QString id() = 0;
virtual QString name() = 0;
virtual QString appStyleSheet() = 0;
+ virtual QString qtTheme() = 0;
virtual QPalette colorScheme() = 0;
};
diff --git a/application/themes/SystemTheme.cpp b/application/themes/SystemTheme.cpp
index 6ced6843..6d8a0ee8 100644
--- a/application/themes/SystemTheme.cpp
+++ b/application/themes/SystemTheme.cpp
@@ -1,10 +1,26 @@
#include "SystemTheme.h"
#include <QApplication>
#include <QStyle>
+#include <QStyleFactory>
+#include <QDebug>
SystemTheme::SystemTheme()
{
- systemPalette = QApplication::style()->standardPalette();
+ const auto & style = QApplication::style();
+ systemPalette = style->standardPalette();
+ QString lowerThemeName = style->objectName();
+ qWarning() << systemTheme;
+ QStringList styles = QStyleFactory::keys();
+ for(auto &st: styles)
+ {
+ if(st.toLower() == lowerThemeName)
+ {
+ systemTheme = st;
+ return;
+ }
+ }
+ // fall back to fusion if we can't find the current theme.
+ systemTheme = "Fusion";
}
QString SystemTheme::id()
@@ -17,6 +33,11 @@ QString SystemTheme::name()
return QObject::tr("System");
}
+QString SystemTheme::qtTheme()
+{
+ return systemTheme;
+}
+
QPalette SystemTheme::colorScheme()
{
return systemPalette;
diff --git a/application/themes/SystemTheme.h b/application/themes/SystemTheme.h
index 90fd8ed9..75a8738c 100644
--- a/application/themes/SystemTheme.h
+++ b/application/themes/SystemTheme.h
@@ -10,6 +10,7 @@ public:
QString id() override;
QString name() override;
+ QString qtTheme() override;
QString appStyleSheet() override;
QPalette colorScheme() override;
private: