next steps startwindow-integration --> UNSTABLE

This commit is contained in:
doitux
2008-09-11 15:03:46 +00:00
parent f5ea154b09
commit 2af47e0c01
5 changed files with 125 additions and 119 deletions
+97 -102
View File
@@ -480,11 +480,8 @@ gameTableImpl::gameTableImpl(ConfigFile *c, QMainWindow *parent)
myConnectToServerDialog = boost::shared_ptr<connectToServerDialogImpl>(new connectToServerDialogImpl(this));
myStartNetworkGameDialog = boost::shared_ptr<startNetworkGameDialogImpl>(new startNetworkGameDialogImpl(this, myConfig));
myCreateNetworkGameDialog = boost::shared_ptr<createNetworkGameDialogImpl>(new createNetworkGameDialogImpl(this, myConfig));
myAboutPokerthDialog = boost::shared_ptr<aboutPokerthImpl>(new aboutPokerthImpl(this, myConfig));
// myGameLobbyDialog = boost::shared_ptr<gameLobbyDialogImpl>(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; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
for ( j=0; j<=1; j++ ) {
if (holeCardsArray[i][j]->getIsFlipside()) {
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; i<MAX_NUMBER_OF_PLAYERS; i++ ) {
for ( j=0; j<=1; j++ ) {
if (holeCardsArray[i][j]->getIsFlipside()) {
holeCardsArray[i][j]->setPixmap(*flipside, TRUE);
}
}
}
// Re-init audio.
mySDLPlayer->audioDone();
mySDLPlayer->initAudio();
}
void gameTableImpl::initGui(int speed)
{
//kill running Singleshots!!!
+1 -2
View File
@@ -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<aboutPokerthImpl> myAboutPokerthDialog;
boost::shared_ptr<newGameDialogImpl> myNewGameDialog;
boost::shared_ptr<settingsDialogImpl> mySettingsDialog;
boost::shared_ptr<selectAvatarDialogImpl> mySelectAvatarDialog;
+1 -7
View File
@@ -123,6 +123,7 @@
<addaction name="actionStart_Local_Game" />
<addaction name="menuNetwork_Game" />
<addaction name="actionInternet_Game" />
<addaction name="actionAbout_PokerTH" />
<addaction name="actionQuit" />
</widget>
<widget class="QMenu" name="menuSettings" >
@@ -131,15 +132,8 @@
</property>
<addaction name="actionConfigure_PokerTH" />
</widget>
<widget class="QMenu" name="menuAbout" >
<property name="title" >
<string>About</string>
</property>
<addaction name="actionAbout_PokerTH" />
</widget>
<addaction name="menuPokerTH" />
<addaction name="menuSettings" />
<addaction name="menuAbout" />
</widget>
<widget class="QStatusBar" name="statusbar" />
<action name="actionStart_Local_Game" >
@@ -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();
}
}
+12 -8
View File
@@ -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;