automatically save and restore gametable geometry (including fullscreen)

This commit is contained in:
doitux
2009-04-03 19:57:45 +00:00
parent 52dd959a9e
commit 82fe9869e6
5 changed files with 66 additions and 12 deletions
+4 -2
View File
@@ -48,7 +48,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
myQtToolsInterface = CreateQtToolsWrapper();
// !!!! Revisionsnummer der Configdefaults !!!!!
configRev = 62;
configRev = 63;
//standard defaults
logOnOffDefault = "1";
@@ -250,7 +250,9 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
configList.push_back(ConfigInfo("DisableBackToLobbyWarning", CONFIG_TYPE_INT, "0"));
configList.push_back(ConfigInfo("DlgGameLobbyGameListSortingSection", CONFIG_TYPE_INT, "2"));
configList.push_back(ConfigInfo("DlgGameLobbyGameListSortingOrder", CONFIG_TYPE_INT, "1"));
configList.push_back(ConfigInfo("GameTableFullScreenSave", CONFIG_TYPE_INT, "0"));
configList.push_back(ConfigInfo("GameTableHeightSave", CONFIG_TYPE_INT, "600"));
configList.push_back(ConfigInfo("GameTableWidthSave", CONFIG_TYPE_INT, "1024"));
//fill tempList firstTime
configBufferList = configList;
+35
View File
@@ -2770,6 +2770,9 @@ void gameTableImpl::localGameModification() {
//clear log
textBrowser_Log->clear();
//restore saved windows geometry
restoreGameTableGeometry();
}
void gameTableImpl::networkGameModification() {
@@ -2804,6 +2807,9 @@ void gameTableImpl::networkGameModification() {
//clear log
textBrowser_Log->clear();
//restore saved windows geometry
restoreGameTableGeometry();
}
void gameTableImpl::mouseOverFlipCards(bool front) {
@@ -2909,6 +2915,7 @@ void gameTableImpl::closeGameTable() {
myStartWindow->getSession()->terminateNetworkClient();
stopTimer();
if (myStartWindow->getMyServerGuiInterface().get()) myStartWindow->getMyServerGuiInterface()->getSession()->terminateNetworkServer();
saveGameTableGeometry();
myStartWindow->show();
this->hide();
}
@@ -2916,6 +2923,7 @@ void gameTableImpl::closeGameTable() {
else {
myStartWindow->getSession()->terminateNetworkClient();
stopTimer();
saveGameTableGeometry();
myStartWindow->show();
this->hide();
}
@@ -3234,3 +3242,30 @@ void gameTableImpl::refreshGameTableStyle()
label_Handranking->setPixmap(myGameTableStyle->getHandRanking());
}
void gameTableImpl::saveGameTableGeometry()
{
if(this->isFullScreen()) {
myConfig->writeConfigInt("GameTableFullScreenSave", 1);
}
else {
myConfig->writeConfigInt("GameTableFullScreenSave", 0);
myConfig->writeConfigInt("GameTableHeightSave", this->height());
myConfig->writeConfigInt("GameTableWidthSave", this->width());
}
myConfig->writeBuffer();
}
void gameTableImpl::restoreGameTableGeometry()
{
if(myConfig->readConfigInt("GameTableFullScreenSave")) {
if(actionFullScreen->isEnabled()) this->showFullScreen();
}
else {
//resize only if style size allow this and if NOT fixed windows size
if(!myGameTableStyle->getIfFixedWindowSize().toInt() && myConfig->readConfigInt("GameTableHeightSave") <= myGameTableStyle->getMaximumWindowHeight().toInt() && myConfig->readConfigInt("GameTableHeightSave") >= myGameTableStyle->getMinimumWindowHeight().toInt() && myConfig->readConfigInt("GameTableWidthSave") <= myGameTableStyle->getMaximumWindowWidth().toInt() && myConfig->readConfigInt("GameTableWidthSave") >= myGameTableStyle->getMinimumWindowWidth().toInt()){
this->resize(myConfig->readConfigInt("GameTableWidthSave"), myConfig->readConfigInt("GameTableHeightSave"));
}
}
}
+2
View File
@@ -297,6 +297,8 @@ public slots:
void refreshVotesMonitor(int currentVotes, int numVotesNeededToKick);
void refreshGameTableStyle();
void saveGameTableGeometry();
void restoreGameTableGeometry();
private:
+12 -2
View File
@@ -219,6 +219,9 @@ void GameTableStyleReader::readStyleFile(QString file) {
}
wrongItems.clear();
// INFOS
if(StyleDescription == "") { wrongItems << "StyleDescription"; }
// WINDOWS SETTINGS
if(IfFixedWindowSize == "") { wrongItems << "IfFixedWindowSize"; }
if(FixedWindowWidth == "") { wrongItems << "FixedWindowWidth"; }
if(FixedWindowHeight == "") { wrongItems << "FixedWindowHeight"; }
@@ -226,6 +229,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(MinimumWindowHeight == "") { wrongItems << "MinimumWindowHeight"; }
if(MaximumWindowWidth == "") { wrongItems << "MaximumWindowWidth"; }
if(MaximumWindowHeight == "") { wrongItems << "MaximumWindowHeight"; }
// PICS
if(ActionAllIn == "") { wrongItems << "ActionAllIn"; }
if(ActionRaise == "") { wrongItems << "ActionRaise"; }
if(ActionBet == "") { wrongItems << "ActionBet"; }
@@ -268,6 +272,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(Table == "") { wrongItems << "Table"; }
if(HandRanking == "") { wrongItems << "HandRanking"; }
if(ToolBoxBackground == "") { wrongItems << "ToolBoxBackground"; }
// COLORS
if(FKeyIndicatorColor == "") { wrongItems << "FKeyIndicatorColor"; }
if(ChanceLabelPossibleColor == "") { wrongItems << "ChanceLabelPossibleColor"; }
if(ChanceLabelImpossibleColor == "") { wrongItems << "ChanceLabelImpossibleColor"; }
@@ -319,6 +324,7 @@ void GameTableStyleReader::readStyleFile(QString file) {
if(BetSpeedSliderGrooveBorderColor == "") { wrongItems << "BetSpeedSliderGrooveBorderColor"; }
if(BetSpeedSliderHandleBgColor == "") { wrongItems << "BetSpeedSliderHandleBgColor"; }
if(BetSpeedSliderHandleBorderColor == "") { wrongItems << "BetSpeedSliderHandleBorderColor"; }
// SIZE
if(ChatLogTextSize == "") { wrongItems << "ChatLogTextSize"; }
//if one or more items are wrong or left show detailed error message
@@ -554,7 +560,9 @@ void GameTableStyleReader::setWindowsGeometry(gameTableImpl *gt)
gt->actionFullScreen->setEnabled(TRUE);
}
else {
gt->actionFullScreen->setDisabled(TRUE);
gt->actionFullScreen->setDisabled(TRUE);
if(gt->isFullScreen())
gt->showNormal();
}
}
else {
@@ -569,7 +577,9 @@ void GameTableStyleReader::setWindowsGeometry(gameTableImpl *gt)
gt->actionFullScreen->setEnabled(TRUE);
}
else {
gt->actionFullScreen->setDisabled(TRUE);
gt->actionFullScreen->setDisabled(TRUE);
if(gt->isFullScreen())
gt->showNormal();
}
}
+13 -8
View File
@@ -47,14 +47,25 @@ public:
QString getSmallBlindPuck() const { return SmallBlindPuck; }
QString getBigBlindPuck() const { return BigBlindPuck; }
QString getHandRanking() const { return HandRanking; }
QString getActionPic(int);
QString getFKeyIndicatorColor() const { return FKeyIndicatorColor; }
QString getChanceLabelImpossibleColor() const { return ChanceLabelImpossibleColor; }
QString getChanceLabelPossibleColor() const { return ChanceLabelPossibleColor; }
QString getChatLogTextColor() const { return ChatLogTextColor; }
QString getChatTextNickNotifyColor() const { return ChatTextNickNotifyColor; }
QString getLogWinnerMainPotColor() const { return LogWinnerMainPotColor; }
QString getLogWinnerSidePotColor() const { return LogWinnerSidePotColor; }
QString getLogPlayerSitsOutColor() const { return LogPlayerSitsOutColor; }
QString getLogNewGameAdminColor() const { return LogNewGameAdminColor; }
QString getBreakLobbyButtonBgColor() const { return BreakLobbyButtonBgColor; }
QString getActionPic(int);
QString getMinimumWindowWidth() const { return MinimumWindowWidth; }
QString getMinimumWindowHeight() const { return MinimumWindowHeight; }
QString getMaximumWindowWidth() const { return MaximumWindowWidth; }
QString getMaximumWindowHeight() const { return MaximumWindowHeight; }
QString getIfFixedWindowSize() const { return IfFixedWindowSize; }
bool getFallBack() const { return fallBack; }
//set pictures
@@ -88,12 +99,6 @@ public:
void setButtonsStyle(MyActionButton*, MyActionButton*, MyActionButton*, MyActionButton*, int);
void setAwayRadioButtonsStyle(QRadioButton*);
QString getLogWinnerMainPotColor() const { return LogWinnerMainPotColor; }
QString getLogWinnerSidePotColor() const { return LogWinnerSidePotColor; }
QString getLogPlayerSitsOutColor() const { return LogPlayerSitsOutColor; }
QString getLogNewGameAdminColor() const { return LogNewGameAdminColor; }
QString getBreakLobbyButtonBgColor() const { return BreakLobbyButtonBgColor; }
private:
//style values
// INFOS