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) diff --git a/pokerth_game.pro b/pokerth_game.pro index 59199d5e..f458b64b 100644 --- a/pokerth_game.pro +++ b/pokerth_game.pro @@ -578,6 +578,7 @@ mac { -lssl \ -lsqlite3 \ -ltinyxml \ + -lprotobuf \ -lz \ -framework \ Carbon @@ -657,4 +658,7 @@ maemo{ android_test{ 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/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/game_defs.h b/src/game_defs.h index 8efa04cd..07a0bde2 100644 --- a/src/game_defs.h +++ b/src/game_defs.h @@ -103,6 +103,21 @@ enum PlayerActionLog { LOG_ACTION_JOIN // has joined the game }; +#define LOG_UPLOAD_ID_SIZE 40 + +enum LogUploadErrorCode { + 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 { KICK_DENIED_INVALID_STATE = 0, KICK_DENIED_TOO_FEW_PLAYERS, 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/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/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 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/logfiledialog/logfiledialog.cpp b/src/gui/qt/logfiledialog/logfiledialog.cpp index d1f8b101..d4b0b0aa 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,16 +261,42 @@ 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.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.isEmpty() && returnMessage.size() < 128) { - serverMsg += "\n" + tr("Failure reason: ") + returnMessage; + // if there is an error code, display a corresponding message. + if (returnMessage.at(0).isDigit()) { + serverMsg += "\n" + tr("Failure reason: "); + switch (returnMessage.toInt()) + { + 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: ") + returnMessage; + break; + } } MyMessageBox::warning( this, tr("Uploading log file"), serverMsg, QMessageBox::Close ); 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()) { 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; 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();