mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Force Oracle run on new install/update (#3497)
* Force Oracle run on new install/update Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com> * Add settings option to disable such a check Signed-off-by: Zach Halpern <ZaHalpern+github@gmail.com>
This commit is contained in:
parent
273d5d89b7
commit
41bfbf2e83
6 changed files with 75 additions and 5 deletions
|
|
@ -317,9 +317,9 @@ void MainWindow::actAbout()
|
|||
|
||||
void MainWindow::actTips()
|
||||
{
|
||||
if (tip != NULL) {
|
||||
if (tip != nullptr) {
|
||||
delete tip;
|
||||
tip = NULL;
|
||||
tip = nullptr;
|
||||
}
|
||||
tip = new DlgTipOfTheDay();
|
||||
if (tip->successfulInit) {
|
||||
|
|
@ -828,13 +828,30 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
if (tip->successfulInit && settingsCache->getShowTipsOnStartup() && tip->newTipsAvailable) {
|
||||
tip->show();
|
||||
}
|
||||
|
||||
// Only run the check updater if the user wants it (defaults to on)
|
||||
if (settingsCache->getNotifyAboutNewVersion()) {
|
||||
auto versionUpdater = new MainUpdateHelper();
|
||||
connect(versionUpdater, SIGNAL(newVersionDetected(QString)), this, SLOT(alertForcedOracleRun(QString)));
|
||||
QtConcurrent::run(versionUpdater, &MainUpdateHelper::testForNewVersion);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::alertForcedOracleRun(const QString &newVersion)
|
||||
{
|
||||
settingsCache->setClientVersion(newVersion);
|
||||
QMessageBox::information(this, tr("New Version"),
|
||||
tr("Congratulations on updating to Cockatrice %1!\n"
|
||||
"Oracle will now launch to update your card database.")
|
||||
.arg(newVersion));
|
||||
actCheckCardUpdates();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
if (tip != NULL) {
|
||||
if (tip != nullptr) {
|
||||
delete tip;
|
||||
tip = NULL;
|
||||
tip = nullptr;
|
||||
}
|
||||
if (trayIcon) {
|
||||
trayIcon->hide();
|
||||
|
|
@ -1271,3 +1288,10 @@ void MainWindow::promptForgotPasswordReset()
|
|||
dlg.getPlayerName(), dlg.getToken(), dlg.getPassword());
|
||||
}
|
||||
}
|
||||
|
||||
void MainUpdateHelper::testForNewVersion()
|
||||
{
|
||||
if (settingsCache->getClientVersion() != VERSION_STRING) {
|
||||
emit newVersionDetected(VERSION_STRING);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue