From 2af47e0c01e9340b20547179cb2f1a06d28476a8 Mon Sep 17 00:00:00 2001 From: doitux Date: Thu, 11 Sep 2008 15:03:46 +0000 Subject: [PATCH] next steps startwindow-integration --> UNSTABLE --- src/gui/qt/gametable/gametableimpl.cpp | 199 ++++++++++----------- src/gui/qt/gametable/gametableimpl.h | 3 +- src/gui/qt/startwindow.ui | 8 +- src/gui/qt/startwindow/startwindowimpl.cpp | 14 ++ src/gui/qt/startwindow/startwindowimpl.h | 20 ++- 5 files changed, 125 insertions(+), 119 deletions(-) diff --git a/src/gui/qt/gametable/gametableimpl.cpp b/src/gui/qt/gametable/gametableimpl.cpp index a5c6a53c..d530dd73 100755 --- a/src/gui/qt/gametable/gametableimpl.cpp +++ b/src/gui/qt/gametable/gametableimpl.cpp @@ -480,11 +480,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) myConnectToServerDialog = boost::shared_ptr(new connectToServerDialogImpl(this)); myStartNetworkGameDialog = boost::shared_ptr(new startNetworkGameDialogImpl(this, myConfig)); myCreateNetworkGameDialog = boost::shared_ptr(new createNetworkGameDialogImpl(this, myConfig)); - myAboutPokerthDialog = boost::shared_ptr(new aboutPokerthImpl(this, myConfig)); -// myGameLobbyDialog = boost::shared_ptr(new gameLobbyDialogImpl(this, myConfig)); myStartNetworkGameDialog->setMyW(this); -// myGameLobbyDialog->setMyW(this); myTimeoutDialog.reset(new timeoutMsgBoxImpl(this)); @@ -533,12 +530,7 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent) connect(blinkingStartButtonAnimationTimer, SIGNAL(timeout()), this, SLOT( blinkingStartButtonAnimationAction())); - connect( actionNewGame, SIGNAL( triggered() ), this, SLOT( callNewGameDialog() ) ); - connect( actionAboutPokerth, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) ); connect( actionSettings, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) ); - connect( actionJoin_network_Game, SIGNAL( triggered() ), this, SLOT( callJoinNetworkGameDialog() ) ); - connect( actionCreate_network_Game, SIGNAL( triggered() ), this, SLOT( callCreateNetworkGameDialog() ) ); - connect( actionInternet_Game, SIGNAL( triggered() ), this, SLOT( callGameLobbyDialog() ) ); connect( actionQuit, SIGNAL( triggered() ), this, SLOT( quitPokerTH() ) ); connect( actionFullScreen, SIGNAL( triggered() ), this, SLOT( switchFullscreen() ) ); connect( actionShowHideChat, SIGNAL( triggered() ), this, SLOT( switchChatWindow() ) ); @@ -792,8 +784,6 @@ void gameTableImpl::startNewLocalGame(newGameDialogImpl *v) { } -void gameTableImpl::callAboutPokerthDialog() { myAboutPokerthDialog->exec(); } - void gameTableImpl::callCreateNetworkGameDialog() { myCreateNetworkGameDialog->exec(); @@ -998,101 +988,106 @@ void gameTableImpl::callSettingsDialog() { mySettingsDialog->exec(); if (mySettingsDialog->result() == QDialog::Accepted && mySettingsDialog->getSettingsCorrect()) { - //Toolbox verstecken? - if (myConfig->readConfigInt("ShowLeftToolBox")) { groupBox_LeftToolBox->show(); } - else { groupBox_LeftToolBox->hide(); } - - if (myConfig->readConfigInt("ShowRightToolBox")) { groupBox_RightToolBox->show(); } - else { groupBox_RightToolBox->hide(); } - - //Add avatar (if set) - mySession->addOwnAvatar(myConfig->readConfigString("MyAvatar")); - - //Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen - if (mySettingsDialog->getPlayerNickIsChanged() && mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) { - - Game *currentGame = mySession->getCurrentGame(); - PlayerListIterator it = currentGame->getSeatsList()->begin(); - (*it)->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData()); - (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent1Name->text().toUtf8().constData()); - (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent2Name->text().toUtf8().constData()); - (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent3Name->text().toUtf8().constData()); - (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent4Name->text().toUtf8().constData()); - (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent5Name->text().toUtf8().constData()); - (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent6Name->text().toUtf8().constData()); - mySettingsDialog->setPlayerNickIsChanged(FALSE); - - refreshPlayerName(); - } - - if(mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) { - - Game *currentGame = mySession->getCurrentGame(); - PlayerListIterator it = currentGame->getSeatsList()->begin(); - (*it)->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData()); - (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent1Avatar->getMyLink().toUtf8().constData()); - (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent2Avatar->getMyLink().toUtf8().constData()); - (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent3Avatar->getMyLink().toUtf8().constData()); - (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent4Avatar->getMyLink().toUtf8().constData()); - (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent5Avatar->getMyLink().toUtf8().constData()); - (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent6Avatar->getMyLink().toUtf8().constData()); - - //avatar refresh - refreshPlayerAvatar(); - } - - //Flipside refresh - if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") { - - flipside = new QPixmap(); - *flipside = QPixmap::fromImage(QImage(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()))); - } - else { - flipside = new QPixmap(); - *flipside = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/flipside.png")); - } - - //Check for anti-peek mode - if(mySession->getCurrentGame()) { - QPixmap tempCardsPixmapArray[2]; - int tempCardsIntArray[2]; - - mySession->getCurrentGame()->getSeatsList()->front()->getMyCards(tempCardsIntArray); - if(myConfig->readConfigInt("AntiPeekMode")) { - holeCardsArray[0][0]->setPixmap(*flipside, TRUE); - tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[0], 10)+".png")); - holeCardsArray[0][0]->setFrontPixmap(tempCardsPixmapArray[0]); - holeCardsArray[0][1]->setPixmap(*flipside, TRUE); - tempCardsPixmapArray[1]= QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[1], 10)+".png")); - holeCardsArray[0][1]->setFrontPixmap(tempCardsPixmapArray[1]); - } - else { - tempCardsPixmapArray[0]= QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[0], 10)+".png")); - holeCardsArray[0][0]->setPixmap(tempCardsPixmapArray[0],FALSE); - tempCardsPixmapArray[1]= QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[1], 10)+".png")); - holeCardsArray[0][1]->setPixmap(tempCardsPixmapArray[1],FALSE); - } - } - - if(mySession->getCurrentGame()) { - //blind buttons refresh - refreshButton(); - } - int i,j; - - for (i=1; igetIsFlipside()) { - holeCardsArray[i][j]->setPixmap(*flipside, TRUE); - } - } - } - // Re-init audio. - mySDLPlayer->audioDone(); - mySDLPlayer->initAudio(); + applySettings(); } } +void gameTableImpl::applySettings() { + + //Toolbox verstecken? + if (myConfig->readConfigInt("ShowLeftToolBox")) { groupBox_LeftToolBox->show(); } + else { groupBox_LeftToolBox->hide(); } + + if (myConfig->readConfigInt("ShowRightToolBox")) { groupBox_RightToolBox->show(); } + else { groupBox_RightToolBox->hide(); } + + //Add avatar (if set) + mySession->addOwnAvatar(myConfig->readConfigString("MyAvatar")); + + //Falls Spielernamen geändert wurden --> neu zeichnen --> erst beim nächsten Neustart neu ausgelesen + if (mySettingsDialog->getPlayerNickIsChanged() && mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) { + + Game *currentGame = mySession->getCurrentGame(); + PlayerListIterator it = currentGame->getSeatsList()->begin(); + (*it)->setMyName(mySettingsDialog->lineEdit_HumanPlayerName->text().toUtf8().constData()); + (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent1Name->text().toUtf8().constData()); + (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent2Name->text().toUtf8().constData()); + (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent3Name->text().toUtf8().constData()); + (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent4Name->text().toUtf8().constData()); + (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent5Name->text().toUtf8().constData()); + (*(++it))->setMyName(mySettingsDialog->lineEdit_Opponent6Name->text().toUtf8().constData()); + mySettingsDialog->setPlayerNickIsChanged(FALSE); + + refreshPlayerName(); + } + + if(mySession->getCurrentGame() && !mySession->isNetworkClientRunning()) { + + Game *currentGame = mySession->getCurrentGame(); + PlayerListIterator it = currentGame->getSeatsList()->begin(); + (*it)->setMyAvatar(mySettingsDialog->pushButton_HumanPlayerAvatar->getMyLink().toUtf8().constData()); + (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent1Avatar->getMyLink().toUtf8().constData()); + (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent2Avatar->getMyLink().toUtf8().constData()); + (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent3Avatar->getMyLink().toUtf8().constData()); + (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent4Avatar->getMyLink().toUtf8().constData()); + (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent5Avatar->getMyLink().toUtf8().constData()); + (*(++it))->setMyAvatar(mySettingsDialog->pushButton_Opponent6Avatar->getMyLink().toUtf8().constData()); + + //avatar refresh + refreshPlayerAvatar(); + } + + //Flipside refresh + if (myConfig->readConfigInt("FlipsideOwn") && myConfig->readConfigString("FlipsideOwnFile") != "") { + + flipside = new QPixmap(); + *flipside = QPixmap::fromImage(QImage(QString::fromUtf8(myConfig->readConfigString("FlipsideOwnFile").c_str()))); + } + else { + flipside = new QPixmap(); + *flipside = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/flipside.png")); + } + + //Check for anti-peek mode + if(mySession->getCurrentGame()) { + QPixmap tempCardsPixmapArray[2]; + int tempCardsIntArray[2]; + + mySession->getCurrentGame()->getSeatsList()->front()->getMyCards(tempCardsIntArray); + if(myConfig->readConfigInt("AntiPeekMode")) { + holeCardsArray[0][0]->setPixmap(*flipside, TRUE); + tempCardsPixmapArray[0] = QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[0], 10)+".png")); + holeCardsArray[0][0]->setFrontPixmap(tempCardsPixmapArray[0]); + holeCardsArray[0][1]->setPixmap(*flipside, TRUE); + tempCardsPixmapArray[1]= QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[1], 10)+".png")); + holeCardsArray[0][1]->setFrontPixmap(tempCardsPixmapArray[1]); + } + else { + tempCardsPixmapArray[0]= QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[0], 10)+".png")); + holeCardsArray[0][0]->setPixmap(tempCardsPixmapArray[0],FALSE); + tempCardsPixmapArray[1]= QPixmap::fromImage(QImage(myAppDataPath +"gfx/cards/default/"+QString::number(tempCardsIntArray[1], 10)+".png")); + holeCardsArray[0][1]->setPixmap(tempCardsPixmapArray[1],FALSE); + } + } + + if(mySession->getCurrentGame()) { + //blind buttons refresh + refreshButton(); + } + int i,j; + + for (i=1; igetIsFlipside()) { + holeCardsArray[i][j]->setPixmap(*flipside, TRUE); + } + } + } + // Re-init audio. + mySDLPlayer->audioDone(); + mySDLPlayer->initAudio(); +} + void gameTableImpl::initGui(int speed) { //kill running Singleshots!!! diff --git a/src/gui/qt/gametable/gametableimpl.h b/src/gui/qt/gametable/gametableimpl.h index a8b0d2a2..0e1411f7 100755 --- a/src/gui/qt/gametable/gametableimpl.h +++ b/src/gui/qt/gametable/gametableimpl.h @@ -200,8 +200,8 @@ public slots: void setGameSpeed(const int theValue) { guiGameSpeed = theValue; setSpeeds(); } // Achtung Faktor 10!!! void callNewGameDialog() ; - void callAboutPokerthDialog(); void callSettingsDialog(); + void applySettings(); void callCreateNetworkGameDialog(); void callJoinNetworkGameDialog(); void callGameLobbyDialog(); @@ -404,7 +404,6 @@ private: QPixmap *flipside; // Dialogs - boost::shared_ptr myAboutPokerthDialog; boost::shared_ptr myNewGameDialog; boost::shared_ptr mySettingsDialog; boost::shared_ptr mySelectAvatarDialog; diff --git a/src/gui/qt/startwindow.ui b/src/gui/qt/startwindow.ui index e5179116..eb44f9c8 100644 --- a/src/gui/qt/startwindow.ui +++ b/src/gui/qt/startwindow.ui @@ -123,6 +123,7 @@ + @@ -131,15 +132,8 @@ - - - About - - - - diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index 0cca30a5..7f32ef37 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -89,6 +89,9 @@ startWindowImpl::startWindowImpl(ConfigFile *c) connect( pushButton_Create_Network_Game, SIGNAL( clicked() ), this, SLOT( callCreateNetworkGameDialog() ) ); connect( actionJoin_Network_Game, SIGNAL( triggered() ), this, SLOT( callJoinNetworkGameDialog() ) ); connect( pushButton_Join_Network_Game, SIGNAL( clicked() ), this, SLOT( callJoinNetworkGameDialog() ) ); + + connect( actionAbout_PokerTH, SIGNAL( triggered() ), this, SLOT( callAboutPokerthDialog() ) ); + connect( actionConfigure_PokerTH, SIGNAL( triggered() ), this, SLOT( callSettingsDialog() ) ); connect(this, SIGNAL(signalShowClientDialog()), this, SLOT(showClientDialog())); @@ -396,3 +399,14 @@ void startWindowImpl::showNetworkStartDialog() myServerGuiInterface->getSession().terminateNetworkServer(); } } + +void startWindowImpl::callAboutPokerthDialog() { myAboutPokerthDialog->exec(); } + +void startWindowImpl::callSettingsDialog() { + + mySettingsDialog->exec(); + + if (mySettingsDialog->result() == QDialog::Accepted && mySettingsDialog->getSettingsCorrect()) { + myGuiInterface->getMyW()->applySettings(); + } +} diff --git a/src/gui/qt/startwindow/startwindowimpl.h b/src/gui/qt/startwindow/startwindowimpl.h index 45060ce7..01315e65 100644 --- a/src/gui/qt/startwindow/startwindowimpl.h +++ b/src/gui/qt/startwindow/startwindowimpl.h @@ -89,14 +89,18 @@ signals: public slots: - void callNewGameDialog(); - void callGameLobbyDialog(); - void callCreateNetworkGameDialog(); - void callJoinNetworkGameDialog(); - void showLobbyDialog(); - void joinGameLobby(); - void showClientDialog(); - void showNetworkStartDialog(); + + void callAboutPokerthDialog(); + void callSettingsDialog(); + void callNewGameDialog(); + void callGameLobbyDialog(); + void callCreateNetworkGameDialog(); + void callJoinNetworkGameDialog(); + void showLobbyDialog(); + void joinGameLobby(); + void showClientDialog(); + void showNetworkStartDialog(); + private: ConfigFile *myConfig;