From dc5f7fb495931daf26b66786103728597a1a4689 Mon Sep 17 00:00:00 2001 From: floty Date: Sat, 22 Dec 2012 00:19:53 +0100 Subject: [PATCH 01/10] adapt log of local game to log of network/internet game --- src/engine/local_engine/localhand.cpp | 6 ++-- src/engine/local_engine/localplayer.cpp | 32 ++++++++-------------- src/engine/local_engine/localplayer.h | 6 ++-- src/engine/network_engine/clientplayer.cpp | 2 +- src/engine/network_engine/clientplayer.h | 2 +- src/engine/playerinterface.h | 4 +-- src/gui/qt/gametable/gametableimpl.cpp | 16 +++++------ src/gui/qt/gametable/log/guilog.h | 2 +- 8 files changed, 30 insertions(+), 40 deletions(-) diff --git a/src/engine/local_engine/localhand.cpp b/src/engine/local_engine/localhand.cpp index a54cc537..364d33b6 100755 --- a/src/engine/local_engine/localhand.cpp +++ b/src/engine/local_engine/localhand.cpp @@ -490,7 +490,7 @@ void LocalHand::setBlinds() (*it_c)->setMySet((*it_c)->getMyCash()); // 1 to do not log this - (*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1); + (*it_c)->setMyAction(PLAYER_ACTION_ALLIN); } else { (*it_c)->setMySet(smallBlind); @@ -510,7 +510,7 @@ void LocalHand::setBlinds() (*it_c)->setMySet((*it_c)->getMyCash()); // 1 to do not log this - (*it_c)->setMyAction(PLAYER_ACTION_ALLIN,1); + (*it_c)->setMyAction(PLAYER_ACTION_ALLIN); } else { (*it_c)->setMySet(2*smallBlind); @@ -526,7 +526,7 @@ void LocalHand::switchRounds() // logging last player action PlayerListConstIterator previousPlayerIt = getRunningPlayerIt(previousPlayerID); if(previousPlayerIt != runningPlayerList->end()) { - if(myLog) myLog->logPlayerAction((*previousPlayerIt)->getMyName(),myLog->transformPlayerActionLog((*previousPlayerIt)->getMyAction()),(*previousPlayerIt)->getMySet()); + if(myLog) myLog->logPlayerAction((*previousPlayerIt)->getMyName(),myLog->transformPlayerActionLog((*previousPlayerIt)->getMyAction()),(*previousPlayerIt)->getMyLastRelativeSet()); } PlayerListIterator it, it_1; diff --git a/src/engine/local_engine/localplayer.cpp b/src/engine/local_engine/localplayer.cpp index 34340e59..76bfb741 100755 --- a/src/engine/local_engine/localplayer.cpp +++ b/src/engine/local_engine/localplayer.cpp @@ -1068,7 +1068,7 @@ void LocalPlayer::action() //set that i was the last active player. need this for unhighlighting groupbox currentHand->setPreviousPlayerID(myID); - currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet); + currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, myLastRelativeSet); currentHand->getGuiInterface()->nextPlayerAnimation(); // cout << "playerID in action(): " << (*(currentHand->getCurrentBeRo()->getCurrentPlayersTurnIt()))->getMyID() << endl; @@ -3230,14 +3230,12 @@ void LocalPlayer::evaluation(int bet, int raise) case 3: { // all in if(highestSet >= myCash + mySet) { - mySet += myCash; - myCash = 0; + setMySet(myCash); myAction = PLAYER_ACTION_ALLIN; } // sonst else { - myCash = myCash - highestSet + mySet; - mySet = highestSet; + setMySet(highestSet-mySet); } } break; @@ -3250,16 +3248,14 @@ void LocalPlayer::evaluation(int bet, int raise) currentHand->getCurrentBeRo()->setFullBetRule(true); } currentHand->getCurrentBeRo()->setMinimumRaise(myCash); - mySet = myCash; - myCash = 0; + setMySet(myCash); myAction = PLAYER_ACTION_ALLIN; highestSet = mySet; } // sonst else { currentHand->getCurrentBeRo()->setMinimumRaise(bet); - myCash = myCash - bet; - mySet = bet; + setMySet(bet); highestSet = mySet; } @@ -3272,14 +3268,12 @@ void LocalPlayer::evaluation(int bet, int raise) if(currentHand->getCurrentBeRo()->getFullBetRule()) { // full bet rule -> only call possible // all in if(highestSet >= myCash + mySet) { - mySet += myCash; - myCash = 0; + setMySet(myCash); myAction = PLAYER_ACTION_ALLIN; } // sonst else { - myCash = myCash - highestSet + mySet; - mySet = highestSet; + setMySet(highestSet-mySet); myAction = PLAYER_ACTION_CALL; } } else { @@ -3292,8 +3286,7 @@ void LocalPlayer::evaluation(int bet, int raise) // perhaps full bet rule if(highestSet >= myCash + mySet) { // only call all-in - mySet += myCash; - myCash = 0; + setMySet(myCash); myAction = PLAYER_ACTION_ALLIN; } else { // raise, but not enough --> full bet rule @@ -3301,9 +3294,8 @@ void LocalPlayer::evaluation(int bet, int raise) // lastPlayerAction für Karten umblättern reihenfolge setzrn currentHand->setLastActionPlayerID(myUniqueID); - mySet += myCash; + setMySet(myCash); currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet); - myCash = 0; myAction = PLAYER_ACTION_ALLIN; highestSet = mySet; } @@ -3311,9 +3303,8 @@ void LocalPlayer::evaluation(int bet, int raise) // lastPlayerAction für Karten umblättern reihenfolge setzrn currentHand->setLastActionPlayerID(myUniqueID); - mySet += myCash; + setMySet(myCash); currentHand->getCurrentBeRo()->setMinimumRaise(mySet-highestSet); - myCash = 0; myAction = PLAYER_ACTION_ALLIN; highestSet = mySet; } @@ -3321,8 +3312,7 @@ void LocalPlayer::evaluation(int bet, int raise) // sonst else { currentHand->getCurrentBeRo()->setMinimumRaise(raise); - myCash = myCash + mySet - highestSet - raise; - mySet = highestSet + raise; + setMySet(highestSet+raise-mySet); highestSet = mySet; // lastPlayerAction für Karten umblättern reihenfolge setzrn currentHand->setLastActionPlayerID(myUniqueID); diff --git a/src/engine/local_engine/localplayer.h b/src/engine/local_engine/localplayer.h index a37c3fe7..ca98c608 100755 --- a/src/engine/local_engine/localplayer.h +++ b/src/engine/local_engine/localplayer.h @@ -113,10 +113,10 @@ public: return myLastRelativeSet; } - void setMyAction(PlayerAction theValue, bool blind = 0) { + void setMyAction(PlayerAction theValue, bool human = 0) { myAction = theValue; - // logging for human player - if(myAction && !blind) currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, mySet); + // logging for seat 0 + if(myAction && human) currentHand->getGuiInterface()->logPlayerActionMsg(myName, myAction, myLastRelativeSet); } PlayerAction getMyAction() const { return myAction; diff --git a/src/engine/network_engine/clientplayer.cpp b/src/engine/network_engine/clientplayer.cpp index ba42368b..cfa13e6d 100644 --- a/src/engine/network_engine/clientplayer.cpp +++ b/src/engine/network_engine/clientplayer.cpp @@ -195,7 +195,7 @@ ClientPlayer::getMyLastRelativeSet() const } void -ClientPlayer::setMyAction(PlayerAction theValue, bool /*blind*/) +ClientPlayer::setMyAction(PlayerAction theValue, bool /*human*/) { boost::recursive_mutex::scoped_lock lock(m_syncMutex); myAction = theValue; diff --git a/src/engine/network_engine/clientplayer.h b/src/engine/network_engine/clientplayer.h index 1ccdc7a7..6b33d8db 100644 --- a/src/engine/network_engine/clientplayer.h +++ b/src/engine/network_engine/clientplayer.h @@ -64,7 +64,7 @@ public: int getMySet() const; int getMyLastRelativeSet() const; - void setMyAction(PlayerAction theValue, bool blind); + void setMyAction(PlayerAction theValue, bool human); PlayerAction getMyAction() const; void setMyButton(int theValue); diff --git a/src/engine/playerinterface.h b/src/engine/playerinterface.h index 533fc394..46a124ec 100644 --- a/src/engine/playerinterface.h +++ b/src/engine/playerinterface.h @@ -62,8 +62,8 @@ public: virtual int getMySet() const =0; virtual int getMyLastRelativeSet() const =0; - virtual void setMyAction(PlayerAction theValue, bool blind=0) =0; - virtual PlayerAction getMyAction() const =0; + virtual void setMyAction(PlayerAction theValue, bool human=0) =0; + virtual PlayerAction getMyAction() const =0; virtual void setMyButton(int theValue) =0; virtual int getMyButton() const =0; diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index cc232a24..9fc7c494 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -1990,7 +1990,7 @@ void gameTableImpl::myFold() boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); boost::shared_ptr humanPlayer = currentHand->getSeatsList()->front(); - humanPlayer->setMyAction(PLAYER_ACTION_FOLD); + humanPlayer->setMyAction(PLAYER_ACTION_FOLD,true); humanPlayer->setMyTurn(0); //set that i was the last active player. need this for unhighlighting groupbox @@ -2009,7 +2009,7 @@ void gameTableImpl::myCheck() boost::shared_ptr currentHand = myStartWindow->getSession()->getCurrentGame()->getCurrentHand(); boost::shared_ptr humanPlayer = currentHand->getSeatsList()->front(); humanPlayer->setMyTurn(0); - humanPlayer->setMyAction(PLAYER_ACTION_CHECK); + humanPlayer->setMyAction(PLAYER_ACTION_CHECK,true); //set that i was the last active player. need this for unhighlighting groupbox currentHand->setPreviousPlayerID(0); @@ -2072,10 +2072,10 @@ void gameTableImpl::myCall() humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMyCash(0); - humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); + humanPlayer->setMyAction(PLAYER_ACTION_ALLIN,true); } else { humanPlayer->setMySet(tempHighestSet - humanPlayer->getMySet()); - humanPlayer->setMyAction(PLAYER_ACTION_CALL); + humanPlayer->setMyAction(PLAYER_ACTION_CALL,true); } humanPlayer->setMyTurn(0); @@ -2108,7 +2108,7 @@ void gameTableImpl::mySet() humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMyCash(0); - humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); + humanPlayer->setMyAction(PLAYER_ACTION_ALLIN,true); // full bet rule if(currentHand->getCurrentBeRo()->getHighestSet() + currentHand->getCurrentBeRo()->getMinimumRaise() > humanPlayer->getMySet()) { @@ -2119,7 +2119,7 @@ void gameTableImpl::mySet() if(myActionIsRaise) { //do not if allIn if(humanPlayer->getMyAction() != 6) { - humanPlayer->setMyAction(PLAYER_ACTION_RAISE); + humanPlayer->setMyAction(PLAYER_ACTION_RAISE,true); } myActionIsRaise = 0; @@ -2129,7 +2129,7 @@ void gameTableImpl::mySet() if(myActionIsBet) { //do not if allIn if(humanPlayer->getMyAction() != 6) { - humanPlayer->setMyAction(PLAYER_ACTION_BET); + humanPlayer->setMyAction(PLAYER_ACTION_BET,true); } myActionIsBet = 0; @@ -2166,7 +2166,7 @@ void gameTableImpl::myAllIn() humanPlayer->setMySet(humanPlayer->getMyCash()); humanPlayer->setMyCash(0); - humanPlayer->setMyAction(PLAYER_ACTION_ALLIN); + humanPlayer->setMyAction(PLAYER_ACTION_ALLIN,true); // full bet rule if(currentHand->getCurrentBeRo()->getHighestSet() + currentHand->getCurrentBeRo()->getMinimumRaise() > humanPlayer->getMySet()) { diff --git a/src/gui/qt/gametable/log/guilog.h b/src/gui/qt/gametable/log/guilog.h index e81c2e18..b3b5e861 100644 --- a/src/gui/qt/gametable/log/guilog.h +++ b/src/gui/qt/gametable/log/guilog.h @@ -21,9 +21,9 @@ #include #include #include +#include #include "configfile.h" -#include #include #include From f07c6f13333793b897977e8a897d8aa03d5163d9 Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 22 Dec 2012 01:22:28 +0100 Subject: [PATCH 02/10] android test fixes --- src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp | 6 ++++-- src/gui/qt/startwindow/startwindowimpl.cpp | 22 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp b/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp index b63c3d47..cc38e715 100755 --- a/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp +++ b/src/gui/qt/aboutpokerth/aboutpokerthimpl.cpp @@ -21,8 +21,10 @@ #include #ifdef ANDROID -#include -#include + #ifndef ANDROID_TEST + #include + #include + #endif #endif aboutPokerthImpl::aboutPokerthImpl(QWidget *parent, ConfigFile *c) diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index 91653e66..88534dc7 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -46,6 +46,13 @@ #include "logfiledialog.h" #include "guilog.h" +#ifdef ANDROID + #ifndef ANDROID_TEST + #include + #include + #endif +#endif + using namespace std; startWindowImpl::startWindowImpl(ConfigFile *c, Log *l) @@ -99,6 +106,21 @@ startWindowImpl::startWindowImpl(ConfigFile *c, Log *l) } this->showFullScreen(); + + //TODO HACK Missing QSystemScreenSaver::setScreenSaverInhibited(TRUE) + #ifndef ANDROID_TEST + JavaVM *currVM = (JavaVM *)QApplication::platformNativeInterface()->nativeResourceForWidget("JavaVM", 0); + JNIEnv* env; + if (currVM->AttachCurrentThread(&env, NULL)<0) { + qCritical()<<"AttachCurrentThread failed"; + } else { +// jclass jclassApplicationClass = env->FindClass("android/view/View"); +// if (jclassApplicationClass) { +// env->SetStaticIntField(jclassApplicationClass, env->GetStaticFieldID(jclassApplicationClass,"KEEP_SCREEN_ON", "I"), 1); +// } + currVM->DetachCurrentThread(); + } + #endif #else // this->menubar->setStyleSheet("QMenuBar { background-color: #4B4B4B; font-size:20px; border-width: 0px;} QMenuBar::item { color: #F0F0F0; }"); this->menubar->hide(); From 60f35815b02796414b6b57667a088892cb22669d Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 22 Dec 2012 08:06:10 +0100 Subject: [PATCH 03/10] android test fix --- pokerth_game.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pokerth_game.pro b/pokerth_game.pro index 59199d5e..a6bfdc48 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -655,6 +655,8 @@ maemo{ } android_test{ + #switch of android audio + CONFIG += android_api8 DEFINES += ANDROID DEFINES += ANDROID_TEST } From 755c71aa3b3bdc6a02b6ed3c68d4090b901e757b Mon Sep 17 00:00:00 2001 From: lotodore Date: Sat, 22 Dec 2012 13:37:21 +0100 Subject: [PATCH 04/10] Changelog fixes. --- ChangeLog | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index f34659d1..6f83485a 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,20 +1,21 @@ 2012-12-22 version 1.0-beta1 -- Support for bigger android screen resolutions enhancement(#160) -- Android sound support enhancement (#156) -- Online log file analyse tool (#146) -- game name in window title enhancement (#155) -- new card deck version for bottom action label possibility enhancement (#154) -- Emoticons for the chat enhancement (#153) -- Show only one game in log preview enhancement (#145) -- Extra column in lobby game list for timeouts enhancement (#140) -- Update flags enhancement (#137) -- Enable Activate the "accidentally call after big raise" blocker by default enhancement (#131) -- Server refactoring for libprotobuf usage which basically enables html5 clients +- Support for higher android screen resolutions (enhancement #160) +- Android sound support (enhancement #156) +- Online log file analysis tool (enhancement #146) +- Game name in window title (enhancement #155) +- New card deck version which supports changes of the action label position (enhancement #154) +- Emoticons for the chat (enhancement #153) +- Show only one game in the log preview (enhancement #145) +- Extra column in lobby game list for timeouts (enhancement #140) +- Updated country flags (enhancement #137) +- Enable activating the "accidentally call after big raise" blocker by default (enhancement #131) +- Server refactoring using google protocol buffers which basically enables use of html5 clients - Chatbot whitelist for poker expressions -- BUGFIX: Rich AI players raise although opponents are all-in bug (#4) -- BUGFIX: In rare case, winner doesn't win, money disappears (#3) -- BUGFIX: Chip Miscalculation bug (#152) -- BUGFIX: IPv6 setting grayed out bug (#148) +- BUGFIX: Rich AI players raise although opponents are all-in (bug #4) +- BUGFIX: In rare case, winner doesn't win, money disappears (bug #3) +- BUGFIX: Chip Miscalculation fixed (bug #152) +- BUGFIX: IPv6 settings are now correctly grayed out (bug #148) +- BUGFIX: Fixing rejoin after synchronization error (bug #147) 2012-06-21 version 0.9.5 - First experimental Android release (#80) From c879e3aed827f2786de40c986b348c32cc021411 Mon Sep 17 00:00:00 2001 From: floty Date: Sat, 22 Dec 2012 13:48:04 +0100 Subject: [PATCH 05/10] codes for handling error file upload (#146) --- src/game_defs.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/game_defs.h b/src/game_defs.h index 8efa04cd..026d30db 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -103,6 +103,19 @@ enum PlayerActionLog { LOG_ACTION_JOIN // has joined the game }; +enum LogUploadErrorCode { + ERROR_NO_FILE = 1, + ERROR_OPEN_DB = 2, + ERROR_MAX_NUM_TOTAL = 3, + ERROR_MAX_NUM_IP = 4, + ERROR_FILE_SIZE = 5, + ERROR_FILE_EXT = 6, + ERROR_FILE_HEAD = 7, + ERROR_ID = 8, + ERROR_FILE_MOVE = 9, + ERROR_INSERT_DB = 10 +}; + enum DenyKickPlayerReason { KICK_DENIED_INVALID_STATE = 0, KICK_DENIED_TOO_FEW_PLAYERS, From 6d904100dc13b113e4ada50d0a1feb4d6197a169 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sat, 22 Dec 2012 17:57:00 +0100 Subject: [PATCH 06/10] Fixing compiler warnings and cppcheck issues. --- .../changecompleteblindsdialogimpl.cpp | 2 +- src/gui/qt/changecontentdialog/changecontentdialogimpl.cpp | 2 +- .../createinternetgamedialog/createinternetgamedialogimpl.cpp | 2 +- .../qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp | 2 +- .../qt/internetgamelogindialog/internetgamelogindialogimpl.cpp | 2 +- src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp b/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp index dc48768c..417f5b0d 100644 --- a/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp +++ b/src/gui/qt/changecompleteblindsdialog/changecompleteblindsdialogimpl.cpp @@ -97,9 +97,9 @@ void changeCompleteBlindsDialogImpl::sortBlindsList() bool changeCompleteBlindsDialogImpl::eventFilter(QObject *obj, QEvent *event) { +#ifdef ANDROID QKeyEvent *keyEvent = static_cast(event); -#ifdef ANDROID //androi changes for return key behavior (hopefully useless from necessitas beta2) if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) { if(spinBox_afterThisAlwaysRaiseValue->hasFocus()) { diff --git a/src/gui/qt/changecontentdialog/changecontentdialogimpl.cpp b/src/gui/qt/changecontentdialog/changecontentdialogimpl.cpp index 868126d0..5544ee38 100644 --- a/src/gui/qt/changecontentdialog/changecontentdialogimpl.cpp +++ b/src/gui/qt/changecontentdialog/changecontentdialogimpl.cpp @@ -113,9 +113,9 @@ void changeContentDialogImpl::saveContent() bool changeContentDialogImpl::eventFilter(QObject *obj, QEvent *event) { +#ifdef ANDROID QKeyEvent *keyEvent = static_cast(event); -#ifdef ANDROID //androi changes for return key behavior (hopefully useless from necessitas beta2) if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) { if(lineEdit->hasFocus()) { diff --git a/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp b/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp index 251e4540..60d87147 100644 --- a/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp +++ b/src/gui/qt/createinternetgamedialog/createinternetgamedialogimpl.cpp @@ -235,9 +235,9 @@ void createInternetGameDialogImpl::gameTypeChanged() bool createInternetGameDialogImpl::eventFilter(QObject *obj, QEvent *event) { +#ifdef ANDROID QKeyEvent *keyEvent = static_cast(event); -#ifdef ANDROID //androi changes for return key behavior (hopefully useless from necessitas beta2) if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) { if(spinBox_startCash->hasFocus()) { diff --git a/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp b/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp index b48f589f..80f6e10c 100644 --- a/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp +++ b/src/gui/qt/createnetworkgamedialog/createnetworkgamedialogimpl.cpp @@ -132,9 +132,9 @@ void createNetworkGameDialogImpl::callChangeBlindsDialog(bool show) bool createNetworkGameDialogImpl::eventFilter(QObject *obj, QEvent *event) { +#ifdef ANDROID QKeyEvent *keyEvent = static_cast(event); -#ifdef ANDROID //androi changes for return key behavior (hopefully useless from necessitas beta2) if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) { if(spinBox_startCash ->hasFocus()) { diff --git a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp index 1c5b40f8..2caa4899 100644 --- a/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp +++ b/src/gui/qt/internetgamelogindialog/internetgamelogindialogimpl.cpp @@ -152,9 +152,9 @@ void internetGameLoginDialogImpl::okButtonCheck() bool internetGameLoginDialogImpl::eventFilter(QObject *obj, QEvent *event) { +#ifdef ANDROID QKeyEvent *keyEvent = static_cast(event); -#ifdef ANDROID //androi changes for return key behavior (hopefully useless from necessitas beta2) if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) { if(lineEdit_username->hasFocus()) { diff --git a/src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp b/src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp index d2b13143..e258fe4b 100755 --- a/src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp +++ b/src/gui/qt/newlocalgamedialog/newgamedialogimpl.cpp @@ -84,9 +84,9 @@ void newGameDialogImpl::callChangeBlindsDialog(bool show) bool newGameDialogImpl::eventFilter(QObject *obj, QEvent *event) { +#ifdef ANDROID QKeyEvent *keyEvent = static_cast(event); -#ifdef ANDROID //androi changes for return key behavior (hopefully useless from necessitas beta2) if (event->type() == QEvent::KeyPress && keyEvent->key() == Qt::Key_Return) { if(spinBox_gameSpeed->hasFocus()) { From fbcd47cb37b2691806958aeff3b790d99a159f54 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sat, 22 Dec 2012 18:09:33 +0100 Subject: [PATCH 07/10] Fixing mac build. --- pokerth_game.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/pokerth_game.pro b/pokerth_game.pro index a6bfdc48..6f0af10d 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -578,6 +578,7 @@ mac { -lssl \ -lsqlite3 \ -ltinyxml \ + -lprotobuf \ -lz \ -framework \ Carbon From dc11a850dc04385a1fc827ed786780c5ced31de0 Mon Sep 17 00:00:00 2001 From: doitux Date: Sat, 22 Dec 2012 19:08:23 +0100 Subject: [PATCH 08/10] please android_test now ;D --- pokerth_game.pro | 5 +++-- src/gui/qt/sound/soundevents.cpp | 22 +++++++++++----------- src/gui/qt/sound/soundevents.h | 23 ++++++++++++----------- 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/pokerth_game.pro b/pokerth_game.pro index a6bfdc48..45411407 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -655,8 +655,9 @@ maemo{ } android_test{ - #switch of android audio - CONFIG += android_api8 DEFINES += ANDROID DEFINES += ANDROID_TEST + DEFINES += ANDROID_API8 + HEADERS += src/gui/qt/sound/androidapi8dummy.h + SOURCES += src/gui/qt/sound/androidapi8dummy.cpp } diff --git a/src/gui/qt/sound/soundevents.cpp b/src/gui/qt/sound/soundevents.cpp index d31acc93..1226b694 100644 --- a/src/gui/qt/sound/soundevents.cpp +++ b/src/gui/qt/sound/soundevents.cpp @@ -1,13 +1,13 @@ #include "soundevents.h" #ifdef ANDROID -#ifdef ANDROID_API8 -#include "androidapi8dummy.h" + #ifdef ANDROID_API8 + #include "androidapi8dummy.h" + #else + #include "androidaudio.h" + #endif #else -#include "androidaudio.h" -#endif -#else -#include "sdlplayer.h" + #include "sdlplayer.h" #endif @@ -22,11 +22,11 @@ SoundEvents::SoundEvents(ConfigFile *c): myConfig(c), lastSBValue(0), lastSBLeve { #ifdef ANDROID -#ifdef ANDROID_API8 - myPlayer = new AndroidApi8Dummy(myConfig); -#else - myPlayer = new AndroidAudio(myConfig); -#endif + #ifdef ANDROID_API8 + myPlayer = new AndroidApi8Dummy(myConfig); + #else + myPlayer = new AndroidAudio(myConfig); + #endif #else myPlayer = new SDLPlayer(myConfig); #endif diff --git a/src/gui/qt/sound/soundevents.h b/src/gui/qt/sound/soundevents.h index a584b4f4..1f7849da 100644 --- a/src/gui/qt/sound/soundevents.h +++ b/src/gui/qt/sound/soundevents.h @@ -4,13 +4,13 @@ #include #ifdef ANDROID -#ifdef ANDROID_API8 -class AndroidApi8Dummy; + #ifdef ANDROID_API8 + class AndroidApi8Dummy; + #else + class AndroidAudio; + #endif #else -class AndroidAudio; -#endif -#else -class SDLPlayer; + class SDLPlayer; #endif @@ -34,14 +34,15 @@ protected: private: #ifdef ANDROID -#ifdef ANDROID_API8 - AndroidApi8Dummy *myPlayer; -#else - AndroidAudio *myPlayer; -#endif + #ifdef ANDROID_API8 + AndroidApi8Dummy *myPlayer; + #else + AndroidAudio *myPlayer; + #endif #else SDLPlayer *myPlayer; #endif + ConfigFile *myConfig; int lastSBValue; unsigned int lastSBLevel; From ae786702f6ead662e9c31e92007c21fd2a8b9171 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sat, 22 Dec 2012 19:57:45 +0100 Subject: [PATCH 09/10] Handle specific web server errors during log file upload. --- src/game_defs.h | 23 ++++++++------ src/gui/qt/logfiledialog/logfiledialog.cpp | 37 +++++++++++++++++++--- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/src/game_defs.h b/src/game_defs.h index 026d30db..63a81380 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -103,17 +103,20 @@ enum PlayerActionLog { LOG_ACTION_JOIN // has joined the game }; +#define LOG_UPLOAD_ERROR_PREFIX "ERROR" +#define LOG_UPLOAD_ID_SIZE 40 + enum LogUploadErrorCode { - ERROR_NO_FILE = 1, - ERROR_OPEN_DB = 2, - ERROR_MAX_NUM_TOTAL = 3, - ERROR_MAX_NUM_IP = 4, - ERROR_FILE_SIZE = 5, - ERROR_FILE_EXT = 6, - ERROR_FILE_HEAD = 7, - ERROR_ID = 8, - ERROR_FILE_MOVE = 9, - ERROR_INSERT_DB = 10 + LOG_UPLOAD_ERROR_NO_FILE = 1, + LOG_UPLOAD_ERROR_OPEN_DB = 2, + LOG_UPLOAD_ERROR_MAX_NUM_TOTAL = 3, + LOG_UPLOAD_ERROR_MAX_NUM_IP = 4, + LOG_UPLOAD_ERROR_FILE_SIZE = 5, + LOG_UPLOAD_ERROR_FILE_EXT = 6, + LOG_UPLOAD_ERROR_FILE_HEAD = 7, + LOG_UPLOAD_ERROR_ID = 8, + LOG_UPLOAD_ERROR_FILE_MOVE = 9, + LOG_UPLOAD_ERROR_INSERT_DB = 10 }; enum DenyKickPlayerReason { diff --git a/src/gui/qt/logfiledialog/logfiledialog.cpp b/src/gui/qt/logfiledialog/logfiledialog.cpp index d1f8b101..2d7b1753 100644 --- a/src/gui/qt/logfiledialog/logfiledialog.cpp +++ b/src/gui/qt/logfiledialog/logfiledialog.cpp @@ -27,6 +27,7 @@ #include "guilog.h" #include "configfile.h" #include "mymessagebox.h" +#include #include LogFileDialog::LogFileDialog(QWidget *parent, ConfigFile *c) : @@ -223,7 +224,7 @@ void LogFileDialog::uploadFile() uploadInProgressAnimationStart(); uploader->QueueUpload( - "http://pokerth.net/log_file_analysis/upload.php", + "http://pokerth.net/log_file_analysis/upload.php", "", "", file.fileName().toStdString(), @@ -260,7 +261,7 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage) QString id = returnMessage.trimmed(); - if(id.length() == 40 && !id.contains("ERROR")) { + if(id.length() == LOG_UPLOAD_ID_SIZE && !id.contains(LOG_UPLOAD_ERROR_PREFIX)) { qDebug() << id << endl; QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID="+id)); @@ -268,8 +269,36 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage) qDebug() << returnMessage << endl; QString serverMsg(tr("Processing of the log file on the web server failed.\nPlease verify that you are uploading a valid PokerTH log file.")); // if there is a readable message, display it. - if (!returnMessage.isEmpty() && returnMessage.size() < 128) { - serverMsg += "\n" + tr("Failure reason: ") + returnMessage; + if (returnMessage.startsWith(LOG_UPLOAD_ERROR_PREFIX)) { + serverMsg += "\n" + tr("Failure reason: "); + QString errorCodeStr = returnMessage.mid(sizeof(LOG_UPLOAD_ERROR_PREFIX)).trimmed(); + int errorCode = errorCodeStr.toInt(); + switch (errorCode) + { + case LOG_UPLOAD_ERROR_NO_FILE : + serverMsg += tr("No file received."); + break; + case LOG_UPLOAD_ERROR_MAX_NUM_TOTAL : + serverMsg += tr("File rejected because of too many uploads."); + break; + case LOG_UPLOAD_ERROR_MAX_NUM_IP : + serverMsg += tr("File rejected because of too many recent uploads. Please try again later."); + break; + case LOG_UPLOAD_ERROR_FILE_SIZE : + serverMsg += tr("The file is too large."); + break; + case LOG_UPLOAD_ERROR_FILE_EXT : + case LOG_UPLOAD_ERROR_FILE_HEAD : + serverMsg += tr("This file is not a valid and current PokerTH log file."); + break; + case LOG_UPLOAD_ERROR_OPEN_DB : + case LOG_UPLOAD_ERROR_ID : + case LOG_UPLOAD_ERROR_FILE_MOVE : + case LOG_UPLOAD_ERROR_INSERT_DB : + default : + serverMsg += tr("Internal error. Please try again later. ID: ") + errorCodeStr; + break; + } } MyMessageBox::warning( this, tr("Uploading log file"), serverMsg, QMessageBox::Close ); From d9f6bd88c222e257a1b6c11f69b146d88bea6a90 Mon Sep 17 00:00:00 2001 From: lotodore Date: Sat, 22 Dec 2012 20:56:00 +0100 Subject: [PATCH 10/10] More work on log upload error codes. --- src/game_defs.h | 1 - src/gui/qt/logfiledialog/logfiledialog.cpp | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/game_defs.h b/src/game_defs.h index 63a81380..07a0bde2 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -103,7 +103,6 @@ enum PlayerActionLog { LOG_ACTION_JOIN // has joined the game }; -#define LOG_UPLOAD_ERROR_PREFIX "ERROR" #define LOG_UPLOAD_ID_SIZE 40 enum LogUploadErrorCode { diff --git a/src/gui/qt/logfiledialog/logfiledialog.cpp b/src/gui/qt/logfiledialog/logfiledialog.cpp index 2d7b1753..d4b0b0aa 100644 --- a/src/gui/qt/logfiledialog/logfiledialog.cpp +++ b/src/gui/qt/logfiledialog/logfiledialog.cpp @@ -261,19 +261,17 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage) QString id = returnMessage.trimmed(); - if(id.length() == LOG_UPLOAD_ID_SIZE && !id.contains(LOG_UPLOAD_ERROR_PREFIX)) { + if(id.length() == LOG_UPLOAD_ID_SIZE && id.at(0) != '<') { qDebug() << id << endl; QDesktopServices::openUrl(QUrl("http://logfile-analysis.pokerth.net/?ID="+id)); } else { qDebug() << returnMessage << endl; QString serverMsg(tr("Processing of the log file on the web server failed.\nPlease verify that you are uploading a valid PokerTH log file.")); - // if there is a readable message, display it. - if (returnMessage.startsWith(LOG_UPLOAD_ERROR_PREFIX)) { + // if there is an error code, display a corresponding message. + if (returnMessage.at(0).isDigit()) { serverMsg += "\n" + tr("Failure reason: "); - QString errorCodeStr = returnMessage.mid(sizeof(LOG_UPLOAD_ERROR_PREFIX)).trimmed(); - int errorCode = errorCodeStr.toInt(); - switch (errorCode) + switch (returnMessage.toInt()) { case LOG_UPLOAD_ERROR_NO_FILE : serverMsg += tr("No file received."); @@ -296,7 +294,7 @@ void LogFileDialog::showLogAnalysis(QString /*filename*/, QString returnMessage) case LOG_UPLOAD_ERROR_FILE_MOVE : case LOG_UPLOAD_ERROR_INSERT_DB : default : - serverMsg += tr("Internal error. Please try again later. ID: ") + errorCodeStr; + serverMsg += tr("Internal error. Please try again later. ID: ") + returnMessage; break; } }