src/mainwindow.cpp

changeset 40
30cb5e836736
parent 39
caac957e9834
child 41
0abada2a9802
--- a/src/mainwindow.cpp	Sat Feb 01 17:10:11 2020 +0200
+++ b/src/mainwindow.cpp	Sat Feb 01 17:20:10 2020 +0200
@@ -67,6 +67,7 @@
 		});
 	}
 	this->updateTitle();
+	this->restoreStartupSettings();
 	this->restoreSettings();
 	this->updateRenderPreferences();
 	this->newModel();
@@ -296,16 +297,25 @@
 	this->libraries.storeToSettings(&this->settings);
 }
 
+void MainWindow::restoreStartupSettings()
+{
+	this->restoreGeometry(this->settings.value("MainWindow/Geometry").toByteArray());
+}
+
 /**
  * @brief Restores saved settings relating to the main window
  */
 void MainWindow::restoreSettings()
 {
-	this->restoreGeometry(this->settings.value("MainWindow/Geometry").toByteArray());
 	this->recentlyOpenedFiles = this->settings.value("MainWindow/RecentlyOpened").toStringList();
 	this->documentSplitterState = this->settings.value("MainWindow/DocumentSplitterState").toByteArray();
 	this->renderPreferences.style = static_cast<gl::RenderStyle>(this->settings.value("Render/Style").toInt());
-	this->renderPreferences.mainColor = this->settings.value("Render/MainColor").toString();
+	this->renderPreferences.mainColor = this->settings.value(
+		"Render/MainColor",
+		gl::RenderPreferences{}.mainColor).toString();
+	this->renderPreferences.backgroundColor = this->settings.value(
+		"Render/BackgroundColor",
+		gl::RenderPreferences{}.backgroundColor).toString();
 	const QString systemLocale = QLocale::system().name();
 	const QVariant defaultLocale = this->settings.value("locale", systemLocale);
 	changeLanguage(defaultLocale.toString());

mercurial