QTfrontend/hwform.cpp
changeset 289 604c4a779c20
parent 271 f2f9a3d5b441
child 290 09738170c557
equal deleted inserted replaced
288:929c44745fd9 289:604c4a779c20
    50 	connect(ui.pageMain->BtnDemos,	SIGNAL(clicked()),	this, SLOT(GoToDemos()));
    50 	connect(ui.pageMain->BtnDemos,	SIGNAL(clicked()),	this, SLOT(GoToDemos()));
    51 	connect(ui.pageMain->BtnNet,	SIGNAL(clicked()),	this, SLOT(GoToNet()));
    51 	connect(ui.pageMain->BtnNet,	SIGNAL(clicked()),	this, SLOT(GoToNet()));
    52 	connect(ui.pageMain->BtnInfo,	SIGNAL(clicked()),	this, SLOT(GoToInfo()));
    52 	connect(ui.pageMain->BtnInfo,	SIGNAL(clicked()),	this, SLOT(GoToInfo()));
    53 	connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(close()));
    53 	connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(close()));
    54 
    54 
    55 	connect(ui.pageLocalGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
    55 	connect(ui.pageLocalGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    56 	connect(ui.pageLocalGame->BtnSimpleGame,	SIGNAL(clicked()),	this, SLOT(SimpleGame()));
    56 	connect(ui.pageLocalGame->BtnSimpleGame,	SIGNAL(clicked()),	this, SLOT(SimpleGame()));
    57 
    57 
    58 	connect(ui.pageEditTeam->BtnTeamSave,	SIGNAL(clicked()),	this, SLOT(TeamSave()));
    58 	connect(ui.pageEditTeam->BtnTeamSave,	SIGNAL(clicked()),	this, SLOT(TeamSave()));
    59 	connect(ui.pageEditTeam->BtnTeamDiscard,	SIGNAL(clicked()),	this, SLOT(TeamDiscard()));
    59 	connect(ui.pageEditTeam->BtnTeamDiscard,	SIGNAL(clicked()),	this, SLOT(TeamDiscard()));
    60 
    60 
    61 	connect(ui.pageMultiplayer->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
    61 	connect(ui.pageMultiplayer->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    62 	connect(ui.pageMultiplayer->BtnStartMPGame,	SIGNAL(clicked()),	this, SLOT(StartMPGame()));
    62 	connect(ui.pageMultiplayer->BtnStartMPGame,	SIGNAL(clicked()),	this, SLOT(StartMPGame()));
    63 
    63 
    64 	connect(ui.pagePlayDemo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
    64 	connect(ui.pagePlayDemo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    65 	connect(ui.pagePlayDemo->BtnPlayDemo,	SIGNAL(clicked()),	this, SLOT(PlayDemo()));
    65 	connect(ui.pagePlayDemo->BtnPlayDemo,	SIGNAL(clicked()),	this, SLOT(PlayDemo()));
    66 	connect(ui.pagePlayDemo->DemosList,	SIGNAL(doubleClicked (const QModelIndex &)),	this, SLOT(PlayDemo()));
    66 	connect(ui.pagePlayDemo->DemosList,	SIGNAL(doubleClicked (const QModelIndex &)),	this, SLOT(PlayDemo()));
    67 
    67 
    68 	connect(ui.pageOptions->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
    68 	connect(ui.pageOptions->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    69 	connect(ui.pageOptions->BtnNewTeam,	SIGNAL(clicked()),	this, SLOT(NewTeam()));
    69 	connect(ui.pageOptions->BtnNewTeam,	SIGNAL(clicked()),	this, SLOT(NewTeam()));
    70 	connect(ui.pageOptions->BtnEditTeam,	SIGNAL(clicked()),	this, SLOT(EditTeam()));
    70 	connect(ui.pageOptions->BtnEditTeam,	SIGNAL(clicked()),	this, SLOT(EditTeam()));
    71 	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	config, SLOT(SaveOptions()));
    71 	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	config, SLOT(SaveOptions()));
    72 
    72 
    73 	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
    73 	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    74 	connect(ui.pageNet->BtnNetConnect,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
    74 	connect(ui.pageNet->BtnNetConnect,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
    75 
    75 
    76 	connect(ui.pageNetGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToNetChat()));
    76 	connect(ui.pageNetGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    77 	connect(ui.pageNetGame->BtnAddTeam,	SIGNAL(clicked()),	this, SLOT(NetAddTeam()));
    77 	connect(ui.pageNetGame->BtnAddTeam,	SIGNAL(clicked()),	this, SLOT(NetAddTeam()));
    78 	connect(ui.pageNetGame->BtnGo,	SIGNAL(clicked()),	this, SLOT(NetStartGame()));
    78 	connect(ui.pageNetGame->BtnGo,	SIGNAL(clicked()),	this, SLOT(NetStartGame()));
    79 
    79 
    80 	connect(ui.pageNetChat->BtnDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect()));
    80 	connect(ui.pageNetChat->BtnDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect()));
    81 	connect(ui.pageNetChat->BtnJoin,	SIGNAL(clicked()),	this, SLOT(NetJoin()));
    81 	connect(ui.pageNetChat->BtnJoin,	SIGNAL(clicked()),	this, SLOT(NetJoin()));
    82 	connect(ui.pageNetChat->BtnCreate,	SIGNAL(clicked()),	this, SLOT(NetCreate()));
    82 	connect(ui.pageNetChat->BtnCreate,	SIGNAL(clicked()),	this, SLOT(NetCreate()));
    83 
    83 
    84 	connect(ui.pageInfo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoToMain()));
    84 	connect(ui.pageInfo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    85 
    85 
    86 	ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
    86 	ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
    87 }
    87 }
    88 
    88 
    89 void HWForm::UpdateTeamsLists()
    89 void HWForm::UpdateTeamsLists()
   100 	ui.pageOptions->CBTeamName->addItems(teamslist);
   100 	ui.pageOptions->CBTeamName->addItems(teamslist);
   101 }
   101 }
   102 
   102 
   103 void HWForm::GoToMain()
   103 void HWForm::GoToMain()
   104 {
   104 {
   105 	ui.Pages->setCurrentIndex(ID_PAGE_MAIN);
   105 	GoToPage(ID_PAGE_MAIN);
   106 }
   106 }
   107 
   107 
   108 void HWForm::GoToSinglePlayer()
   108 void HWForm::GoToSinglePlayer()
   109 {
   109 {
   110 	ui.Pages->setCurrentIndex(ID_PAGE_SINGLEPLAYER);
   110 	GoToPage(ID_PAGE_SINGLEPLAYER);
   111 }
   111 }
   112 
   112 
   113 void HWForm::GoToSetup()
   113 void HWForm::GoToSetup()
   114 {
   114 {
   115 	ui.Pages->setCurrentIndex(ID_PAGE_SETUP);
   115 	GoToPage(ID_PAGE_SETUP);
   116 }
   116 }
   117 
   117 
   118 void HWForm::GoToInfo()
   118 void HWForm::GoToInfo()
   119 {
   119 {
   120 	ui.Pages->setCurrentIndex(ID_PAGE_INFO);
   120 	GoToPage(ID_PAGE_INFO);
   121 }
   121 }
   122 
   122 
   123 void HWForm::GoToMultiplayer()
   123 void HWForm::GoToMultiplayer()
   124 {
   124 {
   125 	QStringList tmNames=config->GetTeamsList();
   125 	QStringList tmNames=config->GetTeamsList();
   145 	ui.Pages->setCurrentIndex(ID_PAGE_DEMOS);
   145 	ui.Pages->setCurrentIndex(ID_PAGE_DEMOS);
   146 }
   146 }
   147 
   147 
   148 void HWForm::GoToNet()
   148 void HWForm::GoToNet()
   149 {
   149 {
   150 	ui.Pages->setCurrentIndex(ID_PAGE_NET);
   150 	GoToPage(ID_PAGE_NET);
   151 }
   151 }
   152 
   152 
   153 void HWForm::GoToNetChat()
   153 void HWForm::GoToNetChat()
   154 {
   154 {
   155 	ui.Pages->setCurrentIndex(ID_PAGE_NETCHAT);
   155 	GoToPage(ID_PAGE_NETCHAT);
       
   156 }
       
   157 
       
   158 void HWForm::GoToPage(quint8 id)
       
   159 {
       
   160 	PagesStack.push(ui.Pages->currentIndex());
       
   161 	ui.Pages->setCurrentIndex(id);
       
   162 }
       
   163 
       
   164 void HWForm::GoBack()
       
   165 {
       
   166 	quint8 id = PagesStack.isEmpty() ? ID_PAGE_MAIN : PagesStack.pop();
       
   167 	ui.Pages->setCurrentIndex(id);
   156 }
   168 }
   157 
   169 
   158 void HWForm::NewTeam()
   170 void HWForm::NewTeam()
   159 {
   171 {
   160 	editedTeam = new HWTeam("unnamed");
   172 	editedTeam = new HWTeam("unnamed");