camino-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Camino-devel] camino/src/client ClientInterface.cpp ClientInt...


From: Pascal Audoux
Subject: [Camino-devel] camino/src/client ClientInterface.cpp ClientInt...
Date: Thu, 30 Jan 2003 16:44:11 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Pascal Audoux <address@hidden>  03/01/30 16:44:11

Modified files:
        src/client     : ClientInterface.cpp ClientInterface.h Game.cpp 
                         Game.h 

Log message:
        Manage connection of the client (can't connect twice but if it fails, 
can retry)

Patches:
Index: camino/src/client/ClientInterface.cpp
diff -u camino/src/client/ClientInterface.cpp:1.13 
camino/src/client/ClientInterface.cpp:1.14
--- camino/src/client/ClientInterface.cpp:1.13  Wed Jan 29 14:42:03 2003
+++ camino/src/client/ClientInterface.cpp       Thu Jan 30 16:44:11 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: ClientInterface.cpp,v 1.13 2003/01/29 19:42:03 Audoux Exp $
+** Version : $Id: ClientInterface.cpp,v 1.14 2003/01/30 21:44:11 Audoux Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -50,7 +50,7 @@
 
 ClientInterface::ClientInterface()
 {
-    _clientEngine = new ClientEngine();
+       _clientEngine = new ClientEngine();
        _serverDialog = 0;
        _server = 0;
        _serverWidget = 0;
@@ -65,6 +65,7 @@
        setCentralWidget( _game );
 
        zoom( 2 );
+       connect( _game, SIGNAL( sig_connected( bool ) ), SLOT( slot_connected( 
bool ) ) );
 }
 
 ClientInterface::~ClientInterface()
@@ -167,6 +168,11 @@
        statusBar()->message( text, 0 );
 }
 
+void ClientInterface::slot_connected( bool state )
+{
+       _actions[ACT_CONNECT]->setEnabled( ! state );
+}
+
 void ClientInterface::quitting()
 {
        qApp->quit();
@@ -182,7 +188,7 @@
        }
 
        // add a test on server.
-       
+
        _serverDialog = new ServerDialog( this );
        connect( _serverDialog, SIGNAL( sig_quit() ), SLOT( 
slot_quitServerDialog() ) );
        connect( _serverDialog, SIGNAL( sig_serverStarted( CaminoServer *, 
ServerWidget * ) ),
@@ -192,11 +198,13 @@
 
 void ClientInterface::connectToServer()
 {
-       DialogConnection dialog;
-       if( dialog.exec() ) {
-               _game->connectToServer( dialog.getHost(),
-                       dialog.getPort(),
-                       dialog.getPlayer() );
+       if( ! _game->isConnected() ) {
+               DialogConnection dialog;
+               if( dialog.exec() ) {
+                       _game->connectToServer( dialog.getHost(),
+                               dialog.getPort(),
+                               dialog.getPlayer() );
+               }
        }
 }
 
Index: camino/src/client/ClientInterface.h
diff -u camino/src/client/ClientInterface.h:1.10 
camino/src/client/ClientInterface.h:1.11
--- camino/src/client/ClientInterface.h:1.10    Tue Jan 28 16:54:27 2003
+++ camino/src/client/ClientInterface.h Thu Jan 30 16:44:11 2003
@@ -5,7 +5,7 @@
 ** ClientInterface.h
 ** Interface of the client
 **
-** Version : $Id: ClientInterface.h,v 1.10 2003/01/28 21:54:27 pfremy Exp $
+** Version : $Id: ClientInterface.h,v 1.11 2003/01/30 21:44:11 Audoux Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -66,6 +66,9 @@
 
        /** Slot for writing in the StatusBar */
        void slot_status( QString text );
+
+       /** Slot when the client is connected or disconneted */
+       void slot_connected( bool slot );
 
        /** Slot for destroying the server dialog */
        void slot_quitServerDialog();
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.10 camino/src/client/Game.cpp:1.11
--- camino/src/client/Game.cpp:1.10     Wed Jan 29 17:22:47 2003
+++ camino/src/client/Game.cpp  Thu Jan 30 16:44:11 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.10 2003/01/29 22:22:47 Audoux Exp $
+** Version : $Id: Game.cpp,v 1.11 2003/01/30 21:44:11 Audoux Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -62,6 +62,7 @@
 
        connect( _chat, SIGNAL( sig_message( const QString & ) ), SLOT( 
slot_message( const QString & ) ) );
        connect( _engine, SIGNAL( sig_message( const QString & ) ), SLOT( 
slot_serverMessage( const QString & ) ) );
+       connect( _engine, SIGNAL( sig_connected( bool ) ), SIGNAL( 
sig_connected( bool ) ) );
 
        connect( _presentation, SIGNAL( sig_tile( int ) ), SLOT( slot_tile( int 
) ) );
        connect( _actions, SIGNAL( sig_play() ), SLOT( slot_play() ) );
@@ -72,6 +73,11 @@
 
 Game::~Game()
 {
+}
+
+bool Game::isConnected()
+{
+       return _engine->isConnected();
 }
 
 void Game::reupdate()
Index: camino/src/client/Game.h
diff -u camino/src/client/Game.h:1.8 camino/src/client/Game.h:1.9
--- camino/src/client/Game.h:1.8        Wed Jan 29 17:22:47 2003
+++ camino/src/client/Game.h    Thu Jan 30 16:44:11 2003
@@ -5,7 +5,7 @@
 ** Game.h
 ** Main widget of the game
 **
-** Version : $Id: Game.h,v 1.8 2003/01/29 22:22:47 Audoux Exp $
+** Version : $Id: Game.h,v 1.9 2003/01/30 21:44:11 Audoux Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -57,6 +57,8 @@
 
        void connectToServer( QString host, int port, QString player );
 
+       bool isConnected();
+
        void reupdate();
 
 public slots:
@@ -70,6 +72,9 @@
        void slot_complete();
        void slot_trash();
        void slot_undo();
+
+signals:
+       void sig_connected( bool );
 
 protected:
        ActionList * _actions;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]