QTfrontend/hwform.cpp
changeset 2345 daf1785f2337
parent 2261 57e99c908e7c
child 2368 e0750b23c9e6
equal deleted inserted replaced
2344:63b3da03ce46 2345:daf1785f2337
   575 
   575 
   576 	connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)),
   576 	connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)),
   577 		hwnet, SLOT(CreateRoom(const QString&)));
   577 		hwnet, SLOT(CreateRoom(const QString&)));
   578 	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
   578 	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
   579 		hwnet, SLOT(JoinRoom(const QString&)));
   579 		hwnet, SLOT(JoinRoom(const QString&)));
   580 	connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)),
   580 //	connect(ui.pageRoomsList, SIGNAL(askForCreateRoom(const QString &)),
   581 		this, SLOT(NetGameMaster()));
   581 //		this, SLOT(NetGameMaster()));
   582 	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
   582 //	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
   583 		this, SLOT(NetGameSlave()));
   583 //		this, SLOT(NetGameSlave()));
   584 	connect(ui.pageRoomsList, SIGNAL(askForRoomList()),
   584 	connect(ui.pageRoomsList, SIGNAL(askForRoomList()),
   585 		hwnet, SLOT(askRoomsList()));
   585 		hwnet, SLOT(askRoomsList()));
       
   586 
       
   587 // room status stuff
       
   588 	connect(hwnet, SIGNAL(roomMaster(bool)),
       
   589 		this, SLOT(NetGameChangeStatus(bool)));
   586 
   590 
   587 // net page stuff
   591 // net page stuff
   588 	connect(hwnet, SIGNAL(chatStringFromNet(const QString&)),
   592 	connect(hwnet, SIGNAL(chatStringFromNet(const QString&)),
   589 		ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&)));
   593 		ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&)));
   590 	connect(hwnet, SIGNAL(setReadyStatus(const QString &, bool)),
   594 	connect(hwnet, SIGNAL(setReadyStatus(const QString &, bool)),
   879 		sdli.StartMusic();
   883 		sdli.StartMusic();
   880 	else
   884 	else
   881 		sdli.StopMusic();
   885 		sdli.StopMusic();
   882 }
   886 }
   883 
   887 
       
   888 void HWForm::NetGameChangeStatus(bool isMaster)
       
   889 {
       
   890 	if (isMaster)
       
   891 		NetGameMaster();
       
   892 	else
       
   893 		NetGameSlave();
       
   894 }
       
   895 
   884 void HWForm::NetGameMaster()
   896 void HWForm::NetGameMaster()
   885 {
   897 {
   886 	ui.pageNetGame->setMasterMode(true);
   898 	ui.pageNetGame->setMasterMode(true);
   887 	ui.pageNetGame->restrictJoins->setChecked(false);
   899 	ui.pageNetGame->restrictJoins->setChecked(false);
   888 	ui.pageNetGame->restrictTeamAdds->setChecked(false);
   900 	ui.pageNetGame->restrictTeamAdds->setChecked(false);
   889 	ui.pageNetGame->pGameCFG->GameSchemes->setModel(ammoSchemeModel);
   901 	ui.pageNetGame->pGameCFG->GameSchemes->setModel(ammoSchemeModel);
       
   902 	ui.pageNetGame->pGameCFG->setEnabled(true);
       
   903 	ui.pageNetGame->pNetTeamsWidget->setInteractivity(true);
   890 	
   904 	
   891 	if (hwnet)
   905 	if (hwnet)
   892 	{
   906 	{
   893 		// disconnect connections first to ensure their inexistance and not to connect twice
   907 		// disconnect connections first to ensure their inexistance and not to connect twice
   894 		ui.pageNetGame->BtnStart->disconnect(hwnet);
   908 		ui.pageNetGame->BtnStart->disconnect(hwnet);
   905 	}
   919 	}
   906 }
   920 }
   907 
   921 
   908 void HWForm::NetGameSlave()
   922 void HWForm::NetGameSlave()
   909 {
   923 {
       
   924 	ui.pageNetGame->pGameCFG->setEnabled(false);
       
   925 	ui.pageNetGame->pNetTeamsWidget->setInteractivity(false);
       
   926 	
   910 	if (hwnet)
   927 	if (hwnet)
   911 	{
   928 	{
   912 		NetAmmoSchemeModel * netAmmo = new NetAmmoSchemeModel(hwnet);
   929 		NetAmmoSchemeModel * netAmmo = new NetAmmoSchemeModel(hwnet);
   913 		connect(hwnet, SIGNAL(netSchemeConfig(QStringList &)), netAmmo, SLOT(setNetSchemeConfig(QStringList &)));
   930 		connect(hwnet, SIGNAL(netSchemeConfig(QStringList &)), netAmmo, SLOT(setNetSchemeConfig(QStringList &)));
   914 		ui.pageNetGame->pGameCFG->GameSchemes->setModel(netAmmo);
   931 		ui.pageNetGame->pGameCFG->GameSchemes->setModel(netAmmo);