--- a/src/mainwindow.cpp Sat Feb 01 15:49:28 2020 +0200 +++ b/src/mainwindow.cpp Sat Feb 01 17:10:11 2020 +0200 @@ -68,10 +68,13 @@ } this->updateTitle(); this->restoreSettings(); - this->updateRenderStyles(); + this->updateRenderPreferences(); this->newModel(); } +// MainWindow needs a destructor even if it is empty because otherwise the destructor of the +// std::unique_ptr is resolved in the header file, where it will complain about Ui_MainWindow +// being incomplete. MainWindow::~MainWindow() { } @@ -162,7 +165,7 @@ void MainWindow::openModelForEditing(const QString& modelName) { Document* document = new Document{this->documents.findModelByName(modelName), &this->documents, this->colorTable}; - document->setRenderStyle(this->renderStyle); + document->setRenderPreferences(this->renderPreferences); this->ui->tabs->addTab(document, modelName); this->ui->tabs->setCurrentWidget(document); document->restoreSplitterState(this->documentSplitterState); @@ -221,9 +224,9 @@ void MainWindow::setRenderStyle(gl::RenderStyle renderStyle) { - this->renderStyle = renderStyle; + this->renderPreferences.style = renderStyle; this->saveSettings(); - this->updateRenderStyles(); + this->updateRenderPreferences(); } void MainWindow::changeEvent(QEvent* event) @@ -264,20 +267,20 @@ setWindowTitle(title); } -void MainWindow::updateRenderStyles() +void MainWindow::updateRenderPreferences() { for (int i = 0; i < this->ui->tabs->count(); i += 1) { Document* document = qobject_cast<Document*>(this->ui->tabs->widget(i)); if (document != nullptr) { - document->setRenderStyle(renderStyle); + document->setRenderPreferences(this->renderPreferences); } } for (auto data : ::renderStyleButtons) { QAction* action = data.memberInstance(this->ui.get()); - action->setChecked(this->renderStyle == data.payload); + action->setChecked(this->renderPreferences.style == data.payload); } } @@ -289,7 +292,7 @@ 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<int>(this->renderStyle)); + this->settings.setValue("MainWindow/RenderStyle", static_cast<int>(this->renderPreferences.style)); this->libraries.storeToSettings(&this->settings); } @@ -301,13 +304,15 @@ 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->renderStyle = static_cast<gl::RenderStyle>(this->settings.value("MainWindow/RenderStyle").toInt()); + this->renderPreferences.style = static_cast<gl::RenderStyle>(this->settings.value("Render/Style").toInt()); + this->renderPreferences.mainColor = this->settings.value("Render/MainColor").toString(); const QString systemLocale = QLocale::system().name(); const QVariant defaultLocale = this->settings.value("locale", systemLocale); changeLanguage(defaultLocale.toString()); this->libraries.restoreFromSettings(&this->settings); this->updateRecentlyOpenedDocumentsMenu(); this->loadColors(); + this->updateRenderPreferences(); } QString MainWindow::pathToTranslation(const QString& localeCode)