Reorganize single player menu
authorunc0rr
Fri, 31 Oct 2008 14:40:00 +0000
changeset 1443 e79e4b48c771
parent 1442 ef9785d0b392
child 1444 06f6ae457a2f
Reorganize single player menu
QTfrontend/hedgewars.qrc
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/res/Multiplayer.png
QTfrontend/res/Record.png
QTfrontend/res/SimpleGame.png
QTfrontend/res/Trainings.png
--- a/QTfrontend/hedgewars.qrc	Fri Oct 31 14:35:59 2008 +0000
+++ b/QTfrontend/hedgewars.qrc	Fri Oct 31 14:40:00 2008 +0000
@@ -20,6 +20,9 @@
     <file>res/Hedgehog.svg</file>
     <file>res/net.png</file>
     <file>res/About.png</file>
+    <file>res/SimpleGame.png</file>
+    <file>res/Multiplayer.png</file>
+    <file>res/Trainings.png</file>
     <file>res/Background.png</file>
     <file>res/Exit.png</file>
     <file>res/HedgewarsTitle.png</file>
@@ -31,6 +34,7 @@
     <file>res/unchecked.png</file>
     <file>res/graphicsicon.png</file>
     <file>res/Save.png</file>
+    <file>res/Record.png</file>
     <file>res/weaponsicon.png</file>
     <file>res/teamicon.png</file>
     <file>res/panelbg.png</file>
--- a/QTfrontend/pages.cpp	Fri Oct 31 14:35:59 2008 +0000
+++ b/QTfrontend/pages.cpp	Fri Oct 31 14:40:00 2008 +0000
@@ -101,7 +101,8 @@
 	pageLayout->addWidget(tbw, 0, 0, 1, 3);
 	BtnTeamDiscard = addButton(":/res/Exit.png", pageLayout, 1, 0, true);
 	BtnTeamSave = addButton(":/res/Save.png", pageLayout, 1, 2, true);;
-
+	BtnTeamSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
+	
 	QHBoxLayout * page1Layout = new QHBoxLayout(page1);
 	page1Layout->setAlignment(Qt::AlignTop);
 	QGridLayout * page2Layout = new QGridLayout(page2);
@@ -371,6 +372,7 @@
 	GBAfpslayout->addWidget(fpsedit);
 
 	BtnSaveOptions = addButton(":/res/Save.png", pageLayout, 4, 2, true);
+	BtnSaveOptions->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
 
 	BtnBack = addButton(":/res/Exit.png", pageLayout, 4, 0, true);
 }
@@ -589,20 +591,24 @@
 PageSinglePlayer::PageSinglePlayer(QWidget* parent) : AbstractPage(parent)
 {
 	QFont * font14 = new QFont("MS Shell Dlg", 14);
-	QGridLayout * pageLayout = new QGridLayout(this);
-//	pageLayout->setColumnStretch(0, 1);
-//	pageLayout->setColumnStretch(1, 2);
-//	pageLayout->setColumnStretch(2, 1);
-	pageLayout->setRowStretch(0, 1);
-	pageLayout->setRowStretch(6, 1);
+	QVBoxLayout * vLayout = new QVBoxLayout(this);
+	QHBoxLayout * topLine = new QHBoxLayout();
+	QHBoxLayout * middleLine = new QHBoxLayout();
+	QHBoxLayout * bottomLine = new QHBoxLayout();
+	vLayout->addLayout(topLine);
+	vLayout->addLayout(middleLine);
+	vLayout->addLayout(bottomLine);
 
-	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 = addButton(":/res/Exit.png", pageLayout, 7, 0, true);
+	BtnSimpleGamePage = addButton(":/res/SimpleGame.png", topLine, 0, true);
+	BtnMultiplayer = addButton(":/res/Multiplayer.png", topLine, 1, true);
+//	pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignHCenter);
+	BtnTrainPage = addButton(":/res/Trainings.png", middleLine, 0, true);
+	
+	BtnBack = addButton(":/res/Exit.png", bottomLine, 0, true);
+	BtnDemos = addButton(tr(":/res/Record.png"), bottomLine, 1, true);
+	
+	BtnLoad = addButton(":/res/Save.png", bottomLine, 2, true);
+	BtnLoad->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
 }
 
 PageTraining::PageTraining(QWidget* parent) : AbstractPage(parent)
@@ -633,6 +639,7 @@
 	BtnDefault = addButton(tr("Default"), pageLayout, 1, 1);
 	BtnDelete = addButton(tr("Delete"), pageLayout, 1, 2);
 	BtnSave = addButton(":/res/Save.png", pageLayout, 1, 3, true);
+	BtnSave->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");	
 }
 
 PageInGame::PageInGame(QWidget* parent) :
--- a/QTfrontend/pages.h	Fri Oct 31 14:35:59 2008 +0000
+++ b/QTfrontend/pages.h	Fri Oct 31 14:40:00 2008 +0000
@@ -72,10 +72,6 @@
     } else {
       const QIcon& lp=QIcon(btname);
       QSize sz = lp.actualSize(QSize(65535, 65535));
-      if (btname == ":/res/Save.png")
-      {
-      	butt->setStyleSheet("QPushButton{margin: 12px 0px 12px 0px;}");
-      }
       butt->setIcon(lp);
       butt->setFixedSize(sz);
       butt->setIconSize(sz);
@@ -104,10 +100,20 @@
     return butt;
   };
 
-  QPushButton* addButton(QString btname, QBoxLayout* box, int where) {
+  QPushButton* addButton(QString btname, QBoxLayout* box, int where, bool iconed = false) {
     QPushButton* butt = new QPushButton(this);
-    butt->setFont(*font14);
-    butt->setText(btname);
+    if (!iconed) {
+      butt->setFont(*font14);
+      butt->setText(btname);
+    } else {
+      const QIcon& lp=QIcon(btname);
+      QSize sz = lp.actualSize(QSize(65535, 65535));
+      butt->setIcon(lp);
+      butt->setFixedSize(sz);
+      butt->setIconSize(sz);
+      butt->setFlat(true);
+      butt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+    }
     box->addWidget(butt, where);
     return butt;
   };
Binary file QTfrontend/res/Multiplayer.png has changed
Binary file QTfrontend/res/Record.png has changed
Binary file QTfrontend/res/SimpleGame.png has changed
Binary file QTfrontend/res/Trainings.png has changed