src/mainwindow.cpp

changeset 40
30cb5e836736
parent 39
caac957e9834
child 41
0abada2a9802
equal deleted inserted replaced
39:caac957e9834 40:30cb5e836736
65 { 65 {
66 this->setRenderStyle(data.payload); 66 this->setRenderStyle(data.payload);
67 }); 67 });
68 } 68 }
69 this->updateTitle(); 69 this->updateTitle();
70 this->restoreStartupSettings();
70 this->restoreSettings(); 71 this->restoreSettings();
71 this->updateRenderPreferences(); 72 this->updateRenderPreferences();
72 this->newModel(); 73 this->newModel();
73 } 74 }
74 75
294 this->settings.setValue("MainWindow/DocumentSplitterState", this->documentSplitterState); 295 this->settings.setValue("MainWindow/DocumentSplitterState", this->documentSplitterState);
295 this->settings.setValue("MainWindow/RenderStyle", static_cast<int>(this->renderPreferences.style)); 296 this->settings.setValue("MainWindow/RenderStyle", static_cast<int>(this->renderPreferences.style));
296 this->libraries.storeToSettings(&this->settings); 297 this->libraries.storeToSettings(&this->settings);
297 } 298 }
298 299
300 void MainWindow::restoreStartupSettings()
301 {
302 this->restoreGeometry(this->settings.value("MainWindow/Geometry").toByteArray());
303 }
304
299 /** 305 /**
300 * @brief Restores saved settings relating to the main window 306 * @brief Restores saved settings relating to the main window
301 */ 307 */
302 void MainWindow::restoreSettings() 308 void MainWindow::restoreSettings()
303 { 309 {
304 this->restoreGeometry(this->settings.value("MainWindow/Geometry").toByteArray());
305 this->recentlyOpenedFiles = this->settings.value("MainWindow/RecentlyOpened").toStringList(); 310 this->recentlyOpenedFiles = this->settings.value("MainWindow/RecentlyOpened").toStringList();
306 this->documentSplitterState = this->settings.value("MainWindow/DocumentSplitterState").toByteArray(); 311 this->documentSplitterState = this->settings.value("MainWindow/DocumentSplitterState").toByteArray();
307 this->renderPreferences.style = static_cast<gl::RenderStyle>(this->settings.value("Render/Style").toInt()); 312 this->renderPreferences.style = static_cast<gl::RenderStyle>(this->settings.value("Render/Style").toInt());
308 this->renderPreferences.mainColor = this->settings.value("Render/MainColor").toString(); 313 this->renderPreferences.mainColor = this->settings.value(
314 "Render/MainColor",
315 gl::RenderPreferences{}.mainColor).toString();
316 this->renderPreferences.backgroundColor = this->settings.value(
317 "Render/BackgroundColor",
318 gl::RenderPreferences{}.backgroundColor).toString();
309 const QString systemLocale = QLocale::system().name(); 319 const QString systemLocale = QLocale::system().name();
310 const QVariant defaultLocale = this->settings.value("locale", systemLocale); 320 const QVariant defaultLocale = this->settings.value("locale", systemLocale);
311 changeLanguage(defaultLocale.toString()); 321 changeLanguage(defaultLocale.toString());
312 this->libraries.restoreFromSettings(&this->settings); 322 this->libraries.restoreFromSettings(&this->settings);
313 this->updateRecentlyOpenedDocumentsMenu(); 323 this->updateRecentlyOpenedDocumentsMenu();

mercurial