Check for client updates on startup (#5359)

This commit is contained in:
RickyRister 2024-12-28 13:29:59 -08:00 committed by GitHub
parent e0829a75d2
commit df9c5ae53c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 142 additions and 10 deletions

View file

@ -1,5 +1,6 @@
#include "dlg_update.h"
#include "../client/network/client_update_checker.h"
#include "../client/network/release_channel.h"
#include "../client/ui/window_main.h"
#include "../settings/cache_settings.h"
@ -71,11 +72,6 @@ DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent)
connect(uDownloader, SIGNAL(progressMade(qint64, qint64)), this, SLOT(downloadProgressMade(qint64, qint64)));
connect(uDownloader, SIGNAL(error(QString)), this, SLOT(downloadError(QString)));
ReleaseChannel *channel = SettingsCache::instance().getUpdateReleaseChannel();
connect(channel, SIGNAL(finishedCheck(bool, bool, Release *)), this,
SLOT(finishedUpdateCheck(bool, bool, Release *)));
connect(channel, SIGNAL(error(QString)), this, SLOT(updateCheckError(QString)));
// Check for updates
beginUpdateCheck();
}
@ -110,7 +106,12 @@ void DlgUpdate::beginUpdateCheck()
progress->setMinimum(0);
progress->setMaximum(0);
setLabel(tr("Checking for updates..."));
SettingsCache::instance().getUpdateReleaseChannel()->checkForUpdates();
auto checker = new ClientUpdateChecker(this);
connect(checker, SIGNAL(finishedCheck(bool, bool, Release *)), this,
SLOT(finishedUpdateCheck(bool, bool, Release *)));
connect(checker, SIGNAL(error(QString)), this, SLOT(updateCheckError(QString)));
checker->check();
}
void DlgUpdate::finishedUpdateCheck(bool needToUpdate, bool isCompatible, Release *release)