new setting

This commit is contained in:
RickyRister 2024-12-28 01:53:17 -08:00
parent 7c1807cf03
commit fac5058e7a
6 changed files with 28 additions and 3 deletions

View file

@ -61,6 +61,7 @@ GeneralSettingsPage::GeneralSettingsPage()
// updates
SettingsCache &settings = SettingsCache::instance();
startupUpdateCheckCheckBox.setChecked(settings.getCheckUpdatesOnStartup());
updateNotificationCheckBox.setChecked(settings.getNotifyAboutUpdates());
newVersionOracleCheckBox.setChecked(settings.getNotifyAboutNewVersion());
@ -68,6 +69,8 @@ GeneralSettingsPage::GeneralSettingsPage()
connect(&languageBox, SIGNAL(currentIndexChanged(int)), this, SLOT(languageBoxChanged(int)));
connect(&updateReleaseChannelBox, SIGNAL(currentIndexChanged(int)), &settings, SLOT(setUpdateReleaseChannel(int)));
connect(&startupUpdateCheckCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
&SettingsCache::setCheckUpdatesOnStartup);
connect(&updateNotificationCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings, &SettingsCache::setNotifyAboutUpdate);
connect(&newVersionOracleCheckBox, &QCheckBox::QT_STATE_CHANGED, &settings,
&SettingsCache::setNotifyAboutNewVersion);
@ -78,9 +81,10 @@ GeneralSettingsPage::GeneralSettingsPage()
personalGrid->addWidget(&languageBox, 0, 1);
personalGrid->addWidget(&updateReleaseChannelLabel, 1, 0);
personalGrid->addWidget(&updateReleaseChannelBox, 1, 1);
personalGrid->addWidget(&updateNotificationCheckBox, 3, 0, 1, 2);
personalGrid->addWidget(&newVersionOracleCheckBox, 4, 0, 1, 2);
personalGrid->addWidget(&showTipsOnStartup, 5, 0, 1, 2);
personalGrid->addWidget(&startupUpdateCheckCheckBox, 3, 0, 1, 2);
personalGrid->addWidget(&updateNotificationCheckBox, 4, 0, 1, 2);
personalGrid->addWidget(&newVersionOracleCheckBox, 5, 0, 1, 2);
personalGrid->addWidget(&showTipsOnStartup, 6, 0, 1, 2);
personalGroupBox = new QGroupBox;
personalGroupBox->setLayout(personalGrid);
@ -288,6 +292,7 @@ void GeneralSettingsPage::retranslateUi()
customCardDatabasePathLabel.setText(tr("Custom database directory:"));
tokenDatabasePathLabel.setText(tr("Token database:"));
updateReleaseChannelLabel.setText(tr("Update channel"));
startupUpdateCheckCheckBox.setText(tr("Check for client updates on startup"));
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"));

View file

@ -65,6 +65,7 @@ private:
QGroupBox *personalGroupBox;
QGroupBox *pathsGroupBox;
QComboBox languageBox;
QCheckBox startupUpdateCheckCheckBox;
QCheckBox updateNotificationCheckBox;
QCheckBox newVersionOracleCheckBox;
QComboBox updateReleaseChannelBox;

View file

@ -192,6 +192,7 @@ SettingsCache::SettingsCache()
mbDownloadSpoilers = settings->value("personal/downloadspoilers", false).toBool();
checkUpdatesOnStartup = settings->value("personal/startupUpdateCheck", true).toBool();
notifyAboutUpdates = settings->value("personal/updatenotification", true).toBool();
notifyAboutNewVersion = settings->value("personal/newversionnotification", true).toBool();
updateReleaseChannel = settings->value("personal/updatereleasechannel", 0).toInt();
@ -1107,6 +1108,12 @@ void SettingsCache::setDefaultStartingLifeTotal(const int _defaultStartingLifeTo
settings->setValue("game/defaultstartinglifetotal", defaultStartingLifeTotal);
};
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value)
{
checkUpdatesOnStartup = static_cast<bool>(value);
settings->setValue("personal/startupUpdateCheck", checkUpdatesOnStartup);
}
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
{
rememberGameSettings = _rememberGameSettings;

View file

@ -93,6 +93,7 @@ private:
QString lang;
QString deckPath, replaysPath, picsPath, redirectCachePath, customPicsPath, cardDatabasePath,
customCardDatabasePath, themesPath, spoilerDatabasePath, tokenDatabasePath, themeName;
bool checkUpdatesOnStartup;
bool notifyAboutUpdates;
bool notifyAboutNewVersion;
bool showTipsOnStartup;
@ -269,6 +270,10 @@ public:
{
return buddyConnectNotificationsEnabled;
}
bool getCheckUpdatesOnStartup() const
{
return checkUpdatesOnStartup;
}
bool getNotifyAboutUpdates() const
{
return notifyAboutUpdates;
@ -704,6 +709,7 @@ public slots:
void setCreateGameAsSpectator(const bool _createGameAsSpectator);
void setDefaultStartingLifeTotal(const int _defaultStartingLifeTotal);
void setRememberGameSettings(const bool _rememberGameSettings);
void setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value);
void setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate);
void setNotifyAboutNewVersion(QT_STATE_CHANGED_T _notifyaboutnewversion);
void setUpdateReleaseChannel(int _updateReleaseChannel);

View file

@ -309,6 +309,9 @@ void SettingsCache::setDefaultStartingLifeTotal(const int /* _startingLifeTotal
void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings */)
{
}
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T /* value */)
{
}
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T /* _notifyaboutupdate */)
{
}

View file

@ -313,6 +313,9 @@ void SettingsCache::setDefaultStartingLifeTotal(const int /* _startingLifeTotal
void SettingsCache::setRememberGameSettings(const bool /* _rememberGameSettings */)
{
}
void SettingsCache::setCheckUpdatesOnStartup(QT_STATE_CHANGED_T /* value */)
{
}
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T /* _notifyaboutupdate */)
{
}