mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 21:13:55 -07:00
Add an "always enable new sets" fuse to "new sets found" dialog
Took 11 minutes
This commit is contained in:
parent
808f51a61b
commit
78a8f9104d
3 changed files with 26 additions and 0 deletions
|
|
@ -211,6 +211,7 @@ SettingsCache::SettingsCache()
|
||||||
startupCardUpdateCheckAlwaysUpdate = settings->value("personal/startupCardUpdateCheckAlwaysUpdate", false).toBool();
|
startupCardUpdateCheckAlwaysUpdate = settings->value("personal/startupCardUpdateCheckAlwaysUpdate", false).toBool();
|
||||||
cardUpdateCheckInterval = settings->value("personal/cardUpdateCheckInterval", 7).toInt();
|
cardUpdateCheckInterval = settings->value("personal/cardUpdateCheckInterval", 7).toInt();
|
||||||
lastCardUpdateCheck = settings->value("personal/lastCardUpdateCheck", QDateTime::currentDateTime().date()).toDate();
|
lastCardUpdateCheck = settings->value("personal/lastCardUpdateCheck", QDateTime::currentDateTime().date()).toDate();
|
||||||
|
alwaysEnableNewSets = settings->value("personal/alwaysEnableNewSets", false).toBool();
|
||||||
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();
|
||||||
|
|
||||||
|
|
@ -1246,6 +1247,12 @@ void SettingsCache::setLastCardUpdateCheck(QDate value)
|
||||||
settings->setValue("personal/lastCardUpdateCheck", lastCardUpdateCheck);
|
settings->setValue("personal/lastCardUpdateCheck", lastCardUpdateCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setAlwaysEnableNewSets(bool value)
|
||||||
|
{
|
||||||
|
alwaysEnableNewSets = value;
|
||||||
|
settings->setValue("personal/alwaysEnableNewSets", alwaysEnableNewSets);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
||||||
{
|
{
|
||||||
rememberGameSettings = _rememberGameSettings;
|
rememberGameSettings = _rememberGameSettings;
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,7 @@ private:
|
||||||
bool checkCardUpdatesOnStartup;
|
bool checkCardUpdatesOnStartup;
|
||||||
int cardUpdateCheckInterval;
|
int cardUpdateCheckInterval;
|
||||||
QDate lastCardUpdateCheck;
|
QDate lastCardUpdateCheck;
|
||||||
|
bool alwaysEnableNewSets;
|
||||||
bool notifyAboutUpdates;
|
bool notifyAboutUpdates;
|
||||||
bool notifyAboutNewVersion;
|
bool notifyAboutNewVersion;
|
||||||
bool showTipsOnStartup;
|
bool showTipsOnStartup;
|
||||||
|
|
@ -502,6 +503,10 @@ public:
|
||||||
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
return getLastCardUpdateCheck().daysTo(QDateTime::currentDateTime().date()) >= getCardUpdateCheckInterval() &&
|
||||||
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
getLastCardUpdateCheck() != QDateTime::currentDateTime().date();
|
||||||
}
|
}
|
||||||
|
[[nodiscard]] bool getAlwaysEnableNewSets() const
|
||||||
|
{
|
||||||
|
return alwaysEnableNewSets;
|
||||||
|
}
|
||||||
[[nodiscard]] bool getNotifyAboutUpdates() const override
|
[[nodiscard]] bool getNotifyAboutUpdates() const override
|
||||||
{
|
{
|
||||||
return notifyAboutUpdates;
|
return notifyAboutUpdates;
|
||||||
|
|
@ -1125,6 +1130,7 @@ public slots:
|
||||||
void setStartupCardUpdateCheckAlwaysUpdate(bool value);
|
void setStartupCardUpdateCheckAlwaysUpdate(bool value);
|
||||||
void setCardUpdateCheckInterval(int value);
|
void setCardUpdateCheckInterval(int value);
|
||||||
void setLastCardUpdateCheck(QDate value);
|
void setLastCardUpdateCheck(QDate value);
|
||||||
|
void setAlwaysEnableNewSets(bool 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);
|
||||||
|
|
|
||||||
|
|
@ -1173,6 +1173,13 @@ void MainWindow::cardDatabaseLoadingFailed()
|
||||||
|
|
||||||
void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknownSetsNames)
|
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);
|
QMessageBox msgBox(this);
|
||||||
msgBox.setWindowTitle(tr("New sets found"));
|
msgBox.setWindowTitle(tr("New sets found"));
|
||||||
msgBox.setIcon(QMessageBox::Question);
|
msgBox.setIcon(QMessageBox::Question);
|
||||||
|
|
@ -1183,6 +1190,7 @@ void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknow
|
||||||
.arg(unknownSetsNames.join(", ")));
|
.arg(unknownSetsNames.join(", ")));
|
||||||
|
|
||||||
QPushButton *yesButton = msgBox.addButton(tr("Yes"), QMessageBox::YesRole);
|
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 *noButton = msgBox.addButton(tr("No"), QMessageBox::NoRole);
|
||||||
QPushButton *settingsButton = msgBox.addButton(tr("View sets"), QMessageBox::ActionRole);
|
QPushButton *settingsButton = msgBox.addButton(tr("View sets"), QMessageBox::ActionRole);
|
||||||
msgBox.setDefaultButton(yesButton);
|
msgBox.setDefaultButton(yesButton);
|
||||||
|
|
@ -1193,6 +1201,11 @@ void MainWindow::cardDatabaseNewSetsFound(int numUnknownSets, QStringList unknow
|
||||||
CardDatabaseManager::getInstance()->enableAllUnknownSets();
|
CardDatabaseManager::getInstance()->enableAllUnknownSets();
|
||||||
const auto reloadOk1 =
|
const auto reloadOk1 =
|
||||||
QtConcurrent::run([] { CardDatabaseManager::getInstance()->reloadCardDatabasesAndNotify(); });
|
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) {
|
} else if (msgBox.clickedButton() == noButton) {
|
||||||
CardDatabaseManager::getInstance()->markAllSetsAsKnown();
|
CardDatabaseManager::getInstance()->markAllSetsAsKnown();
|
||||||
} else if (msgBox.clickedButton() == settingsButton) {
|
} else if (msgBox.clickedButton() == settingsButton) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue