QTfrontend/hwform.cpp
changeset 697 44f167938201
parent 696 d6f32ed6edc8
child 702 97858a6682bb
equal deleted inserted replaced
696:d6f32ed6edc8 697:44f167938201
    87 	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    87 	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    88 
    88 
    89 	connect(ui.pageOptions->WeaponEdit,	SIGNAL(clicked()),	this, SLOT(GoToSelectWeapon()));
    89 	connect(ui.pageOptions->WeaponEdit,	SIGNAL(clicked()),	this, SLOT(GoToSelectWeapon()));
    90 	connect(ui.pageOptions->WeaponsButt,	SIGNAL(clicked()),	this, SLOT(GoToSelectNewWeapon()));
    90 	connect(ui.pageOptions->WeaponsButt,	SIGNAL(clicked()),	this, SLOT(GoToSelectNewWeapon()));
    91 	connect(ui.pageSelectWeapon->pWeapons,       SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
    91 	connect(ui.pageSelectWeapon->pWeapons,       SIGNAL(weaponsChanged()), this, SLOT(UpdateWeapons()));
       
    92 	connect(ui.pageNetGame->pGameCFG,       SIGNAL(newWeaponsName(const QString&)), this, SLOT(NetWeaponNameChanged(const QString&)));
    92 
    93 
    93 	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    94 	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    94 	connect(ui.pageNet->BtnSpecifyServer,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
    95 	connect(ui.pageNet->BtnSpecifyServer,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
    95 	connect(ui.pageNet->BtnNetSvrStart,	SIGNAL(clicked()),	this, SLOT(GoToNetServer()));
    96 	connect(ui.pageNet->BtnNetSvrStart,	SIGNAL(clicked()),	this, SLOT(GoToNetServer()));
    96 	connect(ui.pageNet,	SIGNAL(connectClicked(const QString &, quint16)),	this, SLOT(NetConnectServer(const QString &, quint16)));
    97 	connect(ui.pageNet,	SIGNAL(connectClicked(const QString &, quint16)),	this, SLOT(NetConnectServer(const QString &, quint16)));
   130   ui.pageMultiplayer->gameCFG->WeaponsName->clear();
   131   ui.pageMultiplayer->gameCFG->WeaponsName->clear();
   131   ui.pageMultiplayer->gameCFG->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
   132   ui.pageMultiplayer->gameCFG->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
   132 
   133 
   133   ui.pageNetGame->pGameCFG->WeaponsName->clear();
   134   ui.pageNetGame->pGameCFG->WeaponsName->clear();
   134   ui.pageNetGame->pGameCFG->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
   135   ui.pageNetGame->pGameCFG->WeaponsName->addItems(ui.pageSelectWeapon->pWeapons->getWeaponNames());
       
   136 }
       
   137 
       
   138 void HWForm::NetWeaponNameChanged(const QString& name)
       
   139 {
       
   140   QString ammo=ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageNetGame->pGameCFG->WeaponsName->currentText());
       
   141   hwnet->onWeaponsNameChanged(ammo);
   135 }
   142 }
   136 
   143 
   137 void HWForm::UpdateTeamsLists(const QStringList* editable_teams)
   144 void HWForm::UpdateTeamsLists(const QStringList* editable_teams)
   138 {
   145 {
   139 	QStringList teamslist;
   146 	QStringList teamslist;
   413 	connect(hwnet, SIGNAL(fortsModeChanged(bool)), ui.pageNetGame->pGameCFG, SLOT(setFortsMode(bool)));
   420 	connect(hwnet, SIGNAL(fortsModeChanged(bool)), ui.pageNetGame->pGameCFG, SLOT(setFortsMode(bool)));
   414 	connect(hwnet, SIGNAL(hhnumChanged(const HWTeam&)),
   421 	connect(hwnet, SIGNAL(hhnumChanged(const HWTeam&)),
   415 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&)));
   422 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&)));
   416 	connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
   423 	connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
   417 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)));
   424 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)));
       
   425 	connect(hwnet, SIGNAL(ammoChanged(const QString&)), ui.pageNetGame->pGameCFG, SLOT(setNetAmmo(const QString&)));
   418 
   426 
   419 	hwnet->Connect(hostName, port, nick);
   427 	hwnet->Connect(hostName, port, nick);
   420 }
   428 }
   421 
   429 
   422 void HWForm::NetConnect()
   430 void HWForm::NetConnect()
   625 	game->StartTraining();
   633 	game->StartTraining();
   626 }
   634 }
   627 
   635 
   628 void HWForm::CreateNetGame()
   636 void HWForm::CreateNetGame()
   629 {
   637 {
   630 	QString ammo=ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageNetGame->pGameCFG->WeaponsName->currentText());
   638 	QString ammo;
       
   639 	if (pnetserver) {
       
   640 	  ammo=ui.pageSelectWeapon->pWeapons->getWeaponsString(ui.pageNetGame->pGameCFG->WeaponsName->currentText());
       
   641 	} else {
       
   642 	  ammo=ui.pageNetGame->pGameCFG->getNetAmmo();
       
   643 	}
   631 	CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
   644 	CreateGame(ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget, ammo);
   632 
   645 
   633 	connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &)));
   646 	connect(game, SIGNAL(SendNet(const QByteArray &)), hwnet, SLOT(SendNet(const QByteArray &)));
   634 	connect(hwnet, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));
   647 	connect(hwnet, SIGNAL(FromNet(const QByteArray &)), game, SLOT(FromNet(const QByteArray &)));
   635 
   648