QTfrontend/hwform.cpp
changeset 416 595d8663254d
parent 412 2ddcc3e3e644
child 418 595a868918be
equal deleted inserted replaced
415:d6d3a6a473a3 416:595d8663254d
    36 #include "pages.h"
    36 #include "pages.h"
    37 #include "hwconsts.h"
    37 #include "hwconsts.h"
    38 #include "newnetclient.h"
    38 #include "newnetclient.h"
    39 #include "gamecfgwidget.h"
    39 #include "gamecfgwidget.h"
    40 #include "netudpserver.h"
    40 #include "netudpserver.h"
       
    41 #include "netudpwidget.h"
    41 
    42 
    42 HWForm::HWForm(QWidget *parent)
    43 HWForm::HWForm(QWidget *parent)
    43   : QMainWindow(parent), pnetserver(0), pUdpServer(0)
    44   : QMainWindow(parent), pnetserver(0), pUdpServer(0)
    44 {
    45 {
    45 	ui.setupUi(this);
    46 	ui.setupUi(this);
    76 	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    77 	connect(ui.pageOptions->BtnSaveOptions,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    77 
    78 
    78 	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    79 	connect(ui.pageNet->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    79 	connect(ui.pageNet->BtnNetConnect,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
    80 	connect(ui.pageNet->BtnNetConnect,	SIGNAL(clicked()),	this, SLOT(NetConnect()));
    80 	connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(NetStartServer()));
    81 	connect(ui.pageNet->BtnNetSvrStart, SIGNAL(clicked()), this, SLOT(NetStartServer()));
       
    82 	connect(ui.pageNet->pUpdateUdpButt, SIGNAL(clicked()), ui.pageNet->pUdpClient, SLOT(updateList()));
       
    83 	connect(ui.pageNet->pUdpClient->serversList,	SIGNAL(doubleClicked (const QModelIndex &)),	this, SLOT(NetConnectServer()));
    81 
    84 
    82 	connect(ui.pageNetGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    85 	connect(ui.pageNetGame->BtnBack,	SIGNAL(clicked()),	this, SLOT(GoBack()));
    83 	connect(ui.pageNetGame->BtnGo,	SIGNAL(clicked()),	this, SLOT(NetStartGame()));
    86 	connect(ui.pageNetGame->BtnGo,	SIGNAL(clicked()),	this, SLOT(NetStartGame()));
    84 
    87 
    85 	connect(ui.pageNetChat->BtnDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect()));
    88 	connect(ui.pageNetChat->BtnDisconnect, SIGNAL(clicked()), this, SLOT(NetDisconnect()));
   237 				tr("OK"));
   240 				tr("OK"));
   238 		return ;
   241 		return ;
   239 	}
   242 	}
   240 	CreateGame(0, 0);
   243 	CreateGame(0, 0);
   241 	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_" + cProtoVer);
   244 	game->PlayDemo(cfgdir->absolutePath() + "/Demos/" + curritem->text() + ".hwd_" + cProtoVer);
       
   245 }
       
   246 
       
   247 void HWForm::NetConnectServer()
       
   248 {
       
   249   QListWidgetItem * curritem = ui.pageNet->pUdpClient->serversList->currentItem();
       
   250   if (!curritem) {
       
   251     QMessageBox::critical(this,
       
   252 			  tr("Error"),
       
   253 			  tr("Please, select server from the list above"),
       
   254 			  tr("OK"));
       
   255     return ;
       
   256   }
       
   257   _NetConnect(curritem->text(), 46631, ui.pageNet->editNetNick->text());
   242 }
   258 }
   243 
   259 
   244 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick)
   260 void HWForm::_NetConnect(const QString & hostName, quint16 port, const QString & nick)
   245 {
   261 {
   246 	hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget);
   262 	hwnet = new HWNewNet(config, ui.pageNetGame->pGameCFG, ui.pageNetGame->pNetTeamsWidget);