# HG changeset patch # User Teemu Piippo # Date 1656365110 -10800 # Node ID cd70c845563ae111c7fc4a991665cfb149ad64d2 # Parent 304386ff96a4e695b1ff9dadbb669ead00541fb1 Add build system information to the about dialog diff -r 304386ff96a4 -r cd70c845563a CMakeLists.txt --- 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}) diff -r 304386ff96a4 -r cd70c845563a src/about.ui --- 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 @@ 0 0 - 720 - 539 + 930 + 436 @@ -15,15 +15,47 @@ - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + QTabWidget::South + + + 0 + + + + Version and build information + + + + + + <!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 丸ゴシック体M'; 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> + + + + + + + + Copyright + + + + + + <!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 丸ゴシック体M'; 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> - + + + + + diff -r 304386ff96a4 -r cd70c845563a src/main.cpp --- 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()) { + 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(); }