68 }; |
68 }; |
69 #include <main.moc> |
69 #include <main.moc> |
70 |
70 |
71 static void doQtRegistrations() |
71 static void doQtRegistrations() |
72 { |
72 { |
73 QCoreApplication::setApplicationName(QStringLiteral(APPNAME)); |
73 QCoreApplication::setApplicationName(QStringLiteral(CMAKE_PROJECT_NAME)); |
74 QCoreApplication::setOrganizationName("hecknology.net"); |
74 QCoreApplication::setOrganizationName("hecknology.net"); |
75 QCoreApplication::setOrganizationDomain("hecknology.net"); |
75 QCoreApplication::setOrganizationDomain("hecknology.net"); |
76 qRegisterMetaType<Message>(); |
76 qRegisterMetaType<Message>(); |
77 qRegisterMetaType<Library>(); |
77 qRegisterMetaType<Library>(); |
78 qRegisterMetaType<QList<Library>>(); |
78 qRegisterMetaType<QList<Library>>(); |
216 |
216 |
217 static QString title(Ui_MainWindow* ui) |
217 static QString title(Ui_MainWindow* ui) |
218 { |
218 { |
219 QMdiSubWindow* subWindow = ui->mdiArea->activeSubWindow(); |
219 QMdiSubWindow* subWindow = ui->mdiArea->activeSubWindow(); |
220 QString titlestring; |
220 QString titlestring; |
|
221 const QString versionString = fullVersionString(QLocale::ShortFormat); |
221 if (subWindow != nullptr) { |
222 if (subWindow != nullptr) { |
222 return QObject::tr("%1 - %2").arg(subWindow->windowTitle(), fullVersionString()); |
223 titlestring = QObject::tr("%1 - %2").arg(subWindow->windowTitle(), versionString); |
223 } |
224 } |
224 else { |
225 else { |
225 return fullVersionString(); |
226 titlestring = versionString; |
226 } |
227 } |
|
228 if (/* DISABLES CODE */ (true) |
|
229 and std::strcmp(CMAKE_BUILD_TYPE, "Release") != 0 |
|
230 and std::strcmp(CMAKE_BUILD_TYPE, "MinSizeRel") != 0 |
|
231 ) { |
|
232 titlestring += QObject::tr(" [%1]").arg(CMAKE_BUILD_TYPE); |
|
233 } |
|
234 return titlestring; |
227 } |
235 } |
228 |
236 |
229 static ColorTable loadColors(const LibrariesModel* libraries) |
237 static ColorTable loadColors(const LibrariesModel* libraries) |
230 { |
238 { |
231 QTextStream errors; |
239 QTextStream errors; |
371 Ui_About ui; |
379 Ui_About ui; |
372 ui.setupUi(&dialog); |
380 ui.setupUi(&dialog); |
373 for (QTextBrowser* browser : dialog.findChildren<QTextBrowser*>()) { |
381 for (QTextBrowser* browser : dialog.findChildren<QTextBrowser*>()) { |
374 browser->setHtml( |
382 browser->setHtml( |
375 browser->toHtml() |
383 browser->toHtml() |
376 .replace("%APPNAME%", APPNAME) |
384 .replace("%APPNAME%", CMAKE_PROJECT_NAME) |
377 .replace("%COPYRIGHT%", COPYRIGHT) |
385 .replace("%COPYRIGHT%", COPYRIGHT) |
378 .replace("%QTVERSION%", qVersion()) |
386 .replace("%QTVERSION%", qVersion()) |
379 .replace("%VERSION%", detailedVersionString()) |
387 .replace("%VERSION%", detailedVersionString(QLocale::LongFormat)) |
380 .replace("%REVDATE%", revisionDateString()) |
388 .replace("%REVDATE%", revisionDateString(QLocale::LongFormat)) |
381 .replace("%COMPILER_ID%", COMPILER_ID) |
389 .replace("%BUILDTYPE%", CMAKE_BUILD_TYPE) |
382 .replace("%COMPILER_VERSION%", COMPILER_VERSION) |
390 .replace("%COMPILER_ID%", CMAKE_CXX_COMPILER_ID) |
383 .replace("%COMPILER_FLAGS%", COMPILER_FLAGS) |
391 .replace("%COMPILER_VERSION%", CMAKE_CXX_COMPILER_VERSION) |
384 .replace("%COMPILER_CPU%", COMPILER_CPU) |
392 .replace("%COMPILER_FLAGS%", CMAKE_CXX_FLAGS) |
385 .replace("%COMPILER_SYSTEM%", COMPILER_SYSTEM) |
393 .replace("%COMPILER_CPU%", CMAKE_SYSTEM_PROCESSOR) |
|
394 .replace("%COMPILER_SYSTEM%", CMAKE_SYSTEM) |
386 ); |
395 ); |
387 } |
396 } |
388 dialog.setWindowTitle(QObject::tr("About %1").arg(APPNAME)); |
397 dialog.setWindowTitle(QObject::tr("About %1").arg(CMAKE_PROJECT_NAME)); |
389 dialog.exec(); |
398 dialog.exec(); |
390 } |
399 } |
391 |
400 |
392 int main(int argc, char *argv[]) |
401 int main(int argc, char *argv[]) |
393 { |
402 { |
753 for (QDockWidget* dock : mainWindow.findChildren<QDockWidget*>()) { |
762 for (QDockWidget* dock : mainWindow.findChildren<QDockWidget*>()) { |
754 dock->setVisible(true); |
763 dock->setVisible(true); |
755 } |
764 } |
756 restoreSettings(); |
765 restoreSettings(); |
757 updateRenderPreferences(&ui, &renderPreferences, &documents); |
766 updateRenderPreferences(&ui, &renderPreferences, &documents); |
758 ui.actionAbout->setText(ui.actionAbout->text().arg(APPNAME)); |
767 ui.actionAbout->setText(ui.actionAbout->text().arg(CMAKE_PROJECT_NAME)); |
759 updateTitle(); |
768 updateTitle(); |
760 mainWindow.show(); |
769 mainWindow.show(); |
761 const int result = app.exec(); |
770 const int result = app.exec(); |
762 saveSettings(); |
771 saveSettings(); |
763 return result; |
772 return result; |