images at main page
authordisplacer
Mon, 04 Aug 2008 19:04:46 +0000
changeset 1148 e44de3416af4
parent 1147 ce37ebba0806
child 1149 c2d3b4f71836
images at main page
QTfrontend/pages.cpp
QTfrontend/pages.h
--- a/QTfrontend/pages.cpp	Mon Aug 04 17:47:11 2008 +0000
+++ b/QTfrontend/pages.cpp	Mon Aug 04 19:04:46 2008 +0000
@@ -56,33 +56,42 @@
 {
 	QGridLayout * pageLayout = new QGridLayout(this);
 	pageLayout->setMargin(25);
-	pageLayout->setColumnStretch(0, 1);
-	pageLayout->setColumnStretch(1, 2);
-	pageLayout->setColumnStretch(2, 1);
+	//pageLayout->setColumnStretch(0, 1);
+	//pageLayout->setColumnStretch(1, 2);
+	//pageLayout->setColumnStretch(2, 1);
 
-	BtnSinglePlayer = addButton(tr("Single Player"), pageLayout, 0, 1);
-	BtnSinglePlayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	QPushButton* btnLogo = addButton(":/res/HedgewarsTitle.png", pageLayout, 0, 0, 1, 4, QSize(780, 176));
+	pageLayout->setAlignment(btnLogo, Qt::AlignCenter);
+	pageLayout->setRowStretch(0, 1);
+	pageLayout->setRowStretch(1, 100);
+	pageLayout->setRowStretch(2, 1);
 
-	BtnMultiplayer = addButton(tr("Multiplayer"), pageLayout, 1, 1);
-	BtnMultiplayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnSinglePlayer = addButton(":/res/LocalPlay.png", pageLayout, 1, 0, 1, 2, QSize(314, 289));
+	pageLayout->setAlignment(BtnSinglePlayer, Qt::AlignCenter);
+	//BtnSinglePlayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-	BtnNet = addButton(tr("Net game"), pageLayout, 2, 1);
-	BtnNet->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnMultiplayer = new QPushButton(tr("Multiplayer"));// addButton(tr("Multiplayer"), pageLayout, 1, 1);
+	//pageLayout->setAlignment(BtnMultiplayer, Qt::AlignCenter);
+	//BtnMultiplayer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-	BtnLoad = addButton(tr("Saved games"), pageLayout, 3, 1);
-	BtnLoad->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnNet = addButton(":/res/Network play.png", pageLayout, 1, 2, 1, 2, QSize(314, 289));
+	//BtnNet->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-	BtnDemos = addButton(tr("Demos"), pageLayout, 4, 1);
-	BtnDemos->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnLoad = new QPushButton(tr("Saved games"));//addButton(tr("Saved games"), pageLayout, 3, 1);
+	//BtnLoad->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+
+	BtnDemos = new QPushButton(tr("Demos")); // addButton(tr("Demos"), pageLayout, 4, 1);
+	//BtnDemos->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-	BtnSetup = addButton(tr("Setup"), pageLayout, 5, 1);
-	BtnSetup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnSetup = addButton(":/res/Settings.png", pageLayout, 2, 3, QSize(54, 50));
+	//BtnSetup->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-	BtnInfo = addButton(tr("About"), pageLayout, 6, 1);
-	BtnInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnInfo = addButton(":/res/About.png", pageLayout, 2, 1, 1, 2, QSize(116, 37));
+	pageLayout->setAlignment(BtnInfo, Qt::AlignCenter);
+	//BtnInfo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 
-	BtnExit = addButton(tr("Exit"), pageLayout, 7, 1);
-	BtnExit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+	BtnExit = addButton(":/res/Exit.png", pageLayout, 2, 0, 1, 1, QSize(58, 52));
+	//BtnExit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
 }
 
 PageEditTeam::PageEditTeam(QWidget* parent) :
--- a/QTfrontend/pages.h	Mon Aug 04 17:47:11 2008 +0000
+++ b/QTfrontend/pages.h	Mon Aug 04 19:04:46 2008 +0000
@@ -59,18 +59,34 @@
   }
   virtual ~AbstractPage() {};
 
-  QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx) {
+  QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, const QSize sz=QSize(0, 0)) {
     QPushButton* butt = new QPushButton(this);
-    butt->setFont(*font14);
-    butt->setText(btname);
+    if (sz==QSize(0, 0)) {
+      butt->setFont(*font14);
+      butt->setText(btname);
+    } else {
+      const QIcon& lp=QIcon(btname);
+      butt->setIcon(lp);
+      butt->setFixedSize(sz+QSize(2, 2));
+      butt->setIconSize(sz);
+      butt->setFlat(true);
+    }
     grid->addWidget(butt, wy, wx);
     return butt;
   };
 
-  QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan) {
+  QPushButton* addButton(QString btname, QGridLayout* grid, int wy, int wx, int rowSpan, int columnSpan, const QSize sz=QSize(0, 0)) {
     QPushButton* butt = new QPushButton(this);
-    butt->setFont(*font14);
-    butt->setText(btname);
+    if (sz==QSize(0, 0)) {
+      butt->setFont(*font14);
+      butt->setText(btname);
+    } else {
+      const QIcon& lp=QIcon(btname);
+      butt->setIcon(lp);
+      butt->setFixedSize(sz+QSize(2, 2));
+      butt->setIconSize(sz);
+      butt->setFlat(true);
+    }
     grid->addWidget(butt, wy, wx, rowSpan, columnSpan);
     return butt;
   };