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 client/Cl...


From: Philippe Fremy
Subject: [Camino-devel] camino/src client/ClientInterface.cpp client/Cl...
Date: Sun, 26 Jan 2003 11:50:10 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/01/26 11:50:09

Modified files:
        src/client     : ClientInterface.cpp ClientInterface.h 
                         DialogConnection.cpp DialogConnectionUI.ui 
                         Game.cpp Game.h 
        src/common     : MsgCoder.h log.h 
        src/server     : CaminoServer.cpp CaminoServer.h 
                         ServerDialog.cpp ServerDialog.h 
                         ServerDialogUI.ui 

Log message:
        Client is now able to connect to server

Patches:
Index: camino/src/client/ClientInterface.cpp
diff -u camino/src/client/ClientInterface.cpp:1.8 
camino/src/client/ClientInterface.cpp:1.9
--- camino/src/client/ClientInterface.cpp:1.8   Sat Jan 25 12:27:37 2003
+++ camino/src/client/ClientInterface.cpp       Sun Jan 26 11:50:09 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: ClientInterface.cpp,v 1.8 2003/01/25 17:27:37 Audoux Exp $
+** Version : $Id: ClientInterface.cpp,v 1.9 2003/01/26 16:50:09 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -31,6 +31,7 @@
 #include <qpopupmenu.h>
 #include <qsignalmapper.h>
 #include <qstatusbar.h>
+#include <qlineedit.h>
 // application specific include files
 #include "server/ServerDialog.h"
 #include "client/ClientInterface.h"
@@ -45,12 +46,12 @@
        _server = 0;
        setCaption( "Camino" );
        initActions();
-        initMenuBar();
-        initStatusBar();
+       initMenuBar();
+       initStatusBar();
        theme.init();
 
        _game = new Game( this );
-        setCentralWidget( _game );
+       setCentralWidget( _game );
 
        zoom( 2 );
 }
@@ -78,8 +79,11 @@
        QAction * action;
 
        CREATEACTION( "Launch server", "&Launch server", ACT_SERVER );
+       action->setAccel( QString("Ctrl+L") );
        CREATEACTION( "Connect to server", "&Connect to server", ACT_CONNECT );
+       action->setAccel( QString("Ctrl+S") );
        CREATEACTION( "Quit", "&Quit", ACT_QUIT );
+       action->setAccel( QString("Ctrl+Q") );
 
        CREATEACTION( "Change theme", "&Change theme", ACT_THEME );
        CREATEACTION( "Small", "&Small", ACT_ZOOMSMALL );
@@ -94,7 +98,7 @@
 
 void ClientInterface::initMenuBar()
 {
-        QPopupMenu * menuFile = new QPopupMenu( this );
+       QPopupMenu * menuFile = new QPopupMenu( this );
        _actions[ACT_SERVER]->addTo( menuFile );
        _actions[ACT_CONNECT]->addTo( menuFile );
        menuFile->insertSeparator();
@@ -172,6 +176,9 @@
 {
        DialogConnection dialog;
        if( dialog.exec() ) {
+           _game->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.6 
camino/src/client/ClientInterface.h:1.7
--- camino/src/client/ClientInterface.h:1.6     Sat Jan 25 05:04:24 2003
+++ camino/src/client/ClientInterface.h Sun Jan 26 11:50:09 2003
@@ -5,7 +5,7 @@
 ** ClientInterface.h
 ** Interface of the client
 **
-** Version : $Id: ClientInterface.h,v 1.6 2003/01/25 10:04:24 Audoux Exp $
+** Version : $Id: ClientInterface.h,v 1.7 2003/01/26 16:50:09 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -79,7 +79,9 @@
                ACT_ZOOMSMALL,
                ACT_ZOOMMEDIUM,
                ACT_ZOOMLARGE,
-               ACT_QUIT
+               ACT_QUIT,
+
+               NUMBER_OF_ACTION
        };
 
        /** Define the 'actions' */
@@ -101,7 +103,7 @@
 
        Game * _game;
        ServerDialog * _server;
-       QAction * _actions[9];
+       QAction * _actions[NUMBER_OF_ACTION];
 };
 
 #endif // CLIENTINTERFACE_H
Index: camino/src/client/DialogConnection.cpp
diff -u camino/src/client/DialogConnection.cpp:1.2 
camino/src/client/DialogConnection.cpp:1.3
--- camino/src/client/DialogConnection.cpp:1.2  Tue Jan 21 17:26:55 2003
+++ camino/src/client/DialogConnection.cpp      Sun Jan 26 11:50:09 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: DialogConnection.cpp,v 1.2 2003/01/21 22:26:55 pfremy Exp $
+** Version : $Id: DialogConnection.cpp,v 1.3 2003/01/26 16:50:09 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
@@ -31,4 +31,5 @@
        :DialogConnectionUI( parent, name, true )
 {
 
-}
\ No newline at end of file
+}
+
Index: camino/src/client/DialogConnectionUI.ui
diff -u camino/src/client/DialogConnectionUI.ui:1.1 
camino/src/client/DialogConnectionUI.ui:1.2
--- camino/src/client/DialogConnectionUI.ui:1.1 Sun Jan 19 17:12:08 2003
+++ camino/src/client/DialogConnectionUI.ui     Sun Jan 26 11:50:09 2003
@@ -8,28 +8,101 @@
         <rect>
             <x>0</x>
             <y>0</y>
-            <width>304</width>
-            <height>148</height>
+            <width>480</width>
+            <height>218</height>
         </rect>
     </property>
     <property name="caption">
-        <string>Connection to a server</string>
+        <string>Connection to server</string>
     </property>
-    <widget class="QPushButton">
+    <widget class="QGroupBox">
         <property name="name">
-            <cstring>pushButton1</cstring>
+            <cstring>groupBox1</cstring>
         </property>
         <property name="geometry">
             <rect>
-                <x>50</x>
-                <y>110</y>
-                <width>82</width>
-                <height>26</height>
+                <x>10</x>
+                <y>10</y>
+                <width>420</width>
+                <height>117</height>
             </rect>
         </property>
-        <property name="text">
-            <string>Ok</string>
+        <property name="title">
+            <string></string>
         </property>
+        <hbox>
+            <property name="name">
+                <cstring>unnamed</cstring>
+            </property>
+            <widget class="QLayoutWidget">
+                <property name="name">
+                    <cstring>layout7</cstring>
+                </property>
+                <vbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QLabel">
+                        <property name="name">
+                            <cstring>textLabel1</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Player name:</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel">
+                        <property name="name">
+                            <cstring>textLabel2</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Server address :</string>
+                        </property>
+                    </widget>
+                    <widget class="QLabel">
+                        <property name="name">
+                            <cstring>textLabel2_2</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Server port :</string>
+                        </property>
+                    </widget>
+                </vbox>
+            </widget>
+            <widget class="QLayoutWidget">
+                <property name="name">
+                    <cstring>layout6</cstring>
+                </property>
+                <vbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QLineEdit">
+                        <property name="name">
+                            <cstring>_playerName</cstring>
+                        </property>
+                        <property name="text">
+                            <string>Phil_ou_Pascal</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit">
+                        <property name="name">
+                            <cstring>_serverHost</cstring>
+                        </property>
+                        <property name="text">
+                            <string>localhost</string>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit">
+                        <property name="name">
+                            <cstring>_serverPort</cstring>
+                        </property>
+                        <property name="text">
+                            <string>6789</string>
+                        </property>
+                    </widget>
+                </vbox>
+            </widget>
+        </hbox>
     </widget>
     <widget class="QPushButton">
         <property name="name">
@@ -37,8 +110,8 @@
         </property>
         <property name="geometry">
             <rect>
-                <x>170</x>
-                <y>110</y>
+                <x>300</x>
+                <y>160</y>
                 <width>82</width>
                 <height>26</height>
             </rect>
@@ -47,80 +120,39 @@
             <string>Cancel</string>
         </property>
     </widget>
-    <widget class="QGroupBox">
+    <widget class="QPushButton">
         <property name="name">
-            <cstring>groupBox1</cstring>
+            <cstring>_okButton</cstring>
         </property>
         <property name="geometry">
             <rect>
-                <x>10</x>
-                <y>10</y>
-                <width>280</width>
-                <height>81</height>
+                <x>120</x>
+                <y>160</y>
+                <width>82</width>
+                <height>26</height>
             </rect>
         </property>
-        <property name="title">
-            <string></string>
+        <property name="text">
+            <string>Ok</string>
+        </property>
+        <property name="default">
+            <bool>true</bool>
         </property>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>textLabel2</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>10</x>
-                    <y>50</y>
-                    <width>100</width>
-                    <height>20</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Server address:</string>
-            </property>
-        </widget>
-        <widget class="QLineEdit">
-            <property name="name">
-                <cstring>lineEdit1</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>110</x>
-                    <y>20</y>
-                    <width>150</width>
-                    <height>22</height>
-                </rect>
-            </property>
-        </widget>
-        <widget class="QLineEdit">
-            <property name="name">
-                <cstring>lineEdit1_2</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>110</x>
-                    <y>50</y>
-                    <width>150</width>
-                    <height>22</height>
-                </rect>
-            </property>
-        </widget>
-        <widget class="QLabel">
-            <property name="name">
-                <cstring>textLabel1</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>10</x>
-                    <y>20</y>
-                    <width>90</width>
-                    <height>20</height>
-                </rect>
-            </property>
-            <property name="text">
-                <string>Player name:</string>
-            </property>
-        </widget>
     </widget>
 </widget>
+<connections>
+    <connection>
+        <sender>_okButton</sender>
+        <signal>clicked()</signal>
+        <receiver>DialogConnectionUI</receiver>
+        <slot>accept()</slot>
+    </connection>
+    <connection>
+        <sender>pushButton2</sender>
+        <signal>clicked()</signal>
+        <receiver>DialogConnectionUI</receiver>
+        <slot>reject()</slot>
+    </connection>
+</connections>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.4 camino/src/client/Game.cpp:1.5
--- camino/src/client/Game.cpp:1.4      Wed Jan 22 17:57:23 2003
+++ camino/src/client/Game.cpp  Sun Jan 26 11:50:09 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.4 2003/01/22 22:57:23 Audoux Exp $
+** Version : $Id: Game.cpp,v 1.5 2003/01/26 16:50:09 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -25,13 +25,15 @@
 // 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"
 
 Game::Game( QWidget * parent , const char * name )
-  : QWidget( parent, name, QWidget::WStyle_Customize | 
QWidget::WStyle_DialogBorder ), MsgDecoder()
+  : QWidget( parent, name, QWidget::WStyle_Customize | 
QWidget::WStyle_DialogBorder )
 {
        _board = new BoardCanvas( this );
        BoardView * boardView = new BoardView( _board, this );
@@ -42,6 +44,9 @@
        layout->activate();
 
        _board->addTile( 1, 1 );
+
+       _socket = new QSocket( this, "client socket" );
+       connect( _socket, SIGNAL(connected()), SLOT(slotServerConnected()) );
 }
 
 Game::~Game()
@@ -49,6 +54,20 @@
 
 }
 
+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.2 camino/src/client/Game.h:1.3
--- camino/src/client/Game.h:1.2        Wed Jan 22 16:10:15 2003
+++ camino/src/client/Game.h    Sun Jan 26 11:50:09 2003
@@ -5,7 +5,7 @@
 ** Game.h
 ** Main widget of the game
 **
-** Version : $Id: Game.h,v 1.2 2003/01/22 21:10:15 Audoux Exp $
+** Version : $Id: Game.h,v 1.3 2003/01/26 16:50:09 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -35,22 +35,30 @@
 #include "common/MsgDecoder.h"
 
 class BoardCanvas;
+class QSocket;
 
 /*              ------------------------------
  *                         Game
  *              ------------------------------ */
-class Game : public QWidget, public MsgDecoder
+class Game : public QWidget
 {
-       //Q_OBJECT
+       Q_OBJECT
+
 public:
        /** Constructor */
        Game( QWidget * parent = 0, const char * name = 0 );
 
+       void connectToServer( const QString & serverName, int port, const 
QString & playerName );
+
        /** Destructor */
        virtual ~Game();
 
+protected slots:
+       void slotServerConnected(); 
+
 protected:
        BoardCanvas * _board;
+       QSocket * _socket;
 };
 
 #endif // GAME_H
Index: camino/src/common/MsgCoder.h
diff -u camino/src/common/MsgCoder.h:1.3 camino/src/common/MsgCoder.h:1.4
--- camino/src/common/MsgCoder.h:1.3    Tue Jan 21 17:27:41 2003
+++ camino/src/common/MsgCoder.h        Sun Jan 26 11:50:09 2003
@@ -3,7 +3,7 @@
 ** Camino
 **
 **
-** Version : $Id: MsgCoder.h,v 1.3 2003/01/21 22:27:41 pfremy Exp $
+** Version : $Id: MsgCoder.h,v 1.4 2003/01/26 16:50:09 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -52,8 +52,39 @@
 enum NetMsgType {
        FirstMsg = 0,
 
-       ConnectServer,
-
+       ConnectServer,          //! Client connects to server
+       ServerInformation,      //! Server returns the information about the 
waiting party (nb of players, version, type of party)
+       PlayerConnected,    //! Server informs clients that a new player has 
connected
+       TeamIsBeingChosen,      //! 4 players game, servers is currentely 
choosing the team composition
+       TeamsComposition,       //! 4 players game, servers informs client 
about the team composition
+
+       ChatMsg,                        //! Client/Server sends a chat message
+       InfoMsg,                        //! Client/Server sends an information 
message
+       DebugMsg,                       //! Client/Server sends a debug message
+
+       TilesForYou,            //! Server distributes one or many tiles to a 
client
+       ActivePlayer,           //! Server informs all client which player is 
active
+       PlayerPlaysAMove,       //! Client informs server about its move
+       MoveRejected,           //! Server refuses the last move of the client
+       UpdateBoard,            //! Server notifies a new tile on the board
+
+       UndoRequest,            //! Client request an undo
+       UndoAccepted,           //! Client/Server accepts the undo
+       UndoRejected,           //! Client/Server rejects the undo
+       UndoUpdateBoard,        //! Server updates the board
+
+       EndOfGameRequest,       //! Client request end of game
+       EndOfGameAccepted,      //! Client/Server accepts end of game
+       EndOfGameRejected,      //! Client/Server rejects end of game
+
+       PleaseFinishTheBoard,   //! Server asks client to fill-in the board at 
the end of the game
+       FinishBoardMove,                //! Client sets/removes a tile
+       BoardsCompleted,                //! Client thinks the board is finished
+
+       WinnerInformation,              //! Server sends winner information
+       AnotherGameRequest,             //! Client ask for another game
+       AnotherGameAccept,              //! Server accepts the other game
+
        LastMsg
 };
 
Index: camino/src/common/log.h
diff -u camino/src/common/log.h:1.1 camino/src/common/log.h:1.2
--- camino/src/common/log.h:1.1 Tue Jan 21 17:26:06 2003
+++ camino/src/common/log.h     Sun Jan 26 11:50:09 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: log.h,v 1.1 2003/01/21 22:26:06 pfremy Exp $
+** Version : $Id: log.h,v 1.2 2003/01/26 16:50:09 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -28,8 +28,10 @@
 #define logDD { qDebug("%s:%d", __FILE__, __LINE__ );  } qDebug
 #define logWW { qWarning("%s:%d", __FILE__, __LINE__ ); } qWarning
 #else
-#define logDD { qDebug("%s", __PRETTY_FUNCTION__ ); } qDebug
+
+#define logDD( format, args... ) { qDebug( __PRETTY_FUNCTION__ ": " format , 
## args ); }
 #define logWW { qWarning("%s", __PRETTY_FUNCTION__ ); } qWarning
+
 #endif // WIN32
  
  
Index: camino/src/server/CaminoServer.cpp
diff -u camino/src/server/CaminoServer.cpp:1.2 
camino/src/server/CaminoServer.cpp:1.3
--- camino/src/server/CaminoServer.cpp:1.2      Sun Jan 19 12:31:35 2003
+++ camino/src/server/CaminoServer.cpp  Sun Jan 26 11:50:09 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: CaminoServer.cpp,v 1.2 2003/01/19 17:31:35 Audoux Exp $
+** Version : $Id: CaminoServer.cpp,v 1.3 2003/01/26 16:50:09 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
@@ -27,10 +27,11 @@
 // generic include files
 // include files for QT
 #include <qsignalmapper.h>
+
 // application specific include files
+#include "common/log.h"
 
 
-/** add comments here */
 CaminoServer::CaminoServer( int port )
        : QServerSocket( port )
 {
@@ -43,12 +44,16 @@
 
 void CaminoServer::newConnection( int numSocket )
 {
+        //logDD("Connection to the server");
+
+        // if number of player has been reached, reject connection
+
         QSocket * uneso = new QSocket;
         uneso->setSocket( numSocket );
         _theSockets.append( uneso );
         _mapper->setMapping( uneso, _theSockets.count()-1 );
         connect( uneso, SIGNAL( readyRead() ), _mapper, SLOT( map() ) );
-        connect( uneso, SIGNAL( connectionClosed() ), SLOT( slot_socketClose() 
) );
+        //connect( uneso, SIGNAL( connectionClosed() ), SLOT( 
slot_socketClose() ) );
         emit sig_newPlayer( uneso );
         // XXX: uneso->sendConnectionOk();
 }
Index: camino/src/server/CaminoServer.h
diff -u camino/src/server/CaminoServer.h:1.2 
camino/src/server/CaminoServer.h:1.3
--- camino/src/server/CaminoServer.h:1.2        Sun Jan 19 12:31:35 2003
+++ camino/src/server/CaminoServer.h    Sun Jan 26 11:50:09 2003
@@ -5,7 +5,7 @@
 ** CaminoServer.h
 ** Server for the game
 **
-** Version : $Id: CaminoServer.h,v 1.2 2003/01/19 17:31:35 Audoux Exp $
+** Version : $Id: CaminoServer.h,v 1.3 2003/01/26 16:50:09 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 19/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -55,8 +55,8 @@
 
 signals:
        void sig_readEvent( int );
-        void sig_newPlayer( QSocket * );
-        void sig_endConnection( QString name );
+       void sig_newPlayer( QSocket * );
+       void sig_endConnection( QString name );
 
 protected:
        QPtrList<QSocket> _theSockets;
Index: camino/src/server/ServerDialog.cpp
diff -u camino/src/server/ServerDialog.cpp:1.5 
camino/src/server/ServerDialog.cpp:1.6
--- camino/src/server/ServerDialog.cpp:1.5      Sun Jan 26 08:10:23 2003
+++ camino/src/server/ServerDialog.cpp  Sun Jan 26 11:50:09 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: ServerDialog.cpp,v 1.5 2003/01/26 13:10:23 Audoux Exp $
+** Version : $Id: ServerDialog.cpp,v 1.6 2003/01/26 16:50:09 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -28,17 +28,21 @@
 // include files for QT
 #include <qpushbutton.h>
 #include <qradiobutton.h>
+#include <qlineedit.h>
 // application specific include files
 #include "ServerDialog.h"
+#include "server/CaminoServer.h"
+#include "common/log.h"
 
 ServerDialog::ServerDialog( QWidget * parent, const char * name )
 :ServerDialogUI( parent, name )
 {
        slot_2players();
        slot_team1();
-       setFinishEnabled( _page3, true );
-       setNextEnabled( _page2, false );
+       setFinishEnabled( _pageTeam, true );
+       setNextEnabled( _pageWaitConnection, false );
 
+       _server = 0L;
 
        connect( _2players, SIGNAL( clicked() ), SLOT( slot_2players() ) );
        connect( _4players, SIGNAL( clicked() ), SLOT( slot_4players() ) );
@@ -88,13 +92,24 @@
 
 void ServerDialog::slot_selection( const QString & pageTitle )
 {
-       if( pageTitle == title( _page2 ) ) {
-
-       } else if( pageTitle == title( _page3 ) ) {
+       if( pageTitle == title( _pageWaitConnection ) ) {
+               startServer();
        }
 }
 
+void ServerDialog::startServer() 
+{
+       if (_server != 0L) {
+               delete _server;
+       }
+
+       int portNumber = _ipPortNb->text().toInt();
+
+       qDebug("Port number : %d", portNumber );
 
+       _server = new CaminoServer( portNumber );
+       // connect so that new players appear in the player list
+}
 
 
 
Index: camino/src/server/ServerDialog.h
diff -u camino/src/server/ServerDialog.h:1.5 
camino/src/server/ServerDialog.h:1.6
--- camino/src/server/ServerDialog.h:1.5        Sun Jan 26 08:10:23 2003
+++ camino/src/server/ServerDialog.h    Sun Jan 26 11:50:09 2003
@@ -5,7 +5,7 @@
 ** ServerDialog.h
 ** Main dialog of the server
 **
-** Version : $Id: ServerDialog.h,v 1.5 2003/01/26 13:10:23 Audoux Exp $
+** Version : $Id: ServerDialog.h,v 1.6 2003/01/26 16:50:09 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -38,7 +38,7 @@
  *                         ServerDialog
  *              ------------------------------ */
 
-
+class CaminoServer;
 
 /** comment for the class */
 class ServerDialog : public ServerDialogUI
@@ -48,6 +48,10 @@
        /** Constructor */
        ServerDialog( QWidget * parent = 0, const char * name = 0 );
 
+       void startServer();
+
+       CaminoServer * getServer() { return _server; }
+
 public slots:
        void slot_2players();
        void slot_4players();
@@ -63,6 +67,7 @@
 protected:
        int _nb;
        int _team;
+       CaminoServer * _server;
 
 };
 
Index: camino/src/server/ServerDialogUI.ui
diff -u camino/src/server/ServerDialogUI.ui:1.3 
camino/src/server/ServerDialogUI.ui:1.4
--- camino/src/server/ServerDialogUI.ui:1.3     Sun Jan 26 06:30:34 2003
+++ camino/src/server/ServerDialogUI.ui Sun Jan 26 11:50:09 2003
@@ -17,47 +17,120 @@
     </property>
     <widget class="QWidget">
         <property name="name">
-            <cstring>_page1</cstring>
+            <cstring>_pageChoosePlayerNb</cstring>
         </property>
         <attribute name="title">
             <string>Choose number of players</string>
         </attribute>
         <widget class="QRadioButton">
             <property name="name">
-                <cstring>_2players</cstring>
+                <cstring>_4players</cstring>
             </property>
             <property name="geometry">
                 <rect>
                     <x>10</x>
-                    <y>10</y>
+                    <y>40</y>
                     <width>92</width>
                     <height>20</height>
                 </rect>
             </property>
             <property name="text">
-                <string>2 players</string>
+                <string>4 players</string>
             </property>
         </widget>
         <widget class="QRadioButton">
             <property name="name">
-                <cstring>_4players</cstring>
+                <cstring>_2players</cstring>
             </property>
             <property name="geometry">
                 <rect>
                     <x>10</x>
-                    <y>40</y>
+                    <y>10</y>
                     <width>92</width>
                     <height>20</height>
                 </rect>
             </property>
             <property name="text">
-                <string>4 players</string>
+                <string>2 players</string>
+            </property>
+            <property name="checked">
+                <bool>true</bool>
             </property>
         </widget>
     </widget>
     <widget class="QWidget">
         <property name="name">
-            <cstring>_page2</cstring>
+            <cstring>_pageChoosePort</cstring>
+        </property>
+        <attribute name="title">
+            <string>Choose IP port</string>
+        </attribute>
+        <vbox>
+            <property name="name">
+                <cstring>unnamed</cstring>
+            </property>
+            <widget class="QLayoutWidget">
+                <property name="name">
+                    <cstring>layout5</cstring>
+                </property>
+                <hbox>
+                    <property name="name">
+                        <cstring>unnamed</cstring>
+                    </property>
+                    <widget class="QLabel">
+                        <property name="name">
+                            <cstring>textLabel2</cstring>
+                        </property>
+                        <property name="sizePolicy">
+                            <sizepolicy>
+                                <hsizetype>3</hsizetype>
+                                <vsizetype>5</vsizetype>
+                                <horstretch>0</horstretch>
+                                <verstretch>0</verstretch>
+                            </sizepolicy>
+                        </property>
+                        <property name="text">
+                            <string>IP Port Number :</string>
+                        </property>
+                        <property name="scaledContents">
+                            <bool>false</bool>
+                        </property>
+                        <property name="buddy" stdset="0">
+                            <cstring>_ipPortNb</cstring>
+                        </property>
+                    </widget>
+                    <widget class="QLineEdit">
+                        <property name="name">
+                            <cstring>_ipPortNb</cstring>
+                        </property>
+                        <property name="text">
+                            <string>6789</string>
+                        </property>
+                    </widget>
+                    <spacer>
+                        <property name="name">
+                            <cstring>spacer1</cstring>
+                        </property>
+                        <property name="orientation">
+                            <enum>Horizontal</enum>
+                        </property>
+                        <property name="sizeType">
+                            <enum>Expanding</enum>
+                        </property>
+                        <property name="sizeHint">
+                            <size>
+                                <width>175</width>
+                                <height>31</height>
+                            </size>
+                        </property>
+                    </spacer>
+                </hbox>
+            </widget>
+        </vbox>
+    </widget>
+    <widget class="QWidget">
+        <property name="name">
+            <cstring>_pageWaitConnection</cstring>
         </property>
         <attribute name="title">
             <string>Wait for connections</string>
@@ -106,7 +179,7 @@
     </widget>
     <widget class="QWidget">
         <property name="name">
-            <cstring>_page3</cstring>
+            <cstring>_pageTeam</cstring>
         </property>
         <attribute name="title">
             <string>Choose teams</string>
@@ -161,5 +234,8 @@
         </widget>
     </widget>
 </widget>
+<slots>
+    <slot>slotStartGame()</slot>
+</slots>
 <layoutdefaults spacing="6" margin="11"/>
 </UI>




reply via email to

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