# HG changeset patch # User unc0rr # Date 1223474091 0 # Node ID c2f09811bb8c1d5f678e9d18ffde720bbd9d71fc # Parent e56b178d6d62631f661138eba8a3f88e4874d74b Implement rooms list refresh diff -r e56b178d6d62 -r c2f09811bb8c QTfrontend/hwform.cpp --- a/QTfrontend/hwform.cpp Wed Oct 08 13:52:31 2008 +0000 +++ b/QTfrontend/hwform.cpp Wed Oct 08 13:54:51 2008 +0000 @@ -419,6 +419,8 @@ hwnet, SLOT(CreateRoom(const QString&))); connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)), hwnet, SLOT(JoinRoom(const QString&))); + connect(ui.pageRoomsList, SIGNAL(askForRoomList()), + hwnet, SLOT(askRoomsList())); connect(hwnet, SIGNAL(chatStringFromNet(const QStringList&)), ui.pageNetGame->pChatWidget, SLOT(onChatStringFromNet(const QStringList&))); diff -r e56b178d6d62 -r c2f09811bb8c QTfrontend/newnetclient.cpp --- a/QTfrontend/newnetclient.cpp Wed Oct 08 13:52:31 2008 +0000 +++ b/QTfrontend/newnetclient.cpp Wed Oct 08 13:54:51 2008 +0000 @@ -479,3 +479,13 @@ emit(chatStringFromNet(QStringList(mynick) << str)); } } + +void HWNewNet::askRoomsList() +{ + if(netClientState != 2) + { + qDebug("Illegal try to get rooms list!"); + return; + } + RawSendNet(QString("LIST")); +} diff -r e56b178d6d62 -r c2f09811bb8c QTfrontend/newnetclient.h --- a/QTfrontend/newnetclient.h Wed Oct 08 13:52:31 2008 +0000 +++ b/QTfrontend/newnetclient.h Wed Oct 08 13:54:51 2008 +0000 @@ -125,6 +125,7 @@ void onWeaponsNameChanged(const QString& name, const QString& ammo); void JoinRoom(const QString & room); void CreateRoom(const QString & room); + void askRoomsList(); private slots: void ClientRead(); diff -r e56b178d6d62 -r c2f09811bb8c QTfrontend/pages.cpp --- a/QTfrontend/pages.cpp Wed Oct 08 13:52:31 2008 +0000 +++ b/QTfrontend/pages.cpp Wed Oct 08 13:54:51 2008 +0000 @@ -636,6 +636,7 @@ connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick())); connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick())); + connect(BtnRefresh, SIGNAL(clicked()), this, SLOT(onRefreshClick())); connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick())); } @@ -653,7 +654,7 @@ else QMessageBox::critical(this, tr("Error"), - tr("Please, select record from the list"), + tr("Please, enter room name"), tr("OK")); } @@ -671,3 +672,8 @@ emit askForJoinRoom(curritem->data(Qt::DisplayRole).toString()); } +void PageRoomsList::onRefreshClick() +{ + emit askForRoomList(); +} + diff -r e56b178d6d62 -r c2f09811bb8c QTfrontend/pages.h --- a/QTfrontend/pages.h Wed Oct 08 13:52:31 2008 +0000 +++ b/QTfrontend/pages.h Wed Oct 08 13:54:51 2008 +0000 @@ -356,10 +356,12 @@ private slots: void onCreateClick(); void onJoinClick(); + void onRefreshClick(); signals: void askForCreateRoom(const QString &); void askForJoinRoom(const QString &); + void askForRoomList(); }; #endif // PAGES_H