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

View file

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

View file

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

View file

@ -93,6 +93,7 @@ private:
QString lang; QString lang;
QString deckPath, replaysPath, picsPath, redirectCachePath, customPicsPath, cardDatabasePath, QString deckPath, replaysPath, picsPath, redirectCachePath, customPicsPath, cardDatabasePath,
customCardDatabasePath, themesPath, spoilerDatabasePath, tokenDatabasePath, themeName; customCardDatabasePath, themesPath, spoilerDatabasePath, tokenDatabasePath, themeName;
bool checkUpdatesOnStartup;
bool notifyAboutUpdates; bool notifyAboutUpdates;
bool notifyAboutNewVersion; bool notifyAboutNewVersion;
bool showTipsOnStartup; bool showTipsOnStartup;
@ -269,6 +270,10 @@ public:
{ {
return buddyConnectNotificationsEnabled; return buddyConnectNotificationsEnabled;
} }
bool getCheckUpdatesOnStartup() const
{
return checkUpdatesOnStartup;
}
bool getNotifyAboutUpdates() const bool getNotifyAboutUpdates() const
{ {
return notifyAboutUpdates; return notifyAboutUpdates;
@ -704,6 +709,7 @@ public slots:
void setCreateGameAsSpectator(const bool _createGameAsSpectator); void setCreateGameAsSpectator(const bool _createGameAsSpectator);
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 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 setUpdateReleaseChannel(int _updateReleaseChannel); void setUpdateReleaseChannel(int _updateReleaseChannel);

View file

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