29
29
30
30
#include " programupdater.h"
31
31
32
+ #include < QtCore/qconfig.h>
32
33
#include < QtSystemDetection>
33
34
#include < QDebug>
34
35
#include < QDesktopServices>
35
36
#include < QRegularExpression>
36
37
#include < QXmlStreamReader>
37
38
39
+ #include < libtorrent/version.hpp>
40
+
38
41
#include " base/global.h"
39
42
#include " base/net/downloadmanager.h"
40
43
#include " base/preferences.h"
@@ -61,6 +64,24 @@ namespace
61
64
}
62
65
return (newVersion > currentVersion);
63
66
}
67
+
68
+ QString buildVariant ()
69
+ {
70
+ #if defined(Q_OS_MACOS)
71
+ constexpr auto BASE_OS = " Mac OS X" _L1;
72
+ #elif defined(Q_OS_WIN)
73
+ constexpr auto BASE_OS = " Windows x64" _L1;
74
+ #endif
75
+
76
+ if constexpr ((QT_VERSION_MAJOR == 6 ) && (LIBTORRENT_VERSION_MAJOR == 1 ))
77
+ return BASE_OS;
78
+ else if constexpr ((QT_VERSION_MAJOR == 6 ) && (LIBTORRENT_VERSION_MAJOR > 1 ))
79
+ return u" %1 (lt%2%3)" _s.arg (BASE_OS).arg (LIBTORRENT_VERSION_MAJOR).arg (LIBTORRENT_VERSION_MINOR);
80
+ else if constexpr (QT_VERSION_MAJOR > 6 )
81
+ return u" %1 (qt%2 lt%3%4)" _s.arg (BASE_OS).arg (QT_VERSION_MAJOR).arg (LIBTORRENT_VERSION_MAJOR).arg (LIBTORRENT_VERSION_MINOR);
82
+
83
+ return {};
84
+ }
64
85
}
65
86
66
87
void ProgramUpdater::checkForUpdates () const
@@ -97,12 +118,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
97
118
: QString {};
98
119
};
99
120
100
- #ifdef Q_OS_MACOS
101
- const QString OS_TYPE = u" Mac OS X" _s;
102
- #elif defined(Q_OS_WIN)
103
- const QString OS_TYPE = u" Windows x64" _s;
104
- #endif
105
-
121
+ const QString variant = buildVariant ();
106
122
bool inItem = false ;
107
123
QString version;
108
124
QString updateLink;
@@ -128,7 +144,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
128
144
{
129
145
if (inItem && (xml.name () == u" item" ))
130
146
{
131
- if (type.compare (OS_TYPE , Qt::CaseInsensitive) == 0 )
147
+ if (type.compare (variant , Qt::CaseInsensitive) == 0 )
132
148
{
133
149
qDebug (" The last update available is %s" , qUtf8Printable (version));
134
150
if (!version.isEmpty ())
0 commit comments