86 connect(action, &QAction::triggered, [this, data]() |
86 connect(action, &QAction::triggered, [this, data]() |
87 { |
87 { |
88 this->setRenderStyle(data.payload); |
88 this->setRenderStyle(data.payload); |
89 }); |
89 }); |
90 } |
90 } |
|
91 connect(this->ui->actionDrawAxes, &QAction::triggered, this, &MainWindow::setDrawAxes); |
91 this->updateTitle(); |
92 this->updateTitle(); |
92 this->restoreStartupSettings(); |
93 this->restoreStartupSettings(); |
93 this->restoreSettings(); |
94 this->restoreSettings(); |
94 this->updateRenderPreferences(); |
95 this->updateRenderPreferences(); |
95 this->newModel(); |
96 this->newModel(); |
259 } |
260 } |
260 |
261 |
261 void MainWindow::setRenderStyle(gl::RenderStyle renderStyle) |
262 void MainWindow::setRenderStyle(gl::RenderStyle renderStyle) |
262 { |
263 { |
263 this->renderPreferences.style = renderStyle; |
264 this->renderPreferences.style = renderStyle; |
|
265 this->saveSettings(); |
|
266 this->updateRenderPreferences(); |
|
267 } |
|
268 |
|
269 void MainWindow::setDrawAxes(bool drawAxes) |
|
270 { |
|
271 this->renderPreferences.drawAxes = drawAxes; |
264 this->saveSettings(); |
272 this->saveSettings(); |
265 this->updateRenderPreferences(); |
273 this->updateRenderPreferences(); |
266 } |
274 } |
267 |
275 |
268 /** |
276 /** |
435 for (auto data : ::renderStyleButtons) |
443 for (auto data : ::renderStyleButtons) |
436 { |
444 { |
437 QAction* action = data.memberInstance(this->ui.get()); |
445 QAction* action = data.memberInstance(this->ui.get()); |
438 action->setChecked(this->renderPreferences.style == data.payload); |
446 action->setChecked(this->renderPreferences.style == data.payload); |
439 } |
447 } |
|
448 this->ui->actionDrawAxes->setChecked(this->renderPreferences.drawAxes); |
440 } |
449 } |
441 |
450 |
442 /** |
451 /** |
443 * @brief Stores the settings of the main window, storing geometry, etc |
452 * @brief Stores the settings of the main window, storing geometry, etc |
444 */ |
453 */ |
446 { |
455 { |
447 this->settings.setMainWindowGeometry(this->saveGeometry()); |
456 this->settings.setMainWindowGeometry(this->saveGeometry()); |
448 this->settings.setRecentFiles(this->recentlyOpenedFiles); |
457 this->settings.setRecentFiles(this->recentlyOpenedFiles); |
449 this->settings.setMainSplitterState(this->documentSplitterState); |
458 this->settings.setMainSplitterState(this->documentSplitterState); |
450 this->settings.setRenderStyle(static_cast<int>(this->renderPreferences.style)); |
459 this->settings.setRenderStyle(static_cast<int>(this->renderPreferences.style)); |
|
460 this->settings.setDrawAxes(this->renderPreferences.drawAxes); |
451 this->libraries.storeToSettings(&this->settings); |
461 this->libraries.storeToSettings(&this->settings); |
452 } |
462 } |
453 |
463 |
454 void MainWindow::restoreStartupSettings() |
464 void MainWindow::restoreStartupSettings() |
455 { |
465 { |
467 this->renderPreferences.mainColor = this->settings.mainColor(); |
477 this->renderPreferences.mainColor = this->settings.mainColor(); |
468 this->renderPreferences.backgroundColor = this->settings.backgroundColor(); |
478 this->renderPreferences.backgroundColor = this->settings.backgroundColor(); |
469 this->renderPreferences.lineThickness = this->settings.lineThickness(); |
479 this->renderPreferences.lineThickness = this->settings.lineThickness(); |
470 this->renderPreferences.lineAntiAliasing = this->settings.lineAntiAliasing(); |
480 this->renderPreferences.lineAntiAliasing = this->settings.lineAntiAliasing(); |
471 this->renderPreferences.selectedColor = this->settings.selectedColor(); |
481 this->renderPreferences.selectedColor = this->settings.selectedColor(); |
|
482 this->renderPreferences.drawAxes = this->settings.drawAxes(); |
472 const QString systemLocale = QLocale::system().name(); |
483 const QString systemLocale = QLocale::system().name(); |
473 const QVariant defaultLocale = this->settings.locale(); |
484 const QVariant defaultLocale = this->settings.locale(); |
474 this->changeLanguage(defaultLocale.toString()); |
485 this->changeLanguage(defaultLocale.toString()); |
475 this->libraries.restoreFromSettings(&this->settings); |
486 this->libraries.restoreFromSettings(&this->settings); |
476 this->updateRecentlyOpenedDocumentsMenu(); |
487 this->updateRecentlyOpenedDocumentsMenu(); |