Easter egg (with stub image, will paint later)
authorunc0rr
Tue, 29 May 2007 21:55:45 +0000
changeset 530 f0b962214436
parent 529 812682c1ab62
child 531 1f6c6eb0ea02
Easter egg (with stub image, will paint later)
QTfrontend/hedgewars.qrc
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/mapContainer.cpp
QTfrontend/res/bonus.png
--- a/QTfrontend/hedgewars.qrc	Sun May 27 20:17:55 2007 +0000
+++ b/QTfrontend/hedgewars.qrc	Tue May 29 21:55:45 2007 +0000
@@ -13,6 +13,7 @@
     <file>res/botlevels/net3.png</file>
     <file>res/botlevels/net4.png</file>
     <file>res/botlevels/net5.png</file>
+    <file>res/bonus.png</file>
     <file>res/Hedgehog.svg</file>
     <file>res/net.png</file>
 </qresource>
--- a/QTfrontend/hwform.cpp	Sun May 27 20:17:55 2007 +0000
+++ b/QTfrontend/hwform.cpp	Tue May 29 21:55:45 2007 +0000
@@ -59,7 +59,8 @@
 	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(clicked()), this, SLOT(close()));
+	connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
+	connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
 
 	connect(ui.pageLocalGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
 	connect(ui.pageLocalGame->BtnSimpleGame,	SIGNAL(clicked()),	this, SLOT(SimpleGame()));
@@ -201,6 +202,25 @@
 	ui.Pages->setCurrentIndex(id);
 }
 
+void HWForm::btnExitPressed()
+{
+	eggTimer.start();
+}
+
+void HWForm::btnExitClicked()
+{
+	if (eggTimer.elapsed() < 3000)
+		close();
+	else
+	{
+		QPushButton * btn = findChild<QPushButton *>("imageButt");
+		if (btn)
+		{
+			btn->setIcon(QIcon(":/res/bonus.png"));
+		}
+	}
+}
+
 void HWForm::NewTeam()
 {
 	editedTeam = new HWTeam("unnamed");
--- a/QTfrontend/hwform.h	Sun May 27 20:17:55 2007 +0000
+++ b/QTfrontend/hwform.h	Tue May 29 21:55:45 2007 +0000
@@ -21,6 +21,7 @@
 
 #include <QMainWindow>
 #include <QStack>
+#include <QTime>
 
 #include "netserver.h"
 #include "game.h"
@@ -50,6 +51,8 @@
 	void GoToInfo();
 	void GoToPage(quint8 id);
 	void GoBack();
+	void btnExitPressed();
+	void btnExitClicked();
 	void NewTeam();
 	void EditTeam();
 	void TeamSave();
@@ -93,6 +96,7 @@
 	QStack<quint8> PagesStack;
 	HWNetServer* pnetserver;
 	HWNetUdpServer* pUdpServer;
+	QTime eggTimer;
 	void AddStatText(const QString & msg);
 	void OnPageShown(quint8 id, quint8 lastid=0);
 };
--- a/QTfrontend/mapContainer.cpp	Sun May 27 20:17:55 2007 +0000
+++ b/QTfrontend/mapContainer.cpp	Tue May 29 21:55:45 2007 +0000
@@ -33,6 +33,7 @@
   QWidget(parent), mainLayout(this)
 {
   imageButt=new QPushButton(this);
+  imageButt->setObjectName("imageButt");
   imageButt->setFixedSize(256, 128);
   imageButt->setFlat(true);
   imageButt->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);//QSizePolicy::Minimum, QSizePolicy::Minimum);
Binary file QTfrontend/res/bonus.png has changed