camino-devel
[Top][All Lists]
Advanced

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

[Camino-devel] camino/src/client ClientEngine.cpp ClientEngine...


From: Philippe Fremy
Subject: [Camino-devel] camino/src/client ClientEngine.cpp ClientEngine...
Date: Tue, 18 Feb 2003 16:05:13 -0500

CVSROOT:        /cvsroot/camino
Module name:    camino
Changes by:     Philippe Fremy <address@hidden> 03/02/18 16:05:12

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

Log message:
        display name of player and connection state in client window

Patches:
Index: camino/src/client/ClientEngine.cpp
diff -u camino/src/client/ClientEngine.cpp:1.11 
camino/src/client/ClientEngine.cpp:1.12
--- camino/src/client/ClientEngine.cpp:1.11     Tue Feb 18 13:43:20 2003
+++ camino/src/client/ClientEngine.cpp  Tue Feb 18 16:05:12 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: ClientEngine.cpp,v 1.11 2003/02/18 18:43:20 pfremy Exp $
+** Version : $Id: ClientEngine.cpp,v 1.12 2003/02/18 21:05:12 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
@@ -62,12 +62,12 @@
 void ClientEngine::slotServerConnected()
 {
        _state = StateWaitStart;
-       emit sig_connected( true );
        qDebug("ClientEngine - Connection with server established!");
        qDebug("ClientEngine - send player name " );
        connectServer( _playerName );
        qDebug("ClientEngine - send player name - done" );
        _state = StateWaitStart;
+       emit sig_connected( true );
 }
 
 void ClientEngine::slotConnectionClosed()
Index: camino/src/client/ClientEngine.h
diff -u camino/src/client/ClientEngine.h:1.9 
camino/src/client/ClientEngine.h:1.10
--- camino/src/client/ClientEngine.h:1.9        Mon Feb 17 19:11:50 2003
+++ camino/src/client/ClientEngine.h    Tue Feb 18 16:05:12 2003
@@ -5,7 +5,7 @@
 ** ClientEngine.h
 ** The intelligence of the client is here
 **
-** Version : $Id: ClientEngine.h,v 1.9 2003/02/18 00:11:50 pfremy Exp $
+** Version : $Id: ClientEngine.h,v 1.10 2003/02/18 21:05:12 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 14/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -62,6 +62,10 @@
        void sendMessage( NetMsgSubtype msgLevel, const QString & msg );
 
        void sendUndo();
+
+       QString getPlayerName() {
+                return _playerName; 
+       }
 
 signals:
        void sig_message( const QString & msg );
Index: camino/src/client/Game.cpp
diff -u camino/src/client/Game.cpp:1.13 camino/src/client/Game.cpp:1.14
--- camino/src/client/Game.cpp:1.13     Mon Feb 17 17:03:41 2003
+++ camino/src/client/Game.cpp  Tue Feb 18 16:05:12 2003
@@ -2,7 +2,7 @@
 **
 ** Camino
 **
-** Version : $Id: Game.cpp,v 1.13 2003/02/17 22:03:41 pfremy Exp $
+** Version : $Id: Game.cpp,v 1.14 2003/02/18 21:05:12 pfremy Exp $
 **
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
@@ -25,6 +25,9 @@
 // generic include files
 // include files for QT
 #include <qlayout.h>
+#include <qhbox.h>
+#include <qvbox.h>
+#include <qlabel.h>
 
 // application specific include files
 #include "common/log.h"
@@ -40,30 +43,31 @@
   : QWidget( parent, name, QWidget::WStyle_Customize | 
QWidget::WStyle_DialogBorder )
 {
        _engine = new ClientEngine();
-
        _board = new BoardCanvas( this );
-       BoardView * boardView = new BoardView( _board, this );
-
-       _actions = new ActionList( this );
-       _presentation = new TilePresentation( this );
-
-       QHBoxLayout * layH1 = new QHBoxLayout();
-       layH1->addWidget( _presentation );
-       layH1->addWidget( boardView, 1 );
-       layH1->addWidget( _actions );
-
-       _chat = new ChatWidget( this );
 
        QVBoxLayout * layout = new QVBoxLayout( this );
-       layout->addLayout( layH1, 1 );
-       layout->addWidget( _chat, 1 );
+       layout->setAutoAdd( true );
        layout->activate();
 
+
+       QVBox * vbox = new QVBox( this );
+       vbox->setSpacing( 10 );
+       _playerLabel = new QLabel( "Not connected", vbox );
+       _playerLabel->setAlignment( AlignHCenter );
+       slot_clientConnected( false ); // sets the text of the label
+       QHBox * hbox = new QHBox( vbox );
+       hbox->setSpacing( 10 );
+       _presentation = new TilePresentation( hbox );
+       BoardView * boardView = new BoardView( _board, hbox );
+       _actions = new ActionList( hbox );
+       _chat = new ChatWidget( vbox );
+
        _board->addTile( 1, 1 );
 
        connect( _chat, SIGNAL( sig_message( const QString & ) ), SLOT( 
slot_chatMessage( 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( _engine, SIGNAL( sig_connected( bool ) ), SLOT( 
slot_clientConnected( bool ) ) );
 
        connect( _presentation, SIGNAL( sig_tile( int ) ), SLOT( slot_tile( int 
) ) );
        connect( _actions, SIGNAL( sig_play() ), SLOT( slot_play() ) );
@@ -109,7 +113,7 @@
        _chat->newMessage( msg );
 }
 
-void Game::slot_tile( int tile )
+void Game::slot_tile( int /* tile */ )
 {
 
 }
@@ -139,3 +143,11 @@
        printf( "%d %d\n", row, col );
 }
 
+void Game::slot_clientConnected( bool state )
+{
+       if (state) {
+               _playerLabel->setText( "Connected: " + _engine->getPlayerName() 
);
+       } else {
+               _playerLabel->setText( "Not Connected" );
+       }
+}
Index: camino/src/client/Game.h
diff -u camino/src/client/Game.h:1.11 camino/src/client/Game.h:1.12
--- camino/src/client/Game.h:1.11       Mon Feb 17 17:03:41 2003
+++ camino/src/client/Game.h    Tue Feb 18 16:05:12 2003
@@ -5,7 +5,7 @@
 ** Game.h
 ** Main widget of the game
 **
-** Version : $Id: Game.h,v 1.11 2003/02/17 22:03:41 pfremy Exp $
+** Version : $Id: Game.h,v 1.12 2003/02/18 21:05:12 pfremy Exp $
 ** Author(s) : Philippe Fremy, Pascal Audoux
 ** Creation : 15/01/2003
 ** Copyright: Pascal Audoux, Philippe Fremy 2003
@@ -40,6 +40,7 @@
 class ChatWidget;
 class ClientEngine;
 class TilePresentation;
+class QLabel;
 
 /*              ------------------------------
  *                         Game
@@ -75,6 +76,8 @@
        void slot_trash();
        void slot_undo();
 
+       void slot_clientConnected( bool state );
+
 signals:
        void sig_connected( bool );
 
@@ -84,6 +87,7 @@
        BoardCanvas * _board;
        ChatWidget * _chat;
        ClientEngine * _engine;
+       QLabel * _playerLabel;
 };
 
 #endif // GAME_H




reply via email to

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