133 this->updateRecentlyOpenedDocumentsMenu(); |
133 this->updateRecentlyOpenedDocumentsMenu(); |
134 } |
134 } |
135 |
135 |
136 void MainWindow::openModelForEditing(const QString& modelName) |
136 void MainWindow::openModelForEditing(const QString& modelName) |
137 { |
137 { |
138 Document* document = new Document{this->documents.findModelByName(modelName), &this->documents}; |
138 Document* document = new Document{this->documents.findModelByName(modelName), &this->documents, this->colorTable}; |
139 this->ui->tabs->addTab(document, modelName); |
139 this->ui->tabs->addTab(document, modelName); |
140 this->ui->tabs->setCurrentWidget(document); |
140 this->ui->tabs->setCurrentWidget(document); |
141 document->restoreSplitterState(this->documentSplitterState); |
141 document->restoreSplitterState(this->documentSplitterState); |
142 connect(document, &Document::splitterChanged, this, &MainWindow::handleDocumentSplitterChange); |
142 connect(document, &Document::splitterChanged, this, &MainWindow::handleDocumentSplitterChange); |
143 } |
143 } |
252 const QString systemLocale = QLocale::system().name(); |
252 const QString systemLocale = QLocale::system().name(); |
253 const QVariant defaultLocale = this->settings.value("locale", systemLocale); |
253 const QVariant defaultLocale = this->settings.value("locale", systemLocale); |
254 changeLanguage(defaultLocale.toString()); |
254 changeLanguage(defaultLocale.toString()); |
255 this->libraries.restoreFromSettings(&this->settings); |
255 this->libraries.restoreFromSettings(&this->settings); |
256 this->updateRecentlyOpenedDocumentsMenu(); |
256 this->updateRecentlyOpenedDocumentsMenu(); |
|
257 this->loadColors(); |
257 } |
258 } |
258 |
259 |
259 QString MainWindow::pathToTranslation(const QString& localeCode) |
260 QString MainWindow::pathToTranslation(const QString& localeCode) |
260 { |
261 { |
261 QDir dir {":/locale"}; |
262 QDir dir {":/locale"}; |
262 return dir.filePath(localeCode + ".qm"); |
263 return dir.filePath(localeCode + ".qm"); |
263 } |
264 } |
|
265 |
|
266 void MainWindow::loadColors() |
|
267 { |
|
268 QTextStream errors; |
|
269 this->colorTable = this->libraries.loadColorTable(errors); |
|
270 } |