Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show running qt version if it differs from compiled version #5501

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<$<BOOL:${WIN32}>:USEWINSDK>
$<$<BOOL:${BUILD_WITH_CRASHPAD}>:CHATTERINO_WITH_CRASHPAD>
)

# source group for IDEs
source_group(TREE ${CMAKE_SOURCE_DIR} FILES ${VERSION_SOURCE_FILES})
Expand Down
18 changes: 14 additions & 4 deletions src/common/Version.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
#include "common/Version.hpp"

#include "common/Literals.hpp"
#include "common/Modes.hpp"

#include <QFileInfo>
#include <QStringBuilder>

namespace chatterino {

using namespace literals;

Version::Version()
: version_(CHATTERINO_VERSION)
, commitHash_(QStringLiteral(CHATTERINO_GIT_HASH))
Expand Down Expand Up @@ -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
Expand Down
Loading