mapeditor.h
changeset 531 be24af55da40
parent 528 36d140349897
child 537 16d3598f611f
     1.1 --- a/mapeditor.h	Fri Jun 29 09:43:53 2007 +0000
     1.2 +++ b/mapeditor.h	Fri Jun 29 09:43:53 2007 +0000
     1.3 @@ -29,6 +29,15 @@
     1.4  		Idle,			//!< Idle, waiting for user event
     1.5  		EditHeading		//!< Editing heading (dont't select another branch now)
     1.6  	};
     1.7 +    /*! \brief Networking states
     1.8 +		
     1.9 +		In Network modus we want to switch of saveState, autosave, ...
    1.10 +	*/
    1.11 +	enum NetState {
    1.12 +		Offline,			//!< Offline
    1.13 +		Client,				//!< I am the client and connected to server
    1.14 +		Server				//!< I am the server
    1.15 +	};
    1.16      MapEditor(QWidget* parent=0);
    1.17  	~MapEditor();
    1.18      MapCenterObj* getMapCenter();		//!< Return center of map
    1.19 @@ -336,10 +345,14 @@
    1.20  
    1.21  public:
    1.22  	void newServer();
    1.23 +	void connectToServer();
    1.24  
    1.25  private slots:	
    1.26  	void newClient();
    1.27  	void sendData(const QString &s);
    1.28 +	void readData();
    1.29 +	void displayNetworkError (QAbstractSocket::SocketError);
    1.30 +
    1.31  	void autosave ();
    1.32  
    1.33  private:
    1.34 @@ -410,8 +423,16 @@
    1.35  	QPoint exportOffset;		// set before export, used in save
    1.36  	BranchObj::HideTmpMode hidemode;	// true while exporting to hide some stuff
    1.37  
    1.38 +	NetState netstate;			// offline, client, server
    1.39  	QTcpServer *tcpServer;		// Act as server in conference mode (experimental)
    1.40 -	QList <QTcpSocket*> clientList;
    1.41 +	QList <QTcpSocket*> clientList;		// List of connected clients
    1.42 +	quint16 sendCounter;		// Increased with every sent command
    1.43 +
    1.44 +	QTcpSocket	*clientSocket;	// socket of this client
    1.45 +	QString server;				// server address of this client
    1.46 +	int port;					// server port of this client
    1.47 +	void displayClientError(QAbstractSocket::SocketError socketError);
    1.48 +
    1.49  
    1.50  	int timerId;				// animation timer
    1.51  	QList <MapObj*> animObjList;// list with animated objects