GH-903 simple theme switching and dark theme
This commit is contained in:
@ -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());
|
||||
|
@ -329,13 +329,23 @@
|
||||
<item>
|
||||
<widget class="QGroupBox" name="themeBox">
|
||||
<property name="title">
|
||||
<string>Icon Theme</string>
|
||||
<string>Theme</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="themeBoxLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>&Icons</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>themeComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="themeComboBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
@ -380,6 +390,29 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="themeComboBoxColors">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Colors</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>themeComboBoxColors</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -552,6 +585,7 @@
|
||||
<tabstop>sortByNameBtn</tabstop>
|
||||
<tabstop>languageBox</tabstop>
|
||||
<tabstop>themeComboBox</tabstop>
|
||||
<tabstop>themeComboBoxColors</tabstop>
|
||||
<tabstop>showConsoleCheck</tabstop>
|
||||
<tabstop>autoCloseConsoleCheck</tabstop>
|
||||
<tabstop>lineLimitSpinBox</tabstop>
|
||||
|
Reference in New Issue
Block a user