From 5f8d2d18e7785e5d5757e9360ded19460c382451 Mon Sep 17 00:00:00 2001 From: doitux Date: Thu, 9 Apr 2009 23:57:25 +0000 Subject: [PATCH] adds style version number to check if style is outdated --- .../gui/table/danuxi1/danuxi1tablestyle.xml | 1 + .../gui/table/default/defaulttablestyle.xml | 1 + src/game_defs.h | 2 ++ src/gui/qt/gametable/gametableimpl.cpp | 28 ++++++++----------- src/gui/qt/styles/gametablestylereader.cpp | 16 +++++++++-- src/gui/qt/styles/gametablestylereader.h | 1 + 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/data/gfx/gui/table/danuxi1/danuxi1tablestyle.xml b/data/gfx/gui/table/danuxi1/danuxi1tablestyle.xml index 1710ec24..e8c978c8 100644 --- a/data/gfx/gui/table/danuxi1/danuxi1tablestyle.xml +++ b/data/gfx/gui/table/danuxi1/danuxi1tablestyle.xml @@ -3,6 +3,7 @@ + diff --git a/data/gfx/gui/table/default/defaulttablestyle.xml b/data/gfx/gui/table/default/defaulttablestyle.xml index 6eb9fb0e..f8974df7 100644 --- a/data/gfx/gui/table/default/defaulttablestyle.xml +++ b/data/gfx/gui/table/default/defaulttablestyle.xml @@ -3,6 +3,7 @@ + diff --git a/src/game_defs.h b/src/game_defs.h index d58684c3..3f4547df 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -35,6 +35,8 @@ #define POKERTH_BETA_REVISION 0 #define POKERTH_BETA_RELEASE_STRING "0.7-beta1" +#define PokerTH_STYLE_FILE_VERSION 1 + enum ServerNetworkMode { NETWORK_MODE_TCP = 1, NETWORK_MODE_SCTP = 2, diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index 075c5643..d5ab2da9 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -1285,10 +1285,6 @@ void gameTableImpl::provideMyActions(int mode) { Game *currentGame = myStartWindow->getSession()->getCurrentGame(); HandInterface *currentHand = currentGame->getCurrentHand(); -// cout << "provideMyActions get myAction" << currentHand->getSeatsList()->front()->getMyAction() << endl; -// cout << "provideMyActions get mySet" << currentGame->getSeatsList()->front()->getMySet() << endl; -// cout << "provideMyActions get HighestSet" << currentHand->getCurrentBeRo()->getHighestSet() << endl; - //really disabled buttons if human player is fold/all-in or ... and not called from dealberocards if(/*pushButton_BetRaise->isCheckable() && */mode != 0 && (currentHand->getSeatsList()->front()->getMyAction() == PLAYER_ACTION_ALLIN || currentHand->getSeatsList()->front()->getMyAction() == PLAYER_ACTION_FOLD || (currentGame->getSeatsList()->front()->getMySet() == currentHand->getCurrentBeRo()->getHighestSet() && (currentGame->getSeatsList()->front()->getMyAction() != PLAYER_ACTION_NONE)))) { @@ -1408,9 +1404,9 @@ void gameTableImpl::provideMyActions(int mode) { //if value changed on bet/raise button --> uncheck to prevent unwanted actions - QString lastBetValueString = lastPushButtonBetRaiseString.section(" ",1 ,1); + QString lastBetValueString = lastPushButtonBetRaiseString; int index = lastBetValueString.indexOf("$"); - lastBetValueString.remove(index,1); + lastBetValueString.remove(0, index+1); bool ok; int lastBetValue = lastBetValueString.toInt(&ok,10); @@ -1582,9 +1578,9 @@ int gameTableImpl::getMyCallAmount() { int gameTableImpl::getBetRaisePushButtonValue() { - QString betValueString = pushButton_BetRaise->text().section(" ",1 ,1); + QString betValueString = pushButton_BetRaise->text(); int index = betValueString.indexOf("$"); - betValueString.remove(index,1); + betValueString.remove(0, index+1); bool ok; int betValue = betValueString.toInt(&ok,10); @@ -3161,16 +3157,16 @@ void gameTableImpl::refreshActionButtonFKeyIndicator(bool clear) } else { if(myConfig->readConfigInt("AlternateFKeysUserActionMode") == 0 ){ - pushButton_AllIn->setFKeyText("F4"); - pushButton_BetRaise->setFKeyText("F3"); - pushButton_CallCheck->setFKeyText("F2"); - pushButton_Fold->setFKeyText("F1"); + if(!pushButton_AllIn->text().isEmpty()) pushButton_AllIn->setFKeyText("F4"); + if(!pushButton_BetRaise->text().isEmpty()) pushButton_BetRaise->setFKeyText("F3"); + if(!pushButton_CallCheck->text().isEmpty()) pushButton_CallCheck->setFKeyText("F2"); + if(!pushButton_Fold->text().isEmpty()) pushButton_Fold->setFKeyText("F1"); } else { - pushButton_AllIn->setFKeyText("F1"); - pushButton_BetRaise->setFKeyText("F2"); - pushButton_CallCheck->setFKeyText("F3"); - pushButton_Fold->setFKeyText("F4"); + if(!pushButton_AllIn->text().isEmpty()) pushButton_AllIn->setFKeyText("F1"); + if(!pushButton_BetRaise->text().isEmpty()) pushButton_BetRaise->setFKeyText("F2"); + if(!pushButton_CallCheck->text().isEmpty()) pushButton_CallCheck->setFKeyText("F3"); + if(!pushButton_Fold->text().isEmpty()) pushButton_Fold->setFKeyText("F4"); } } } diff --git a/src/gui/qt/styles/gametablestylereader.cpp b/src/gui/qt/styles/gametablestylereader.cpp index 0bc698b1..b073b4c5 100644 --- a/src/gui/qt/styles/gametablestylereader.cpp +++ b/src/gui/qt/styles/gametablestylereader.cpp @@ -107,6 +107,7 @@ void GameTableStyleReader::readStyleFile(QString file) { // INFOS if(itemsList->ValueStr() == "StyleDescription") { StyleDescription = QString::fromUtf8(tempString1.c_str()); } else if(itemsList->ValueStr() == "StyleMaintainerEMail") { StyleMaintainerEMail = QString::fromUtf8(tempString1.c_str()); } + else if(itemsList->ValueStr() == "PokerTHStyleFileVersion") { PokerTHStyleFileVersion = QString::fromUtf8(tempString1.c_str()); } // WINDOWS SETTINGS else if (itemsList->ValueStr() == "IfFixedWindowSize") { IfFixedWindowSize = QString::fromUtf8(tempString1.c_str()); } else if (itemsList->ValueStr() == "FixedWindowWidth") { FixedWindowWidth = QString::fromUtf8(tempString1.c_str()); } @@ -233,6 +234,7 @@ void GameTableStyleReader::readStyleFile(QString file) { // INFOS if(StyleDescription == "") { leftItems << "StyleDescription"; } + if(PokerTHStyleFileVersion == "") { leftItems << "PokerTHStyleFileVersion"; } // WINDOWS SETTINGS if(IfFixedWindowSize == "") { leftItems << "IfFixedWindowSize"; } if(FixedWindowWidth == "") { leftItems << "FixedWindowWidth"; } @@ -433,8 +435,16 @@ void GameTableStyleReader::readStyleFile(QString file) { //if one or more items are left show detailed error message if(!leftItems.isEmpty() && myW != 0) showLeftItemsErrorMessage(StyleDescription, leftItems, StyleMaintainerEMail); - //if one or more pictures where not found show detailed error message - if(!itemPicsLeft.isEmpty() && myW != 0) showItemPicsLeftErrorMessage(StyleDescription, itemPicsLeft, StyleMaintainerEMail); + else { + //if one or more pictures where not found show detailed error message + if(!itemPicsLeft.isEmpty() && myW != 0) showItemPicsLeftErrorMessage(StyleDescription, itemPicsLeft, StyleMaintainerEMail); + //check for style file version + if(!PokerTHStyleFileVersion.isEmpty() && PokerTHStyleFileVersion.toInt() != PokerTH_STYLE_FILE_VERSION) { + QMessageBox::warning(myW, tr("Game Table Style Error"), + tr("Selected game table style \"%1\" seems to be outdated. \n The current PokerTH game table style version is \"%2\", but this style has version \"%3\" set. \n\nPlease contact the game table style builder %4.").arg(StyleDescription).arg(PokerTH_STYLE_FILE_VERSION).arg(PokerTHStyleFileVersion).arg(StyleMaintainerEMail), + QMessageBox::Ok); + } + } } else { qDebug() << "could not load game table style file: " << tinyFileName.c_str(); } } @@ -444,7 +454,7 @@ void GameTableStyleReader::showLeftItemsErrorMessage(QString style, QStringList QString items = failedItems.join(", "); QMessageBox::warning(myW, tr("Game Table Style Error"), - tr("Current game table style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of \"%2\" is/are left. \n\nPlease contact the game table style builder %3.").arg(style).arg(items).arg(email), + tr("Selected game table style \"%1\" seems to be incomplete or defective. \n\nThe value(s) of \"%2\" is/are left. \n\nPlease contact the game table style builder %3.").arg(style).arg(items).arg(email), QMessageBox::Ok); } diff --git a/src/gui/qt/styles/gametablestylereader.h b/src/gui/qt/styles/gametablestylereader.h index c5c7d888..58b76a3f 100644 --- a/src/gui/qt/styles/gametablestylereader.h +++ b/src/gui/qt/styles/gametablestylereader.h @@ -112,6 +112,7 @@ private: // INFOS QString StyleDescription; QString StyleMaintainerEMail; + QString PokerTHStyleFileVersion; // WINDOWS SETTINGS QString IfFixedWindowSize; QString FixedWindowWidth;