Add "Join official server" button
authorunc0rr
Wed, 22 Oct 2008 14:01:43 +0000
changeset 1395 46fd70de89e2
parent 1394 962001cfcf48
child 1396 abb28dcb6d0d
Add "Join official server" button
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/teamselhelper.cpp
--- a/QTfrontend/hwform.cpp	Tue Oct 21 18:31:40 2008 +0000
+++ b/QTfrontend/hwform.cpp	Wed Oct 22 14:01:43 2008 +0000
@@ -92,10 +92,11 @@
 	connect(ui.pageSelectWeapon->pWeapons,       SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
 	connect(ui.pageNetGame->pGameCFG,       SIGNAL(newWeaponsName(const QString&)), this, SLOT(NetWeaponNameChanged(const QString&)));
 
-	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
-	connect(ui.pageNet->BtnSpecifyServer,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
-	connect(ui.pageNet->BtnNetSvrStart,	SIGNAL(clicked()),	this, SLOT(GoToNetServer()));
-	connect(ui.pageNet,	SIGNAL(connectClicked(const QString &, quint16)),	this, SLOT(NetConnectServer(const QString &, quint16)));
+	connect(ui.pageNet->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
+	connect(ui.pageNet->BtnSpecifyServer, SIGNAL(clicked()), this, SLOT(NetConnect()));
+	connect(ui.pageNet->BtnOfficialServer, SIGNAL(clicked()), this, SLOT(NetConnectOfficialServer()));
+	connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(GoToNetServer()));
+	connect(ui.pageNet, SIGNAL(connectClicked(const QString &, quint16)), this, SLOT(NetConnectServer(const QString &, quint16)));
 	
 	connect(ui.pageNetServer->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
 	connect(ui.pageNetServer->BtnStart,	SIGNAL(clicked()),	this, SLOT(NetStartServer()));
@@ -401,7 +402,12 @@
 
 void HWForm::NetConnectServer(const QString & host, quint16 port)
 {
-  _NetConnect(host, port, ui.pageOptions->editNetNick->text());
+	_NetConnect(host, port, ui.pageOptions->editNetNick->text());
+}
+
+void HWForm::NetConnectOfficialServer()
+{
+	NetConnectServer("netserver.hedgewars.org", 46631);
 }
 
 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick)
--- a/QTfrontend/hwform.h	Tue Oct 21 18:31:40 2008 +0000
+++ b/QTfrontend/hwform.h	Wed Oct 22 14:01:43 2008 +0000
@@ -70,6 +70,7 @@
 	void StartTraining();
 	void NetConnect();
 	void NetConnectServer(const QString & host, quint16 port);
+	void NetConnectOfficialServer();
 	void NetStartServer();
 	void NetDisconnect();
 	void NetConnected();
--- a/QTfrontend/pages.cpp	Tue Oct 21 18:31:40 2008 +0000
+++ b/QTfrontend/pages.cpp	Wed Oct 22 14:01:43 2008 +0000
@@ -383,7 +383,9 @@
 	BtnNetSvrStart = new QPushButton(this);
 	BtnNetSvrStart->setFont(*font14);
 	BtnNetSvrStart->setText(QPushButton::tr("Start server"));
-	pageLayout->addWidget(BtnNetSvrStart, 3, 2);
+	pageLayout->addWidget(BtnNetSvrStart, 4, 2);
+
+	BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true);
 
 	ConnGroupBox = new QGroupBox(this);
 	ConnGroupBox->setTitle(QGroupBox::tr("Net game"));
@@ -412,7 +414,10 @@
 	BtnSpecifyServer->setText(QPushButton::tr("Specify"));
 	GBClayout->addWidget(BtnSpecifyServer, 2, 1);
 
-	BtnBack = addButton(":/res/Exit.png", pageLayout, 3, 0, true);
+	BtnOfficialServer = new QPushButton(ConnGroupBox);
+	BtnOfficialServer->setFont(*font14);
+	BtnOfficialServer->setText(QPushButton::tr("Join official server"));
+	GBClayout->addWidget(BtnOfficialServer, 3, 0, 1, 3);
 
 	connect(BtnNetConnect, SIGNAL(clicked()), this, SLOT(slotConnect()));
 }
--- a/QTfrontend/pages.h	Tue Oct 21 18:31:40 2008 +0000
+++ b/QTfrontend/pages.h	Wed Oct 22 14:01:43 2008 +0000
@@ -1,6 +1,6 @@
 /*
  * Hedgewars, a free turn based strategy game
- * Copyright (c) 2006, 2007 Andrey Korotaev <unC0Rr@gmail.com>
+ * Copyright (c) 2006-2008 Andrey Korotaev <unC0Rr@gmail.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -216,6 +216,7 @@
 	QPushButton * BtnNetConnect;
 	QPushButton * BtnNetSvrStart;
 	QPushButton * BtnSpecifyServer;
+	QPushButton * BtnOfficialServer;
 
 private:
 	QGroupBox * ConnGroupBox;
--- a/QTfrontend/teamselhelper.cpp	Tue Oct 21 18:31:40 2008 +0000
+++ b/QTfrontend/teamselhelper.cpp	Wed Oct 22 14:01:43 2008 +0000
@@ -40,7 +40,7 @@
 	setPalette(newPalette);
 	setAutoFillBackground(true);
 
-	mainLayout.setSpacing(0);
+	mainLayout.setSpacing(3);
 	mainLayout.setMargin(0);
 	this->setMaximumHeight(30);
 	QIcon difficultyIcon=team.isNetTeam() ?