Tue, 28 Jun 2022 00:25:10 +0300
Add build system information to the about dialog
CMakeLists.txt | file | annotate | diff | comparison | revisions | |
src/about.ui | file | annotate | diff | comparison | revisions | |
src/main.cpp | file | annotate | diff | comparison | revisions |
--- a/CMakeLists.txt Mon Jun 27 23:58:04 2022 +0300 +++ b/CMakeLists.txt Tue Jun 28 00:25:10 2022 +0300 @@ -37,6 +37,32 @@ include_directories(${GLM_INCLUDE_DIR}) add_definitions(-DQT_NO_KEYWORDS) source_group(${PROJECT_NAME} REGULAR_EXPRESSION "src/.+\\.(cpp|h|ui)") + +if (NOT MSVC) + if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wunused") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-nonliteral -Wnonnull -Wnull-dereference -Winfinite-recursion -Wuninitialized -Wmissing-noreturn") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wundef -Wmissing-field-initializers") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-qual -Wcast-align -Wcast-function-type -Wconversion") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-declarations -Wdate-time") +endif() +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcovered-switch-default -Wextra-semi -Wgnu -Wmicrosoft") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual -Wsometimes-uninitialized -Wstring-concatenation -Wstring-conversion -Wsuggest-override") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override -Wundefined-func-template -Wundefined-reinterpret-cast") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized-const-reference -Wunreachable-code -Wunreachable-code-break -Wunreachable-code-return") +endif() +add_definitions(-DCOMPILER_ID="${CMAKE_CXX_COMPILER_ID}") +add_definitions(-DCOMPILER_VERSION="${CMAKE_CXX_COMPILER_VERSION}") +add_definitions(-DCOMPILER_FLAGS="${CMAKE_CXX_FLAGS}") +add_definitions(-DCOMPILER_CPU="${CMAKE_SYSTEM_PROCESSOR}") +add_definitions(-DCOMPILER_SYSTEM="${CMAKE_SYSTEM}") + add_subdirectory(widgets) set(SOURCE_FILES @@ -137,26 +163,6 @@ include_directories("${PROJECT_BINARY_DIR}") include_directories("${PROJECT_BINARY_DIR}/src") include_directories("${PROJECT_SOURCE_DIR}") - -if (NOT MSVC) - if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG") - endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wunused") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-implicit-fallthrough") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-noexcept-type") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wformat-nonliteral -Wnonnull -Wnull-dereference -Winfinite-recursion -Wuninitialized -Wmissing-noreturn") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wundef -Wmissing-field-initializers") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcast-qual -Wcast-align -Wcast-function-type -Wconversion") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-declarations -Wdate-time") -endif() -if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wcovered-switch-default -Wextra-semi -Wgnu -Wmicrosoft") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual -Wsometimes-uninitialized -Wstring-concatenation -Wstring-conversion -Wsuggest-override") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsuggest-override -Wundefined-func-template -Wundefined-reinterpret-cast") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wuninitialized-const-reference -Wunreachable-code -Wunreachable-code-break -Wunreachable-code-return") -endif() qt_add_resources(QRC_SOURCE ${QRC_FILE}) qt_wrap_ui(FORMS_HEADERS ${FORM_FILES})
--- a/src/about.ui Mon Jun 27 23:58:04 2022 +0300 +++ b/src/about.ui Tue Jun 28 00:25:10 2022 +0300 @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>720</width> - <height>539</height> + <width>930</width> + <height>436</height> </rect> </property> <property name="windowTitle"> @@ -15,15 +15,47 @@ </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QTextBrowser" name="textBrowser"> - <property name="html"> - <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + <widget class="QTabWidget" name="tabWidget"> + <property name="tabPosition"> + <enum>QTabWidget::South</enum> + </property> + <property name="currentIndex"> + <number>0</number> + </property> + <widget class="QWidget" name="tab"> + <attribute name="title"> + <string>Version and build information</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QTextBrowser" name="versionBrowser"> + <property name="html"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'EPSONEXT 丸ã´ã·ãã¯ä½ï¼'; font-size:11pt; font-weight:400; font-style:normal;"> -<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600;">%APPNAME% %VERSION%</span></h1> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt version %QTVERSION%</p> -<hr /> +<h1 style=" margin-top:18px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><img src=":/icons/appicon.png" height="64" /><span style=" font-size:xx-large; font-weight:600;"> %APPNAME% %VERSION%</span></h1> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Qt version: %QTVERSION%</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Compiler: %COMPILER_ID% %COMPILER_VERSION%</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Compiler system: %COMPILER_SYSTEM% (%COMPILER_CPU%)</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Compiler flags: %COMPILER_FLAGS%</p></body></html></string> + </property> + </widget> + </item> + </layout> + </widget> + <widget class="QWidget" name="tab_2"> + <attribute name="title"> + <string>Copyright</string> + </attribute> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QTextBrowser" name="copyrightBrowser"> + <property name="html"> + <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'EPSONEXT 丸ã´ã·ãã¯ä½ï¼'; font-size:11pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">%COPYRIGHT%</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p> @@ -63,7 +95,11 @@ <td> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">MIT</p></td> <td></td></tr></table></body></html></string> - </property> + </property> + </widget> + </item> + </layout> + </widget> </widget> </item> <item>
--- a/src/main.cpp Mon Jun 27 23:58:04 2022 +0300 +++ b/src/main.cpp Tue Jun 28 00:25:10 2022 +0300 @@ -370,14 +370,21 @@ QDialog dialog{parent}; Ui_About ui; ui.setupUi(&dialog); - ui.textBrowser->setHtml( - ui.textBrowser->toHtml() - .replace("%APPNAME%", APPNAME) - .replace("%COPYRIGHT%", COPYRIGHT) - .replace("%VERSION%", detailedVersionString()) - .replace("%REVDATE%", revisionDateString()) - .replace("%QTVERSION%", qVersion()) - ); + for (QTextBrowser* browser : dialog.findChildren<QTextBrowser*>()) { + browser->setHtml( + browser->toHtml() + .replace("%APPNAME%", APPNAME) + .replace("%COPYRIGHT%", COPYRIGHT) + .replace("%QTVERSION%", qVersion()) + .replace("%VERSION%", detailedVersionString()) + .replace("%REVDATE%", revisionDateString()) + .replace("%COMPILER_ID%", COMPILER_ID) + .replace("%COMPILER_VERSION%", COMPILER_VERSION) + .replace("%COMPILER_FLAGS%", COMPILER_FLAGS) + .replace("%COMPILER_CPU%", COMPILER_CPU) + .replace("%COMPILER_SYSTEM%", COMPILER_SYSTEM) + ); + } dialog.setWindowTitle(QObject::tr("About %1").arg(APPNAME)); dialog.exec(); }