mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
Make Program Updater choose the same build for download
We're probably stuck offering the duo of RC_1_2 and RC_2_0 for some time in the future. So hardcode the choices and make the Program Updater choose the variant the user currently uses.
This commit is contained in:
parent
59a5fcf7d0
commit
f4a0868426
1 changed files with 19 additions and 7 deletions
|
@ -29,6 +29,9 @@
|
||||||
|
|
||||||
#include "programupdater.h"
|
#include "programupdater.h"
|
||||||
|
|
||||||
|
#include <libtorrent/version.hpp>
|
||||||
|
|
||||||
|
#include <QtCore/qconfig.h>
|
||||||
#include <QtSystemDetection>
|
#include <QtSystemDetection>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
@ -61,6 +64,20 @@ namespace
|
||||||
}
|
}
|
||||||
return (newVersion > currentVersion);
|
return (newVersion > currentVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString buildVariant()
|
||||||
|
{
|
||||||
|
#if defined(Q_OS_MACOS)
|
||||||
|
const auto BASE_OS = u"Mac OS X"_s;
|
||||||
|
#elif defined(Q_OS_WIN)
|
||||||
|
const auto BASE_OS = u"Windows x64"_s;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if constexpr ((QT_VERSION_MAJOR == 6) && (LIBTORRENT_VERSION_MAJOR == 1))
|
||||||
|
return BASE_OS;
|
||||||
|
|
||||||
|
return u"%1 (qt%2 lt%3%4)"_s.arg(BASE_OS, QString::number(QT_VERSION_MAJOR), QString::number(LIBTORRENT_VERSION_MAJOR), QString::number(LIBTORRENT_VERSION_MINOR));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgramUpdater::checkForUpdates() const
|
void ProgramUpdater::checkForUpdates() const
|
||||||
|
@ -97,12 +114,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
|
||||||
: QString {};
|
: QString {};
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
const QString variant = buildVariant();
|
||||||
const QString OS_TYPE = u"Mac OS X"_s;
|
|
||||||
#elif defined(Q_OS_WIN)
|
|
||||||
const QString OS_TYPE = u"Windows x64"_s;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool inItem = false;
|
bool inItem = false;
|
||||||
QString version;
|
QString version;
|
||||||
QString updateLink;
|
QString updateLink;
|
||||||
|
@ -128,7 +140,7 @@ void ProgramUpdater::rssDownloadFinished(const Net::DownloadResult &result)
|
||||||
{
|
{
|
||||||
if (inItem && (xml.name() == u"item"))
|
if (inItem && (xml.name() == u"item"))
|
||||||
{
|
{
|
||||||
if (type.compare(OS_TYPE, Qt::CaseInsensitive) == 0)
|
if (type.compare(variant, Qt::CaseInsensitive) == 0)
|
||||||
{
|
{
|
||||||
qDebug("The last update available is %s", qUtf8Printable(version));
|
qDebug("The last update available is %s", qUtf8Printable(version));
|
||||||
if (!version.isEmpty())
|
if (!version.isEmpty())
|
||||||
|
|
Loading…
Reference in a new issue