mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-02-04 11:07:31 -08:00
35 lines
1009 B
C++
35 lines
1009 B
C++
#include "client_update_checker.h"
|
|
|
|
#include "../../settings/cache_settings.h"
|
|
#include "release_channel.h"
|
|
|
|
ClientUpdateChecker::ClientUpdateChecker(QObject *parent) : QObject(parent)
|
|
{
|
|
}
|
|
|
|
void ClientUpdateChecker::check()
|
|
{
|
|
auto releaseChannel = SettingsCache::instance().getUpdateReleaseChannel();
|
|
|
|
finishedCheckConnection =
|
|
connect(releaseChannel, &ReleaseChannel::finishedCheck, this, &ClientUpdateChecker::actFinishedCheck);
|
|
errorConnection = connect(releaseChannel, &ReleaseChannel::error, this, &ClientUpdateChecker::actError);
|
|
|
|
releaseChannel->checkForUpdates();
|
|
}
|
|
|
|
void ClientUpdateChecker::actFinishedCheck(bool needToUpdate, bool isCompatible, Release *release)
|
|
{
|
|
disconnect(finishedCheckConnection);
|
|
disconnect(errorConnection);
|
|
|
|
emit finishedCheck(needToUpdate, isCompatible, release);
|
|
}
|
|
|
|
void ClientUpdateChecker::actError(const QString &errorString)
|
|
{
|
|
disconnect(finishedCheckConnection);
|
|
disconnect(errorConnection);
|
|
|
|
emit error(errorString);
|
|
} |