[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/kde4/playground/games/kombination/src
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2005-09-30 22:01:15
Message-ID: 1128117675.947928.28107.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 465818 by aacid:

don't replicate code dude


 M  +7 -12     kombination.cpp  
 M  +2 -0      kombination.h  


--- branches/work/kde4/playground/games/kombination/src/kombination.cpp \
#465817:465818 @@ -141,20 +141,10 @@
 			else
 			{
 				delete m_client;
-				m_client = new client(ng.server->text(), ng.clientPort->value(), nick);
+				createClient(ng.server->text(), ng.clientPort->value(), nick);
 				Settings::setClientNick(ng.clientNick->text());
 				Settings::setClientPort(ng.clientPort->value());
 				Settings::setClientServer(ng.server->text());
-				connect(m_client, SIGNAL(connected()), this, SLOT(connected()));
-				connect(m_client, SIGNAL(error(const QString &)), this, SLOT(clientError(const \
                QString &)));
-				connect(m_client, SIGNAL(newPlayer(const QString &)), m_chatWidget, \
                SLOT(addPlayer(const QString &)));
-				connect(m_client, SIGNAL(gotMessage(const QString &)), m_chatWidget, \
                SLOT(addMessage(const QString &)));
-				connect(m_client, SIGNAL(startGame()), m_chatWidget, SLOT(startGame()));
-				connect(m_client, SIGNAL(startGame()), this, SLOT(startGame()));
-				connect(m_client, SIGNAL(newTile(tile *)), m_tileWidget, SLOT(addTile(tile *)));
-				connect(m_client, SIGNAL(nextPlayer(const QString &, bool)), m_chatWidget, \
                SLOT(nextPlayer(const QString &, bool)));
-				connect(m_client, SIGNAL(nextPlayer(const QString &, bool)), m_board, \
                SLOT(nextPlayer(const QString &, bool)));
-				m_client->tryConnect();
 			}			
 		}
 	}
@@ -165,7 +155,12 @@
 void Kombination::serverStarted()
 {
 	// besides beign the server we are also going to play :-D
-	m_client = new client("localhost", m_port, m_nick);
+	createClient("localhost", m_port, m_nick);
+}
+
+void Kombination::createClient(const QString &host, int port, const QString &nick)
+{
+	m_client = new client(host, port, nick);
 	connect(m_client, SIGNAL(connected()), this, SLOT(connected()));
 	connect(m_client, SIGNAL(error(const QString &)), this, SLOT(clientError(const \
QString &)));  connect(m_client, SIGNAL(newPlayer(const QString &)), m_chatWidget, \
                SLOT(addPlayer(const QString &)));
--- branches/work/kde4/playground/games/kombination/src/kombination.h #465817:465818
@@ -39,6 +39,8 @@
 		void toggleReadyButton();
 
 	private:
+		void createClient(const QString &server, int port, const QString &nick);
+		
 		boardWidget *m_board;
 		chatWidget *m_chatWidget;
 		client *m_client;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic