QTfrontend/net/tcpBase.h
author koda
Tue, 04 Dec 2012 03:25:31 +0100
branchflibqtfrontend
changeset 8214 8edc37cdcfbf
parent 8092 08960209db8c
child 8363 0b4ac686fc44
permissions -rw-r--r--
can reopen engine again...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     1
/*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 533
diff changeset
     2
 * Hedgewars, a free turn based strategy game
4976
088d40d8aba2 Happy 2011 :)
koda
parents: 1066
diff changeset
     3
 * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
6952
7f70f37bbf08 license header year range adjustments
sheepluva
parents: 6700
diff changeset
     4
 * Copyright (c) 2004-2012 Andrey Korotaev <unC0Rr@gmail.com>
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     5
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     7
 * it under the terms of the GNU General Public License as published by
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     8
 * the Free Software Foundation; version 2 of the License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
     9
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    13
 * GNU General Public License for more details.
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    14
 *
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    15
 * You should have received a copy of the GNU General Public License
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    16
 * along with this program; if not, write to the Free Software
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    18
 */
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    19
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    20
#ifndef _TCPBASE_INCLUDED
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    21
#define _TCPBASE_INCLUDED
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    22
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    23
#include <QObject>
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    24
#include <QProcess>
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    25
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    26
class TCPBase : public QObject
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    27
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    28
        Q_OBJECT
389
9628e69b609f Fix IPCSocket issues
unc0rr
parents: 291
diff changeset
    29
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    30
    public:
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents: 8070
diff changeset
    31
        TCPBase(QObject * parent = 0);
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    32
        virtual ~TCPBase();
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    33
8069
bb7671829935 - Only allow one engine instance running at the moment
unc0rr
parents: 7289
diff changeset
    34
        virtual bool couldBeRemoved();
bb7671829935 - Only allow one engine instance running at the moment
unc0rr
parents: 7289
diff changeset
    35
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    36
    signals:
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents: 8070
diff changeset
    37
        void nextPlease();
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    38
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    39
    protected:
8069
bb7671829935 - Only allow one engine instance running at the moment
unc0rr
parents: 7289
diff changeset
    40
        bool m_hasStarted;
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents: 8070
diff changeset
    41
        int m_port;
291
afa378f1e961 automatic assign of game server TCP port
displacer
parents: 186
diff changeset
    42
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents: 8070
diff changeset
    43
        void start(bool couldCancelPreviousRequest);
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    44
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents: 8070
diff changeset
    45
        virtual QStringList getArguments() = 0;
08960209db8c Try to use map preview facilities:
unc0rr
parents: 8070
diff changeset
    46
        virtual void onEngineStart() = 0;
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    47
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents: 8070
diff changeset
    48
        void clientDisconnected();
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    49
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    50
    private:
7289
835bb2852579 Restore almost old TCPBase behaviour
Stepan777 <stepik-777@mail.ru>
parents: 7180
diff changeset
    51
        void RealStart();
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    52
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6060
diff changeset
    53
    private slots:
8092
08960209db8c Try to use map preview facilities:
unc0rr
parents: 8070
diff changeset
    54
        void iStart();
184
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    55
};
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    56
f97a7a3dc8f6 - Update more headers
unc0rr
parents: 183
diff changeset
    57
#endif // _TCPBASE_INCLUDED