From 98d7e84ed2d53188d45613aa6e6330b0af648799 Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 10 Jul 2010 13:25:23 +0000 Subject: [PATCH] move some style related defines and enums back to gui context --- src/game_defs.h | 10 ---------- src/gui/qt/styles/carddeckstylereader.h | 10 ++++++++++ src/gui/qt/styles/gametablestylereader.cpp | 17 ++++++++--------- src/gui/qt/styles/gametablestylereader.h | 14 ++++++++++++-- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/game_defs.h b/src/game_defs.h index 88367bf1..62017461 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -35,8 +35,6 @@ #define POKERTH_BETA_REVISION 0 #define POKERTH_BETA_RELEASE_STRING "0.8-svn" -#define POKERTH_GT_STYLE_FILE_VERSION 2 -#define POKERTH_CD_STYLE_FILE_VERSION 1 enum ServerMode { SERVER_MODE_LAN, @@ -134,12 +132,4 @@ struct ServerStats unsigned maxPlayersLoggedIn; }; -enum StyleState { - OK = 0, - OUTDATED, - FIELDS_EMPTY, - PICTURES_MISSING, - NOT_READABLE -}; - #endif diff --git a/src/gui/qt/styles/carddeckstylereader.h b/src/gui/qt/styles/carddeckstylereader.h index 551c91d1..bb980d58 100644 --- a/src/gui/qt/styles/carddeckstylereader.h +++ b/src/gui/qt/styles/carddeckstylereader.h @@ -26,6 +26,16 @@ #include #include +#define POKERTH_CD_STYLE_FILE_VERSION 1 + +enum CdStyleState { + CD_STYLE_OK = 0, + CD_STYLE_OUTDATED, + CD_STYLE_FIELDS_EMPTY, + CD_STYLE_PICTURES_MISSING, + CD_STYLE_NOT_READABLE +}; + class CardDeckStyleReader : public QObject { Q_OBJECT public: diff --git a/src/gui/qt/styles/gametablestylereader.cpp b/src/gui/qt/styles/gametablestylereader.cpp index 3275a1e0..35d0750d 100644 --- a/src/gui/qt/styles/gametablestylereader.cpp +++ b/src/gui/qt/styles/gametablestylereader.cpp @@ -23,7 +23,6 @@ #include #include - using namespace std; GameTableStyleReader::GameTableStyleReader(ConfigFile *c, QWidget *w) : myConfig(c), myW(w), fallBack(0), loadedSuccessfull(0) @@ -482,20 +481,20 @@ void GameTableStyleReader::readStyleFile(QString file) { //set loadedSuccessfull TRUE if everything works if(leftItems.isEmpty() && itemPicsLeft.isEmpty() && PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() == POKERTH_GT_STYLE_FILE_VERSION) { loadedSuccessfull = 1; - myState = OK; + myState = GT_STYLE_OK; } else loadedSuccessfull = 1; //check for style file version if(PokerTHStyleFileVersion != "" && PokerTHStyleFileVersion.toInt() != POKERTH_GT_STYLE_FILE_VERSION) - myState = OUTDATED; + myState = GT_STYLE_OUTDATED; else { //if one or more items are left - if(!leftItems.isEmpty() && myW != 0) myState = FIELDS_EMPTY; + if(!leftItems.isEmpty() && myW != 0) myState = GT_STYLE_FIELDS_EMPTY; //if one or more pictures where not found - if(!itemPicsLeft.isEmpty() && myW != 0) myState = PICTURES_MISSING; + if(!itemPicsLeft.isEmpty() && myW != 0) myState = GT_STYLE_PICTURES_MISSING; } } } @@ -881,13 +880,13 @@ QString GameTableStyleReader::getFallBackFieldContent(QString field, int type) QString GameTableStyleReader::getMyStateToolTipInfo() { switch (myState) { - case OK: return QString(tr("Everything OK!")); + case GT_STYLE_OK: return QString(tr("Everything OK!")); break; - case PICTURES_MISSING: return QString(tr("Some pictures are missing, please contact style maintainer for this issue.")); + case GT_STYLE_PICTURES_MISSING: return QString(tr("Some pictures are missing, please contact style maintainer for this issue.")); break; - case FIELDS_EMPTY: return QString(tr("Some style fields are missing, please contact style maintainer for this issue.")); + case GT_STYLE_FIELDS_EMPTY: return QString(tr("Some style fields are missing, please contact style maintainer for this issue.")); break; - case OUTDATED: return QString(tr("This style is outdated, please contact style maintainer for this issue.")); + case GT_STYLE_OUTDATED: return QString(tr("This style is outdated, please contact style maintainer for this issue.")); break; default: return QString(""); } diff --git a/src/gui/qt/styles/gametablestylereader.h b/src/gui/qt/styles/gametablestylereader.h index 5358385b..2b80f457 100644 --- a/src/gui/qt/styles/gametablestylereader.h +++ b/src/gui/qt/styles/gametablestylereader.h @@ -28,6 +28,16 @@ #include #include +#define POKERTH_GT_STYLE_FILE_VERSION 2 + +enum GtStyleState { + GT_STYLE_OK = 0, + GT_STYLE_OUTDATED, + GT_STYLE_FIELDS_EMPTY, + GT_STYLE_PICTURES_MISSING, + GT_STYLE_NOT_READABLE +}; + class gameTableImpl; class GameTableStyleReader : public QObject { @@ -77,7 +87,7 @@ public: bool getFallBack() const { return fallBack; } bool getLoadedSuccessfull() const { return loadedSuccessfull; } - StyleState getState() const { return myState; } + GtStyleState getState() const { return myState; } //set pictures void setTableBackground(gameTableImpl*); @@ -294,7 +304,7 @@ private: bool fallBack; bool loadedSuccessfull; - StyleState myState; + GtStyleState myState; };