mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Check for client updates on startup (#5359)
This commit is contained in:
parent
e0829a75d2
commit
df9c5ae53c
13 changed files with 142 additions and 10 deletions
|
|
@ -40,6 +40,8 @@
|
|||
#include "../../settings/cache_settings.h"
|
||||
#include "../../utility/logger.h"
|
||||
#include "../get_text_with_max.h"
|
||||
#include "../network/client_update_checker.h"
|
||||
#include "../network/release_channel.h"
|
||||
#include "../tabs/tab_game.h"
|
||||
#include "../tabs/tab_supervisor.h"
|
||||
#include "pb/event_connection_closed.pb.h"
|
||||
|
|
@ -879,6 +881,10 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
|
||||
void MainWindow::startupConfigCheck()
|
||||
{
|
||||
if (SettingsCache::instance().getCheckUpdatesOnStartup()) {
|
||||
actCheckClientUpdates();
|
||||
}
|
||||
|
||||
if (SettingsCache::instance().getClientVersion() == CLIENT_INFO_NOT_SET) {
|
||||
// no config found, 99% new clean install
|
||||
qDebug() << "Startup: old client version empty, assuming first start after clean install";
|
||||
|
|
@ -1223,6 +1229,21 @@ void MainWindow::actCheckServerUpdates()
|
|||
connect(hps, &HandlePublicServers::sigPublicServersDownloadedSuccessfully, [=]() { hps->deleteLater(); });
|
||||
}
|
||||
|
||||
void MainWindow::actCheckClientUpdates()
|
||||
{
|
||||
auto checker = new ClientUpdateChecker(this);
|
||||
connect(checker, &ClientUpdateChecker::finishedCheck, this, &MainWindow::checkClientUpdatesFinished);
|
||||
checker->check();
|
||||
}
|
||||
|
||||
void MainWindow::checkClientUpdatesFinished(bool needToUpdate, bool /* isCompatible */, Release * /* release */)
|
||||
{
|
||||
if (needToUpdate) {
|
||||
DlgUpdate dlg(this);
|
||||
dlg.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::refreshShortcuts()
|
||||
{
|
||||
ShortcutsSettings &shortcuts = SettingsCache::instance().shortcuts();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue