From d534a56d95bca7bdd812be024d9eacba4734e2b7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 9 Nov 2012 17:20:11 +0000 Subject: Many changes: tabconv'd the C++ code, added a license, BSD, and docs. --- c++-qt/tests/echo/mainwnd.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'c++-qt/tests/echo/mainwnd.cpp') 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 @@ +/* + * Copyright (C) 2007-2012 Xagasoft, All rights reserved. + * + * This file is part of the libgats library and is released under the + * terms of the license contained in the file LICENSE. + */ + #include "mainwnd.h" MainWnd::MainWnd() { - pSrv = new QTcpServer( this ); - connect( pSrv, SIGNAL(newConnection()), this, SLOT(newConnection())); - pSrv->listen( QHostAddress::Any, 7317 ); + pSrv = new QTcpServer( this ); + connect( pSrv, SIGNAL(newConnection()), this, SLOT(newConnection())); + pSrv->listen( QHostAddress::Any, 7317 ); } MainWnd::~MainWnd() @@ -13,24 +20,24 @@ MainWnd::~MainWnd() void MainWnd::newConnection() { - while( pSrv->hasPendingConnections() ) - { - QTcpSocket *pSock = pSrv->nextPendingConnection(); - Gats::GatsStream *pGats = new Gats::GatsStream( *pSock ); - connect( pSock, SIGNAL(readyRead()), pGats, SLOT(readObject()) ); - connect( pGats, SIGNAL(objectRead( Gats::Object * )), - this, SLOT(objectRead( Gats::Object * ))); - } + while( pSrv->hasPendingConnections() ) + { + QTcpSocket *pSock = pSrv->nextPendingConnection(); + Gats::GatsStream *pGats = new Gats::GatsStream( *pSock ); + connect( pSock, SIGNAL(readyRead()), pGats, SLOT(readObject()) ); + connect( pGats, SIGNAL(objectRead( Gats::Object * )), + this, SLOT(objectRead( Gats::Object * ))); + } } void MainWnd::objectRead( Gats::Object *pObj ) { - ((Gats::GatsStream *)sender())->writeObject( pObj ); + ((Gats::GatsStream *)sender())->writeObject( pObj ); - Gats::Object *pCopy = pObj->clone(); - delete pObj; + Gats::Object *pCopy = pObj->clone(); + delete pObj; - ((Gats::GatsStream *)sender())->writeObject( pCopy ); + ((Gats::GatsStream *)sender())->writeObject( pCopy ); - delete pCopy; + delete pCopy; } -- cgit v1.2.3