More work on Training mode
authorunc0rr
Thu, 06 Sep 2007 19:10:03 +0000
changeset 587 74db4115064a
parent 586 ecb6347dfeca
child 588 b2e61fc49e5d
More work on Training mode
QTfrontend/game.cpp
QTfrontend/game.h
QTfrontend/hwform.cpp
QTfrontend/hwform.h
QTfrontend/pages.cpp
QTfrontend/pages.h
QTfrontend/ui_hwform.cpp
QTfrontend/ui_hwform.h
--- a/QTfrontend/game.cpp	Thu Sep 06 18:14:12 2007 +0000
+++ b/QTfrontend/game.cpp	Thu Sep 06 19:10:03 2007 +0000
@@ -280,6 +280,11 @@
 	SetGameState(gsStarted);
 }
 
+void HWGame::StartTraining()
+{
+
+}
+
 void HWGame::SetGameState(GameState state)
 {
 	gameState = state;
--- a/QTfrontend/game.h	Thu Sep 06 18:14:12 2007 +0000
+++ b/QTfrontend/game.h	Thu Sep 06 19:10:03 2007 +0000
@@ -48,6 +48,7 @@
 	void StartLocal();
 	void StartQuick();
 	void StartNet();
+	void StartTraining();
 
  protected:
 	virtual QStringList setArguments();
--- a/QTfrontend/hwform.cpp	Thu Sep 06 18:14:12 2007 +0000
+++ b/QTfrontend/hwform.cpp	Thu Sep 06 19:10:03 2007 +0000
@@ -104,9 +104,12 @@
 	connect(ui.pageGameStats->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
 
 	connect(ui.pageSinglePlayer->BtnSimpleGamePage,	SIGNAL(clicked()),	this, SLOT(GoToSimpleGame()));
-	connect(ui.pageSinglePlayer->BtnTrainPage,	SIGNAL(clicked()),	this, SLOT(GoBack()));
+	connect(ui.pageSinglePlayer->BtnTrainPage,	SIGNAL(clicked()),	this, SLOT(GoToTraining()));
 	connect(ui.pageSinglePlayer->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
 
+	connect(ui.pageTraining->BtnStartTrain,	SIGNAL(clicked()),	this, SLOT(StartTraining()));
+	connect(ui.pageTraining->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
+
 	GoToPage(ID_PAGE_MAIN);
 }
 
@@ -144,6 +147,11 @@
 	GoToPage(ID_PAGE_SIMPLEGAME);
 }
 
+void HWForm::GoToTraining()
+{
+	GoToPage(ID_PAGE_TRAINING);
+}
+
 void HWForm::GoToSetup()
 {
 	GoToPage(ID_PAGE_SETUP);
@@ -530,3 +538,10 @@
 	demofile.write(demo.constData(), demo.size());
 	demofile.close();
 }
+
+void HWForm::StartTraining()
+{
+	CreateGame(0, 0);
+
+	game->StartTraining();
+}
--- a/QTfrontend/hwform.h	Thu Sep 06 18:14:12 2007 +0000
+++ b/QTfrontend/hwform.h	Thu Sep 06 19:10:03 2007 +0000
@@ -51,6 +51,7 @@
 	void GoToNet();
 	void GoToInfo();
 	void GoToSimpleGame();
+	void GoToTraining();
 	void GoToPage(quint8 id);
 	void GoBack();
 	void btnExitPressed();
@@ -62,6 +63,7 @@
 	void TeamDiscard();
 	void SimpleGame();
 	void PlayDemo();
+	void StartTraining();
 	void NetConnect();
 	void NetConnectServer();
 	void NetStartServer();
@@ -92,7 +94,8 @@
 		ID_PAGE_INFO            =  7,
 		ID_PAGE_MAIN            =  8,
 		ID_PAGE_GAMESTATS       =  9,
-		ID_PAGE_SINGLEPLAYER    = 10
+		ID_PAGE_SINGLEPLAYER    = 10,
+		ID_PAGE_TRAINING	= 11
 		};
 	HWGame * game;
 	HWTeam * editedTeam;
--- a/QTfrontend/pages.cpp	Thu Sep 06 18:14:12 2007 +0000
+++ b/QTfrontend/pages.cpp	Thu Sep 06 19:10:03 2007 +0000
@@ -557,3 +557,24 @@
 
 }
 
+PageTraining::PageTraining(QWidget* parent) : QWidget(parent)
+{
+	QFont * font14 = new QFont("MS Shell Dlg", 14);
+	QGridLayout * pageLayout = new QGridLayout(this);
+	pageLayout->setMargin(25);
+	pageLayout->setColumnStretch(0, 1);
+	pageLayout->setColumnStretch(1, 2);
+	pageLayout->setColumnStretch(2, 1);
+
+	BtnStartTrain = new QPushButton(this);
+	BtnStartTrain->setFont(*font14);
+	BtnStartTrain->setText(QPushButton::tr("Go!"));
+	pageLayout->addWidget(BtnStartTrain, 1, 2);
+
+	BtnBack = new QPushButton(this);
+	BtnBack->setFont(*font14);
+	BtnBack->setText(QPushButton::tr("Back"));
+	pageLayout->addWidget(BtnBack, 1, 0);
+
+}
+
--- a/QTfrontend/pages.h	Thu Sep 06 18:14:12 2007 +0000
+++ b/QTfrontend/pages.h	Thu Sep 06 19:10:03 2007 +0000
@@ -215,5 +215,16 @@
 	GameCFGWidget *gameCFG;
 };
 
+class PageTraining : public QWidget
+{
+	Q_OBJECT
+
+public:
+	PageTraining(QWidget* parent = 0);
+
+	QPushButton *BtnStartTrain;
+	QPushButton *BtnBack;
+};
+
 
 #endif // PAGES_H
--- a/QTfrontend/ui_hwform.cpp	Thu Sep 06 18:14:12 2007 +0000
+++ b/QTfrontend/ui_hwform.cpp	Thu Sep 06 19:10:03 2007 +0000
@@ -86,4 +86,7 @@
 
 	pageSinglePlayer = new PageSinglePlayer();
 	Pages->addWidget(pageSinglePlayer);
+
+	pageTraining = new PageTraining();
+	Pages->addWidget(pageTraining);
 }
--- a/QTfrontend/ui_hwform.h	Thu Sep 06 18:14:12 2007 +0000
+++ b/QTfrontend/ui_hwform.h	Thu Sep 06 19:10:03 2007 +0000
@@ -31,6 +31,7 @@
 class PageInfo;
 class PageGameStats;
 class PageSinglePlayer;
+class PageTraining;
 class QStackedLayout;
 class QFont;
 class QWidget;
@@ -53,6 +54,7 @@
 	PageInfo *pageInfo;
 	PageGameStats *pageGameStats;
 	PageSinglePlayer *pageSinglePlayer;
+	PageTraining *pageTraining;
 
 	QStackedLayout *Pages;
 	QFont *font14;