Merge pull request #1407 from Fizztastic/fix_1396
Option to opt-out of remember game settings
This commit is contained in:
commit
4d2fdaec08
4 changed files with 31 additions and 10 deletions
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
void DlgCreateGame::sharedCtor()
|
void DlgCreateGame::sharedCtor()
|
||||||
{
|
{
|
||||||
|
rememberGameSettings = new QCheckBox(tr("Re&member settings"));
|
||||||
descriptionLabel = new QLabel(tr("&Description:"));
|
descriptionLabel = new QLabel(tr("&Description:"));
|
||||||
descriptionEdit = new QLineEdit;
|
descriptionEdit = new QLineEdit;
|
||||||
descriptionLabel->setBuddy(descriptionEdit);
|
descriptionLabel->setBuddy(descriptionEdit);
|
||||||
|
@ -38,6 +39,7 @@ void DlgCreateGame::sharedCtor()
|
||||||
generalGrid->addWidget(descriptionEdit, 0, 1);
|
generalGrid->addWidget(descriptionEdit, 0, 1);
|
||||||
generalGrid->addWidget(maxPlayersLabel, 1, 0);
|
generalGrid->addWidget(maxPlayersLabel, 1, 0);
|
||||||
generalGrid->addWidget(maxPlayersEdit, 1, 1);
|
generalGrid->addWidget(maxPlayersEdit, 1, 1);
|
||||||
|
generalGrid->addWidget(rememberGameSettings, 2, 0);
|
||||||
|
|
||||||
QVBoxLayout *gameTypeLayout = new QVBoxLayout;
|
QVBoxLayout *gameTypeLayout = new QVBoxLayout;
|
||||||
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
QMapIterator<int, QString> gameTypeIterator(gameTypes);
|
||||||
|
@ -111,6 +113,7 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
|
||||||
{
|
{
|
||||||
sharedCtor();
|
sharedCtor();
|
||||||
|
|
||||||
|
rememberGameSettings->setChecked(settingsCache->getRememberGameSettings());
|
||||||
descriptionEdit->setText(settingsCache->getGameDescription());
|
descriptionEdit->setText(settingsCache->getGameDescription());
|
||||||
maxPlayersEdit->setValue(settingsCache->getMaxPlayers());
|
maxPlayersEdit->setValue(settingsCache->getMaxPlayers());
|
||||||
onlyBuddiesCheckBox->setChecked(settingsCache->getOnlyBuddies());
|
onlyBuddiesCheckBox->setChecked(settingsCache->getOnlyBuddies());
|
||||||
|
@ -126,6 +129,10 @@ DlgCreateGame::DlgCreateGame(TabRoom *_room, const QMap<int, QString> &_gameType
|
||||||
spectatorsCanTalkCheckBox->setChecked(settingsCache->getSpectatorsCanTalk());
|
spectatorsCanTalkCheckBox->setChecked(settingsCache->getSpectatorsCanTalk());
|
||||||
spectatorsSeeEverythingCheckBox->setChecked(settingsCache->getSpectatorsCanSeeEverything());
|
spectatorsSeeEverythingCheckBox->setChecked(settingsCache->getSpectatorsCanSeeEverything());
|
||||||
|
|
||||||
|
if (!rememberGameSettings->isChecked()){
|
||||||
|
actReset();
|
||||||
|
}
|
||||||
|
|
||||||
clearButton = new QPushButton(tr("&Clear"));
|
clearButton = new QPushButton(tr("&Clear"));
|
||||||
buttonBox->addButton(QDialogButtonBox::Cancel);
|
buttonBox->addButton(QDialogButtonBox::Cancel);
|
||||||
buttonBox->addButton(clearButton, QDialogButtonBox::ActionRole);
|
buttonBox->addButton(clearButton, QDialogButtonBox::ActionRole);
|
||||||
|
@ -140,6 +147,7 @@ DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QS
|
||||||
{
|
{
|
||||||
sharedCtor();
|
sharedCtor();
|
||||||
|
|
||||||
|
rememberGameSettings->setEnabled(false);
|
||||||
descriptionEdit->setEnabled(false);
|
descriptionEdit->setEnabled(false);
|
||||||
maxPlayersEdit->setEnabled(false);
|
maxPlayersEdit->setEnabled(false);
|
||||||
passwordEdit->setEnabled(false);
|
passwordEdit->setEnabled(false);
|
||||||
|
@ -203,15 +211,6 @@ descriptionEdit->setFocus();
|
||||||
|
|
||||||
void DlgCreateGame::actOK()
|
void DlgCreateGame::actOK()
|
||||||
{
|
{
|
||||||
settingsCache->setGameDescription(descriptionEdit->text());
|
|
||||||
settingsCache->setMaxPlayers(maxPlayersEdit->value());
|
|
||||||
settingsCache->setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
|
||||||
settingsCache->setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
|
||||||
settingsCache->setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
|
||||||
settingsCache->setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
|
||||||
settingsCache->setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
|
||||||
settingsCache->setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
|
||||||
|
|
||||||
Command_CreateGame cmd;
|
Command_CreateGame cmd;
|
||||||
cmd.set_description(descriptionEdit->text().simplified().toStdString());
|
cmd.set_description(descriptionEdit->text().simplified().toStdString());
|
||||||
cmd.set_password(passwordEdit->text().toStdString());
|
cmd.set_password(passwordEdit->text().toStdString());
|
||||||
|
@ -233,7 +232,18 @@ void DlgCreateGame::actOK()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
settingsCache->setGameTypes(gameTypes);
|
settingsCache->setRememberGameSettings(rememberGameSettings->isChecked());
|
||||||
|
if (rememberGameSettings->isChecked()){
|
||||||
|
settingsCache->setGameDescription(descriptionEdit->text());
|
||||||
|
settingsCache->setMaxPlayers(maxPlayersEdit->value());
|
||||||
|
settingsCache->setOnlyBuddies(onlyBuddiesCheckBox->isChecked());
|
||||||
|
settingsCache->setOnlyRegistered(onlyRegisteredCheckBox->isChecked());
|
||||||
|
settingsCache->setSpectatorsAllowed(spectatorsAllowedCheckBox->isChecked());
|
||||||
|
settingsCache->setSpectatorsNeedPassword(spectatorsNeedPasswordCheckBox->isChecked());
|
||||||
|
settingsCache->setSpectatorsCanTalk(spectatorsCanTalkCheckBox->isChecked());
|
||||||
|
settingsCache->setSpectatorsCanSeeEverything(spectatorsSeeEverythingCheckBox->isChecked());
|
||||||
|
settingsCache->setGameTypes(gameTypes);
|
||||||
|
}
|
||||||
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
PendingCommand *pend = room->prepareRoomCommand(cmd);
|
||||||
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
connect(pend, SIGNAL(finished(Response, CommandContainer, QVariant)), this, SLOT(checkResponse(Response)));
|
||||||
room->sendRoomCommand(pend);
|
room->sendRoomCommand(pend);
|
||||||
|
|
|
@ -39,6 +39,7 @@ private:
|
||||||
QCheckBox *spectatorsAllowedCheckBox, *spectatorsNeedPasswordCheckBox, *spectatorsCanTalkCheckBox, *spectatorsSeeEverythingCheckBox;
|
QCheckBox *spectatorsAllowedCheckBox, *spectatorsNeedPasswordCheckBox, *spectatorsCanTalkCheckBox, *spectatorsSeeEverythingCheckBox;
|
||||||
QDialogButtonBox *buttonBox;
|
QDialogButtonBox *buttonBox;
|
||||||
QPushButton *clearButton;
|
QPushButton *clearButton;
|
||||||
|
QCheckBox *rememberGameSettings;
|
||||||
|
|
||||||
void sharedCtor();
|
void sharedCtor();
|
||||||
};
|
};
|
||||||
|
|
|
@ -118,6 +118,7 @@ SettingsCache::SettingsCache()
|
||||||
spectatorsNeedPassword = settings->value("game/spectatorsneedpassword", false).toBool();
|
spectatorsNeedPassword = settings->value("game/spectatorsneedpassword", false).toBool();
|
||||||
spectatorsCanTalk = settings->value("game/spectatorscantalk", false).toBool();
|
spectatorsCanTalk = settings->value("game/spectatorscantalk", false).toBool();
|
||||||
spectatorsCanSeeEverything = settings->value("game/spectatorscanseeeverything", false).toBool();
|
spectatorsCanSeeEverything = settings->value("game/spectatorscanseeeverything", false).toBool();
|
||||||
|
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
||||||
clientID = settings->value("personal/clientid", "notset").toString();
|
clientID = settings->value("personal/clientid", "notset").toString();
|
||||||
|
|
||||||
QString file = getSettingsPath();
|
QString file = getSettingsPath();
|
||||||
|
@ -605,3 +606,9 @@ void SettingsCache::setSpectatorsCanSeeEverything(const bool _spectatorsCanSeeEv
|
||||||
spectatorsCanSeeEverything = _spectatorsCanSeeEverything;
|
spectatorsCanSeeEverything = _spectatorsCanSeeEverything;
|
||||||
settings->setValue("game/spectatorscanseeeverything", spectatorsCanSeeEverything);
|
settings->setValue("game/spectatorscanseeeverything", spectatorsCanSeeEverything);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setRememberGameSettings(const bool _rememberGameSettings)
|
||||||
|
{
|
||||||
|
rememberGameSettings = _rememberGameSettings;
|
||||||
|
settings->setValue("game/remembergamesettings", rememberGameSettings);
|
||||||
|
}
|
|
@ -102,6 +102,7 @@ private:
|
||||||
bool spectatorsNeedPassword;
|
bool spectatorsNeedPassword;
|
||||||
bool spectatorsCanTalk;
|
bool spectatorsCanTalk;
|
||||||
bool spectatorsCanSeeEverything;
|
bool spectatorsCanSeeEverything;
|
||||||
|
bool rememberGameSettings;
|
||||||
int keepalive;
|
int keepalive;
|
||||||
QByteArray deckEditorLayoutState, deckEditorGeometry;
|
QByteArray deckEditorLayoutState, deckEditorGeometry;
|
||||||
QSize deckEditorFilterSize, deckEditorDeckSize, deckEditorCardSize;
|
QSize deckEditorFilterSize, deckEditorDeckSize, deckEditorCardSize;
|
||||||
|
@ -178,6 +179,7 @@ public:
|
||||||
bool getSpectatorsNeedPassword() const { return spectatorsNeedPassword; }
|
bool getSpectatorsNeedPassword() const { return spectatorsNeedPassword; }
|
||||||
bool getSpectatorsCanTalk() const { return spectatorsCanTalk; }
|
bool getSpectatorsCanTalk() const { return spectatorsCanTalk; }
|
||||||
bool getSpectatorsCanSeeEverything() const { return spectatorsCanSeeEverything; }
|
bool getSpectatorsCanSeeEverything() const { return spectatorsCanSeeEverything; }
|
||||||
|
bool getRememberGameSettings() const { return rememberGameSettings; }
|
||||||
int getKeepAlive() const { return keepalive; }
|
int getKeepAlive() const { return keepalive; }
|
||||||
void setClientID(QString clientID);
|
void setClientID(QString clientID);
|
||||||
QString getClientID() { return clientID; }
|
QString getClientID() { return clientID; }
|
||||||
|
@ -257,6 +259,7 @@ public slots:
|
||||||
void setSpectatorsNeedPassword(const bool _spectatorsNeedPassword);
|
void setSpectatorsNeedPassword(const bool _spectatorsNeedPassword);
|
||||||
void setSpectatorsCanTalk(const bool _spectatorsCanTalk);
|
void setSpectatorsCanTalk(const bool _spectatorsCanTalk);
|
||||||
void setSpectatorsCanSeeEverything(const bool _spectatorsCanSeeEverything);
|
void setSpectatorsCanSeeEverything(const bool _spectatorsCanSeeEverything);
|
||||||
|
void setRememberGameSettings(const bool _rememberGameSettings);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SettingsCache *settingsCache;
|
extern SettingsCache *settingsCache;
|
||||||
|
|
Loading…
Reference in a new issue