diff --git a/cockatrice/src/client/settings/cache_settings.cpp b/cockatrice/src/client/settings/cache_settings.cpp index a66897b4a..9a46c6426 100644 --- a/cockatrice/src/client/settings/cache_settings.cpp +++ b/cockatrice/src/client/settings/cache_settings.cpp @@ -211,6 +211,7 @@ SettingsCache::SettingsCache() startupCardUpdateCheckAlwaysUpdate = settings->value("personal/startupCardUpdateCheckAlwaysUpdate", false).toBool(); cardUpdateCheckInterval = settings->value("personal/cardUpdateCheckInterval", 7).toInt(); lastCardUpdateCheck = settings->value("personal/lastCardUpdateCheck", QDateTime::currentDateTime().date()).toDate(); + alwaysEnableNewSets = settings->value("personal/alwaysEnableNewSets", false).toBool(); notifyAboutUpdates = settings->value("personal/updatenotification", true).toBool(); notifyAboutNewVersion = settings->value("personal/newversionnotification", true).toBool(); @@ -1246,6 +1247,12 @@ void SettingsCache::setLastCardUpdateCheck(QDate value) settings->setValue("personal/lastCardUpdateCheck", lastCardUpdateCheck); } +void SettingsCache::setAlwaysEnableNewSets(bool value) +{ + alwaysEnableNewSets = value; + settings->setValue("personal/alwaysEnableNewSets", alwaysEnableNewSets); +} + void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings) { rememberGameSettings = _rememberGameSettings; diff --git a/cockatrice/src/client/settings/cache_settings.h b/cockatrice/src/client/settings/cache_settings.h index ece61487f..0cd5ceb68 100644 --- a/cockatrice/src/client/settings/cache_settings.h +++ b/cockatrice/src/client/settings/cache_settings.h @@ -216,6 +216,7 @@ private: bool checkCardUpdatesOnStartup; int cardUpdateCheckInterval; QDate lastCardUpdateCheck; + bool alwaysEnableNewSets; bool notifyAboutUpdates; bool notifyAboutNewVersion; bool showTipsOnStartup; @@ -502,6 +503,10 @@ public: return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() && getLastCardUpdateCheck() != QDateTime::currentDateTime().date(); } + [[nodiscard]] bool getAlwaysEnableNewSets() const + { + return alwaysEnableNewSets; + } [[nodiscard]] bool getNotifyAboutUpdates() const override { return notifyAboutUpdates; @@ -1125,6 +1130,7 @@ public slots: void setStartupCardUpdateCheckAlwaysUpdate(bool value); void setCardUpdateCheckInterval(int value); void setLastCardUpdateCheck(QDate value); + void setAlwaysEnableNewSets(bool value); void setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate); void setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion); void setUpdateReleaseChannelIndex(int value); diff --git a/cockatrice/src/interface/window_main.cpp b/cockatrice/src/interface/window_main.cpp index 49f1b9f50..50375eea6 100644 --- a/cockatrice/src/interface/window_main.cpp +++ b/cockatrice/src/interface/window_main.cpp @@ -1173,6 +1173,13 @@ void MainWindow::cardDatabaseLoadingFailed() void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknownSetsNames) { + if (SettingsCache::instance().getAlwaysEnableNewSets()) { + CardDatabaseManager::getInstance()->enableAllUnknownSets(); + const auto reloadOk1 = + QtConcurrent::run([] { CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify(); }); + return; + } + QMessageBox msgBox(this); msgBox.setWindowTitle(tr("New sets found")); msgBox.setIcon(QMessageBox::Question); @@ -1183,6 +1190,7 @@ void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknow .arg(unknownSetsNames.join(", "))); QPushButton *yesButton = msgBox.addButton(tr("Yes"), QMessageBox::YesRole); + QPushButton *yesAlwaysButton = msgBox.addButton(tr("Yes, always enable"), QMessageBox::YesRole); QPushButton *noButton = msgBox.addButton(tr("No"), QMessageBox::NoRole); QPushButton *settingsButton = msgBox.addButton(tr("View sets"), QMessageBox::ActionRole); msgBox.setDefaultButton(yesButton); @@ -1193,6 +1201,11 @@ void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknow CardDatabaseManager::getInstance()->enableAllUnknownSets(); const auto reloadOk1 = QtConcurrent::run([] { CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify(); }); + } else if (msgBox.clickedButton() == yesAlwaysButton) { + CardDatabaseManager::getInstance()->enableAllUnknownSets(); + const auto reloadOk1 = + QtConcurrent::run([] { CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify(); }); + SettingsCache::instance().setAlwaysEnableNewSets(true); } else if (msgBox.clickedButton() == noButton) { CardDatabaseManager::getInstance()->markAllSetsAsKnown(); } else if (msgBox.clickedButton() == settingsButton) {