-
Notifications
You must be signed in to change notification settings - Fork 94
/
Version.h
73 lines (58 loc) · 2.12 KB
/
Version.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#pragma once
#include "globals/VersionInfo.h"
#include <QString>
namespace mediaelch {
namespace constants {
// Update versions via ./scripts/release/bump_version.py
constexpr char AppName[] = "MediaElch";
constexpr char AppVersionStr[] = "2.12.1"; // major.minor.patch
constexpr char AppVersionFullStr[] = "2.12.1-dev"; // major.minor.patch[-identifier]
constexpr char VersionName[] = "Benzar";
constexpr char OrganizationName[] = "kvibes";
#ifdef QT_NO_DEBUG
constexpr char CompilationType[] = "Release";
#else
constexpr char CompilationType[] = "Debug";
#endif
const QString CompilerString = []() -> QString {
// Taken from QtCreator (qt-creator/src/plugins/coreplugin/icore.cpp) - Modified
#if defined(Q_CC_CLANG) // must be before GNU, because clang claims to be GNU too
QString isAppleString;
# if defined(__apple_build_version__) // Apple clang has other version numbers
isAppleString = QLatin1String(" (Apple)");
# endif
return QLatin1String("Clang ") + QString::number(__clang_major__) + '.' + QString::number(__clang_minor__)
+ isAppleString;
#elif defined(Q_CC_GNU)
return QLatin1String("GCC ") + QLatin1String(__VERSION__);
#elif defined(Q_CC_MSVC)
if (_MSC_VER > 1999) {
return QLatin1String("MSVC <unknown>");
}
if (_MSC_VER >= 1920) {
return QLatin1String("MSVC 2019");
}
if (_MSC_VER >= 1910) {
return QLatin1String("MSVC 2017");
}
if (_MSC_VER >= 1900) {
return QLatin1String("MSVC 2015");
}
return QLatin1String("MSVC <unknown>");
#else
return QLatin1String("<unknown compiler>");
#endif
}();
} // namespace constants
inline VersionInfo currentVersion()
{
return VersionInfo(constants::AppVersionStr);
}
/// \brief Returns a string that identifies this app and version.
/// \details The identifier can be used for User-Agent headers of network requests.
/// It is short, simple and follows RFC 1945 <https://datatracker.ietf.org/doc/html/rfc1945#section-3.7>
inline QString currentVersionIdentifier()
{
return QStringLiteral("%1/%2").arg(constants::AppName, constants::AppVersionFullStr);
}
} // namespace mediaelch