mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-06 23:52:31 -06:00
Merge pull request #19295 from sledgehammer999/noop-update
Disable update checks on versions before Windows 10
This commit is contained in:
@@ -31,6 +31,11 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <versionhelpers.h> // must follow after Windows.h
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
@@ -273,9 +278,15 @@ MainWindow::MainWindow(IGUIApplication *app, const State initialState)
|
|||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
connect(m_ui->actionCheckForUpdates, &QAction::triggered, this, [this]() { checkProgramUpdate(true); });
|
connect(m_ui->actionCheckForUpdates, &QAction::triggered, this, [this]() { checkProgramUpdate(true); });
|
||||||
|
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if (::IsWindows10OrGreater() && pref->isUpdateCheckEnabled())
|
||||||
|
checkProgramUpdate(false);
|
||||||
|
#else
|
||||||
|
|
||||||
// trigger an early check on startup
|
// trigger an early check on startup
|
||||||
if (pref->isUpdateCheckEnabled())
|
if (pref->isUpdateCheckEnabled())
|
||||||
checkProgramUpdate(false);
|
checkProgramUpdate(false);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
m_ui->actionCheckForUpdates->setVisible(false);
|
m_ui->actionCheckForUpdates->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
@@ -1483,7 +1494,11 @@ void MainWindow::loadPreferences()
|
|||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
if (pref->isUpdateCheckEnabled())
|
if (pref->isUpdateCheckEnabled())
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if (::IsWindows10OrGreater() && !m_programUpdateTimer)
|
||||||
|
#else
|
||||||
if (!m_programUpdateTimer)
|
if (!m_programUpdateTimer)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
m_programUpdateTimer = new QTimer(this);
|
m_programUpdateTimer = new QTimer(this);
|
||||||
m_programUpdateTimer->setInterval(24h);
|
m_programUpdateTimer->setInterval(24h);
|
||||||
@@ -1919,6 +1934,21 @@ void MainWindow::updatePowerManagementState()
|
|||||||
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
|
||||||
void MainWindow::checkProgramUpdate(const bool invokedByUser)
|
void MainWindow::checkProgramUpdate(const bool invokedByUser)
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
if (!::IsWindows10OrGreater())
|
||||||
|
{
|
||||||
|
if (invokedByUser) {
|
||||||
|
auto *msgBox = new QMessageBox {QMessageBox::Information, u"qBittorrent"_qs
|
||||||
|
, tr("This is the last supported version for your Windows version.")
|
||||||
|
, QMessageBox::Ok, this};
|
||||||
|
msgBox->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
msgBox->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_programUpdateTimer)
|
if (m_programUpdateTimer)
|
||||||
m_programUpdateTimer->stop();
|
m_programUpdateTimer->stop();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user