equal
deleted
inserted
replaced
35 #include "gameuiconfig.h" |
35 #include "gameuiconfig.h" |
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 |
41 |
41 HWForm::HWForm(QWidget *parent) |
42 HWForm::HWForm(QWidget *parent) |
42 : QMainWindow(parent), pnetserver(0) |
43 : QMainWindow(parent), pnetserver(0), pUdpServer(0) |
43 { |
44 { |
44 ui.setupUi(this); |
45 ui.setupUi(this); |
45 |
46 |
46 config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); |
47 config = new GameUIConfig(this, cfgdir->absolutePath() + "/hedgewars.ini"); |
47 |
48 |
286 void HWForm::NetStartServer() |
287 void HWForm::NetStartServer() |
287 { |
288 { |
288 pnetserver = new HWNetServer; |
289 pnetserver = new HWNetServer; |
289 pnetserver->StartServer(); |
290 pnetserver->StartServer(); |
290 _NetConnect(pnetserver->getRunningHostName(), pnetserver->getRunningPort(), ui.pageNet->editNetNick->text()); |
291 _NetConnect(pnetserver->getRunningHostName(), pnetserver->getRunningPort(), ui.pageNet->editNetNick->text()); |
|
292 pUdpServer = new HWNetUdpServer(); |
291 } |
293 } |
292 |
294 |
293 void HWForm::NetDisconnect() |
295 void HWForm::NetDisconnect() |
294 { |
296 { |
295 if(hwnet) { |
297 if(hwnet) { |
296 hwnet->Disconnect(); |
298 hwnet->Disconnect(); |
297 delete hwnet; |
299 delete hwnet; |
298 hwnet=0; |
300 hwnet=0; |
299 } |
301 } |
300 if(pnetserver) { |
302 if(pnetserver) { |
|
303 pUdpServer->deleteLater(); |
301 pnetserver->StopServer(); |
304 pnetserver->StopServer(); |
302 delete pnetserver; |
305 delete pnetserver; |
303 pnetserver=0; |
306 pnetserver=0; |
304 } |
307 } |
305 } |
308 } |