From 468e1bdd26bc9868f7eaece64a0774165dc0b791 Mon Sep 17 00:00:00 2001 From: DawnFire42 Date: Tue, 10 Mar 2026 17:10:14 -0400 Subject: [PATCH] Now remember settings separately and & shortcuts removed --- .../src/client/settings/cache_settings.cpp | 25 +++++++++++++++++++ .../src/client/settings/cache_settings.h | 21 ++++++++++++++++ .../dialogs/dlg_local_game_options.cpp | 18 ++++++------- 3 files changed, 55 insertions(+), 9 deletions(-) diff --git a/cockatrice/src/client/settings/cache_settings.cpp b/cockatrice/src/client/settings/cache_settings.cpp index 30093fd52..64c8e718d 100644 --- a/cockatrice/src/client/settings/cache_settings.cpp +++ b/cockatrice/src/client/settings/cache_settings.cpp @@ -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(_notifyaboutupdate); diff --git a/cockatrice/src/client/settings/cache_settings.h b/cockatrice/src/client/settings/cache_settings.h index 5c5054105..2bbf85352 100644 --- a/cockatrice/src/client/settings/cache_settings.h +++ b/cockatrice/src/client/settings/cache_settings.h @@ -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 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); diff --git a/cockatrice/src/interface/widgets/dialogs/dlg_local_game_options.cpp b/cockatrice/src/interface/widgets/dialogs/dlg_local_game_options.cpp index 0083b4327..52466ff10 100644 --- a/cockatrice/src/interface/widgets/dialogs/dlg_local_game_options.cpp +++ b/cockatrice/src/interface/widgets/dialogs/dlg_local_game_options.cpp @@ -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();