GH-903 simple theme switching and dark theme

This commit is contained in:
Petr Mrázek
2016-10-21 09:07:26 +02:00
parent f07496ac6d
commit 872cfe036d
11 changed files with 237 additions and 4 deletions

View File

@ -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());