summaryrefslogtreecommitdiffstats
path: root/application/pages/global/MultiMCPage.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-10-21 09:07:26 +0200
committerPetr Mrázek <peterix@gmail.com>2016-10-21 09:07:26 +0200
commit872cfe036d9472739939ad401dbe9511193d62ca (patch)
tree2d8356848c4955b09d66d6fc96924cc4da85ccb9 /application/pages/global/MultiMCPage.cpp
parentf07496ac6d42986266f3bff5093fa0009521ecd5 (diff)
downloadMultiMC-872cfe036d9472739939ad401dbe9511193d62ca.tar
MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.tar.gz
MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.tar.lz
MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.tar.xz
MultiMC-872cfe036d9472739939ad401dbe9511193d62ca.zip
GH-903 simple theme switching and dark theme
Diffstat (limited to 'application/pages/global/MultiMCPage.cpp')
-rw-r--r--application/pages/global/MultiMCPage.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/application/pages/global/MultiMCPage.cpp b/application/pages/global/MultiMCPage.cpp
index c1a24a56..9694fab5 100644
--- a/application/pages/global/MultiMCPage.cpp
+++ b/application/pages/global/MultiMCPage.cpp
@@ -28,6 +28,7 @@
#include <FileSystem.h>
#include "MultiMC.h"
#include "BuildConfig.h"
+#include "themes/ITheme.h"
// FIXME: possibly move elsewhere
enum InstSortMode
@@ -305,6 +306,14 @@ void MultiMCPage::applySettings()
MMC->setIconTheme(s->get("IconTheme").toString());
}
+ auto originalAppTheme = s->get("ApplicationTheme").toString();
+ auto newAppTheme = ui->themeComboBoxColors->currentData().toString();
+ if(originalAppTheme != newAppTheme)
+ {
+ s->set("ApplicationTheme", newAppTheme);
+ MMC->setApplicationTheme(newAppTheme);
+ }
+
// Console settings
s->set("ShowConsole", ui->showConsoleCheck->isChecked());
s->set("AutoCloseConsole", ui->autoCloseConsoleCheck->isChecked());
@@ -386,6 +395,21 @@ void MultiMCPage::loadSettings()
ui->themeComboBox->setCurrentIndex(0);
}
+ {
+ auto currentTheme = s->get("ApplicationTheme").toString();
+ auto themes = MMC->getValidApplicationThemes();
+ int idx = 0;
+ for(auto &theme: themes)
+ {
+ ui->themeComboBoxColors->addItem(theme->name(), theme->id());
+ if(currentTheme == theme->id())
+ {
+ ui->themeComboBoxColors->setCurrentIndex(idx);
+ }
+ idx++;
+ }
+ }
+
// Console settings
ui->showConsoleCheck->setChecked(s->get("ShowConsole").toBool());
ui->autoCloseConsoleCheck->setChecked(s->get("AutoCloseConsole").toBool());