Add button for controlling room options (no usefull yet)
authorunc0rr
Fri, 24 Oct 2008 17:30:30 +0000
changeset 1409 d1cbe4a57ebf
parent 1408 fab171a17968
child 1410 eece43296890
Add button for controlling room options (no usefull yet)
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/hwform.cpp	Fri Oct 24 15:02:26 2008 +0000
+++ b/QTfrontend/hwform.cpp	Fri Oct 24 17:30:30 2008 +0000
@@ -29,6 +29,7 @@
 #include <QCloseEvent>
 #include <QCheckBox>
 #include <QTextBrowser>
+#include <QAction>
 
 #include "hwform.h"
 #include "game.h"
@@ -435,6 +436,10 @@
 		hwnet, SLOT(CreateRoom(const QString&)));
 	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
 		hwnet, SLOT(JoinRoom(const QString&)));
+	connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)),
+		this, SLOT(NetGameMaster()));
+	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
+		this, SLOT(NetGameSlave()));
 	connect(ui.pageRoomsList, SIGNAL(askForRoomList()),
 		hwnet, SLOT(askRoomsList()));
 
@@ -726,3 +731,15 @@
 	else
 		sdli.StopMusic();
 }
+
+void HWForm::NetGameMaster()
+{
+	ui.pageNetGame->BtnMaster->setVisible(true);
+	ui.pageNetGame->restrictJoins->setChecked(false);
+	ui.pageNetGame->restrictTeamAdds->setChecked(false);
+}
+
+void HWForm::NetGameSlave()
+{
+	ui.pageNetGame->BtnMaster->setVisible(false);
+}
--- a/QTfrontend/hwform.h	Fri Oct 24 15:02:26 2008 +0000
+++ b/QTfrontend/hwform.h	Fri Oct 24 17:30:30 2008 +0000
@@ -87,6 +87,8 @@
 	void NetWeaponNameChanged(const QString& name);
 	void onFrontendFullscreen(bool value);
 	void Music(bool checked);
+	void NetGameMaster();
+	void NetGameSlave();
 
 private:
 	void _NetConnect(const QString & hostName, quint16 port, const QString & nick);
--- a/QTfrontend/pages.cpp	Fri Oct 24 15:02:26 2008 +0000
+++ b/QTfrontend/pages.cpp	Fri Oct 24 17:30:30 2008 +0000
@@ -35,6 +35,8 @@
 #include <QTabWidget>
 #include <QTextBrowser>
 #include <QTableWidget>
+#include <QAction>
+#include <QMenu>
 
 #include "pages.h"
 #include "sdlkeys.h"
@@ -523,7 +525,7 @@
 
 	// chatwidget
 	pChatWidget = new HWChatWidget(this);
-	pageLayout->addWidget(pChatWidget, 1, 0);
+	pageLayout->addWidget(pChatWidget, 1, 0, 2, 1);
 	pageLayout->setRowStretch(1, 100);
 
 	pGameCFG = new GameCFGWidget(this);
@@ -533,12 +535,25 @@
 	pNetTeamsWidget->setAcceptOuter(true);
 	pageLayout->addWidget(pNetTeamsWidget, 0, 1, 2, 1);
 
-	BtnBack = addButton(":/res/Exit.png", pageLayout, 2, 0, true);
-
 	BtnGo = new QPushButton(this);
 	BtnGo->setFont(*font14);
 	BtnGo->setText(QPushButton::tr("Ready"));
-	pageLayout->addWidget(BtnGo, 2, 1);
+	pageLayout->addWidget(BtnGo, 3, 1);
+
+	BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true);
+
+	BtnMaster = addButton(tr("Control"), pageLayout, 2, 1);
+	QMenu * menu = new QMenu(BtnMaster);
+	startGame = new QAction(QAction::tr("Start"), menu);
+	restrictJoins = new QAction(QAction::tr("Restrict Joins"), menu);
+	restrictJoins->setCheckable(true);
+	restrictTeamAdds = new QAction(QAction::tr("Restrict Team Additions"), menu);
+	restrictTeamAdds->setCheckable(true);
+	menu->addAction(startGame);
+	menu->addAction(restrictJoins);
+	menu->addAction(restrictTeamAdds);
+	
+	BtnMaster->setMenu(menu);
 }
 
 PageInfo::PageInfo(QWidget* parent) : AbstractPage(parent)
--- a/QTfrontend/pages.h	Fri Oct 24 15:02:26 2008 +0000
+++ b/QTfrontend/pages.h	Fri Oct 24 17:30:30 2008 +0000
@@ -41,6 +41,7 @@
 class QTableView;
 class QTextBrowser;
 class QTableWidget;
+class QAction;
 
 class GameCFGWidget;
 class TeamSelWidget;
@@ -67,7 +68,7 @@
     if (!iconed) {
       butt->setFont(*font14);
       butt->setText(btname);
-      butt->setStyleSheet("background-color: #0d0544");
+      //butt->setStyleSheet("background-color: #0d0544");
     } else {
       const QIcon& lp=QIcon(btname);
       QSize sz = lp.actualSize(QSize(65535, 65535));
@@ -261,6 +262,11 @@
 
 	QPushButton *BtnBack;
 	QPushButton *BtnGo;
+	QPushButton *BtnMaster;
+	
+	QAction * startGame;
+	QAction * restrictJoins;
+	QAction * restrictTeamAdds;
 
 	HWChatWidget* pChatWidget;