Enable admin button when have privilege. Button does nothing yet.
authorunc0rr
Mon, 02 Mar 2009 21:20:45 +0000
changeset 1856 e71dbf958c87
parent 1855 a2a9b8544ecc
child 1857 b835395659e2
Enable admin button when have privilege. Button does nothing yet.
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/hwform.cpp	Mon Mar 02 21:13:34 2009 +0000
+++ b/QTfrontend/hwform.cpp	Mon Mar 02 21:20:45 2009 +0000
@@ -482,6 +482,8 @@
 
 	connect(hwnet, SIGNAL(roomsList(const QStringList&)),
 		ui.pageRoomsList, SLOT(setRoomsList(const QStringList&)));
+	connect(hwnet, SIGNAL(adminAccess(bool)),
+		ui.pageRoomsList, SLOT(setAdmin(bool)));
 	
 	connect(hwnet, SIGNAL(serverMessage(const QString&)),
 		ui.pageRoomsList->chatWidget, SLOT(onServerMessage(const QString&)));
--- a/QTfrontend/newnetclient.cpp	Mon Mar 02 21:13:34 2009 +0000
+++ b/QTfrontend/newnetclient.cpp	Mon Mar 02 21:20:45 2009 +0000
@@ -231,6 +231,7 @@
 		RawSendNet(QString("PROTO%1%2").arg(delimeter).arg(*cProtoVer));
 		netClientState = 1;
 		m_game_connected = true;
+		emit adminAccess(false);
 		return;
 	}
 
@@ -565,6 +566,12 @@
 		return;
 	}
 
+
+	if (lst[0] == "ADMIN_ACCESS") {
+		emit adminAccess(true);
+		return;
+	}
+
 	qWarning() << "Net: Unknown message:" << lst;
 }
 
--- a/QTfrontend/newnetclient.h	Mon Mar 02 21:13:34 2009 +0000
+++ b/QTfrontend/newnetclient.h	Mon Mar 02 21:20:45 2009 +0000
@@ -99,8 +99,9 @@
   void nickAddedLobby(const QString& nick);
   void nickRemovedLobby(const QString& nick);
   void FromNet(const QByteArray & buf);
+  void adminAccess(bool);
+
   void AddNetTeam(const HWTeam&);
-
   void seedChanged(const QString & seed);
   void mapChanged(const QString & map);
   void themeChanged(const QString & theme);
--- a/QTfrontend/pages.cpp	Mon Mar 02 21:13:34 2009 +0000
+++ b/QTfrontend/pages.cpp	Mon Mar 02 21:20:45 2009 +0000
@@ -765,10 +765,12 @@
 	pageLayout->addWidget(chatWidget, 4, 0, 1, 2);
 	pageLayout->setRowStretch(4, 350);
 
-	BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true);
 	BtnCreate = addButton(tr("Create"), pageLayout, 0, 1);
 	BtnJoin = addButton(tr("Join"), pageLayout, 1, 1);
 	BtnRefresh = addButton(tr("Refresh"), pageLayout, 3, 1);
+	
+	BtnBack = addButton(":/res/Exit.png", pageLayout, 5, 0, true);
+	BtnAdmin = addButton(tr("Admin features"), pageLayout, 5, 1);
 
 	connect(BtnCreate, SIGNAL(clicked()), this, SLOT(onCreateClick()));
 	connect(BtnJoin, SIGNAL(clicked()), this, SLOT(onJoinClick()));
@@ -776,6 +778,10 @@
 	connect(roomsList, SIGNAL(doubleClicked (const QModelIndex &)), this, SLOT(onJoinClick()));
 }
 
+void PageRoomsList::setAdmin(bool flag)
+{
+	BtnAdmin->setVisible(flag);
+}
 
 void PageRoomsList::setRoomsList(const QStringList & list)
 {
--- a/QTfrontend/pages.h	Mon Mar 02 21:13:34 2009 +0000
+++ b/QTfrontend/pages.h	Mon Mar 02 21:20:45 2009 +0000
@@ -369,10 +369,12 @@
 	QPushButton * BtnCreate;
 	QPushButton * BtnJoin;
 	QPushButton * BtnRefresh;
+	QPushButton * BtnAdmin;
 	HWChatWidget * chatWidget;
 	
 public slots:
 	void setRoomsList(const QStringList & list);
+	void setAdmin(bool);
 
 private slots:
 	void onCreateClick();