Implement rooms list refresh
authorunc0rr
Wed, 08 Oct 2008 13:54:51 +0000
changeset 1315 c2f09811bb8c
parent 1314 e56b178d6d62
child 1316 50514e45d0b5
Implement rooms list refresh
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
QTfrontend/pages.cpp
QTfrontend/pages.h
--- 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&)));
--- 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"));
+}
--- 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();
--- 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();
+}
+
--- 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