QTfrontend/hwform.cpp
changeset 637 8fa7ed5e13bd
parent 636 dc93ac775bb9
child 646 ed610c2cd0a4
equal deleted inserted replaced
636:dc93ac775bb9 637:8fa7ed5e13bd
    40 #include "pages.h"
    40 #include "pages.h"
    41 #include "hwconsts.h"
    41 #include "hwconsts.h"
    42 #include "newnetclient.h"
    42 #include "newnetclient.h"
    43 #include "gamecfgwidget.h"
    43 #include "gamecfgwidget.h"
    44 #include "netserverslist.h"
    44 #include "netserverslist.h"
    45 #include "netudpwidget.h"
       
    46 #include "netudpserver.h"
    45 #include "netudpserver.h"
    47 #include "netwwwwidget.h"
       
    48 #include "netwwwserver.h"
    46 #include "netwwwserver.h"
    49 #include "chatwidget.h"
    47 #include "chatwidget.h"
    50 #include "playrecordpage.h"
    48 #include "playrecordpage.h"
    51 
    49 
    52 HWForm::HWForm(QWidget *parent)
    50 HWForm::HWForm(QWidget *parent)
    53   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0)
    51   : QMainWindow(parent), pnetserver(0), pRegisterServer(0), editedTeam(0), hwnet(0)
    54 {
    52 {
    55 	ui.setupUi(this);
    53 	ui.setupUi(this);
    56 	config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
    54 	config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini");
    57 
    55 
    58 	UpdateTeamsLists();
    56 	UpdateTeamsLists();
   345   _NetConnect(curritem->text(), 46631, ui.pageNet->editNetNick->text());
   343   _NetConnect(curritem->text(), 46631, ui.pageNet->editNetNick->text());
   346 }
   344 }
   347 
   345 
   348 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick)
   346 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick)
   349 {
   347 {
       
   348 	if(hwnet) {
       
   349 		hwnet->Disconnect();
       
   350 		delete hwnet;
       
   351 		hwnet=0;
       
   352 	}
   350 	ui.pageNetGame->pChatWidget->clear();
   353 	ui.pageNetGame->pChatWidget->clear();
   351 	hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget);
   354 	hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget);
       
   355 
   352 	connect(hwnet, SIGNAL(GameStateChanged(GameState)), this, SLOT(NetGameStateChanged(GameState)));
   356 	connect(hwnet, SIGNAL(GameStateChanged(GameState)), this, SLOT(NetGameStateChanged(GameState)));
   353 	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
   357 	connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
   354 	connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
   358 	connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
   355 
   359 
   356 	connect(hwnet, SIGNAL(chatStringFromNet(const QStringList&)),
   360 	connect(hwnet, SIGNAL(chatStringFromNet(const QStringList&)),