camino-devel
[Top][All Lists]
Advanced

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

[Camino-devel] camino/src camino.pro client/ClientInterface.cp...


From: Philippe Fremy
Subject: [Camino-devel] camino/src camino.pro client/ClientInterface.cp...
Date: Sun, 26 Jan 2003 13:10:57 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/01/26 13:10:57

Modified files:
        src            : camino.pro 
        src/client     : ClientInterface.cpp ClientInterface.h Game.cpp 
                         Game.h 
Added files:
        src/client     : ClientEngine.cpp ClientEngine.h 

Log message:
        put the intelligence of the client into a separate class

Patches:
Index: camino/src/camino.pro
diff -u camino/src/camino.pro:1.13 camino/src/camino.pro:1.14
--- camino/src/camino.pro:1.13  Sun Jan 26 09:03:45 2003
+++ camino/src/camino.pro       Sun Jan 26 13:10:57 2003
@@ -36,6 +36,7 @@
 HEADERS += client/Game.h
 HEADERS += client/Theme.h
 HEADERS += client/TileSprite.h
+HEADERS += client/ClientEngine.h
 
 SOURCES += client/BoardCanvas.cpp
 SOURCES += client/BoardView.cpp
@@ -44,6 +45,7 @@
 SOURCES += client/Game.cpp
 SOURCES += client/Theme.cpp
 SOURCES += client/TileSprite.cpp
+SOURCES += client/ClientEngine.cpp
 
 # common
 HEADERS += common/log.h
Index: camino/src/client/ClientInterface.cpp
diff -u camino/src/client/ClientInterface.cpp:1.9 
camino/src/client/ClientInterface.cpp:1.10
--- camino/src/client/ClientInterface.cpp:1.9   Sun Jan 26 11:50:09 2003
+++ camino/src/client/ClientInterface.cpp       Sun Jan 26 13:10:57 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: ClientInterface.cpp,v 1.9 2003/01/26 16:50:09 pfremy Exp $
+** Version : $Id: ClientInterface.cpp,v 1.10 2003/01/26 18:10:57 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -37,12 +37,15 @@
 #include "client/ClientInterface.h"
 #include "client/DialogConnection.h"
 #include "client/Theme.h"
-#include "Game.h"
+#include "client/ClientEngine.h"
+#include "client/Game.h"
 
 extern Theme theme;
 
 ClientInterface::ClientInterface()
 {
+       _clientEngine = new ClientEngine();
+
        _server = 0;
        setCaption( "Camino" );
        initActions();
@@ -50,7 +53,7 @@
        initStatusBar();
        theme.init();
 
-       _game = new Game( this );
+       _game = new Game( _clientEngine, this );
        setCentralWidget( _game );
 
        zoom( 2 );
@@ -176,7 +179,7 @@
 {
        DialogConnection dialog;
        if( dialog.exec() ) {
-           _game->connectToServer( dialog._serverHost->text(), 
+           _clientEngine->connectToServer( dialog._serverHost->text(), 
                                   dialog._serverPort->text().toInt(),
                                   dialog._playerName->text() );
        }
Index: camino/src/client/ClientInterface.h
diff -u camino/src/client/ClientInterface.h:1.7 
camino/src/client/ClientInterface.h:1.8
--- camino/src/client/ClientInterface.h:1.7     Sun Jan 26 11:50:09 2003
+++ camino/src/client/ClientInterface.h Sun Jan 26 13:10:57 2003
@@ -5,7 +5,7 @@
 ** ClientInterface.h
 ** Interface of the client
 **
-** Version : $Id: ClientInterface.h,v 1.7 2003/01/26 16:50:09 pfremy Exp $
+** Version : $Id: ClientInterface.h,v 1.8 2003/01/26 18:10:57 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -38,6 +38,7 @@
 class QAction;
 
 class Game;
+class ClientEngine;
 class ServerDialog;
 
 /*              ------------------------------
@@ -102,6 +103,7 @@
        void zoom( int level );
 
        Game * _game;
+       ClientEngine * _clientEngine;
        ServerDialog * _server;
        QAction * _actions[NUMBER_OF_ACTION];
 };
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.5 camino/src/client/Game.cpp:1.6
--- camino/src/client/Game.cpp:1.5      Sun Jan 26 11:50:09 2003
+++ camino/src/client/Game.cpp  Sun Jan 26 13:10:57 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.5 2003/01/26 16:50:09 pfremy Exp $
+** Version : $Id: Game.cpp,v 1.6 2003/01/26 18:10:57 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -25,16 +25,18 @@
 // generic include files
 // include files for QT
 #include <qlayout.h>
-#include <qsocket.h>
 
 // application specific include files
 #include "Game.h"
 #include "client/BoardCanvas.h"
 #include "client/BoardView.h"
+#include "client/ClientEngine.h"
 
-Game::Game( QWidget * parent , const char * name )
+Game::Game( ClientEngine * engine, QWidget * parent , const char * name )
   : QWidget( parent, name, QWidget::WStyle_Customize | 
QWidget::WStyle_DialogBorder )
 {
+       _clientEngine = engine;
+
        _board = new BoardCanvas( this );
        BoardView * boardView = new BoardView( _board, this );
 
@@ -44,29 +46,10 @@
        layout->activate();
 
        _board->addTile( 1, 1 );
-
-       _socket = new QSocket( this, "client socket" );
-       connect( _socket, SIGNAL(connected()), SLOT(slotServerConnected()) );
 }
 
 Game::~Game()
 {
-
-}
-
-void Game::connectToServer( const QString & serverName, int port, const 
QString & playerName )
-{
-       qDebug("connecting to server...");
-       qDebug("Host : %s", serverName.latin1() );
-       qDebug("IP: %d", port );
-       qDebug("Player name : %s", playerName.latin1() );
-
-       _socket->connectToHost( serverName, port );
-}
-
-void Game::slotServerConnected()
-{
-       qDebug("Connection with server established!");
 }
 
 
Index: camino/src/client/Game.h
diff -u camino/src/client/Game.h:1.3 camino/src/client/Game.h:1.4
--- camino/src/client/Game.h:1.3        Sun Jan 26 11:50:09 2003
+++ camino/src/client/Game.h    Sun Jan 26 13:10:57 2003
@@ -5,7 +5,7 @@
 ** Game.h
 ** Main widget of the game
 **
-** Version : $Id: Game.h,v 1.3 2003/01/26 16:50:09 pfremy Exp $
+** Version : $Id: Game.h,v 1.4 2003/01/26 18:10:57 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -35,7 +35,7 @@
 #include "common/MsgDecoder.h"
 
 class BoardCanvas;
-class QSocket;
+class ClientEngine;
 
 /*              ------------------------------
  *                         Game
@@ -46,19 +46,14 @@
 
 public:
        /** Constructor */
-       Game( QWidget * parent = 0, const char * name = 0 );
-
-       void connectToServer( const QString & serverName, int port, const 
QString & playerName );
+       Game( ClientEngine *, QWidget * parent = 0, const char * name = 0 );
 
        /** Destructor */
        virtual ~Game();
 
-protected slots:
-       void slotServerConnected(); 
-
 protected:
        BoardCanvas * _board;
-       QSocket * _socket;
+       ClientEngine * _clientEngine;
 };
 
 #endif // GAME_H




reply via email to

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