Implements protocol message JOINING on frontend, so client in a room always displays correct room name, even when room name changes. Fixes
issue #522.
--- a/QTfrontend/hwform.cpp Sat Feb 09 18:32:51 2013 -0500
+++ b/QTfrontend/hwform.cpp Sat Feb 09 18:58:19 2013 -0500
@@ -1238,6 +1238,8 @@
this, SLOT(NetGameChangeStatus(bool)), Qt::QueuedConnection);
// net page stuff
+ connect(hwnet, SIGNAL(roomNameUpdated(const QString &)),
+ ui.pageNetGame, SLOT(setRoomName(const QString &)));
connect(hwnet, SIGNAL(chatStringFromNet(const QString&)),
ui.pageNetGame->chatWidget, SLOT(onChatString(const QString&)), Qt::QueuedConnection);
--- a/QTfrontend/net/newnetclient.cpp Sat Feb 09 18:32:51 2013 -0500
+++ b/QTfrontend/net/newnetclient.cpp Sat Feb 09 18:58:19 2013 -0500
@@ -512,9 +512,12 @@
QString roomName = tmp.takeFirst();
m_roomsListModel->updateRoom(roomName, tmp);
- // keep track of room name so correct name is displayed when you become room admin
+ // keep track of room name so correct name is displayed
if(myroom == roomName)
+ {
myroom = tmp[1];
+ emit roomNameUpdated(myroom);
+ }
return;
}
@@ -598,6 +601,18 @@
return;
}
+ if(lst[0] == "JOINING")
+ {
+ if(lst.size() < 2)
+ {
+ qWarning("Net: Bad JOINING message");
+ return;
+ }
+
+ myroom = lst[1];
+ emit roomNameUpdated(myroom);
+ }
+
if(netClientState == InLobby && lst[0] == "JOINED")
{
if(lst.size() < 2 || lst[1] != mynick)
--- a/QTfrontend/net/newnetclient.h Sat Feb 09 18:32:51 2013 -0500
+++ b/QTfrontend/net/newnetclient.h Sat Feb 09 18:58:19 2013 -0500
@@ -105,6 +105,7 @@
void FromNet(const QByteArray & buf);
void adminAccess(bool);
void roomMaster(bool);
+ void roomNameUpdated(const QString & name);
void netSchemeConfig(QStringList &);
void paramChanged(const QString & param, const QStringList & value);
--- a/QTfrontend/ui/page/pagenetgame.h Sat Feb 09 18:32:51 2013 -0500
+++ b/QTfrontend/ui/page/pagenetgame.h Sat Feb 09 18:58:19 2013 -0500
@@ -35,12 +35,6 @@
public:
PageNetGame(QWidget* parent);
- /**
- * Sets the room name to display.
- * @param roomName room name to be displayed.
- */
- void setRoomName(const QString & roomName);
-
void setSettings(QSettings * settings);
void displayError(const QString & message);
@@ -62,6 +56,7 @@
GameCFGWidget* pGameCFG;
public slots:
+ void setRoomName(const QString & roomName);
void setReadyStatus(bool isReady);
void setUser(const QString & nickname);
void onUpdateClick();