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++-libbu++/src/gatscon/clientwidget.cpp | 95 +++++++++++++++++--------------- 1 file changed, 51 insertions(+), 44 deletions(-) (limited to 'c++-libbu++/src/gatscon/clientwidget.cpp') diff --git a/c++-libbu++/src/gatscon/clientwidget.cpp b/c++-libbu++/src/gatscon/clientwidget.cpp index 941d9fa..f13e736 100644 --- a/c++-libbu++/src/gatscon/clientwidget.cpp +++ b/c++-libbu++/src/gatscon/clientwidget.cpp @@ -1,3 +1,10 @@ +/* + * 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 "clientwidget.h" #include "clientthread.h" @@ -14,16 +21,16 @@ using namespace Bu; ClientWidget::ClientWidget( QWidget *pParent, const QByteArray &baHost, - int iPort ) : - QWidget( pParent ) + int iPort ) : + QWidget( pParent ) { - setupUi( this ); + setupUi( this ); - pCli = new ClientThread( this, baHost, iPort ); - connect( pCli, SIGNAL(recv( Gats::Object *)), - this, SLOT(recv(Gats::Object *)), Qt::QueuedConnection ); - - pCli->start(); + pCli = new ClientThread( this, baHost, iPort ); + connect( pCli, SIGNAL(recv( Gats::Object *)), + this, SLOT(recv(Gats::Object *)), Qt::QueuedConnection ); + + pCli->start(); } ClientWidget::~ClientWidget() @@ -32,51 +39,51 @@ ClientWidget::~ClientWidget() void ClientWidget::saveTo( const QString &sFile ) { - File fOut( sFile.toAscii().constData(), File::WriteNew ); - Gats::GatsStream gsOut( fOut ); - QTreeWidgetItem *pRoot = twHistory->invisibleRootItem(); - for( int j = 0; j < pRoot->childCount(); j++ ) - { - Gats::Object *pObj = treeToGats( pRoot->child( j ) ); - gsOut.writeObject( pObj ); - delete pObj; - } + File fOut( sFile.toAscii().constData(), File::WriteNew ); + Gats::GatsStream gsOut( fOut ); + QTreeWidgetItem *pRoot = twHistory->invisibleRootItem(); + for( int j = 0; j < pRoot->childCount(); j++ ) + { + Gats::Object *pObj = treeToGats( pRoot->child( j ) ); + gsOut.writeObject( pObj ); + delete pObj; + } } void ClientWidget::send() { - try - { - Gats::Object *pObj = Gats::Object::strToGats( - leGats->text().toAscii().constData() - ); - sio << "Send: " << *pObj << sio.nl; - QTreeWidgetItem *pIt = new QTreeWidgetItem( - twHistory->invisibleRootItem() - ); - pIt->setText( 0, "send" ); - gatsToTree( pIt, pObj ); - pCli->send( pObj ); - delete pObj; + try + { + Gats::Object *pObj = Gats::Object::strToGats( + leGats->text().toAscii().constData() + ); + sio << "Send: " << *pObj << sio.nl; + QTreeWidgetItem *pIt = new QTreeWidgetItem( + twHistory->invisibleRootItem() + ); + pIt->setText( 0, "send" ); + gatsToTree( pIt, pObj ); + pCli->send( pObj ); + delete pObj; - leGats->setText(""); - leGats->setFocus(); - } - catch( Bu::ExceptionBase &e ) - { - QMessageBox::critical( this, "Gats Console - Error", e.what() ); - } + leGats->setText(""); + leGats->setFocus(); + } + catch( Bu::ExceptionBase &e ) + { + QMessageBox::critical( this, "Gats Console - Error", e.what() ); + } } void ClientWidget::recv( Gats::Object *pObj ) { - sio << "Recv: " << *pObj << sio.nl; + sio << "Recv: " << *pObj << sio.nl; - QTreeWidgetItem *pIt = new QTreeWidgetItem( - twHistory->invisibleRootItem() - ); - pIt->setText( 0, "recv" ); - gatsToTree( pIt, pObj ); - delete pObj; + QTreeWidgetItem *pIt = new QTreeWidgetItem( + twHistory->invisibleRootItem() + ); + pIt->setText( 0, "recv" ); + gatsToTree( pIt, pObj ); + delete pObj; } -- cgit v1.2.3