QTfrontend/hwform.cpp
changeset 1874 1b145e099b75
parent 1873 815a3ff1fe4b
child 1875 189370d394db
equal deleted inserted replaced
1873:815a3ff1fe4b 1874:1b145e099b75
   478 	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
   478 	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
   479 	connect(hwnet, SIGNAL(LeftRoom()), this, SLOT(NetLeftRoom()));
   479 	connect(hwnet, SIGNAL(LeftRoom()), this, SLOT(NetLeftRoom()));
   480 	connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
   480 	connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
   481 	connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
   481 	connect(ui.pageNetGame->BtnBack, SIGNAL(clicked()), hwnet, SLOT(partRoom()));
   482 
   482 
       
   483 // rooms list page stuff
   483 	connect(hwnet, SIGNAL(roomsList(const QStringList&)),
   484 	connect(hwnet, SIGNAL(roomsList(const QStringList&)),
   484 		ui.pageRoomsList, SLOT(setRoomsList(const QStringList&)));
   485 		ui.pageRoomsList, SLOT(setRoomsList(const QStringList&)));
   485 	connect(hwnet, SIGNAL(adminAccess(bool)),
   486 	connect(hwnet, SIGNAL(adminAccess(bool)),
   486 		ui.pageRoomsList, SLOT(setAdmin(bool)));
   487 		ui.pageRoomsList, SLOT(setAdmin(bool)));
   487 	connect(hwnet, SIGNAL(adminAccess(bool)),
   488 	connect(hwnet, SIGNAL(adminAccess(bool)),
   499 	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
   500 	connect(ui.pageRoomsList, SIGNAL(askForJoinRoom(const QString &)),
   500 		this, SLOT(NetGameSlave()));
   501 		this, SLOT(NetGameSlave()));
   501 	connect(ui.pageRoomsList, SIGNAL(askForRoomList()),
   502 	connect(ui.pageRoomsList, SIGNAL(askForRoomList()),
   502 		hwnet, SLOT(askRoomsList()));
   503 		hwnet, SLOT(askRoomsList()));
   503 
   504 
       
   505 // net page stuff
   504 	connect(hwnet, SIGNAL(chatStringFromNet(const QString&)),
   506 	connect(hwnet, SIGNAL(chatStringFromNet(const QString&)),
   505 		ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&)));
   507 		ui.pageNetGame->pChatWidget, SLOT(onChatString(const QString&)));
   506 	connect(hwnet, SIGNAL(setReadyStatus(const QString &, bool)),
   508 	connect(hwnet, SIGNAL(setReadyStatus(const QString &, bool)),
   507 		ui.pageNetGame->pChatWidget, SLOT(setReadyStatus(const QString &, bool)));
   509 		ui.pageNetGame->pChatWidget, SLOT(setReadyStatus(const QString &, bool)));
   508 	connect(hwnet, SIGNAL(chatStringFromMe(const QString&)),
   510 	connect(hwnet, SIGNAL(chatStringFromMe(const QString&)),
   513 		hwnet, SLOT(chatLineToNet(const QString&)));
   515 		hwnet, SLOT(chatLineToNet(const QString&)));
   514 	connect(ui.pageNetGame->BtnGo, SIGNAL(clicked()), hwnet, SLOT(ToggleReady()));
   516 	connect(ui.pageNetGame->BtnGo, SIGNAL(clicked()), hwnet, SLOT(ToggleReady()));
   515 	connect(hwnet, SIGNAL(setMyReadyStatus(bool)),
   517 	connect(hwnet, SIGNAL(setMyReadyStatus(bool)),
   516 		ui.pageNetGame, SLOT(setReadyStatus(bool)));
   518 		ui.pageNetGame, SLOT(setReadyStatus(bool)));
   517 
   519 
       
   520 // chat widget actions
   518 	connect(ui.pageNetGame->pChatWidget, SIGNAL(kick(const QString&)),
   521 	connect(ui.pageNetGame->pChatWidget, SIGNAL(kick(const QString&)),
   519 		hwnet, SLOT(kickPlayer(const QString&)));
   522 		hwnet, SLOT(kickPlayer(const QString&)));
   520 	connect(ui.pageNetGame->pChatWidget, SIGNAL(ban(const QString&)),
   523 	connect(ui.pageNetGame->pChatWidget, SIGNAL(ban(const QString&)),
   521 		hwnet, SLOT(banPlayer(const QString&)));
   524 		hwnet, SLOT(banPlayer(const QString&)));
   522 	connect(ui.pageNetGame->pChatWidget, SIGNAL(info(const QString&)),
   525 	connect(ui.pageNetGame->pChatWidget, SIGNAL(info(const QString&)),
   526 	connect(ui.pageRoomsList->chatWidget, SIGNAL(ban(const QString&)),
   529 	connect(ui.pageRoomsList->chatWidget, SIGNAL(ban(const QString&)),
   527 		hwnet, SLOT(banPlayer(const QString&)));
   530 		hwnet, SLOT(banPlayer(const QString&)));
   528 	connect(ui.pageRoomsList->chatWidget, SIGNAL(info(const QString&)),
   531 	connect(ui.pageRoomsList->chatWidget, SIGNAL(info(const QString&)),
   529 		hwnet, SLOT(infoPlayer(const QString&)));
   532 		hwnet, SLOT(infoPlayer(const QString&)));
   530 
   533 
       
   534 // chatting
   531 	connect(ui.pageRoomsList->chatWidget, SIGNAL(chatLine(const QString&)),
   535 	connect(ui.pageRoomsList->chatWidget, SIGNAL(chatLine(const QString&)),
   532 		hwnet, SLOT(chatLineToLobby(const QString&)));
   536 		hwnet, SLOT(chatLineToLobby(const QString&)));
   533 	connect(hwnet, SIGNAL(chatStringLobby(const QString&)),
   537 	connect(hwnet, SIGNAL(chatStringLobby(const QString&)),
   534 		ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&)));
   538 		ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&)));
   535 	connect(hwnet, SIGNAL(chatStringFromMeLobby(const QString&)),
   539 	connect(hwnet, SIGNAL(chatStringFromMeLobby(const QString&)),
   536 		ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&)));
   540 		ui.pageRoomsList->chatWidget, SLOT(onChatString(const QString&)));
   537 
   541 
       
   542 // nick list stuff
   538 	connect(hwnet, SIGNAL(nickAdded(const QString&)),
   543 	connect(hwnet, SIGNAL(nickAdded(const QString&)),
   539 		ui.pageNetGame->pChatWidget, SLOT(nickAdded(const QString&)));
   544 		ui.pageNetGame->pChatWidget, SLOT(nickAdded(const QString&)));
   540 	connect(hwnet, SIGNAL(nickRemoved(const QString&)),
   545 	connect(hwnet, SIGNAL(nickRemoved(const QString&)),
   541 		ui.pageNetGame->pChatWidget, SLOT(nickRemoved(const QString&)));
   546 		ui.pageNetGame->pChatWidget, SLOT(nickRemoved(const QString&)));
   542 	connect(hwnet, SIGNAL(nickAddedLobby(const QString&)),
   547 	connect(hwnet, SIGNAL(nickAddedLobby(const QString&)),
   543 		ui.pageRoomsList->chatWidget, SLOT(nickAdded(const QString&)));
   548 		ui.pageRoomsList->chatWidget, SLOT(nickAdded(const QString&)));
   544 	connect(hwnet, SIGNAL(nickRemovedLobby(const QString&)),
   549 	connect(hwnet, SIGNAL(nickRemovedLobby(const QString&)),
   545 		ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&)));
   550 		ui.pageRoomsList->chatWidget, SLOT(nickRemoved(const QString&)));
   546 
   551 
       
   552 // teams selecting stuff
   547 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(hhogsNumChanged(const HWTeam&)),
   553 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(hhogsNumChanged(const HWTeam&)),
   548 		hwnet, SLOT(onHedgehogsNumChanged(const HWTeam&)));
   554 		hwnet, SLOT(onHedgehogsNumChanged(const HWTeam&)));
   549 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamColorChanged(const HWTeam&)),
   555 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamColorChanged(const HWTeam&)),
   550 		hwnet, SLOT(onTeamColorChanged(const HWTeam&)));
   556 		hwnet, SLOT(onTeamColorChanged(const HWTeam&)));
   551 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamWillPlay(HWTeam)), hwnet, SLOT(AddTeam(HWTeam)));
   557 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamWillPlay(HWTeam)), hwnet, SLOT(AddTeam(HWTeam)));
   552 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(acceptRequested(HWTeam)), hwnet, SLOT(AddTeam(HWTeam)));
   558 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(acceptRequested(HWTeam)), hwnet, SLOT(AddTeam(HWTeam)));
   553 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamNotPlaying(const HWTeam&)), hwnet, SLOT(RemoveTeam(const HWTeam&)));
   559 	connect(ui.pageNetGame->pNetTeamsWidget, SIGNAL(teamNotPlaying(const HWTeam&)), hwnet, SLOT(RemoveTeam(const HWTeam&)));
   554 
       
   555 	//connect(ui.pageNetGame->pGameCFG->pMapContainer, SIGNAL(newTemplateFilter(int)), hwnet, SLOT(onTemplateFilterChanged(int)));
       
   556 
       
   557 	connect(hwnet, SIGNAL(hhnumChanged(const HWTeam&)),
   560 	connect(hwnet, SIGNAL(hhnumChanged(const HWTeam&)),
   558 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&)));
   561 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeHHNum(const HWTeam&)));
   559 	connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
   562 	connect(hwnet, SIGNAL(teamColorChanged(const HWTeam&)),
   560 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)));
   563 		ui.pageNetGame->pNetTeamsWidget, SLOT(changeTeamColor(const HWTeam&)));
       
   564 
       
   565 	//connect(ui.pageNetGame->pGameCFG->pMapContainer, SIGNAL(newTemplateFilter(int)), hwnet, SLOT(onTemplateFilterChanged(int)));
       
   566 
   561 	//connect(hwnet, SIGNAL(templateFilterChanged(int)), ui.pageNetGame->pGameCFG->pMapContainer, SLOT(setTemplateFilter(int)));
   567 	//connect(hwnet, SIGNAL(templateFilterChanged(int)), ui.pageNetGame->pGameCFG->pMapContainer, SLOT(setTemplateFilter(int)));
   562 
   568 
   563 	
   569 // config stuff
       
   570 	connect(hwnet, SIGNAL(paramChanged(const QString &, const QStringList &)), ui.pageNetGame->pGameCFG, SLOT(setParam(const QString &, const QStringList &)));
       
   571 	connect(ui.pageNetGame->pGameCFG, SIGNAL(paramChanged(const QString &, const QStringList &)), hwnet, SLOT(onParamChanged(const QString &, const QStringList &)));
       
   572 
       
   573 
   564 	connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()), Qt::QueuedConnection);
   574 	connect(hwnet, SIGNAL(Disconnected()), this, SLOT(ForcedDisconnect()), Qt::QueuedConnection);
   565 hwnet->Connect(hostName, port, nick);
   575 	
       
   576 	hwnet->Connect(hostName, port, nick);
   566 }
   577 }
   567 
   578 
   568 void HWForm::NetConnect()
   579 void HWForm::NetConnect()
   569 {
   580 {
   570 	HWHostPortDialog * hpd = new HWHostPortDialog(this);
   581 	HWHostPortDialog * hpd = new HWHostPortDialog(this);