Add the option to background the oracle wizard, add an option to automatically launch oracle wizard in background every X days since last launch.

This commit is contained in:
Lukas Brübach 2025-06-24 21:23:27 +02:00
parent 208f8349a6
commit deb60b1bc2
11 changed files with 190 additions and 20 deletions

View file

@ -71,6 +71,10 @@ GeneralSettingsPage::GeneralSettingsPage()
// updates
SettingsCache &settings = SettingsCache::instance();
startupUpdateCheckCheckBox.setChecked(settings.getCheckUpdatesOnStartup());
startupCardUpdateCheckCheckBox.setChecked(settings.getCheckCardUpdatesOnStartup());
cardUpdateCheckIntervalSpinBox.setMinimum(1);
cardUpdateCheckIntervalSpinBox.setMaximum(30);
cardUpdateCheckIntervalSpinBox.setValue(settings.getCardUpdateCheckInterval());
updateNotificationCheckBox.setChecked(settings.getNotifyAboutUpdates());
newVersionOracleCheckBox.setChecked(settings.getNotifyAboutNewVersion());
@ -83,6 +87,10 @@ GeneralSettingsPage::GeneralSettingsPage()
&GeneralSettingsPage::languageBoxChanged);
connect(&startupUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
&SettingsCache::setCheckUpdatesOnStartup);
connect(&startupCardUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
&SettingsCache::setCheckCardUpdatesOnStartup);
connect(&cardUpdateCheckIntervalSpinBox, &QSpinBox::valueChanged, &settings,
&SettingsCache::setCardUpdateCheckInterval);
connect(&updateNotificationCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setNotifyAboutUpdate);
connect(&newVersionOracleCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
&SettingsCache::setNotifyAboutNewVersion);
@ -95,9 +103,13 @@ GeneralSettingsPage::GeneralSettingsPage()
personalGrid->addWidget(&updateReleaseChannelLabel, 2, 0);
personalGrid->addWidget(&updateReleaseChannelBox, 2, 1);
personalGrid->addWidget(&startupUpdateCheckCheckBox, 4, 0, 1, 2);
personalGrid->addWidget(&updateNotificationCheckBox, 5, 0, 1, 2);
personalGrid->addWidget(&newVersionOracleCheckBox, 6, 0, 1, 2);
personalGrid->addWidget(&showTipsOnStartup, 7, 0, 1, 2);
personalGrid->addWidget(&startupCardUpdateCheckCheckBox, 5, 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->setLayout(personalGrid);
@ -341,6 +353,9 @@ void GeneralSettingsPage::retranslateUi()
tokenDatabasePathLabel.setText(tr("Token database:"));
updateReleaseChannelLabel.setText(tr("Update channel"));
startupUpdateCheckCheckBox.setText(tr("Check for client updates on startup"));
startupCardUpdateCheckCheckBox.setText(tr("Automatically update card database in the background on startup."));
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"));
newVersionOracleCheckBox.setText(tr("Automatically run Oracle when running a new version of Cockatrice"));
showTipsOnStartup.setText(tr("Show tips on startup"));
@ -348,6 +363,12 @@ void GeneralSettingsPage::retranslateUi()
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
int oldIndex = updateReleaseChannelBox.currentIndex();
updateReleaseChannelBox.clear();

View file

@ -71,6 +71,10 @@ private:
QGroupBox *pathsGroupBox;
QComboBox languageBox;
QCheckBox startupUpdateCheckCheckBox;
QCheckBox startupCardUpdateCheckCheckBox;
QLabel cardUpdateCheckIntervalLabel;
QSpinBox cardUpdateCheckIntervalSpinBox;
QLabel lastCardUpdateCheckDateLabel;
QCheckBox updateNotificationCheckBox;
QCheckBox newVersionOracleCheckBox;
QComboBox updateReleaseChannelBox;