mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 10:33:54 -07:00
Add client UI setting for idleclientdisconnect (#2244)
* Add client UI setting for idleclientdisconnect Added disabled option in client UI for client disconnect. * Updated settings text Updated settings text for clarity. * Updated descripton text (again) Per request for clarity
This commit is contained in:
parent
dfc4d9937b
commit
63a4f147f4
5 changed files with 22 additions and 3 deletions
|
|
@ -398,12 +398,16 @@ UserInterfaceSettingsPage::UserInterfaceSettingsPage()
|
||||||
annotateTokensCheckBox.setChecked(settingsCache->getAnnotateTokens());
|
annotateTokensCheckBox.setChecked(settingsCache->getAnnotateTokens());
|
||||||
connect(&annotateTokensCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setAnnotateTokens(int)));
|
connect(&annotateTokensCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setAnnotateTokens(int)));
|
||||||
|
|
||||||
|
idleClientTimeOutCheckBox.setChecked(settingsCache->getIdleClientTimeOutEnabled());
|
||||||
|
connect(&idleClientTimeOutCheckBox, SIGNAL(stateChanged(int)), settingsCache, SLOT(setIdleClientTimeOutEnabled(int)));
|
||||||
|
|
||||||
QGridLayout *generalGrid = new QGridLayout;
|
QGridLayout *generalGrid = new QGridLayout;
|
||||||
generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0);
|
generalGrid->addWidget(¬ificationsEnabledCheckBox, 0, 0);
|
||||||
generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0);
|
generalGrid->addWidget(&specNotificationsEnabledCheckBox, 1, 0);
|
||||||
generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0);
|
generalGrid->addWidget(&doubleClickToPlayCheckBox, 2, 0);
|
||||||
generalGrid->addWidget(&playToStackCheckBox, 3, 0);
|
generalGrid->addWidget(&playToStackCheckBox, 3, 0);
|
||||||
generalGrid->addWidget(&annotateTokensCheckBox, 4, 0);
|
generalGrid->addWidget(&annotateTokensCheckBox, 4, 0);
|
||||||
|
generalGrid->addWidget(&idleClientTimeOutCheckBox, 5, 0);
|
||||||
|
|
||||||
generalGroupBox = new QGroupBox;
|
generalGroupBox = new QGroupBox;
|
||||||
generalGroupBox->setLayout(generalGrid);
|
generalGroupBox->setLayout(generalGrid);
|
||||||
|
|
@ -438,6 +442,7 @@ void UserInterfaceSettingsPage::retranslateUi()
|
||||||
annotateTokensCheckBox.setText(tr("Annotate card text on tokens"));
|
annotateTokensCheckBox.setText(tr("Annotate card text on tokens"));
|
||||||
animationGroupBox->setTitle(tr("Animation settings"));
|
animationGroupBox->setTitle(tr("Animation settings"));
|
||||||
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
tapAnimationCheckBox.setText(tr("&Tap/untap animation"));
|
||||||
|
idleClientTimeOutCheckBox.setText(tr("Disconnect from server if idle for 1 hour"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@ private:
|
||||||
QCheckBox playToStackCheckBox;
|
QCheckBox playToStackCheckBox;
|
||||||
QCheckBox annotateTokensCheckBox;
|
QCheckBox annotateTokensCheckBox;
|
||||||
QCheckBox tapAnimationCheckBox;
|
QCheckBox tapAnimationCheckBox;
|
||||||
|
QCheckBox idleClientTimeOutCheckBox;
|
||||||
QGroupBox *generalGroupBox;
|
QGroupBox *generalGroupBox;
|
||||||
QGroupBox *animationGroupBox;
|
QGroupBox *animationGroupBox;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -390,8 +390,11 @@ QString RemoteClient::getSrvClientID(const QString _hostname)
|
||||||
|
|
||||||
void RemoteClient::doIdleTimeOut()
|
void RemoteClient::doIdleTimeOut()
|
||||||
{
|
{
|
||||||
doDisconnectFromServer();
|
if (settingsCache->getIdleClientTimeOutEnabled()) {
|
||||||
emit idleTimeout();
|
doDisconnectFromServer();
|
||||||
|
emit idleTimeout();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoteClient::resetIdleTimer()
|
void RemoteClient::resetIdleTimer()
|
||||||
|
|
|
||||||
|
|
@ -250,6 +250,7 @@ SettingsCache::SettingsCache()
|
||||||
spectatorsCanSeeEverything = settings->value("game/spectatorscanseeeverything", false).toBool();
|
spectatorsCanSeeEverything = settings->value("game/spectatorscanseeeverything", false).toBool();
|
||||||
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
rememberGameSettings = settings->value("game/remembergamesettings", true).toBool();
|
||||||
clientID = settings->value("personal/clientid", "notset").toString();
|
clientID = settings->value("personal/clientid", "notset").toString();
|
||||||
|
idleClientTimeOutEnabled = settings->value("interface/idleClientTimeOutEnabled", true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsCache::setCardInfoViewMode(const int _viewMode) {
|
void SettingsCache::setCardInfoViewMode(const int _viewMode) {
|
||||||
|
|
@ -391,6 +392,12 @@ void SettingsCache::setAnnotateTokens(int _annotateTokens)
|
||||||
settings->setValue("interface/annotatetokens", annotateTokens);
|
settings->setValue("interface/annotatetokens", annotateTokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsCache::setIdleClientTimeOutEnabled(int _idleClientTimeOutEnabled)
|
||||||
|
{
|
||||||
|
idleClientTimeOutEnabled = _idleClientTimeOutEnabled;
|
||||||
|
settings->setValue("interface/idleClientTimeOutEnabled", idleClientTimeOutEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
void SettingsCache::setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes)
|
void SettingsCache::setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes)
|
||||||
{
|
{
|
||||||
tabGameSplitterSizes = _tabGameSplitterSizes;
|
tabGameSplitterSizes = _tabGameSplitterSizes;
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ private:
|
||||||
bool doubleClickToPlay;
|
bool doubleClickToPlay;
|
||||||
bool playToStack;
|
bool playToStack;
|
||||||
bool annotateTokens;
|
bool annotateTokens;
|
||||||
|
bool idleClientTimeOutEnabled;
|
||||||
QByteArray tabGameSplitterSizes;
|
QByteArray tabGameSplitterSizes;
|
||||||
bool displayCardNames;
|
bool displayCardNames;
|
||||||
bool horizontalHand;
|
bool horizontalHand;
|
||||||
|
|
@ -131,6 +132,7 @@ public:
|
||||||
bool getNotificationsEnabled() const { return notificationsEnabled; }
|
bool getNotificationsEnabled() const { return notificationsEnabled; }
|
||||||
bool getSpectatorNotificationsEnabled() const { return spectatorNotificationsEnabled; }
|
bool getSpectatorNotificationsEnabled() const { return spectatorNotificationsEnabled; }
|
||||||
bool getNotifyAboutUpdates() const { return notifyAboutUpdates; }
|
bool getNotifyAboutUpdates() const { return notifyAboutUpdates; }
|
||||||
|
bool getIdleClientTimeOutEnabled() const { return idleClientTimeOutEnabled; }
|
||||||
|
|
||||||
bool getDoubleClickToPlay() const { return doubleClickToPlay; }
|
bool getDoubleClickToPlay() const { return doubleClickToPlay; }
|
||||||
bool getPlayToStack() const { return playToStack; }
|
bool getPlayToStack() const { return playToStack; }
|
||||||
|
|
@ -207,6 +209,7 @@ public slots:
|
||||||
void setDoubleClickToPlay(int _doubleClickToPlay);
|
void setDoubleClickToPlay(int _doubleClickToPlay);
|
||||||
void setPlayToStack(int _playToStack);
|
void setPlayToStack(int _playToStack);
|
||||||
void setAnnotateTokens(int _annotateTokens);
|
void setAnnotateTokens(int _annotateTokens);
|
||||||
|
void setIdleClientTimeOutEnabled(int _idleClientTimeOutEnabled);
|
||||||
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
void setTabGameSplitterSizes(const QByteArray &_tabGameSplitterSizes);
|
||||||
void setDisplayCardNames(int _displayCardNames);
|
void setDisplayCardNames(int _displayCardNames);
|
||||||
void setHorizontalHand(int _horizontalHand);
|
void setHorizontalHand(int _horizontalHand);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue