Added callback to display player names of connected players.

This commit is contained in:
lotodore
2007-04-08 20:35:42 +00:00
parent e89b543a92
commit 07a0e01620
12 changed files with 32 additions and 8 deletions
+1
View File
@@ -99,4 +99,5 @@ void GuiWrapper::SignalNetClientError(int errorID, int osErrorID) { myW->SignalN
void GuiWrapper::SignalNetServerSuccess(int actionID) { }
void GuiWrapper::SignalNetServerError(int errorID, int osErrorID) { }
void GuiWrapper::SignalNetServerPlayerJoined(const string &playerName) { myW->SignalNetServerPlayerJoined(QString::fromUtf8(playerName.c_str())); }
+1
View File
@@ -99,6 +99,7 @@ public:
void SignalNetServerSuccess(int actionID);
void SignalNetServerError(int errorID, int osErrorID);
void SignalNetServerPlayerJoined(const std::string &playerName);
private:
+3
View File
@@ -544,6 +544,9 @@ mainWindowImpl::mainWindowImpl(QMainWindow *parent)
// Errors are handled globally, not within one dialog.
connect(this, SIGNAL(SignalNetClientError(int, int)), this, SLOT(networkError(int, int)));
connect(this, SIGNAL(SignalNetServerPlayerJoined(QString)), myStartNetworkGameDialog, SLOT(addConnectedPlayer(QString)));
// textBrowser_Log->append(QString::number(this->pos().x(),10)+" "+QString::number(this->pos().y(),10));
// textBrowser_Log->append(QString::number(this->x(),10)+" "+QString::number(this->y(),10));
+1
View File
@@ -94,6 +94,7 @@ signals:
void SignalNetClientConnect(int actionID);
void SignalNetClientGameInfo(int actionID);
void SignalNetClientError(int errorID, int osErrorID);
void SignalNetServerPlayerJoined(QString playerName);
public slots:
@@ -41,10 +41,10 @@ void startNetworkGameDialogImpl::cancel() {
}
void startNetworkGameDialogImpl::addConnectedPlayer(std::string playerName) {
void startNetworkGameDialogImpl::addConnectedPlayer(QString playerName) {
QTreeWidgetItem *item = new QTreeWidgetItem(treeWidget,0);
item->setData(0, 0, QString::fromUtf8(playerName.c_str()));
item->setData(0, 0, playerName);
}
void startNetworkGameDialogImpl::keyPressEvent ( QKeyEvent * event ) {
@@ -37,7 +37,7 @@ public slots:
void startGame();
void cancel();
void addConnectedPlayer(std::string);
void addConnectedPlayer(QString playerName);
void keyPressEvent ( QKeyEvent*);
};