Remember color scheme on exit

This commit is contained in:
xarkes 2018-03-01 16:30:31 +01:00
parent 427f3797e8
commit 3843864ff9
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,8 @@ void GeneralOptionsWidget::updateFontFromConfig()
void GeneralOptionsWidget::updateThemeFromConfig() void GeneralOptionsWidget::updateThemeFromConfig()
{ {
// Disconnect currentIndexChanged because clearing the comboxBox and refiling it causes its index to change.
disconnect(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_colorComboBox_currentIndexChanged(int)));
ui->themeComboBox->setCurrentIndex(Config()->getDarkTheme() ? 1 : 0); ui->themeComboBox->setCurrentIndex(Config()->getDarkTheme() ? 1 : 0);
QList<QString> themes = Core()->getColorThemes(); QList<QString> themes = Core()->getColorThemes();
@ -42,6 +44,7 @@ void GeneralOptionsWidget::updateThemeFromConfig()
QString curTheme = Config()->getCurrentTheme(); QString curTheme = Config()->getCurrentTheme();
int index = themes.indexOf(curTheme) + 1; int index = themes.indexOf(curTheme) + 1;
ui->colorComboBox->setCurrentIndex(index); ui->colorComboBox->setCurrentIndex(index);
connect(ui->colorComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(on_colorComboBox_currentIndexChanged(int)));
} }
void GeneralOptionsWidget::on_fontSelectionButton_clicked() void GeneralOptionsWidget::on_fontSelectionButton_clicked()

View File

@ -23,6 +23,11 @@ Configuration* Configuration::instance()
void Configuration::loadInitial() void Configuration::loadInitial()
{ {
setDarkTheme(getDarkTheme()); setDarkTheme(getDarkTheme());
QString theme = s.value("theme").toString();
if (theme != "default")
{
Core()->cmd(QString("eco %1").arg(theme));
}
} }
void Configuration::resetAll() void Configuration::resetAll()