- Make look better
authorunc0rr
Mon, 04 Aug 2008 20:29:13 +0000
changeset 1150 ae86e36dad2e
parent 1149 c2d3b4f71836
child 1151 ee6573db301a
- Make look better - Refactor code a bit
QTfrontend/hwform.cpp
QTfrontend/main.cpp
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/res/HedgewarsTitle.png
QTfrontend/res/LocalPlay.png
QTfrontend/res/Network play.png
--- a/QTfrontend/hwform.cpp	Mon Aug 04 19:28:01 2008 +0000
+++ b/QTfrontend/hwform.cpp	Mon Aug 04 20:29:13 2008 +0000
@@ -56,9 +56,6 @@
 
 	connect(ui.pageMain->BtnSinglePlayer,	SIGNAL(clicked()),	this, SLOT(GoToSinglePlayer()));
 	connect(ui.pageMain->BtnSetup,	SIGNAL(clicked()),	this, SLOT(GoToSetup()));
-	connect(ui.pageMain->BtnMultiplayer,	SIGNAL(clicked()),	this, SLOT(GoToMultiplayer()));
-	connect(ui.pageMain->BtnLoad,	SIGNAL(clicked()),	this, SLOT(GoToSaves()));
-	connect(ui.pageMain->BtnDemos,	SIGNAL(clicked()),	this, SLOT(GoToDemos()));
 	connect(ui.pageMain->BtnNet,	SIGNAL(clicked()),	this, SLOT(GoToNet()));
 	connect(ui.pageMain->BtnInfo,	SIGNAL(clicked()),	this, SLOT(GoToInfo()));
 	connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
@@ -108,6 +105,9 @@
 
 	connect(ui.pageSinglePlayer->BtnSimpleGamePage,	SIGNAL(clicked()),	this, SLOT(SimpleGame()));
 	connect(ui.pageSinglePlayer->BtnTrainPage,	SIGNAL(clicked()),	this, SLOT(GoToTraining()));
+	connect(ui.pageSinglePlayer->BtnMultiplayer,	SIGNAL(clicked()),	this, SLOT(GoToMultiplayer()));
+	connect(ui.pageSinglePlayer->BtnLoad,	SIGNAL(clicked()),	this, SLOT(GoToSaves()));
+	connect(ui.pageSinglePlayer->BtnDemos,	SIGNAL(clicked()),	this, SLOT(GoToDemos()));
 	connect(ui.pageSinglePlayer->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
 
 	connect(ui.pageTraining->BtnStartTrain,	SIGNAL(clicked()),	this, SLOT(StartTraining()));
--- a/QTfrontend/main.cpp	Mon Aug 04 19:28:01 2008 +0000
+++ b/QTfrontend/main.cpp	Mon Aug 04 20:29:13 2008 +0000
@@ -53,30 +53,21 @@
 
 	Q_INIT_RESOURCE(hedgewars);
 
-	QString imgAddr=":/res/Background.png";
-	QImage bgrndIm(imgAddr);
-	QRect deskSz=qApp->desktop()->screenGeometry();
-	bgrndIm=bgrndIm.scaled(deskSz.width()-deskSz.left(), deskSz.height()-deskSz.top(), 
-			       Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
-	if (bgrndIm.save(QDir::tempPath()+"/hedgewarsScaledBgrnd.png")) {
-	  imgAddr=QDir::tempPath()+"/hedgewarsScaledBgrnd.png";
-	}
-	
 	qApp->setStyleSheet
 	  (QString(
 		   ".HWForm{"
-		   "background-image: url(\"%1\");"
+		   "background-image: url(\":/res/Background.png\");"
 		   "background-position: bottom center;"
 		   //" background-origin: content;"
-		   "background-repeat: no-repeat;"
-		   "background-color: #3f095f;"
+		   "background-repeat: repeat-x;"
+		   "background-color: #870c8f;"
 		   "}"
 		   "PageMain > QPushButton{"
 		   "border: solid transparent;"
 		   "}"
-		   ).arg(imgAddr)
+		   )
 	   );
-	
+
 	bindir->cd("bin"); // workaround over NSIS installer
 
 	cfgdir->setPath(cfgdir->homePath());
--- a/QTfrontend/pages.cpp	Mon Aug 04 19:28:01 2008 +0000
+++ b/QTfrontend/pages.cpp	Mon Aug 04 20:29:13 2008 +0000
@@ -55,34 +55,30 @@
   AbstractPage(parent)
 {
 	QGridLayout * pageLayout = new QGridLayout(this);
-	pageLayout->setMargin(25);
+	//pageLayout->setMargin(25);
 	//pageLayout->setColumnStretch(0, 1);
 	//pageLayout->setColumnStretch(1, 2);
 	//pageLayout->setColumnStretch(2, 1);
 
-	QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, QSize(780, 176));
-	pageLayout->setAlignment(btnLogo, Qt::AlignCenter);
+	QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, QSize(720, 140));
+	pageLayout->setAlignment(btnLogo, Qt::AlignHCenter);
 	pageLayout->setRowStretch(0, 1);
-	pageLayout->setRowStretch(1, 100);
-	pageLayout->setRowStretch(2, 1);
+	pageLayout->setRowStretch(1, 1);
+	pageLayout->setRowStretch(2, 0);
+	pageLayout->setRowStretch(3, 1);
 
-	BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 1, 0, 1, 2, QSize(314, 289));
-	pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignCenter);
-
-	BtnMultiplayer = new QPushButton(tr("Multiplayer"));// addButton(tr("Multiplayer"), pageLayout, 1, 1);
+	BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 2, 0, 1, 2, QSize(314, 260));
+	pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter);
 
-	BtnNet = addButton(":/res/Network play.png", pageLayout, 1, 2, 1, 2, QSize(314, 289));
+	BtnNet = addButton(":/res/Network play.png", pageLayout, 2, 2, 1, 2, QSize(314, 260));
+	pageLayout->setAlignment(BtnNet, Qt::AlignHCenter);
 
-	BtnLoad = new QPushButton(tr("Saved games"));//addButton(tr("Saved games"), pageLayout, 3, 1);
-
-	BtnDemos = new QPushButton(tr("Demos")); // addButton(tr("Demos"), pageLayout, 4, 1);
+	BtnSetup = addButton(":/res/Settings.png", pageLayout, 3, 3, QSize(54, 50));
 
-	BtnSetup = addButton(":/res/Settings.png", pageLayout, 2, 3, QSize(54, 50));
+	BtnInfo = addButton(":/res/About.png", pageLayout, 3, 1, 1, 2, QSize(116, 37));
+	pageLayout->setAlignment(BtnInfo, Qt::AlignHCenter);
 
-	BtnInfo = addButton(":/res/About.png", pageLayout, 2, 1, 1, 2, QSize(116, 37));
-	pageLayout->setAlignment(BtnInfo, Qt::AlignCenter);
-
-	BtnExit = addButton(":/res/Exit.png", pageLayout, 2, 0, 1, 1, QSize(58, 52));
+	BtnExit = addButton(":/res/Exit.png", pageLayout, 3, 0, 1, 1, QSize(58, 52));
 }
 
 PageEditTeam::PageEditTeam(QWidget* parent) :
@@ -591,7 +587,7 @@
 	pageLayout->addWidget(labelGameStats, 0, 0, 1, 3);
 }
 
-PageSinglePlayer::PageSinglePlayer(QWidget* parent) : QWidget(parent)
+PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent)
 {
 	QFont * font14 = new QFont("MS Shell Dlg", 14);
 	QGridLayout * pageLayout = new QGridLayout(this);
@@ -600,23 +596,15 @@
 	pageLayout->setColumnStretch(1, 2);
 	pageLayout->setColumnStretch(2, 1);
 	pageLayout->setRowStretch(0, 1);
-	pageLayout->setRowStretch(3, 1);
-
-	BtnSimpleGamePage = new QPushButton(this);
-	BtnSimpleGamePage->setFont(*font14);
-	BtnSimpleGamePage->setText(QPushButton::tr("Simple Game"));
-	pageLayout->addWidget(BtnSimpleGamePage, 1, 1);
+	pageLayout->setRowStretch(6, 1);
 
-	BtnTrainPage = new QPushButton(this);
-	BtnTrainPage->setFont(*font14);
-	BtnTrainPage->setText(QPushButton::tr("Training"));
-	pageLayout->addWidget(BtnTrainPage, 2, 1);
+	BtnSimpleGamePage = addButton(tr("Simple Game"), pageLayout, 1, 1);
+	BtnTrainPage = addButton(tr("Training"), pageLayout, 2, 1);
+	BtnMultiplayer = addButton(tr("Multiplayer"), pageLayout, 3, 1);
+	BtnLoad = addButton(tr("Saved games"), pageLayout, 4, 1);
+	BtnDemos = addButton(tr("Demos"), pageLayout, 5, 1);
 
-	BtnBack = new QPushButton(this);
-	BtnBack->setFont(*font14);
-	BtnBack->setText(QPushButton::tr("Back"));
-	pageLayout->addWidget(BtnBack, 4, 0);
-
+	BtnBack = addButton(tr("Back"), pageLayout, 7, 0);
 }
 
 PageTraining::PageTraining(QWidget* parent) : QWidget(parent)
--- a/QTfrontend/pages.h	Mon Aug 04 19:28:01 2008 +0000
+++ b/QTfrontend/pages.h	Mon Aug 04 20:29:13 2008 +0000
@@ -112,11 +112,8 @@
 	PageMain(QWidget* parent = 0);
 
 	QPushButton *BtnSinglePlayer;
-	QPushButton *BtnMultiplayer;
 	QPushButton *BtnNet;
 	QPushButton *BtnSetup;
-	QPushButton *BtnLoad;
-	QPushButton *BtnDemos;
 	QPushButton *BtnInfo;
 	QPushButton *BtnExit;
 };
@@ -289,7 +286,7 @@
 	QLabel *labelGameStats;
 };
 
-class PageSinglePlayer : public QWidget
+class PageSinglePlayer : public AbstractPage
 {
 	Q_OBJECT
 
@@ -298,6 +295,9 @@
 
 	QPushButton *BtnSimpleGamePage;
 	QPushButton *BtnTrainPage;
+	QPushButton *BtnMultiplayer;
+	QPushButton *BtnLoad;
+	QPushButton *BtnDemos;
 	QPushButton *BtnBack;
 	GameCFGWidget *gameCFG;
 };
Binary file QTfrontend/res/HedgewarsTitle.png has changed
Binary file QTfrontend/res/LocalPlay.png has changed
Binary file QTfrontend/res/Network play.png has changed