summaryrefslogtreecommitdiffstats
path: root/kbattleship/kbattleship/konnectionhandling.h
blob: bc1e6adf9373091ef26441525207570770e2e637 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/***************************************************************************
                                 konnectionhandling.h
                                  -----------------
    Developers: (c) 2000-2001 Nikolas Zimmermann <wildfox@kde.org>
                (c) 2000-2001 Daniel Molkentin <molkentin@kde.org>

 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KONNECTIONHANDLING_H
#define KONNECTIONHANDLING_H

#include <tdelocale.h>
#include <tdemessagebox.h>

#include <tqobject.h>

#include "kbattleshipclient.h"
#include "kbattleshipserver.h"
#include "kmessage.h"

class KonnectionHandling : public TQObject
{
	TQ_OBJECT
  
public:
	enum{SERVER, CLIENT};
	KonnectionHandling(TQWidget *parent, KBattleshipServer *server);
	KonnectionHandling(TQWidget *parent, KBattleshipClient *client);

	int type() { return m_type; }

	void updateInternal(KBattleshipServer *server);
	void updateInternal(KBattleshipClient *client);

public slots:
	void slotNewMessage(KMessage *msg);
	void slotMessageSent(KMessage *msg);
	void slotNewClient();
	void slotLostClient();
	void slotLostServer();
	void slotSocketError(int error);

signals:
	void sigStatusBar(const TQString &);
	void sigEnemyNickname(const TQString &);
	void sigEnemyFieldData(int, int, int, int, int, int, int, bool);
	void sigClientInformation(const TQString &, const TQString &, const TQString &, const TQString &);
	void sigSendNickname();
	void sigSendFieldState(int, int);
	void sigPlaceShips(bool);
	void sigShootable(bool);
	void sigClientLost();
	void sigServerLost();
	void sigReplay();
	void sigLost(KMessage *);
	void sigAbortNetworkGame();
	void sigChatMessage(const TQString &, const TQString &, bool);

private:
	KBattleshipServer *m_kbserver;
	KBattleshipClient *m_kbclient;
	int m_type;
};

#endif