mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
Automatic Card Database Updates (#6004)
* Add the option to background the oracle wizard, add an option to automatically launch oracle wizard in background every X days since last launch. * Mocks and a typo. * Lint. * Lint? * qOverload the spinBox. * Change to a prompt instead. * An Label. * Update window_main.cpp --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de> Co-authored-by: Zach H <zahalpern+github@gmail.com>
This commit is contained in:
parent
76fdbfaa2f
commit
f3913949b2
16 changed files with 360 additions and 17 deletions
|
|
@ -172,6 +172,7 @@ set(cockatrice_SOURCES
|
||||||
src/dialogs/dlg_roll_dice.cpp
|
src/dialogs/dlg_roll_dice.cpp
|
||||||
src/dialogs/dlg_select_set_for_cards.cpp
|
src/dialogs/dlg_select_set_for_cards.cpp
|
||||||
src/dialogs/dlg_settings.cpp
|
src/dialogs/dlg_settings.cpp
|
||||||
|
src/dialogs/dlg_startup_card_check.cpp
|
||||||
src/dialogs/dlg_tip_of_the_day.cpp
|
src/dialogs/dlg_tip_of_the_day.cpp
|
||||||
src/dialogs/dlg_update.cpp
|
src/dialogs/dlg_update.cpp
|
||||||
src/dialogs/dlg_view_log.cpp
|
src/dialogs/dlg_view_log.cpp
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include "../../dialogs/dlg_manage_sets.h"
|
#include "../../dialogs/dlg_manage_sets.h"
|
||||||
#include "../../dialogs/dlg_register.h"
|
#include "../../dialogs/dlg_register.h"
|
||||||
#include "../../dialogs/dlg_settings.h"
|
#include "../../dialogs/dlg_settings.h"
|
||||||
|
#include "../../dialogs/dlg_startup_card_check.h"
|
||||||
#include "../../dialogs/dlg_tip_of_the_day.h"
|
#include "../../dialogs/dlg_tip_of_the_day.h"
|
||||||
#include "../../dialogs/dlg_update.h"
|
#include "../../dialogs/dlg_update.h"
|
||||||
#include "../../dialogs/dlg_view_log.h"
|
#include "../../dialogs/dlg_view_log.h"
|
||||||
|
|
@ -52,6 +53,7 @@
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QButtonGroup>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
|
@ -62,6 +64,7 @@
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QPixmapCache>
|
#include <QPixmapCache>
|
||||||
|
#include <QRadioButton>
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
@ -691,6 +694,7 @@ void MainWindow::retranslateUi()
|
||||||
aTips->setText(tr("&Tip of the Day"));
|
aTips->setText(tr("&Tip of the Day"));
|
||||||
aUpdate->setText(tr("Check for Client Updates"));
|
aUpdate->setText(tr("Check for Client Updates"));
|
||||||
aCheckCardUpdates->setText(tr("Check for Card Updates..."));
|
aCheckCardUpdates->setText(tr("Check for Card Updates..."));
|
||||||
|
aCheckCardUpdatesBackground->setText(tr("Check for Card Updates (Automatic)"));
|
||||||
aStatusBar->setText(tr("Show Status Bar"));
|
aStatusBar->setText(tr("Show Status Bar"));
|
||||||
aViewLog->setText(tr("View &Debug Log"));
|
aViewLog->setText(tr("View &Debug Log"));
|
||||||
aOpenSettingsFolder->setText(tr("Open Settings Folder"));
|
aOpenSettingsFolder->setText(tr("Open Settings Folder"));
|
||||||
|
|
@ -744,6 +748,8 @@ void MainWindow::createActions()
|
||||||
connect(aUpdate, &QAction::triggered, this, &MainWindow::actUpdate);
|
connect(aUpdate, &QAction::triggered, this, &MainWindow::actUpdate);
|
||||||
aCheckCardUpdates = new QAction(this);
|
aCheckCardUpdates = new QAction(this);
|
||||||
connect(aCheckCardUpdates, &QAction::triggered, this, &MainWindow::actCheckCardUpdates);
|
connect(aCheckCardUpdates, &QAction::triggered, this, &MainWindow::actCheckCardUpdates);
|
||||||
|
aCheckCardUpdatesBackground = new QAction(this);
|
||||||
|
connect(aCheckCardUpdatesBackground, &QAction::triggered, this, &MainWindow::actCheckCardUpdatesBackground);
|
||||||
aStatusBar = new QAction(this);
|
aStatusBar = new QAction(this);
|
||||||
aStatusBar->setCheckable(true);
|
aStatusBar->setCheckable(true);
|
||||||
aStatusBar->setChecked(SettingsCache::instance().getShowStatusBar());
|
aStatusBar->setChecked(SettingsCache::instance().getShowStatusBar());
|
||||||
|
|
@ -825,6 +831,7 @@ void MainWindow::createMenus()
|
||||||
helpMenu->addSeparator();
|
helpMenu->addSeparator();
|
||||||
helpMenu->addAction(aUpdate);
|
helpMenu->addAction(aUpdate);
|
||||||
helpMenu->addAction(aCheckCardUpdates);
|
helpMenu->addAction(aCheckCardUpdates);
|
||||||
|
helpMenu->addAction(aCheckCardUpdatesBackground);
|
||||||
helpMenu->addSeparator();
|
helpMenu->addSeparator();
|
||||||
helpMenu->addAction(aStatusBar);
|
helpMenu->addAction(aStatusBar);
|
||||||
helpMenu->addAction(aViewLog);
|
helpMenu->addAction(aViewLog);
|
||||||
|
|
@ -943,6 +950,37 @@ void MainWindow::startupConfigCheck()
|
||||||
} else {
|
} else {
|
||||||
// previous config from this version found
|
// previous config from this version found
|
||||||
qCInfo(WindowMainStartupVersionLog) << "Startup: found config with current version";
|
qCInfo(WindowMainStartupVersionLog) << "Startup: found config with current version";
|
||||||
|
|
||||||
|
if (SettingsCache::instance().getCardUpdateCheckRequired()) {
|
||||||
|
if (SettingsCache::instance().getStartupCardUpdateCheckPromptForUpdate()) {
|
||||||
|
auto startupCardCheckDialog = new DlgStartupCardCheck(this);
|
||||||
|
|
||||||
|
if (startupCardCheckDialog->exec() == QDialog::Accepted) {
|
||||||
|
switch (startupCardCheckDialog->group->checkedId()) {
|
||||||
|
case 0: // foreground
|
||||||
|
actCheckCardUpdates();
|
||||||
|
break;
|
||||||
|
case 1: // background
|
||||||
|
actCheckCardUpdatesBackground();
|
||||||
|
break;
|
||||||
|
case 2: // background + always
|
||||||
|
SettingsCache::instance().setStartupCardUpdateCheckPromptForUpdate(false);
|
||||||
|
SettingsCache::instance().setStartupCardUpdateCheckAlwaysUpdate(true);
|
||||||
|
actCheckCardUpdatesBackground();
|
||||||
|
break;
|
||||||
|
case 3: // don't prompt again + don't run
|
||||||
|
SettingsCache::instance().setStartupCardUpdateCheckPromptForUpdate(false);
|
||||||
|
SettingsCache::instance().setStartupCardUpdateCheckAlwaysUpdate(false);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (SettingsCache::instance().getStartupCardUpdateCheckAlwaysUpdate()) {
|
||||||
|
actCheckCardUpdatesBackground();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const auto reloadOk1 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
|
const auto reloadOk1 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
|
||||||
|
|
||||||
// Run the tips dialog only on subsequent startups.
|
// Run the tips dialog only on subsequent startups.
|
||||||
|
|
@ -1151,6 +1189,16 @@ void MainWindow::cardDatabaseAllNewSetsEnabled()
|
||||||
|
|
||||||
/* CARD UPDATER */
|
/* CARD UPDATER */
|
||||||
void MainWindow::actCheckCardUpdates()
|
void MainWindow::actCheckCardUpdates()
|
||||||
|
{
|
||||||
|
createCardUpdateProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::actCheckCardUpdatesBackground()
|
||||||
|
{
|
||||||
|
createCardUpdateProcess(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::createCardUpdateProcess(bool background)
|
||||||
{
|
{
|
||||||
if (cardUpdateProcess) {
|
if (cardUpdateProcess) {
|
||||||
QMessageBox::information(this, tr("Information"), tr("A card database update is already running."));
|
QMessageBox::information(this, tr("Information"), tr("A card database update is already running."));
|
||||||
|
|
@ -1213,13 +1261,19 @@ void MainWindow::actCheckCardUpdates()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cardUpdateProcess->start(updaterCmd, QStringList());
|
if (!background) {
|
||||||
|
cardUpdateProcess->start(updaterCmd, QStringList());
|
||||||
|
} else {
|
||||||
|
cardUpdateProcess->start(updaterCmd, QStringList("-b"));
|
||||||
|
statusBar()->showMessage(tr("Card database update running."));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::exitCardDatabaseUpdate()
|
void MainWindow::exitCardDatabaseUpdate()
|
||||||
{
|
{
|
||||||
cardUpdateProcess->deleteLater();
|
cardUpdateProcess->deleteLater();
|
||||||
cardUpdateProcess = nullptr;
|
cardUpdateProcess = nullptr;
|
||||||
|
statusBar()->clearMessage();
|
||||||
|
|
||||||
const auto reloadOk1 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
|
const auto reloadOk1 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->loadCardDatabases(); });
|
||||||
}
|
}
|
||||||
|
|
@ -1256,8 +1310,11 @@ void MainWindow::cardUpdateError(QProcess::ProcessError err)
|
||||||
QMessageBox::warning(this, tr("Error"), tr("The card database updater exited with an error:\n%1").arg(error));
|
QMessageBox::warning(this, tr("Error"), tr("The card database updater exited with an error:\n%1").arg(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::cardUpdateFinished(int, QProcess::ExitStatus)
|
void MainWindow::cardUpdateFinished(int, QProcess::ExitStatus exitStatus)
|
||||||
{
|
{
|
||||||
|
if (exitStatus == QProcess::NormalExit) {
|
||||||
|
SettingsCache::instance().setLastCardUpdateCheck(QDateTime::currentDateTime().date());
|
||||||
|
}
|
||||||
exitCardDatabaseUpdate();
|
exitCardDatabaseUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ class MainWindow : public QMainWindow
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public slots:
|
public slots:
|
||||||
void actCheckCardUpdates();
|
void actCheckCardUpdates();
|
||||||
|
void actCheckCardUpdatesBackground();
|
||||||
void actCheckServerUpdates();
|
void actCheckServerUpdates();
|
||||||
void actCheckClientUpdates();
|
void actCheckClientUpdates();
|
||||||
private slots:
|
private slots:
|
||||||
|
|
@ -131,6 +132,7 @@ private:
|
||||||
{
|
{
|
||||||
return "oracle";
|
return "oracle";
|
||||||
};
|
};
|
||||||
|
void createCardUpdateProcess(bool background = false);
|
||||||
void exitCardDatabaseUpdate();
|
void exitCardDatabaseUpdate();
|
||||||
|
|
||||||
void startLocalGame(int numberPlayers);
|
void startLocalGame(int numberPlayers);
|
||||||
|
|
@ -141,7 +143,8 @@ private:
|
||||||
QAction *aConnect, *aDisconnect, *aRegister, *aForgotPassword, *aSinglePlayer, *aWatchReplay, *aFullScreen;
|
QAction *aConnect, *aDisconnect, *aRegister, *aForgotPassword, *aSinglePlayer, *aWatchReplay, *aFullScreen;
|
||||||
QAction *aManageSets, *aEditTokens, *aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet,
|
QAction *aManageSets, *aEditTokens, *aOpenCustomFolder, *aOpenCustomsetsFolder, *aAddCustomSet,
|
||||||
*aReloadCardDatabase;
|
*aReloadCardDatabase;
|
||||||
QAction *aTips, *aUpdate, *aCheckCardUpdates, *aStatusBar, *aViewLog, *aOpenSettingsFolder;
|
QAction *aTips, *aUpdate, *aCheckCardUpdates, *aCheckCardUpdatesBackground, *aStatusBar, *aViewLog,
|
||||||
|
*aOpenSettingsFolder;
|
||||||
|
|
||||||
TabSupervisor *tabSupervisor;
|
TabSupervisor *tabSupervisor;
|
||||||
WndSets *wndSets;
|
WndSets *wndSets;
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,13 @@
|
||||||
#define WIKI_CUSTOM_SHORTCUTS "https://github.com/Cockatrice/Cockatrice/wiki/Custom-Keyboard-Shortcuts"
|
#define WIKI_CUSTOM_SHORTCUTS "https://github.com/Cockatrice/Cockatrice/wiki/Custom-Keyboard-Shortcuts"
|
||||||
#define WIKI_TRANSLATION_FAQ "https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ"
|
#define WIKI_TRANSLATION_FAQ "https://github.com/Cockatrice/Cockatrice/wiki/Translation-FAQ"
|
||||||
|
|
||||||
|
enum startupCardUpdateCheckBehaviorIndex
|
||||||
|
{
|
||||||
|
startupCardUpdateCheckBehaviorIndexNone,
|
||||||
|
startupCardUpdateCheckBehaviorIndexPrompt,
|
||||||
|
startupCardUpdateCheckBehaviorIndexAlways
|
||||||
|
};
|
||||||
|
|
||||||
GeneralSettingsPage::GeneralSettingsPage()
|
GeneralSettingsPage::GeneralSettingsPage()
|
||||||
{
|
{
|
||||||
QStringList languageCodes = findQmFiles();
|
QStringList languageCodes = findQmFiles();
|
||||||
|
|
@ -71,6 +78,21 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
// updates
|
// updates
|
||||||
SettingsCache &settings = SettingsCache::instance();
|
SettingsCache &settings = SettingsCache::instance();
|
||||||
startupUpdateCheckCheckBox.setChecked(settings.getCheckUpdatesOnStartup());
|
startupUpdateCheckCheckBox.setChecked(settings.getCheckUpdatesOnStartup());
|
||||||
|
|
||||||
|
startupCardUpdateCheckBehaviorSelector.addItem(""); // these will be set in retranslateUI
|
||||||
|
startupCardUpdateCheckBehaviorSelector.addItem("");
|
||||||
|
startupCardUpdateCheckBehaviorSelector.addItem("");
|
||||||
|
if (SettingsCache::instance().getStartupCardUpdateCheckPromptForUpdate()) {
|
||||||
|
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexPrompt);
|
||||||
|
} else if (SettingsCache::instance().getStartupCardUpdateCheckAlwaysUpdate()) {
|
||||||
|
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexAlways);
|
||||||
|
} else {
|
||||||
|
startupCardUpdateCheckBehaviorSelector.setCurrentIndex(startupCardUpdateCheckBehaviorIndexNone);
|
||||||
|
}
|
||||||
|
|
||||||
|
cardUpdateCheckIntervalSpinBox.setMinimum(1);
|
||||||
|
cardUpdateCheckIntervalSpinBox.setMaximum(30);
|
||||||
|
cardUpdateCheckIntervalSpinBox.setValue(settings.getCardUpdateCheckInterval());
|
||||||
updateNotificationCheckBox.setChecked(settings.getNotifyAboutUpdates());
|
updateNotificationCheckBox.setChecked(settings.getNotifyAboutUpdates());
|
||||||
newVersionOracleCheckBox.setChecked(settings.getNotifyAboutNewVersion());
|
newVersionOracleCheckBox.setChecked(settings.getNotifyAboutNewVersion());
|
||||||
|
|
||||||
|
|
@ -83,6 +105,15 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
&GeneralSettingsPage::languageBoxChanged);
|
&GeneralSettingsPage::languageBoxChanged);
|
||||||
connect(&startupUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&startupUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
||||||
&SettingsCache::setCheckUpdatesOnStartup);
|
&SettingsCache::setCheckUpdatesOnStartup);
|
||||||
|
connect(&startupCardUpdateCheckBehaviorSelector, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
|
[](int index) {
|
||||||
|
SettingsCache::instance().setStartupCardUpdateCheckPromptForUpdate(
|
||||||
|
index == startupCardUpdateCheckBehaviorIndexPrompt);
|
||||||
|
SettingsCache::instance().setStartupCardUpdateCheckAlwaysUpdate(
|
||||||
|
index == startupCardUpdateCheckBehaviorIndexAlways);
|
||||||
|
});
|
||||||
|
connect(&cardUpdateCheckIntervalSpinBox, qOverload<int>(&QSpinBox::valueChanged), &settings,
|
||||||
|
&SettingsCache::setCardUpdateCheckInterval);
|
||||||
connect(&updateNotificationCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setNotifyAboutUpdate);
|
connect(&updateNotificationCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setNotifyAboutUpdate);
|
||||||
connect(&newVersionOracleCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
connect(&newVersionOracleCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
|
||||||
&SettingsCache::setNotifyAboutNewVersion);
|
&SettingsCache::setNotifyAboutNewVersion);
|
||||||
|
|
@ -95,9 +126,14 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||||
personalGrid->addWidget(&updateReleaseChannelLabel, 2, 0);
|
personalGrid->addWidget(&updateReleaseChannelLabel, 2, 0);
|
||||||
personalGrid->addWidget(&updateReleaseChannelBox, 2, 1);
|
personalGrid->addWidget(&updateReleaseChannelBox, 2, 1);
|
||||||
personalGrid->addWidget(&startupUpdateCheckCheckBox, 4, 0, 1, 2);
|
personalGrid->addWidget(&startupUpdateCheckCheckBox, 4, 0, 1, 2);
|
||||||
personalGrid->addWidget(&updateNotificationCheckBox, 5, 0, 1, 2);
|
personalGrid->addWidget(&startupCardUpdateCheckBehaviorLabel, 5, 0);
|
||||||
personalGrid->addWidget(&newVersionOracleCheckBox, 6, 0, 1, 2);
|
personalGrid->addWidget(&startupCardUpdateCheckBehaviorSelector, 5, 1);
|
||||||
personalGrid->addWidget(&showTipsOnStartup, 7, 0, 1, 2);
|
personalGrid->addWidget(&cardUpdateCheckIntervalLabel, 6, 0);
|
||||||
|
personalGrid->addWidget(&cardUpdateCheckIntervalSpinBox, 6, 1);
|
||||||
|
personalGrid->addWidget(&lastCardUpdateCheckDateLabel, 7, 1);
|
||||||
|
personalGrid->addWidget(&updateNotificationCheckBox, 8, 0, 1, 2);
|
||||||
|
personalGrid->addWidget(&newVersionOracleCheckBox, 9, 0, 1, 2);
|
||||||
|
personalGrid->addWidget(&showTipsOnStartup, 10, 0, 1, 2);
|
||||||
|
|
||||||
personalGroupBox = new QGroupBox;
|
personalGroupBox = new QGroupBox;
|
||||||
personalGroupBox->setLayout(personalGrid);
|
personalGroupBox->setLayout(personalGrid);
|
||||||
|
|
@ -341,6 +377,14 @@ void GeneralSettingsPage::retranslateUi()
|
||||||
tokenDatabasePathLabel.setText(tr("Token database:"));
|
tokenDatabasePathLabel.setText(tr("Token database:"));
|
||||||
updateReleaseChannelLabel.setText(tr("Update channel"));
|
updateReleaseChannelLabel.setText(tr("Update channel"));
|
||||||
startupUpdateCheckCheckBox.setText(tr("Check for client updates on startup"));
|
startupUpdateCheckCheckBox.setText(tr("Check for client updates on startup"));
|
||||||
|
startupCardUpdateCheckBehaviorLabel.setText(tr("Check for card database updates on startup"));
|
||||||
|
startupCardUpdateCheckBehaviorSelector.setItemText(startupCardUpdateCheckBehaviorIndexNone, tr("Don't check"));
|
||||||
|
startupCardUpdateCheckBehaviorSelector.setItemText(startupCardUpdateCheckBehaviorIndexPrompt,
|
||||||
|
tr("Prompt for update"));
|
||||||
|
startupCardUpdateCheckBehaviorSelector.setItemText(startupCardUpdateCheckBehaviorIndexAlways,
|
||||||
|
tr("Always update in the background"));
|
||||||
|
cardUpdateCheckIntervalLabel.setText(tr("Check for card database updates every"));
|
||||||
|
cardUpdateCheckIntervalSpinBox.setSuffix(tr(" days"));
|
||||||
updateNotificationCheckBox.setText(tr("Notify if a feature supported by the server is missing in my client"));
|
updateNotificationCheckBox.setText(tr("Notify if a feature supported by the server is missing in my client"));
|
||||||
newVersionOracleCheckBox.setText(tr("Automatically run Oracle when running a new version of Cockatrice"));
|
newVersionOracleCheckBox.setText(tr("Automatically run Oracle when running a new version of Cockatrice"));
|
||||||
showTipsOnStartup.setText(tr("Show tips on startup"));
|
showTipsOnStartup.setText(tr("Show tips on startup"));
|
||||||
|
|
@ -348,6 +392,12 @@ void GeneralSettingsPage::retranslateUi()
|
||||||
|
|
||||||
const auto &settings = SettingsCache::instance();
|
const auto &settings = SettingsCache::instance();
|
||||||
|
|
||||||
|
QDate lastCheckDate = settings.getLastCardUpdateCheck();
|
||||||
|
int daysAgo = lastCheckDate.daysTo(QDate::currentDate());
|
||||||
|
|
||||||
|
lastCardUpdateCheckDateLabel.setText(
|
||||||
|
tr("Last update check on %1 (%2 days ago)").arg(lastCheckDate.toString()).arg(daysAgo));
|
||||||
|
|
||||||
// We can't change the strings after they're put into the QComboBox, so this is our workaround
|
// We can't change the strings after they're put into the QComboBox, so this is our workaround
|
||||||
int oldIndex = updateReleaseChannelBox.currentIndex();
|
int oldIndex = updateReleaseChannelBox.currentIndex();
|
||||||
updateReleaseChannelBox.clear();
|
updateReleaseChannelBox.clear();
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,11 @@ private:
|
||||||
QGroupBox *pathsGroupBox;
|
QGroupBox *pathsGroupBox;
|
||||||
QComboBox languageBox;
|
QComboBox languageBox;
|
||||||
QCheckBox startupUpdateCheckCheckBox;
|
QCheckBox startupUpdateCheckCheckBox;
|
||||||
|
QLabel startupCardUpdateCheckBehaviorLabel;
|
||||||
|
QComboBox startupCardUpdateCheckBehaviorSelector;
|
||||||
|
QLabel cardUpdateCheckIntervalLabel;
|
||||||
|
QSpinBox cardUpdateCheckIntervalSpinBox;
|
||||||
|
QLabel lastCardUpdateCheckDateLabel;
|
||||||
QCheckBox updateNotificationCheckBox;
|
QCheckBox updateNotificationCheckBox;
|
||||||
QCheckBox newVersionOracleCheckBox;
|
QCheckBox newVersionOracleCheckBox;
|
||||||
QComboBox updateReleaseChannelBox;
|
QComboBox updateReleaseChannelBox;
|
||||||
|
|
|
||||||
50
cockatrice/src/dialogs/dlg_startup_card_check.cpp
Normal file
50
cockatrice/src/dialogs/dlg_startup_card_check.cpp
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
#include "dlg_startup_card_check.h"
|
||||||
|
|
||||||
|
#include "../settings/cache_settings.h"
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
|
|
||||||
|
DlgStartupCardCheck::DlgStartupCardCheck(QWidget *parent) : QDialog(parent)
|
||||||
|
{
|
||||||
|
setWindowTitle(tr("Card Update Check"));
|
||||||
|
|
||||||
|
layout = new QVBoxLayout(this);
|
||||||
|
|
||||||
|
QDate lastCheckDate = SettingsCache::instance().getLastCardUpdateCheck();
|
||||||
|
int daysAgo = lastCheckDate.daysTo(QDate::currentDate());
|
||||||
|
|
||||||
|
instructionLabel = new QLabel(
|
||||||
|
tr("It has been more than %2 days since you last checked your card database for updates.\nChoose how you would "
|
||||||
|
"like to run the card database updater.\nYou can always change this behavior in the 'General' settings tab.")
|
||||||
|
.arg(daysAgo));
|
||||||
|
|
||||||
|
layout->addWidget(instructionLabel);
|
||||||
|
|
||||||
|
group = new QButtonGroup(this);
|
||||||
|
|
||||||
|
foregroundBtn = new QRadioButton(tr("Run in foreground"));
|
||||||
|
backgroundBtn = new QRadioButton(tr("Run in background"));
|
||||||
|
backgroundAlwaysBtn = new QRadioButton(tr("Run in background and always from now on"));
|
||||||
|
dontPromptBtn = new QRadioButton(tr("Don't prompt again and don't run"));
|
||||||
|
dontRunBtn = new QRadioButton(tr("Don't run this time"));
|
||||||
|
|
||||||
|
group->addButton(foregroundBtn, 0);
|
||||||
|
group->addButton(backgroundBtn, 1);
|
||||||
|
group->addButton(backgroundAlwaysBtn, 2);
|
||||||
|
group->addButton(dontPromptBtn, 3);
|
||||||
|
group->addButton(dontRunBtn, 4);
|
||||||
|
|
||||||
|
foregroundBtn->setChecked(true); // default
|
||||||
|
|
||||||
|
layout->addWidget(foregroundBtn);
|
||||||
|
layout->addWidget(backgroundBtn);
|
||||||
|
layout->addWidget(backgroundAlwaysBtn);
|
||||||
|
layout->addWidget(dontPromptBtn);
|
||||||
|
layout->addWidget(dontRunBtn);
|
||||||
|
|
||||||
|
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||||
|
layout->addWidget(buttonBox);
|
||||||
|
|
||||||
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||||
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||||
|
}
|
||||||
24
cockatrice/src/dialogs/dlg_startup_card_check.h
Normal file
24
cockatrice/src/dialogs/dlg_startup_card_check.h
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#ifndef DLG_STARTUP_CARD_CHECK_H
|
||||||
|
#define DLG_STARTUP_CARD_CHECK_H
|
||||||
|
|
||||||
|
#include <QButtonGroup>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QRadioButton>
|
||||||
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
class DlgStartupCardCheck : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit DlgStartupCardCheck(QWidget *parent);
|
||||||
|
|
||||||
|
QVBoxLayout *layout;
|
||||||
|
QLabel *instructionLabel;
|
||||||
|
QButtonGroup *group;
|
||||||
|
QRadioButton *foregroundBtn, *backgroundBtn, *backgroundAlwaysBtn, *dontPromptBtn, *dontRunBtn;
|
||||||
|
QDialogButtonBox *buttonBox;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // DLG_STARTUP_CARD_CHECK_H
|
||||||
|
|
@ -194,6 +194,11 @@ SettingsCache::SettingsCache()
|
||||||
mbDownloadSpoilers = settings->value("personal/downloadspoilers", false).toBool();
|
mbDownloadSpoilers = settings->value("personal/downloadspoilers", false).toBool();
|
||||||
|
|
||||||
checkUpdatesOnStartup = settings->value("personal/startupUpdateCheck", true).toBool();
|
checkUpdatesOnStartup = settings->value("personal/startupUpdateCheck", true).toBool();
|
||||||
|
startupCardUpdateCheckPromptForUpdate =
|
||||||
|
settings->value("personal/startupCardUpdateCheckPromptForUpdate", true).toBool();
|
||||||
|
startupCardUpdateCheckAlwaysUpdate = settings->value("personal/startupCardUpdateCheckAlwaysUpdate", false).toBool();
|
||||||
|
cardUpdateCheckInterval = settings->value("personal/cardUpdateCheckInterval", 7).toInt();
|
||||||
|
lastCardUpdateCheck = settings->value("personal/lastCardUpdateCheck", QDateTime::currentDateTime().date()).toDate();
|
||||||
notifyAboutUpdates = settings->value("personal/updatenotification", true).toBool();
|
notifyAboutUpdates = settings->value("personal/updatenotification", true).toBool();
|
||||||
notifyAboutNewVersion = settings->value("personal/newversionnotification", true).toBool();
|
notifyAboutNewVersion = settings->value("personal/newversionnotification", true).toBool();
|
||||||
updateReleaseChannel = settings->value("personal/updatereleasechannel", 0).toInt();
|
updateReleaseChannel = settings->value("personal/updatereleasechannel", 0).toInt();
|
||||||
|
|
@ -1363,6 +1368,29 @@ void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value)
|
||||||
settings->setValue("personal/startupUpdateCheck", checkUpdatesOnStartup);
|
settings->setValue("personal/startupUpdateCheck", checkUpdatesOnStartup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setStartupCardUpdateCheckPromptForUpdate(bool value)
|
||||||
|
{
|
||||||
|
startupCardUpdateCheckPromptForUpdate = value;
|
||||||
|
settings->setValue("personal/startupCardUpdateCheckPromptForUpdate", startupCardUpdateCheckPromptForUpdate);
|
||||||
|
}
|
||||||
|
void SettingsCache::setStartupCardUpdateCheckAlwaysUpdate(bool value)
|
||||||
|
{
|
||||||
|
startupCardUpdateCheckAlwaysUpdate = value;
|
||||||
|
settings->setValue("personal/startupCardUpdateCheckAlwaysUpdate", startupCardUpdateCheckAlwaysUpdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setCardUpdateCheckInterval(int value)
|
||||||
|
{
|
||||||
|
cardUpdateCheckInterval = value;
|
||||||
|
settings->setValue("personal/cardUpdateCheckInterval", cardUpdateCheckInterval);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setLastCardUpdateCheck(QDate value)
|
||||||
|
{
|
||||||
|
lastCardUpdateCheck = value;
|
||||||
|
settings->setValue("personal/lastCardUpdateCheck", lastCardUpdateCheck);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
||||||
{
|
{
|
||||||
rememberGameSettings = _rememberGameSettings;
|
rememberGameSettings = _rememberGameSettings;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
#include "servers_settings.h"
|
#include "servers_settings.h"
|
||||||
#include "shortcuts_settings.h"
|
#include "shortcuts_settings.h"
|
||||||
|
|
||||||
|
#include <QDate>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
|
|
@ -198,6 +199,11 @@ private:
|
||||||
bool tabVisualDeckStorageOpen, tabServerOpen, tabAccountOpen, tabDeckStorageOpen, tabReplaysOpen, tabAdminOpen,
|
bool tabVisualDeckStorageOpen, tabServerOpen, tabAccountOpen, tabDeckStorageOpen, tabReplaysOpen, tabAdminOpen,
|
||||||
tabLogOpen;
|
tabLogOpen;
|
||||||
bool checkUpdatesOnStartup;
|
bool checkUpdatesOnStartup;
|
||||||
|
bool startupCardUpdateCheckPromptForUpdate;
|
||||||
|
bool startupCardUpdateCheckAlwaysUpdate;
|
||||||
|
bool checkCardUpdatesOnStartup;
|
||||||
|
int cardUpdateCheckInterval;
|
||||||
|
QDate lastCardUpdateCheck;
|
||||||
bool notifyAboutUpdates;
|
bool notifyAboutUpdates;
|
||||||
bool notifyAboutNewVersion;
|
bool notifyAboutNewVersion;
|
||||||
bool showTipsOnStartup;
|
bool showTipsOnStartup;
|
||||||
|
|
@ -438,6 +444,27 @@ public:
|
||||||
{
|
{
|
||||||
return checkUpdatesOnStartup;
|
return checkUpdatesOnStartup;
|
||||||
}
|
}
|
||||||
|
bool getStartupCardUpdateCheckPromptForUpdate()
|
||||||
|
{
|
||||||
|
return startupCardUpdateCheckPromptForUpdate;
|
||||||
|
}
|
||||||
|
bool getStartupCardUpdateCheckAlwaysUpdate()
|
||||||
|
{
|
||||||
|
return startupCardUpdateCheckAlwaysUpdate;
|
||||||
|
}
|
||||||
|
int getCardUpdateCheckInterval() const
|
||||||
|
{
|
||||||
|
return cardUpdateCheckInterval;
|
||||||
|
}
|
||||||
|
QDate getLastCardUpdateCheck() const
|
||||||
|
{
|
||||||
|
return lastCardUpdateCheck;
|
||||||
|
}
|
||||||
|
bool getCardUpdateCheckRequired() const
|
||||||
|
{
|
||||||
|
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
||||||
|
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
||||||
|
}
|
||||||
bool getNotifyAboutUpdates() const
|
bool getNotifyAboutUpdates() const
|
||||||
{
|
{
|
||||||
return notifyAboutUpdates;
|
return notifyAboutUpdates;
|
||||||
|
|
@ -1007,6 +1034,10 @@ public slots:
|
||||||
void setDefaultStartingLifeTotal(const int _defaultStartingLifeTotal);
|
void setDefaultStartingLifeTotal(const int _defaultStartingLifeTotal);
|
||||||
void setRememberGameSettings(const bool _rememberGameSettings);
|
void setRememberGameSettings(const bool _rememberGameSettings);
|
||||||
void setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value);
|
void setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value);
|
||||||
|
void setStartupCardUpdateCheckPromptForUpdate(bool value);
|
||||||
|
void setStartupCardUpdateCheckAlwaysUpdate(bool value);
|
||||||
|
void setCardUpdateCheckInterval(int value);
|
||||||
|
void setLastCardUpdateCheck(QDate value);
|
||||||
void setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate);
|
void setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate);
|
||||||
void setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion);
|
void setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion);
|
||||||
void setUpdateReleaseChannelIndex(int value);
|
void setUpdateReleaseChannelIndex(int value);
|
||||||
|
|
|
||||||
|
|
@ -408,6 +408,18 @@ void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings
|
||||||
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T /* value */)
|
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T /* value */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void SettingsCache::setStartupCardUpdateCheckPromptForUpdate(bool /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setStartupCardUpdateCheckAlwaysUpdate(bool /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setCardUpdateCheckInterval(int /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setLastCardUpdateCheck(QDate /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T /* _notifyaboutupdate */)
|
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T /* _notifyaboutupdate */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
|
#include <QTimer>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
|
|
||||||
QTranslator *translator, *qtTranslator;
|
QTranslator *translator, *qtTranslator;
|
||||||
|
|
@ -16,6 +17,7 @@ ThemeManager *themeManager;
|
||||||
const QString translationPrefix = "oracle";
|
const QString translationPrefix = "oracle";
|
||||||
QString translationPath;
|
QString translationPath;
|
||||||
bool isSpoilersOnly;
|
bool isSpoilersOnly;
|
||||||
|
bool isBackgrounded;
|
||||||
|
|
||||||
void installNewTranslator()
|
void installNewTranslator()
|
||||||
{
|
{
|
||||||
|
|
@ -57,10 +59,13 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// If the program is opened with the -s flag, it will only do spoilers. Otherwise it will do MTGJSON/Tokens
|
// If the program is opened with the -s flag, it will only do spoilers. Otherwise it will do MTGJSON/Tokens
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
QCommandLineOption showProgressOption("s", QCoreApplication::translate("main", "Only run in spoiler mode"));
|
QCommandLineOption spoilersOnlyOption("s", QCoreApplication::translate("main", "Only run in spoiler mode"));
|
||||||
parser.addOption(showProgressOption);
|
QCommandLineOption backgroundOption("b", QCoreApplication::translate("main", "Run in no-confirm background mode"));
|
||||||
|
parser.addOption(spoilersOnlyOption);
|
||||||
|
parser.addOption(backgroundOption);
|
||||||
parser.process(app);
|
parser.process(app);
|
||||||
isSpoilersOnly = parser.isSet(showProgressOption);
|
isSpoilersOnly = parser.isSet(spoilersOnlyOption);
|
||||||
|
isBackgrounded = parser.isSet(backgroundOption);
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
translationPath = qApp->applicationDirPath() + "/../Resources/translations";
|
translationPath = qApp->applicationDirPath() + "/../Resources/translations";
|
||||||
|
|
@ -85,5 +90,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
wizard.show();
|
wizard.show();
|
||||||
|
|
||||||
|
if (isBackgrounded) {
|
||||||
|
QTimer::singleShot(0, &wizard, [&wizard]() { wizard.runInBackground(); });
|
||||||
|
}
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,15 +64,23 @@ OracleWizard::OracleWizard(QWidget *parent) : QWizard(parent)
|
||||||
|
|
||||||
nam = new QNetworkAccessManager(this);
|
nam = new QNetworkAccessManager(this);
|
||||||
|
|
||||||
|
QList<OracleWizardPage *> pages;
|
||||||
|
|
||||||
if (!isSpoilersOnly) {
|
if (!isSpoilersOnly) {
|
||||||
addPage(new IntroPage);
|
pages << new IntroPage << new LoadSetsPage << new SaveSetsPage << new LoadTokensPage << new OutroPage;
|
||||||
addPage(new LoadSetsPage);
|
|
||||||
addPage(new SaveSetsPage);
|
|
||||||
addPage(new LoadTokensPage);
|
|
||||||
addPage(new OutroPage);
|
|
||||||
} else {
|
} else {
|
||||||
addPage(new LoadSpoilersPage);
|
pages << new LoadSpoilersPage << new OutroPage;
|
||||||
addPage(new OutroPage);
|
}
|
||||||
|
|
||||||
|
for (OracleWizardPage *page : pages) {
|
||||||
|
addPage(page);
|
||||||
|
|
||||||
|
// Connect background auto-advance
|
||||||
|
connect(page, &OracleWizardPage::readyToContinue, this, [this]() {
|
||||||
|
if (backgroundMode) {
|
||||||
|
next();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
|
@ -169,6 +177,13 @@ IntroPage::IntroPage(QWidget *parent) : OracleWizardPage(parent)
|
||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IntroPage::initializePage()
|
||||||
|
{
|
||||||
|
if (wizard()->backgroundMode) {
|
||||||
|
emit readyToContinue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QStringList IntroPage::findQmFiles()
|
QStringList IntroPage::findQmFiles()
|
||||||
{
|
{
|
||||||
QDir dir(translationPath);
|
QDir dir(translationPath);
|
||||||
|
|
@ -212,6 +227,14 @@ void OutroPage::retranslateUi()
|
||||||
tr("If the card databases don't reload automatically, restart the Cockatrice client."));
|
tr("If the card databases don't reload automatically, restart the Cockatrice client."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OutroPage::initializePage()
|
||||||
|
{
|
||||||
|
if (wizard()->backgroundMode) {
|
||||||
|
wizard()->accept();
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LoadSetsPage::LoadSetsPage(QWidget *parent) : OracleWizardPage(parent)
|
LoadSetsPage::LoadSetsPage(QWidget *parent) : OracleWizardPage(parent)
|
||||||
{
|
{
|
||||||
urlRadioButton = new QRadioButton(this);
|
urlRadioButton = new QRadioButton(this);
|
||||||
|
|
@ -252,6 +275,12 @@ void LoadSetsPage::initializePage()
|
||||||
|
|
||||||
progressLabel->hide();
|
progressLabel->hide();
|
||||||
progressBar->hide();
|
progressBar->hide();
|
||||||
|
|
||||||
|
if (wizard()->backgroundMode) {
|
||||||
|
if (isEnabled()) {
|
||||||
|
validatePage();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSetsPage::retranslateUi()
|
void LoadSetsPage::retranslateUi()
|
||||||
|
|
@ -616,6 +645,10 @@ void SaveSetsPage::initializePage()
|
||||||
if (!wizard()->importer->startImport()) {
|
if (!wizard()->importer->startImport()) {
|
||||||
QMessageBox::critical(this, tr("Error"), tr("No set has been imported."));
|
QMessageBox::critical(this, tr("Error"), tr("No set has been imported."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wizard()->backgroundMode) {
|
||||||
|
emit readyToContinue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveSetsPage::retranslateUi()
|
void SaveSetsPage::retranslateUi()
|
||||||
|
|
@ -691,6 +724,15 @@ bool SaveSetsPage::validatePage()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoadTokensPage::initializePage()
|
||||||
|
{
|
||||||
|
SimpleDownloadFilePage::initializePage();
|
||||||
|
|
||||||
|
if (wizard()->backgroundMode) {
|
||||||
|
emit readyToContinue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString LoadTokensPage::getDefaultUrl()
|
QString LoadTokensPage::getDefaultUrl()
|
||||||
{
|
{
|
||||||
return TOKENS_URL;
|
return TOKENS_URL;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
|
#include <QTimer>
|
||||||
#include <QWizard>
|
#include <QWizard>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
@ -56,12 +57,20 @@ public:
|
||||||
}
|
}
|
||||||
bool saveTokensToFile(const QString &fileName);
|
bool saveTokensToFile(const QString &fileName);
|
||||||
|
|
||||||
|
void runInBackground()
|
||||||
|
{
|
||||||
|
backgroundMode = true;
|
||||||
|
hide();
|
||||||
|
currentPage()->initializePage();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OracleImporter *importer;
|
OracleImporter *importer;
|
||||||
QSettings *settings;
|
QSettings *settings;
|
||||||
QNetworkAccessManager *nam;
|
QNetworkAccessManager *nam;
|
||||||
bool downloadedPlainXml = false;
|
bool downloadedPlainXml = false;
|
||||||
QByteArray xmlData;
|
QByteArray xmlData;
|
||||||
|
bool backgroundMode = false;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateLanguage();
|
void updateLanguage();
|
||||||
|
|
@ -92,6 +101,9 @@ private:
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void languageBoxChanged(int index);
|
void languageBoxChanged(int index);
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void initializePage() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OutroPage : public OracleWizardPage
|
class OutroPage : public OracleWizardPage
|
||||||
|
|
@ -102,6 +114,9 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void retranslateUi() override;
|
void retranslateUi() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void initializePage() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LoadSetsPage : public OracleWizardPage
|
class LoadSetsPage : public OracleWizardPage
|
||||||
|
|
@ -191,6 +206,7 @@ protected:
|
||||||
QString getDefaultSavePath() override;
|
QString getDefaultSavePath() override;
|
||||||
QString getWindowTitle() override;
|
QString getWindowTitle() override;
|
||||||
QString getFileType() override;
|
QString getFileType() override;
|
||||||
|
void initializePage() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ bool SimpleDownloadFilePage::validatePage()
|
||||||
|
|
||||||
QUrl url = QUrl::fromUserInput(urlLineEdit->text());
|
QUrl url = QUrl::fromUserInput(urlLineEdit->text());
|
||||||
if (!url.isValid()) {
|
if (!url.isValid()) {
|
||||||
QMessageBox::critical(this, tr("Error"), tr("The provided URL is not valid."));
|
QMessageBox::critical(this, tr("Error"), tr("The provided URL is not valid: ") + url.toString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,9 @@ public:
|
||||||
explicit OracleWizardPage(QWidget *parent = nullptr) : QWizardPage(parent){};
|
explicit OracleWizardPage(QWidget *parent = nullptr) : QWizardPage(parent){};
|
||||||
virtual void retranslateUi() = 0;
|
virtual void retranslateUi() = 0;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void readyToContinue();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
inline OracleWizard *wizard()
|
inline OracleWizard *wizard()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,18 @@ void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings
|
||||||
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T /* value */)
|
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T /* value */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
void SettingsCache::setStartupCardUpdateCheckPromptForUpdate(bool /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setStartupCardUpdateCheckAlwaysUpdate(bool /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setCardUpdateCheckInterval(int /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void SettingsCache::setLastCardUpdateCheck(QDate /* value */)
|
||||||
|
{
|
||||||
|
}
|
||||||
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T /* _notifyaboutupdate */)
|
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T /* _notifyaboutupdate */)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue