From 872cfe036d9472739939ad401dbe9511193d62ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 21 Oct 2016 09:07:26 +0200 Subject: GH-903 simple theme switching and dark theme --- application/pages/global/MultiMCPage.cpp | 24 ++++++++++++++++++ application/pages/global/MultiMCPage.ui | 42 +++++++++++++++++++++++++++++--- 2 files changed, 62 insertions(+), 4 deletions(-) (limited to 'application/pages') 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 #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()); diff --git a/application/pages/global/MultiMCPage.ui b/application/pages/global/MultiMCPage.ui index 943b30ac..2d6f45f0 100644 --- a/application/pages/global/MultiMCPage.ui +++ b/application/pages/global/MultiMCPage.ui @@ -329,13 +329,23 @@ - Icon Theme + Theme - - + + + + + &Icons + + + themeComboBox + + + + - + 0 0 @@ -380,6 +390,29 @@ + + + + + 0 + 0 + + + + Qt::StrongFocus + + + + + + + Colors + + + themeComboBoxColors + + + @@ -552,6 +585,7 @@ sortByNameBtn languageBox themeComboBox + themeComboBoxColors showConsoleCheck autoCloseConsoleCheck lineLimitSpinBox -- cgit v1.2.3