QTfrontend/netserver.cpp
changeset 1375 c95c6887b289
parent 1374 f33fa81e583d
child 1384 329d3308e2e3
equal deleted inserted replaced
1374:f33fa81e583d 1375:c95c6887b289
    16  * along with this program; if not, write to the Free Software
    16  * along with this program; if not, write to the Free Software
    17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    18  */
    18  */
    19 
    19 
    20 #include <QMessageBox>
    20 #include <QMessageBox>
       
    21 
       
    22 #include "hwconsts.h"
    21 #include "netserver.h"
    23 #include "netserver.h"
       
    24 
       
    25 HWNetServer::~HWNetServer()
       
    26 {
       
    27 	StopServer();
       
    28 }
    22 
    29 
    23 bool HWNetServer::StartServer(quint16 port)
    30 bool HWNetServer::StartServer(quint16 port)
    24 {
    31 {
    25 	ds_port = port;
    32 	ds_port = port;
    26 
    33 
    27 	return true;
    34 	QStringList params;
       
    35 	params << QString("--port=%1").arg(port);
       
    36 	
       
    37 	process.start(bindir->absolutePath() + "/hedgewars-server", params);
       
    38 
       
    39 	return process.waitForStarted(5000);
    28 }
    40 }
    29 
    41 
    30 void HWNetServer::StopServer()
    42 void HWNetServer::StopServer()
    31 {
    43 {
       
    44 	process.close();
    32 }
    45 }
    33 
    46 
    34 
    47 
    35 quint16 HWNetServer::getRunningPort() const
    48 quint16 HWNetServer::getRunningPort() const
    36 {
    49 {