QTfrontend/hwform.cpp
changeset 1885 75489216b5b0
parent 1875 189370d394db
child 1887 d68939b3f7f0
equal deleted inserted replaced
1884:40e59e9f82ce 1885:75489216b5b0
    30 #include <QCheckBox>
    30 #include <QCheckBox>
    31 #include <QTextBrowser>
    31 #include <QTextBrowser>
    32 #include <QAction>
    32 #include <QAction>
    33 #include <QTimer>
    33 #include <QTimer>
    34 #include <QScrollBar>
    34 #include <QScrollBar>
       
    35 #include <QDataWidgetMapper>
    35 
    36 
    36 #include "hwform.h"
    37 #include "hwform.h"
    37 #include "game.h"
    38 #include "game.h"
    38 #include "team.h"
    39 #include "team.h"
    39 #include "teamselect.h"
    40 #include "teamselect.h"
    47 #include "netserverslist.h"
    48 #include "netserverslist.h"
    48 #include "netudpserver.h"
    49 #include "netudpserver.h"
    49 #include "chatwidget.h"
    50 #include "chatwidget.h"
    50 #include "playrecordpage.h"
    51 #include "playrecordpage.h"
    51 #include "input_ip.h"
    52 #include "input_ip.h"
       
    53 #include "ammoSchemeModel.h"
    52 
    54 
    53 HWForm::HWForm(QWidget *parent)
    55 HWForm::HWForm(QWidget *parent)
    54   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    56   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    55 {
    57 {
    56 	ui.setupUi(this);
    58 	ui.setupUi(this);
    65 	UpdateWeapons();
    67 	UpdateWeapons();
    66 
    68 
    67 	connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool)));
    69 	connect(config, SIGNAL(frontendFullscreen(bool)), this, SLOT(onFrontendFullscreen(bool)));
    68 	onFrontendFullscreen(config->isFrontendFullscreen());
    70 	onFrontendFullscreen(config->isFrontendFullscreen());
    69 
    71 
    70 	connect(ui.pageMain->BtnSinglePlayer,	SIGNAL(clicked()),	this, SLOT(GoToSinglePlayer()));
    72 	connect(ui.pageMain->BtnSinglePlayer, SIGNAL(clicked()), this, SLOT(GoToSinglePlayer()));
    71 	connect(ui.pageMain->BtnSetup,	SIGNAL(clicked()),	this, SLOT(GoToSetup()));
    73 	connect(ui.pageMain->BtnSetup, SIGNAL(clicked()), this, SLOT(GoToSetup()));
    72 	connect(ui.pageMain->BtnNet,	SIGNAL(clicked()),	this, SLOT(GoToNet()));
    74 	connect(ui.pageMain->BtnNet, SIGNAL(clicked()), this, SLOT(GoToNet()));
    73 	connect(ui.pageMain->BtnInfo,	SIGNAL(clicked()),	this, SLOT(GoToInfo()));
    75 	connect(ui.pageMain->BtnInfo, SIGNAL(clicked()), this, SLOT(GoToInfo()));
    74 	connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
    76 	connect(ui.pageMain->BtnExit, SIGNAL(pressed()), this, SLOT(btnExitPressed()));
    75 	connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
    77 	connect(ui.pageMain->BtnExit, SIGNAL(clicked()), this, SLOT(btnExitClicked()));
    76 
    78 
    77 	connect(ui.pageEditTeam->BtnTeamSave,	SIGNAL(clicked()),	this, SLOT(TeamSave()));
    79 	connect(ui.pageEditTeam->BtnTeamSave, SIGNAL(clicked()), this, SLOT(TeamSave()));
    78 	connect(ui.pageEditTeam->BtnTeamDiscard,	SIGNAL(clicked()),	this, SLOT(TeamDiscard()));
    80 	connect(ui.pageEditTeam->BtnTeamDiscard, SIGNAL(clicked()), this, SLOT(TeamDiscard()));
    79 
    81 
    80 	connect(ui.pageEditTeam->signalMapper, SIGNAL(mapped(const int &)), this, SLOT(RandomName(const int &)));
    82 	connect(ui.pageEditTeam->signalMapper, SIGNAL(mapped(const int &)), this, SLOT(RandomName(const int &)));
    81 	connect(ui.pageEditTeam->randTeamButton, SIGNAL(clicked()), this, SLOT(RandomNames()));
    83 	connect(ui.pageEditTeam->randTeamButton, SIGNAL(clicked()), this, SLOT(RandomNames()));
    82 
    84 
    83 	connect(ui.pageMultiplayer->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    85 	connect(ui.pageMultiplayer->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
    84 	connect(ui.pageMultiplayer->BtnStartMPGame,	SIGNAL(clicked()),	this, SLOT(StartMPGame()));
    86 	connect(ui.pageMultiplayer->BtnStartMPGame, SIGNAL(clicked()), this, SLOT(StartMPGame()));
    85 	connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
    87 	connect(ui.pageMultiplayer->teamsSelect, SIGNAL(setEnabledGameStart(bool)),
    86 		ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
    88 		ui.pageMultiplayer->BtnStartMPGame, SLOT(setEnabled(bool)));
    87 	connect(ui.pageMultiplayer->teamsSelect, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
    89 	connect(ui.pageMultiplayer->teamsSelect, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
       
    90 	connect(ui.pageMultiplayer->gameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes()));
    88 
    91 
    89 	connect(ui.pagePlayDemo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    92 	connect(ui.pagePlayDemo->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    90 	connect(ui.pagePlayDemo->BtnPlayDemo,	SIGNAL(clicked()),	this, SLOT(PlayDemo()));
    93 	connect(ui.pagePlayDemo->BtnPlayDemo,	SIGNAL(clicked()),	this, SLOT(PlayDemo()));
    91 	connect(ui.pagePlayDemo->DemosList,	SIGNAL(doubleClicked (const QModelIndex &)),	this, SLOT(PlayDemo()));
    94 	connect(ui.pagePlayDemo->DemosList,	SIGNAL(doubleClicked (const QModelIndex &)),	this, SLOT(PlayDemo()));
    92 
    95 
   111 
   114 
   112 	connect(ui.pageNetGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
   115 	connect(ui.pageNetGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
   113 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   116 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(setEnabledGameStart(bool)),
   114 		ui.pageNetGame->BtnGo, SLOT(setEnabled(bool)));
   117 		ui.pageNetGame->BtnGo, SLOT(setEnabled(bool)));
   115 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
   118 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(SetupClicked()), this, SLOT(IntermediateSetup()));
       
   119 	connect(ui.pageNetGame->pGameCFG, SIGNAL(goToSchemes()), this, SLOT(GoToSchemes()));
   116 
   120 
   117 	connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   121 	connect(ui.pageRoomsList->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   118 
   122 
   119 	connect(ui.pageInfo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   123 	connect(ui.pageInfo->BtnBack, SIGNAL(clicked()), this, SLOT(GoBack()));
   120 
   124 
   138 		ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   142 		ui.pageSelectWeapon->pWeapons, SLOT(deleteWeaponsName())); // executed first
   139 	connect(ui.pageSelectWeapon->pWeapons,	SIGNAL(weaponsDeleted()),
   143 	connect(ui.pageSelectWeapon->pWeapons,	SIGNAL(weaponsDeleted()),
   140 		this, SLOT(UpdateWeapons())); // executed second
   144 		this, SLOT(UpdateWeapons())); // executed second
   141 	connect(ui.pageSelectWeapon->pWeapons,	SIGNAL(weaponsDeleted()),
   145 	connect(ui.pageSelectWeapon->pWeapons,	SIGNAL(weaponsDeleted()),
   142 		this, SLOT(GoBack())); // executed third
   146 		this, SLOT(GoBack())); // executed third
       
   147 
       
   148 
       
   149 	AmmoSchemeModel * ammoSchemeModel = new AmmoSchemeModel(this);
       
   150 	ui.pageScheme->mapper->setModel(ammoSchemeModel);
   143 
   151 
   144 	PagesStack.push(ID_PAGE_MAIN);
   152 	PagesStack.push(ID_PAGE_MAIN);
   145 	GoBack();
   153 	GoBack();
   146 }
   154 }
   147 
   155 
   272 }
   280 }
   273 
   281 
   274 void HWForm::GoToNetServer()
   282 void HWForm::GoToNetServer()
   275 {
   283 {
   276 	GoToPage(ID_PAGE_NETSERVER);
   284 	GoToPage(ID_PAGE_NETSERVER);
       
   285 }
       
   286 
       
   287 void HWForm::GoToSchemes()
       
   288 {
       
   289 	GoToPage(ID_PAGE_SCHEME);
   277 }
   290 }
   278 
   291 
   279 void HWForm::OnPageShown(quint8 id, quint8 lastid)
   292 void HWForm::OnPageShown(quint8 id, quint8 lastid)
   280 {
   293 {
   281 	if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {
   294 	if (id == ID_PAGE_MULTIPLAYER || id == ID_PAGE_NETGAME) {