diff -r 30cb5e836736 -r 0abada2a9802 src/mainwindow.cpp --- a/src/mainwindow.cpp Sat Feb 01 17:20:10 2020 +0200 +++ b/src/mainwindow.cpp Sun Feb 02 00:30:48 2020 +0200 @@ -45,6 +45,11 @@ { offsetof(Ui_MainWindow, actionRenderStyleRandom), gl::RenderStyle::RandomColors }, }; +class A : public QSettings +{ + using QSettings::QSettings; +}; + MainWindow::MainWindow(QWidget *parent) : QMainWindow{parent}, ui{std::make_unique()}, @@ -197,7 +202,7 @@ document->restoreSplitterState(this->documentSplitterState); } } - this->settings.setValue("MainWindow/DocumentSplitterState", this->documentSplitterState); + this->settings.setMainSplitterState(this->documentSplitterState); } } @@ -290,16 +295,16 @@ */ void MainWindow::saveSettings() { - this->settings.setValue("MainWindow/Geometry", this->saveGeometry()); - this->settings.setValue("MainWindow/RecentlyOpened", this->recentlyOpenedFiles); - this->settings.setValue("MainWindow/DocumentSplitterState", this->documentSplitterState); - this->settings.setValue("MainWindow/RenderStyle", static_cast(this->renderPreferences.style)); + this->settings.setMainWindowGeometry(this->saveGeometry()); + this->settings.setRecentFiles(this->recentlyOpenedFiles); + this->settings.setMainSplitterState(this->documentSplitterState); + this->settings.setRenderStyle(static_cast(this->renderPreferences.style)); this->libraries.storeToSettings(&this->settings); } void MainWindow::restoreStartupSettings() { - this->restoreGeometry(this->settings.value("MainWindow/Geometry").toByteArray()); + this->restoreGeometry(this->settings.mainWindowGeometry()); } /** @@ -307,18 +312,14 @@ */ void MainWindow::restoreSettings() { - this->recentlyOpenedFiles = this->settings.value("MainWindow/RecentlyOpened").toStringList(); - this->documentSplitterState = this->settings.value("MainWindow/DocumentSplitterState").toByteArray(); - this->renderPreferences.style = static_cast(this->settings.value("Render/Style").toInt()); - this->renderPreferences.mainColor = this->settings.value( - "Render/MainColor", - gl::RenderPreferences{}.mainColor).toString(); - this->renderPreferences.backgroundColor = this->settings.value( - "Render/BackgroundColor", - gl::RenderPreferences{}.backgroundColor).toString(); + this->recentlyOpenedFiles = this->settings.recentFiles(); + this->documentSplitterState = this->settings.mainSplitterState(); + this->renderPreferences.style = static_cast(this->settings.renderStyle()); + this->renderPreferences.mainColor = this->settings.mainColor(); + this->renderPreferences.backgroundColor = this->settings.backgroundColor(); const QString systemLocale = QLocale::system().name(); - const QVariant defaultLocale = this->settings.value("locale", systemLocale); - changeLanguage(defaultLocale.toString()); + const QVariant defaultLocale = this->settings.locale(); + this->changeLanguage(defaultLocale.toString()); this->libraries.restoreFromSettings(&this->settings); this->updateRecentlyOpenedDocumentsMenu(); this->loadColors();