aboutsummaryrefslogtreecommitdiff
path: root/c++-qt/tests/echo/mainwnd.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-11-09 17:20:11 +0000
committerMike Buland <eichlan@xagasoft.com>2012-11-09 17:20:11 +0000
commitd534a56d95bca7bdd812be024d9eacba4734e2b7 (patch)
treef9b98ee2b80e645a7b54e7934882be6c9f73c165 /c++-qt/tests/echo/mainwnd.cpp
parent61ccc86fdf06f12cb72a8b7e65286f812cf62154 (diff)
downloadlibgats-d534a56d95bca7bdd812be024d9eacba4734e2b7.tar.gz
libgats-d534a56d95bca7bdd812be024d9eacba4734e2b7.tar.bz2
libgats-d534a56d95bca7bdd812be024d9eacba4734e2b7.tar.xz
libgats-d534a56d95bca7bdd812be024d9eacba4734e2b7.zip
Many changes: tabconv'd the C++ code, added a license, BSD, and docs.
Diffstat (limited to '')
-rw-r--r--c++-qt/tests/echo/mainwnd.cpp39
1 files changed, 23 insertions, 16 deletions
diff --git a/c++-qt/tests/echo/mainwnd.cpp b/c++-qt/tests/echo/mainwnd.cpp
index 13c93a1..3995720 100644
--- a/c++-qt/tests/echo/mainwnd.cpp
+++ b/c++-qt/tests/echo/mainwnd.cpp
@@ -1,10 +1,17 @@
1/*
2 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libgats library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#include "mainwnd.h" 8#include "mainwnd.h"
2 9
3MainWnd::MainWnd() 10MainWnd::MainWnd()
4{ 11{
5 pSrv = new QTcpServer( this ); 12 pSrv = new QTcpServer( this );
6 connect( pSrv, SIGNAL(newConnection()), this, SLOT(newConnection())); 13 connect( pSrv, SIGNAL(newConnection()), this, SLOT(newConnection()));
7 pSrv->listen( QHostAddress::Any, 7317 ); 14 pSrv->listen( QHostAddress::Any, 7317 );
8} 15}
9 16
10MainWnd::~MainWnd() 17MainWnd::~MainWnd()
@@ -13,24 +20,24 @@ MainWnd::~MainWnd()
13 20
14void MainWnd::newConnection() 21void MainWnd::newConnection()
15{ 22{
16 while( pSrv->hasPendingConnections() ) 23 while( pSrv->hasPendingConnections() )
17 { 24 {
18 QTcpSocket *pSock = pSrv->nextPendingConnection(); 25 QTcpSocket *pSock = pSrv->nextPendingConnection();
19 Gats::GatsStream *pGats = new Gats::GatsStream( *pSock ); 26 Gats::GatsStream *pGats = new Gats::GatsStream( *pSock );
20 connect( pSock, SIGNAL(readyRead()), pGats, SLOT(readObject()) ); 27 connect( pSock, SIGNAL(readyRead()), pGats, SLOT(readObject()) );
21 connect( pGats, SIGNAL(objectRead( Gats::Object * )), 28 connect( pGats, SIGNAL(objectRead( Gats::Object * )),
22 this, SLOT(objectRead( Gats::Object * ))); 29 this, SLOT(objectRead( Gats::Object * )));
23 } 30 }
24} 31}
25 32
26void MainWnd::objectRead( Gats::Object *pObj ) 33void MainWnd::objectRead( Gats::Object *pObj )
27{ 34{
28 ((Gats::GatsStream *)sender())->writeObject( pObj ); 35 ((Gats::GatsStream *)sender())->writeObject( pObj );
29 36
30 Gats::Object *pCopy = pObj->clone(); 37 Gats::Object *pCopy = pObj->clone();
31 delete pObj; 38 delete pObj;
32 39
33 ((Gats::GatsStream *)sender())->writeObject( pCopy ); 40 ((Gats::GatsStream *)sender())->writeObject( pCopy );
34 41
35 delete pCopy; 42 delete pCopy;
36} 43}