new connected player list in waitforservertostartgame

This commit is contained in:
doitux
2007-05-06 21:15:43 +00:00
parent 476035f791
commit c3e102f745
7 changed files with 67 additions and 32 deletions
+3 -1
View File
@@ -93,7 +93,8 @@ void GuiWrapper::logNewGameHandMsg(int gameID, int handID) { myLog->logNewGameHa
void GuiWrapper::SignalNetClientConnect(int actionID) { myW->SignalNetClientConnect(actionID); }
void GuiWrapper::SignalNetClientGameInfo(int actionID) { myW->SignalNetClientGameInfo(actionID); }
void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->SignalNetClientError(errorID, osErrorID); }
void GuiWrapper::SignalNetClientPlayerJoined(const string &playerName) { myW->SignalNetClientPlayerJoined(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetClientPlayerLeft(const string &playerName) { myW->SignalNetClientPlayerLeft(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetClientGameStart(const GameData &gameData) { myW->SignalNetClientGameStart(gameData.numberOfPlayers, gameData.startCash, gameData.smallBlind, gameData.handsBeforeRaise); }
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
@@ -101,3 +102,4 @@ void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { }
void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { myW->SignalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); }
void GuiWrapper::SignalNetServerPlayerLeft(const string &playerName) { myW->SignalNetServerPlayerLeft(QString::fromUtf8(playerName.c_str())); }
+2
View File
@@ -93,6 +93,8 @@ public:
void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
void SignalNetClientPlayerJoined(const std::string &playerName);
void SignalNetClientPlayerLeft(const std::string &playerName);
void SignalNetClientGameStart(const GameData &gameData);
+3
View File
@@ -552,6 +552,9 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
//Nachrichten Thread-Save
connect(this, SIGNAL(SignalNetClientConnect(int)), myConnectToServerDialog, SLOT(refresh(int)));
connect(this, SIGNAL(SignalNetClientGameInfo(int)), myWaitingForServerGameDialog, SLOT(refresh(int)));
connect(this, SIGNAL(SignalNetClientPlayerJoined(QString)), myWaitingForServerGameDialog, SLOT(addConnectedPlayer(QString)));
connect(this, SIGNAL(SignalNetClientPlayerLeft(QString)), myWaitingForServerGameDialog, SLOT(removePlayer(QString)));
// Errors are handled globally, not within one dialog.
connect(this, SIGNAL(SignalNetClientError(int, int)), this, SLOT(networkError(int, int)));
connect(this, SIGNAL(SignalNetClientGameStart(int, int, int, int)), this, SLOT(networkStart(int, int, int, int)));
+3
View File
@@ -96,10 +96,13 @@ signals:
void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
void SignalNetClientPlayerJoined(QString playerName);
void SignalNetClientPlayerLeft(QString playerName);
void SignalNetClientGameStart(int numberOfPlayers, int startCash, int smallBlind, int handsBeforeRaise);
void SignalNetServerPlayerJoined(QString playerName);
void SignalNetServerPlayerLeft(QString playerName);
public slots:
void setGameSpeed(const int theValue) { guiGameSpeed = theValue; setSpeeds(); } // Achtung Faktor 10!!!
+40 -31
View File
@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>279</width>
<height>81</height>
<height>257</height>
</rect>
</property>
<property name="windowTitle" >
@@ -19,33 +19,26 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="1" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<item row="0" column="0" colspan="3" >
<widget class="QTreeWidget" name="treeWidget" >
<column>
<property name="text" >
<string> Connected Player </string>
</property>
</column>
</widget>
</item>
<item row="1" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<item row="1" column="0" colspan="3" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Waiting for the server to start the game ...</string>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</spacer>
</widget>
</item>
<item row="1" column="1" >
<item row="2" column="1" >
<widget class="QPushButton" name="pushButton_cancel" >
<property name="maximumSize" >
<size>
@@ -58,15 +51,31 @@
</property>
</widget>
</item>
<item row="0" column="0" colspan="3" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Waiting for the server to start the game ...</string>
<item row="2" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="2" column="2" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
@@ -45,3 +45,17 @@ void waitForServerToStartGameDialogImpl::keyPressEvent ( QKeyEvent * event ) {
// if (event->key() == 16777220) { pushButton_connect->click(); } //ENTER
}
void waitForServerToStartGameDialogImpl::addConnectedPlayer(QString playerName) {
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget,0);
item->setData(0, 0, playerName);
}
void waitForServerToStartGameDialogImpl::removePlayer(QString playerName) {
QList<QTreeWidgetItem *> list = treeWidget->findItems(playerName, Qt::MatchExactly, 0);
if(!list.empty()) {
treeWidget->takeTopLevelItem(treeWidget->indexOfTopLevelItem(list[0]));
}
}
@@ -38,6 +38,8 @@ public slots:
void refresh(int actionID);
void cancel();
void keyPressEvent ( QKeyEvent * event );
void addConnectedPlayer(QString playerName);
void removePlayer(QString playerName);
};
#endif