diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index e5509fd9..a7d85307 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -443,10 +443,6 @@ void MainWindow::readSettings() restoreGeometry(geo); QByteArray state = settings.value("state", QByteArray()).toByteArray(); restoreState(state); - if (settings.value("dark").toBool()) - { - this->setDarkTheme(); - } this->responsive = settings.value("responsive").toBool(); } @@ -868,9 +864,7 @@ void MainWindow::on_actionReset_settings_triggered() QMessageBox::Ok | QMessageBox::Cancel); if (ret == QMessageBox::Ok) { - // Save options in settings - QSettings settings; - settings.clear(); + Config()->resetAll(); } } diff --git a/src/utils/Configuration.cpp b/src/utils/Configuration.cpp index 7504801b..8b75d665 100644 --- a/src/utils/Configuration.cpp +++ b/src/utils/Configuration.cpp @@ -8,7 +8,7 @@ Configuration* Configuration::mPtr = nullptr; Configuration::Configuration() : QObject() { mPtr = this; - loadDefaultTheme(); + loadInitial(); } Configuration* Configuration::instance() @@ -16,6 +16,18 @@ Configuration* Configuration::instance() return mPtr; } +void Configuration::loadInitial() +{ + setDarkTheme(s.value("dark").toBool()); +} + +void Configuration::resetAll() +{ + s.clear(); + loadInitial(); + emit fontsUpdated(); +} + void Configuration::loadDefaultTheme() { QColor color0 = QColor(0, 0, 0); diff --git a/src/utils/Configuration.h b/src/utils/Configuration.h index b955f271..ca11d598 100644 --- a/src/utils/Configuration.h +++ b/src/utils/Configuration.h @@ -15,6 +15,8 @@ private: QSettings s; static Configuration* mPtr; + void loadInitial(); + // Colors void loadDefaultTheme(); void loadDarkTheme(); @@ -25,6 +27,8 @@ public: Configuration(); static Configuration* instance(); + void resetAll(); + // Fonts const QFont getFont() const; void setFont(const QFont &font);