Added callback to display player names of connected players.
This commit is contained in:
@@ -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())); }
|
||||
|
||||
|
||||
@@ -99,6 +99,7 @@ public:
|
||||
|
||||
void SignalNetServerSuccess(int actionID);
|
||||
void SignalNetServerError(int errorID, int osErrorID);
|
||||
void SignalNetServerPlayerJoined(const std::string &playerName);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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*);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user