From 126200da823242acec6797636ed618bbba5f69fa Mon Sep 17 00:00:00 2001 From: nerix Date: Tue, 9 Jul 2024 16:18:35 +0200 Subject: [PATCH] show running qt version if it differs from compiled version (#5501) --- CHANGELOG.md | 1 + src/CMakeLists.txt | 4 ++++ src/common/Version.cpp | 18 ++++++++++++++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97cf0796f..83d7c8940 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ - Dev: Refactor/unsingletonize `UserDataController`. (#5459) - Dev: Cleanup `BrowserExtension`. (#5465) - Dev: Deprecate Qt 5.12. (#5396) +- Dev: The running Qt version is now shown in the about page if it differs from the compiled version. (#5501) ## 2.5.1 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7728acdf6..849397b7d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -947,6 +947,10 @@ set_target_properties(${LIBRARY_PROJECT} # this is its own project. set(VERSION_SOURCE_FILES common/Version.cpp common/Version.hpp) add_library(${VERSION_PROJECT} STATIC ${VERSION_SOURCE_FILES}) +target_compile_definitions(${VERSION_PROJECT} PRIVATE + $<$:USEWINSDK> + $<$:CHATTERINO_WITH_CRASHPAD> +) # source group for IDEs source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${VERSION_SOURCE_FILES}) diff --git a/src/common/Version.cpp b/src/common/Version.cpp index 76ef549a0..5e23272cb 100644 --- a/src/common/Version.cpp +++ b/src/common/Version.cpp @@ -1,11 +1,15 @@ #include "common/Version.hpp" +#include "common/Literals.hpp" #include "common/Modes.hpp" #include +#include namespace chatterino { +using namespace literals; + Version::Version() : version_(CHATTERINO_VERSION) , commitHash_(QStringLiteral(CHATTERINO_GIT_HASH)) @@ -79,11 +83,17 @@ QStringList Version::buildTags() const { QStringList tags; - tags.append("Qt " QT_VERSION_STR); + const auto *runtimeVersion = qVersion(); + if (runtimeVersion != QLatin1String{QT_VERSION_STR}) + { + tags.append(u"Qt "_s QT_VERSION_STR u" (running on " % runtimeVersion % + u")"); + } + else + { + tags.append(u"Qt "_s QT_VERSION_STR); + } -#ifdef USEWINSDK - tags.append("Windows SDK"); -#endif #ifdef _MSC_FULL_VER tags.append("MSVC " + QString::number(_MSC_FULL_VER, 10)); #endif