Now remember settings separately and & shortcuts removed

This commit is contained in:
DawnFire42 2026-03-10 17:10:14 -04:00
parent 81a7a768c5
commit 468e1bdd26
No known key found for this signature in database
GPG key ID: 24BB855EE2911B33
3 changed files with 55 additions and 9 deletions

View file

@ -385,6 +385,13 @@ SettingsCache::SettingsCache()
defaultStartingLifeTotal = settings->value("game/defaultstartinglifetotal", 20).toInt();
shareDecklistsOnLoad = settings->value("game/sharedecklistsonload", false).toBool();
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
// Local game settings use "localgameoptions/" prefix to keep them separate
// from server game settings which use "game/" prefix
localGameRememberSettings = settings->value("localgameoptions/remembersettings", false).toBool();
localGameMaxPlayers = settings->value("localgameoptions/maxplayers", 1).toInt();
localGameStartingLifeTotal = settings->value("localgameoptions/startinglifetotal", 20).toInt();
clientID = settings->value("personal/clientid", CLIENT_INFO_NOT_SET).toString();
clientVersion = settings->value("personal/clientversion", CLIENT_INFO_NOT_SET).toString();
}
@ -1478,6 +1485,24 @@ void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
settings->setValue("game/remembergamesettings", rememberGameSettings);
}
void SettingsCache::setLocalGameRememberSettings(bool value)
{
localGameRememberSettings = value;
settings->setValue("localgameoptions/remembersettings", value);
}
void SettingsCache::setLocalGameMaxPlayers(int value)
{
localGameMaxPlayers = value;
settings->setValue("localgameoptions/maxplayers", value);
}
void SettingsCache::setLocalGameStartingLifeTotal(int value)
{
localGameStartingLifeTotal = value;
settings->setValue("localgameoptions/startinglifetotal", value);
}
void SettingsCache::setNotifyAboutUpdate(QT_STATE_CHANGED_T _notifyaboutupdate)
{
notifyAboutUpdates = static_cast<bool>(_notifyaboutupdate);

View file

@ -330,6 +330,12 @@ private:
[[nodiscard]] QString getSafeConfigFilePath(QString configEntry, QString defaultPath) const;
void loadPaths();
bool rememberGameSettings;
// Local game settings (separate from server game settings in game/*)
bool localGameRememberSettings;
int localGameMaxPlayers;
int localGameStartingLifeTotal;
QList<ReleaseChannel *> releaseChannels;
bool isPortableBuild;
bool roundCardCorners;
@ -862,6 +868,18 @@ public:
{
return rememberGameSettings;
}
[[nodiscard]] bool getLocalGameRememberSettings() const
{
return localGameRememberSettings;
}
[[nodiscard]] int getLocalGameMaxPlayers() const
{
return localGameMaxPlayers;
}
[[nodiscard]] int getLocalGameStartingLifeTotal() const
{
return localGameStartingLifeTotal;
}
[[nodiscard]] int getKeepAlive() const override
{
return keepalive;
@ -1089,6 +1107,9 @@ public slots:
void setDefaultStartingLifeTotal(const int _defaultStartingLifeTotal);
void setShareDecklistsOnLoad(const bool _shareDecklistsOnLoad);
void setRememberGameSettings(const bool _rememberGameSettings);
void setLocalGameRememberSettings(bool value);
void setLocalGameMaxPlayers(int value);
void setLocalGameStartingLifeTotal(int value);
void setCheckUpdatesOnStartup(QT_STATE_CHANGED_T value);
void setStartupCardUpdateCheckPromptForUpdate(bool value);
void setStartupCardUpdateCheckAlwaysUpdate(bool value);

View file

@ -12,7 +12,7 @@
DlgLocalGameOptions::DlgLocalGameOptions(QWidget *parent) : QDialog(parent)
{
numberPlayersLabel = new QLabel(tr("P&layers:"), this);
numberPlayersLabel = new QLabel(tr("Players:"), this);
numberPlayersEdit = new QSpinBox(this);
numberPlayersEdit->setMinimum(1);
numberPlayersEdit->setMaximum(8);
@ -25,7 +25,7 @@ DlgLocalGameOptions::DlgLocalGameOptions(QWidget *parent) : QDialog(parent)
generalGroupBox = new QGroupBox(tr("General"), this);
generalGroupBox->setLayout(generalGrid);
startingLifeTotalLabel = new QLabel(tr("Starting &life total:"), this);
startingLifeTotalLabel = new QLabel(tr("Starting life total:"), this);
startingLifeTotalEdit = new QSpinBox(this);
startingLifeTotalEdit->setMinimum(1);
startingLifeTotalEdit->setMaximum(99999);
@ -38,7 +38,7 @@ DlgLocalGameOptions::DlgLocalGameOptions(QWidget *parent) : QDialog(parent)
gameSetupOptionsGroupBox = new QGroupBox(tr("Game setup options"), this);
gameSetupOptionsGroupBox->setLayout(gameSetupGrid);
rememberSettingsCheckBox = new QCheckBox(tr("Re&member settings"), this);
rememberSettingsCheckBox = new QCheckBox(tr("Remember settings"), this);
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
connect(buttonBox, &QDialogButtonBox::accepted, this, &DlgLocalGameOptions::actOK);
@ -51,10 +51,10 @@ DlgLocalGameOptions::DlgLocalGameOptions(QWidget *parent) : QDialog(parent)
mainLayout->addWidget(buttonBox);
setLayout(mainLayout);
rememberSettingsCheckBox->setChecked(SettingsCache::instance().getRememberGameSettings());
rememberSettingsCheckBox->setChecked(SettingsCache::instance().getLocalGameRememberSettings());
if (rememberSettingsCheckBox->isChecked()) {
numberPlayersEdit->setValue(SettingsCache::instance().getMaxPlayers());
startingLifeTotalEdit->setValue(SettingsCache::instance().getDefaultStartingLifeTotal());
numberPlayersEdit->setValue(SettingsCache::instance().getLocalGameMaxPlayers());
startingLifeTotalEdit->setValue(SettingsCache::instance().getLocalGameStartingLifeTotal());
}
setWindowTitle(tr("Local game options"));
@ -65,10 +65,10 @@ DlgLocalGameOptions::DlgLocalGameOptions(QWidget *parent) : QDialog(parent)
void DlgLocalGameOptions::actOK()
{
SettingsCache::instance().setRememberGameSettings(rememberSettingsCheckBox->isChecked());
SettingsCache::instance().setLocalGameRememberSettings(rememberSettingsCheckBox->isChecked());
if (rememberSettingsCheckBox->isChecked()) {
SettingsCache::instance().setMaxPlayers(numberPlayersEdit->value());
SettingsCache::instance().setDefaultStartingLifeTotal(startingLifeTotalEdit->value());
SettingsCache::instance().setLocalGameMaxPlayers(numberPlayersEdit->value());
SettingsCache::instance().setLocalGameStartingLifeTotal(startingLifeTotalEdit->value());
}
accept();