Cockatrice/cockatrice/src/client/network/client_update_checker.cpp
Lukas Brübach 53d80efab8 Turn Card, Settings and Utility into libraries.
Took 4 hours 3 minutes

Took 2 minutes

Took 38 seconds

Took 5 minutes

Took 5 minutes

Took 9 minutes


Took 15 minutes
2025-10-04 11:09:40 +02:00

35 lines
No EOL
1,003 B
C++

#include "client_update_checker.h"
#include "release_channel.h"
#include "settings/cache_settings.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);
}