From 74dd68ad611d15abf16a65c36a7cfd3f4492930a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 9 Nov 2012 16:25:22 +0000 Subject: Made the repo less libbu++-centric. --- src/gatscon/clientthread.cpp | 38 -------- src/gatscon/clientthread.h | 37 -------- src/gatscon/clientwidget.cpp | 82 ----------------- src/gatscon/clientwidget.h | 30 ------ src/gatscon/clientwidget.ui | 87 ------------------ src/gatscon/connectdlg.cpp | 22 ----- src/gatscon/connectdlg.h | 17 ---- src/gatscon/connectdlg.ui | 99 -------------------- src/gatscon/filewidget.cpp | 72 --------------- src/gatscon/filewidget.h | 29 ------ src/gatscon/filewidget.ui | 95 ------------------- src/gatscon/gatstotree.cpp | 91 ------------------- src/gatscon/gatstotree.h | 28 ------ src/gatscon/iobase.cpp | 1 - src/gatscon/iobase.h | 10 -- src/gatscon/main.cpp | 13 --- src/gatscon/mainwnd.cpp | 119 ------------------------ src/gatscon/mainwnd.h | 26 ------ src/gatscon/mainwnd.ui | 207 ------------------------------------------ src/gatscon/proxythread.cpp | 108 ---------------------- src/gatscon/proxythread.h | 60 ------------ src/gatscon/proxywidget.cpp | 131 -------------------------- src/gatscon/proxywidget.h | 33 ------- src/gatscon/proxywidget.ui | 181 ------------------------------------ src/gatscon/setupproxydlg.cpp | 27 ------ src/gatscon/setupproxydlg.h | 18 ---- src/gatscon/setupproxydlg.ui | 112 ----------------------- src/gatscon/treetogats.cpp | 52 ----------- src/gatscon/treetogats.h | 13 --- 29 files changed, 1838 deletions(-) delete mode 100644 src/gatscon/clientthread.cpp delete mode 100644 src/gatscon/clientthread.h delete mode 100644 src/gatscon/clientwidget.cpp delete mode 100644 src/gatscon/clientwidget.h delete mode 100644 src/gatscon/clientwidget.ui delete mode 100644 src/gatscon/connectdlg.cpp delete mode 100644 src/gatscon/connectdlg.h delete mode 100644 src/gatscon/connectdlg.ui delete mode 100644 src/gatscon/filewidget.cpp delete mode 100644 src/gatscon/filewidget.h delete mode 100644 src/gatscon/filewidget.ui delete mode 100644 src/gatscon/gatstotree.cpp delete mode 100644 src/gatscon/gatstotree.h delete mode 100644 src/gatscon/iobase.cpp delete mode 100644 src/gatscon/iobase.h delete mode 100644 src/gatscon/main.cpp delete mode 100644 src/gatscon/mainwnd.cpp delete mode 100644 src/gatscon/mainwnd.h delete mode 100644 src/gatscon/mainwnd.ui delete mode 100644 src/gatscon/proxythread.cpp delete mode 100644 src/gatscon/proxythread.h delete mode 100644 src/gatscon/proxywidget.cpp delete mode 100644 src/gatscon/proxywidget.h delete mode 100644 src/gatscon/proxywidget.ui delete mode 100644 src/gatscon/setupproxydlg.cpp delete mode 100644 src/gatscon/setupproxydlg.h delete mode 100644 src/gatscon/setupproxydlg.ui delete mode 100644 src/gatscon/treetogats.cpp delete mode 100644 src/gatscon/treetogats.h (limited to 'src/gatscon') diff --git a/src/gatscon/clientthread.cpp b/src/gatscon/clientthread.cpp deleted file mode 100644 index 4c7b72a..0000000 --- a/src/gatscon/clientthread.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "clientthread.h" - -#include - -ClientThread::ClientThread( QObject *pParent, const QByteArray &baHost, - int iPort ) : - QThread( pParent ), - baHost( baHost ), - iPort( iPort ), - gsCli( ssCli ) -{ -} - -ClientThread::~ClientThread() -{ -} - -void ClientThread::send( Gats::Object *pObj ) -{ - gsCli.writeObject( pObj ); -} - -void ClientThread::run() -{ - ssCli.setStream( - new Bu::TcpSocket( baHost.constData(), iPort ) - ); - - while( !ssCli.isEos() ) - { - Gats::Object *pObj = gsCli.readObject(); - if( pObj == NULL ) - continue; - - emit recv( pObj ); - } -} - diff --git a/src/gatscon/clientthread.h b/src/gatscon/clientthread.h deleted file mode 100644 index 3182d37..0000000 --- a/src/gatscon/clientthread.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef CLIENT_THREAD_H -#define CLIENT_THREAD_H - -#include -#include - -#include -#include - -namespace Gats -{ - class Object; -}; - -class ClientThread : public QThread -{ - Q_OBJECT; -public: - ClientThread( QObject *pParent, const QByteArray &baHost, int iPort ); - virtual ~ClientThread(); - - void send( Gats::Object *pObj ); - -signals: - void recv( Gats::Object *pObj ); - -protected: - virtual void run(); - -private: - QByteArray baHost; - int iPort; - Bu::StreamStack ssCli; - Gats::GatsStream gsCli; -}; - -#endif diff --git a/src/gatscon/clientwidget.cpp b/src/gatscon/clientwidget.cpp deleted file mode 100644 index 941d9fa..0000000 --- a/src/gatscon/clientwidget.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#include "clientwidget.h" -#include "clientthread.h" - -#include "gatstotree.h" -#include "treetogats.h" - -#include - -#include -#include -#include -#include - -using namespace Bu; - -ClientWidget::ClientWidget( QWidget *pParent, const QByteArray &baHost, - int iPort ) : - QWidget( pParent ) -{ - setupUi( this ); - - pCli = new ClientThread( this, baHost, iPort ); - connect( pCli, SIGNAL(recv( Gats::Object *)), - this, SLOT(recv(Gats::Object *)), Qt::QueuedConnection ); - - pCli->start(); -} - -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; - } -} - -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; - - 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; - - QTreeWidgetItem *pIt = new QTreeWidgetItem( - twHistory->invisibleRootItem() - ); - pIt->setText( 0, "recv" ); - gatsToTree( pIt, pObj ); - delete pObj; -} - diff --git a/src/gatscon/clientwidget.h b/src/gatscon/clientwidget.h deleted file mode 100644 index 06c154d..0000000 --- a/src/gatscon/clientwidget.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef CLIENT_WIDGET_H -#define CLIENT_WIDGET_H - -#include -#include "ui_clientwidget.h" -#include "iobase.h" - -namespace Gats -{ - class Object; -}; - -class ClientWidget : public QWidget, protected Ui::ClientWidget, public IoBase -{ - Q_OBJECT; -public: - ClientWidget( QWidget *pParent, const QByteArray &baHost, int iPort ); - virtual ~ClientWidget(); - - virtual void saveTo( const QString &sFile ); - -public slots: - void send(); - void recv( Gats::Object *pObj ); - -private: - class ClientThread *pCli; -}; - -#endif diff --git a/src/gatscon/clientwidget.ui b/src/gatscon/clientwidget.ui deleted file mode 100644 index a0cb997..0000000 --- a/src/gatscon/clientwidget.ui +++ /dev/null @@ -1,87 +0,0 @@ - - - ClientWidget - - - - 0 - 0 - 363 - 291 - - - - Form - - - - - - - Name - - - - - Type - - - - - Value - - - - - - - - - - Gats: - - - - - - - - - - Send - - - true - - - true - - - - - - - - - - - pushButton - clicked() - ClientWidget - send() - - - 332 - 276 - - - 322 - 367 - - - - - - send() - - diff --git a/src/gatscon/connectdlg.cpp b/src/gatscon/connectdlg.cpp deleted file mode 100644 index 589ae97..0000000 --- a/src/gatscon/connectdlg.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include "connectdlg.h" - -ConnectDlg::ConnectDlg( QWidget *pParent ) : - QDialog( pParent ) -{ - setupUi( this ); -} - -ConnectDlg::~ConnectDlg() -{ -} - -QByteArray ConnectDlg::getHostname() const -{ - return leHost->text().toAscii(); -} - -int ConnectDlg::getPort() const -{ - return sbPort->value(); -} - diff --git a/src/gatscon/connectdlg.h b/src/gatscon/connectdlg.h deleted file mode 100644 index 57ea6cd..0000000 --- a/src/gatscon/connectdlg.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef CONNECT_DLG_H -#define CONNECT_DLG_H - -#include "ui_connectdlg.h" - -class ConnectDlg : public QDialog, protected Ui::ConnectDlg -{ - Q_OBJECT; -public: - ConnectDlg( QWidget *pParent ); - virtual ~ConnectDlg(); - - QByteArray getHostname() const; - int getPort() const; -}; - -#endif diff --git a/src/gatscon/connectdlg.ui b/src/gatscon/connectdlg.ui deleted file mode 100644 index 6875e27..0000000 --- a/src/gatscon/connectdlg.ui +++ /dev/null @@ -1,99 +0,0 @@ - - - ConnectDlg - - - - 0 - 0 - 300 - 93 - - - - Gats Console - Connect - - - - - - - - Hostname: - - - - - - - Port: - - - - - - - localhost - - - - - - - 1 - - - 32767 - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - ConnectDlg - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - ConnectDlg - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/src/gatscon/filewidget.cpp b/src/gatscon/filewidget.cpp deleted file mode 100644 index dbd70fd..0000000 --- a/src/gatscon/filewidget.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "filewidget.h" - -#include "gatstotree.h" -#include "treetogats.h" - -#include -#include -#include - -#include - -using namespace Bu; - -FileWidget::FileWidget( QWidget *pParent ) : - QWidget( pParent ) -{ - setupUi( this ); -} - -FileWidget::FileWidget( QWidget *pParent, QString sFile ) : - QWidget( pParent ) -{ - setupUi( this ); - - File fIn( sFile.toAscii().constData(), File::Read ); - Gats::GatsStream gsIn( fIn ); - Gats::Object *pObj; - while( (pObj = gsIn.readObject()) ) - { - QTreeWidgetItem *pNew = new QTreeWidgetItem( - twGats->invisibleRootItem() - ); - pNew->setText( 0, "" ); - gatsToTree( pNew, pObj ); - delete pObj; - } -} - -FileWidget::~FileWidget() -{ -} - -void FileWidget::saveTo( const QString &sFile ) -{ - File fOut( sFile.toAscii().constData(), File::WriteNew ); - Gats::GatsStream gsOut( fOut ); - QTreeWidgetItem *pRoot = twGats->invisibleRootItem(); - for( int j = 0; j < pRoot->childCount(); j++ ) - { - Gats::Object *pObj = treeToGats( pRoot->child( j ) ); - gsOut.writeObject( pObj ); - delete pObj; - } -} - -void FileWidget::addRootItem() -{ - QString sText = QInputDialog::getText( this, "Gats Console - Add Root Item", - "Gats:"); - Gats::Object *pObj = Gats::Object::strToGats( sText.toAscii().constData() ); - QTreeWidgetItem *pNew = new QTreeWidgetItem( - twGats->invisibleRootItem() - ); - pNew->setText( 0, "" ); - gatsToTree( pNew, pObj ); - delete pObj; -} - -void FileWidget::delRootItem() -{ -} - diff --git a/src/gatscon/filewidget.h b/src/gatscon/filewidget.h deleted file mode 100644 index 9993bfe..0000000 --- a/src/gatscon/filewidget.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef FILE_WIDGET_H -#define FILE_WIDGET_H - -#include "ui_filewidget.h" -#include "iobase.h" - -namespace Gats -{ - class Object; -}; - -class FileWidget : public QWidget, protected Ui::FileWidget, public IoBase -{ - Q_OBJECT; -public: - FileWidget( QWidget *pParent=NULL ); - FileWidget( QWidget *pParent, QString sFile ); - virtual ~FileWidget(); - - virtual void saveTo( const QString &sFile ); - -public slots: - void addRootItem(); - void delRootItem(); - -private: -}; - -#endif diff --git a/src/gatscon/filewidget.ui b/src/gatscon/filewidget.ui deleted file mode 100644 index d0e6ec3..0000000 --- a/src/gatscon/filewidget.ui +++ /dev/null @@ -1,95 +0,0 @@ - - - FileWidget - - - - 0 - 0 - 316 - 300 - - - - Form - - - - - - - Name - - - - - Type - - - - - Value - - - - - - - - - - Add Root Item - - - - - - - Del Root Item - - - - - - - - - - - pushButton_2 - clicked() - FileWidget - addRootItem() - - - 60 - 283 - - - 10 - 343 - - - - - pushButton - clicked() - FileWidget - delRootItem() - - - 252 - 283 - - - 258 - 324 - - - - - - addRootItem() - delRootItem() - - diff --git a/src/gatscon/gatstotree.cpp b/src/gatscon/gatstotree.cpp deleted file mode 100644 index e388d5e..0000000 --- a/src/gatscon/gatstotree.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include "gatstotree.h" - -#include - -#include - -void gatsToTree( QTreeWidgetItem *p, Gats::Object *pObj ) -{ - switch( pObj->getType() ) - { - case Gats::typeInteger: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeString: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeFloat: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeBoolean: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeList: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeDictionary: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - - case Gats::typeNull: - gatsToTree( p, dynamic_cast( pObj ) ); - break; - } -} - -void gatsToTree( QTreeWidgetItem *p, Gats::Integer *pObj ) -{ - p->setText( 1, "int"); - p->setText( 2, QString("%1").arg( pObj->getValue() ) ); -} - -void gatsToTree( QTreeWidgetItem *p, Gats::String *pObj ) -{ - p->setText( 1, "str"); - p->setText( 2, QString("%1").arg( pObj->getStr() ) ); -} - -void gatsToTree( QTreeWidgetItem *p, Gats::Float *pObj ) -{ - p->setText( 1, "float"); - p->setText( 2, QString("%1").arg( pObj->getValue() ) ); -} - -void gatsToTree( QTreeWidgetItem *p, Gats::Boolean *pObj ) -{ - p->setText( 1, "bool"); - p->setText( 2, pObj->getValue()?"true":"false" ); -} - -void gatsToTree( QTreeWidgetItem *p, Gats::List *pObj ) -{ - p->setText( 1, "list"); - int j = 0; - for( Gats::List::iterator i = pObj->begin(); i; i++ ) - { - QTreeWidgetItem *pIt = new QTreeWidgetItem( p ); - pIt->setText( 0, QString("%1").arg( j++ ) ); - gatsToTree( pIt, *i ); - } -} - -void gatsToTree( QTreeWidgetItem *p, Gats::Dictionary *pObj ) -{ - p->setText( 1, "dict"); - for( Gats::Dictionary::iterator i = pObj->begin(); i; i++ ) - { - QTreeWidgetItem *pIt = new QTreeWidgetItem( p ); - pIt->setText( 0, QString( i.getKey().getStr() ) ); - gatsToTree( pIt, *i ); - } -} - -void gatsToTree( QTreeWidgetItem *p, Gats::Null *pObj ) -{ - p->setText( 1, "null"); -} diff --git a/src/gatscon/gatstotree.h b/src/gatscon/gatstotree.h deleted file mode 100644 index a803017..0000000 --- a/src/gatscon/gatstotree.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef GATS_TO_TREE_H -#define GATS_TO_TREE_H - -class QTreeWidgetItem; - -namespace Gats -{ - class Integer; - class String; - class Float; - class Boolean; - class List; - class Dictionary; - class Object; -}; - -#include - -void gatsToTree( QTreeWidgetItem *p, Gats::Object *pObj ); -void gatsToTree( QTreeWidgetItem *p, Gats::Integer *pObj ); -void gatsToTree( QTreeWidgetItem *p, Gats::String *pObj ); -void gatsToTree( QTreeWidgetItem *p, Gats::Float *pObj ); -void gatsToTree( QTreeWidgetItem *p, Gats::Boolean *pObj ); -void gatsToTree( QTreeWidgetItem *p, Gats::List *pObj ); -void gatsToTree( QTreeWidgetItem *p, Gats::Dictionary *pObj ); -void gatsToTree( QTreeWidgetItem *p, Gats::Null *pObj ); - -#endif diff --git a/src/gatscon/iobase.cpp b/src/gatscon/iobase.cpp deleted file mode 100644 index 309444c..0000000 --- a/src/gatscon/iobase.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "iobase.h" diff --git a/src/gatscon/iobase.h b/src/gatscon/iobase.h deleted file mode 100644 index 5bd3843..0000000 --- a/src/gatscon/iobase.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef IO_BASE_H -#define IO_BASE_H - -class IoBase -{ -public: - virtual void saveTo( const class QString &sFile )=0; -}; - -#endif diff --git a/src/gatscon/main.cpp b/src/gatscon/main.cpp deleted file mode 100644 index b9b2327..0000000 --- a/src/gatscon/main.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include "mainwnd.h" -#include - -int main( int argc, char *argv[] ) -{ - QApplication app( argc, argv ); - - MainWnd wnd; - wnd.show(); - - return app.exec(); -} - diff --git a/src/gatscon/mainwnd.cpp b/src/gatscon/mainwnd.cpp deleted file mode 100644 index 5d31019..0000000 --- a/src/gatscon/mainwnd.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "mainwnd.h" - -#include "clientwidget.h" -#include "proxywidget.h" -#include "filewidget.h" - -#include "connectdlg.h" -#include "setupproxydlg.h" - -#include -#include - -MainWnd::MainWnd() -{ - setupUi( this ); - - pMode = new QLabel( "Idle", this ); - statusBar()->addPermanentWidget( pMode ); -} - -MainWnd::~MainWnd() -{ -} - -void MainWnd::connect() -{ - ConnectDlg dlg( this ); - if( dlg.exec() == QDialog::Accepted ) - { - sCurFile.clear(); - setCentralWidget( - new ClientWidget( - this, dlg.getHostname(), dlg.getPort() - ) - ); - pMode->setText( - QString("Client Mode: %1:%2").arg( QString(dlg.getHostname()) ). - arg( dlg.getPort() ) - ); - } -} - -void MainWnd::proxy() -{ - SetupProxyDlg dlg( this ); - - if( dlg.exec() == QDialog::Accepted ) - { - sCurFile.clear(); - setCentralWidget( - new ProxyWidget( - this, dlg.getPortIn(), dlg.getHostOut(), dlg.getPortOut() - ) - ); - pMode->setText( - QString("Proxy Mode: :%1 -> %2:%3").arg( dlg.getPortIn() ). - arg( QString(dlg.getHostOut()) ). - arg( dlg.getPortOut() ) - ); - } -} - -void MainWnd::open() -{ - QString sFile = QFileDialog::getOpenFileName( - this, "Gats Console - open gats file" - ); - if( sFile.isEmpty() ) - return; - - sCurFile = sFile; - setCentralWidget( - new FileWidget( this, sFile ) - ); - pMode->setText( QString("File mode: %1").arg( sCurFile ) ); -} - -void MainWnd::newFile() -{ - sCurFile.clear(); - setCentralWidget( - new FileWidget( this ) - ); - pMode->setText( QString("File mode: ") ); -} - -void MainWnd::save() -{ - if( sCurFile.isEmpty() ) - { - saveAs(); - } - else - { - IoBase *pIo = dynamic_cast(centralWidget()); - if( !pIo ) - return; - - pIo->saveTo( sCurFile ); - } -} - -void MainWnd::saveAs() -{ - IoBase *pIo = dynamic_cast(centralWidget()); - if( !pIo ) - return; - - QString sFile = QFileDialog::getSaveFileName( - this, "Gats Console - save gats file" - ); - if( sFile.isEmpty() ) - return; - - pIo->saveTo( sFile ); - - sCurFile = sFile; -} - diff --git a/src/gatscon/mainwnd.h b/src/gatscon/mainwnd.h deleted file mode 100644 index d1ae080..0000000 --- a/src/gatscon/mainwnd.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef MAIN_WND_H -#define MAIN_WND_H - -#include "ui_mainwnd.h" - -class MainWnd : public QMainWindow, protected Ui::MainWnd -{ - Q_OBJECT; -public: - MainWnd(); - virtual ~MainWnd(); - -public slots: - void connect(); - void proxy(); - void open(); - void newFile(); - void save(); - void saveAs(); - -private: - QString sCurFile; - class QLabel *pMode; -}; - -#endif diff --git a/src/gatscon/mainwnd.ui b/src/gatscon/mainwnd.ui deleted file mode 100644 index 01f534a..0000000 --- a/src/gatscon/mainwnd.ui +++ /dev/null @@ -1,207 +0,0 @@ - - - MainWnd - - - - 0 - 0 - 431 - 319 - - - - Gats Console - - - - - - 0 - 0 - 431 - 21 - - - - - &File - - - - - - - - - - - &Network - - - - - - - - - - - &Open connection... - - - - - &Start proxy... - - - - - &Open Gats File... - - - - - &New Gats File - - - - - &Save - - - - - &Save As... - - - - - E&xit - - - - - - - action_Open_connection - triggered() - MainWnd - connect() - - - -1 - -1 - - - 215 - 159 - - - - - action_Open_proxy_connection - triggered() - MainWnd - proxy() - - - -1 - -1 - - - 215 - 159 - - - - - action_Open_gats_file - triggered() - MainWnd - open() - - - -1 - -1 - - - 215 - 159 - - - - - actionE_xit - triggered() - MainWnd - close() - - - -1 - -1 - - - 215 - 159 - - - - - action_New_Gats_File - triggered() - MainWnd - newFile() - - - -1 - -1 - - - 215 - 159 - - - - - action_Save - triggered() - MainWnd - save() - - - -1 - -1 - - - 215 - 159 - - - - - action_Save_As - triggered() - MainWnd - saveAs() - - - -1 - -1 - - - 215 - 159 - - - - - - connect() - proxy() - open() - save() - saveAs() - newFile() - - diff --git a/src/gatscon/proxythread.cpp b/src/gatscon/proxythread.cpp deleted file mode 100644 index 574b56b..0000000 --- a/src/gatscon/proxythread.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "proxythread.h" - -#include - -#include -#include -#include -#include - -using namespace Bu; - -ProxyThread::ProxyThread( QObject *pParent, int iPortIn, - const QByteArray &baHostOut, int iPortOut ) : - QThread( pParent ), - pHost( NULL ), - iPortIn( iPortIn ), - baHostOut( baHostOut ), - iPortOut( iPortOut ), - gsCli( ssCli ) -{ - pHost = new ProxyHostThread( pParent, this ); -} - -ProxyThread::~ProxyThread() -{ -} - -void ProxyThread::send( Gats::Object *pObj ) -{ - MemBuf bg; - Gats::GatsStream gs( bg ); - gs.writeObject( pObj ); - ssCli.write( bg.getString().getStr(), bg.getString().getSize() ); -} - -void ProxyThread::run() -{ - int iSockIn; - - { - TcpServerSocket tsIn( iPortIn ); - do - { - iSockIn = tsIn.accept( 5 ); - } while( iSockIn < 0 ); - } - - emit gotConnection(); - - ssCli.setStream( new TcpSocket( iSockIn ) ); - ssCli.setBlocking( true ); - - pHost->setStream( - new TcpSocket( baHostOut.constData(), iPortOut ) - ); - - pHost->start(); - - while( !ssCli.isEos() ) - { - Gats::Object *pObj = gsCli.readObject(); - if( pObj == NULL ) - continue; - - pHost->send( pObj ); - emit recv( pObj ); - } - -} - -ProxyHostThread::ProxyHostThread( QObject *pParent, ProxyThread *pClient ) : - QThread( pParent ), - pClient( pClient ), - ssHst(), - gsHst( ssHst ) -{ -} - -ProxyHostThread::~ProxyHostThread() -{ -} - -void ProxyHostThread::send( Gats::Object *pObj ) -{ - MemBuf bg; - Gats::GatsStream gs( bg ); - gs.writeObject( pObj ); - ssHst.write( bg.getString().getStr(), bg.getString().getSize() ); -} - -void ProxyHostThread::setStream( Bu::Stream *pStr ) -{ - ssHst.setStream( pStr ); -} - -void ProxyHostThread::run() -{ - while( !ssHst.isEos() ) - { - Gats::Object *pObj = gsHst.readObject(); - if( pObj == NULL ) - continue; - - pClient->send( pObj ); - emit recv( pObj ); - } -} - diff --git a/src/gatscon/proxythread.h b/src/gatscon/proxythread.h deleted file mode 100644 index df75046..0000000 --- a/src/gatscon/proxythread.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef PROXY_THREAD_H -#define PROXY_THREAD_H - -#include - -#include -#include - -class ProxyThread : public QThread -{ - Q_OBJECT; -public: - ProxyThread( QObject *pParent, int iPortIn, const QByteArray &baHostOut, - int iPortOut ); - virtual ~ProxyThread(); - - class ProxyHostThread *pHost; - - void send( Gats::Object *pObj ); - -signals: - void recv( Gats::Object *pObj ); - void gotConnection(); - -protected: - virtual void run(); - -private: - int iPortIn; - QByteArray baHostOut; - int iPortOut; - - Bu::StreamStack ssCli; - Gats::GatsStream gsCli; -}; - -class ProxyHostThread : public QThread -{ - Q_OBJECT; -public: - ProxyHostThread( QObject *pParent, ProxyThread *pClient ); - virtual ~ProxyHostThread(); - - void send( Gats::Object *pObj ); - - void setStream( Bu::Stream *pStr ); - -signals: - void recv( Gats::Object *pObj ); - -protected: - virtual void run(); - -private: - ProxyThread *pClient; - Bu::StreamStack ssHst; - Gats::GatsStream gsHst; -}; - -#endif diff --git a/src/gatscon/proxywidget.cpp b/src/gatscon/proxywidget.cpp deleted file mode 100644 index 215f95f..0000000 --- a/src/gatscon/proxywidget.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#include "proxywidget.h" -#include "proxythread.h" - -#include "gatstotree.h" -#include "treetogats.h" - -#include - -#include -#include -#include -#include - -using namespace Bu; - -ProxyWidget::ProxyWidget( QWidget *pParent, int iPortIn, - const QByteArray baHost, int iPortOut ) : - QWidget( pParent ), - pPrx( NULL ) -{ - setupUi( this ); - - pPrx = new ProxyThread( this, iPortIn, baHost, iPortOut ); - - connect( pPrx, SIGNAL(gotConnection()), - this, SLOT(gotConnection()), Qt::QueuedConnection ); - connect( pPrx, SIGNAL(recv( Gats::Object *)), - this, SLOT(clientRecv(Gats::Object *)), Qt::QueuedConnection ); - connect( pPrx->pHost, SIGNAL(recv( Gats::Object *)), - this, SLOT(hostRecv(Gats::Object *)), Qt::QueuedConnection ); - - pPrx->start(); -} - -ProxyWidget::~ProxyWidget() -{ -} - -void ProxyWidget::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; - } -} - -void ProxyWidget::sendToClient() -{ - 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, "proxy -> client" ); - gatsToTree( pIt, pObj ); - pPrx->send( pObj ); - delete pObj; - - leGats->setText(""); - leGats->setFocus(); - } - catch( Bu::ExceptionBase &e ) - { - QMessageBox::critical( this, "Gats Console - Error", e.what() ); - } -} - -void ProxyWidget::sendToServer() -{ - 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, "proxy -> host" ); - gatsToTree( pIt, pObj ); - pPrx->pHost->send( pObj ); - delete pObj; - - leGats->setText(""); - leGats->setFocus(); - } - catch( Bu::ExceptionBase &e ) - { - QMessageBox::critical( this, "Gats Console - Error", e.what() ); - } -} - -void ProxyWidget::clientRecv( Gats::Object *pObj ) -{ - sio << "Recv: " << *pObj << sio.nl; - - QTreeWidgetItem *pIt = new QTreeWidgetItem( - twHistory->invisibleRootItem() - ); - pIt->setText( 0, "client -> host" ); - gatsToTree( pIt, pObj ); - delete pObj; -} - -void ProxyWidget::hostRecv( Gats::Object *pObj ) -{ - sio << "Recv: " << *pObj << sio.nl; - - QTreeWidgetItem *pIt = new QTreeWidgetItem( - twHistory->invisibleRootItem() - ); - pIt->setText( 0, "host -> client" ); - gatsToTree( pIt, pObj ); - delete pObj; -} - -void ProxyWidget::gotConnection() -{ - lwConnect->stop(); - swRoot->setCurrentIndex( 1 ); -} - diff --git a/src/gatscon/proxywidget.h b/src/gatscon/proxywidget.h deleted file mode 100644 index d6ebf4d..0000000 --- a/src/gatscon/proxywidget.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef PROXY_WIDGET_H -#define PROXY_WIDGET_H - -#include "ui_proxywidget.h" -#include "iobase.h" - -namespace Gats -{ - class Object; -}; - -class ProxyWidget : public QWidget, protected Ui::ProxyWidget, public IoBase -{ - Q_OBJECT; -public: - ProxyWidget( QWidget *pParent, int iPortIn, const QByteArray baHost, - int iPortOut ); - virtual ~ProxyWidget(); - - virtual void saveTo( const QString &sFile ); - -public slots: - void sendToClient(); - void sendToServer(); - void clientRecv( Gats::Object *pObj ); - void hostRecv( Gats::Object *pObj ); - void gotConnection(); - -private: - class ProxyThread *pPrx; -}; - -#endif diff --git a/src/gatscon/proxywidget.ui b/src/gatscon/proxywidget.ui deleted file mode 100644 index 995fc73..0000000 --- a/src/gatscon/proxywidget.ui +++ /dev/null @@ -1,181 +0,0 @@ - - - ProxyWidget - - - - 0 - 0 - 338 - 300 - - - - Form - - - - 0 - - - - - 0 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Listening for connections... - - - Qt::AlignCenter - - - - - - - - 0 - 50 - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - Name - - - - - Type - - - - - Value - - - - - - - - - - Gats: - - - - - - - - - - - - Send to Client - - - - - - - Send to Server - - - - - - - - - - - - - - - - LoadingWidget - QWidget -
loadingwidget.h
- 1 -
-
- - - - pushButton - clicked() - ProxyWidget - sendToClient() - - - 280 - 258 - - - 392 - 223 - - - - - pushButton_2 - clicked() - ProxyWidget - sendToServer() - - - 306 - 284 - - - 199 - 340 - - - - - - sendToClient() - sendToServer() - -
diff --git a/src/gatscon/setupproxydlg.cpp b/src/gatscon/setupproxydlg.cpp deleted file mode 100644 index 7c7a873..0000000 --- a/src/gatscon/setupproxydlg.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include "setupproxydlg.h" - -SetupProxyDlg::SetupProxyDlg( QWidget *pParent ) : - QDialog( pParent ) -{ - setupUi( this ); -} - -SetupProxyDlg::~SetupProxyDlg() -{ -} - -int SetupProxyDlg::getPortIn() const -{ - return sbPortIn->value(); -} - -QByteArray SetupProxyDlg::getHostOut() const -{ - return leHostOut->text().toAscii(); -} - -int SetupProxyDlg::getPortOut() const -{ - return sbPortOut->value(); -} - diff --git a/src/gatscon/setupproxydlg.h b/src/gatscon/setupproxydlg.h deleted file mode 100644 index 6cc31bd..0000000 --- a/src/gatscon/setupproxydlg.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef SETUP_PROXY_DLG_H -#define SETUP_PROXY_DLG_H - -#include "ui_setupproxydlg.h" - -class SetupProxyDlg : public QDialog, protected Ui::SetupProxyDlg -{ - Q_OBJECT; -public: - SetupProxyDlg( QWidget *pParent=NULL ); - virtual ~SetupProxyDlg(); - - int getPortIn() const; - QByteArray getHostOut() const; - int getPortOut() const; -}; - -#endif diff --git a/src/gatscon/setupproxydlg.ui b/src/gatscon/setupproxydlg.ui deleted file mode 100644 index c713baf..0000000 --- a/src/gatscon/setupproxydlg.ui +++ /dev/null @@ -1,112 +0,0 @@ - - - SetupProxyDlg - - - - 0 - 0 - 359 - 122 - - - - Gats Console - Setup Proxy - - - - - - - - Listening port: - - - - - - - 1 - - - 32767 - - - - - - - Target host: - - - - - - - - - - Target port: - - - - - - - 1 - - - 32767 - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - SetupProxyDlg - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - SetupProxyDlg - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/src/gatscon/treetogats.cpp b/src/gatscon/treetogats.cpp deleted file mode 100644 index a1571d1..0000000 --- a/src/gatscon/treetogats.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "treetogats.h" - -#include - -#include - -Gats::Object *treeToGats( QTreeWidgetItem *pRoot ) -{ - QString sType = pRoot->text( 1 ); - QByteArray baDat = pRoot->text( 2 ).toAscii(); - if( sType == "int" ) - { - return new Gats::Integer( strtoll( baDat.constData(), NULL, 10 ) ); - } - else if( sType == "str" ) - { - return new Gats::String( baDat.constData(), baDat.size() ); - } - else if( sType == "float" ) - { - return new Gats::Float( strtod( baDat.constData(), NULL ) ); - } - else if( sType == "bool" ) - { - return new Gats::Boolean( baDat == "true" ); - } - else if( sType == "list" ) - { - Gats::List *pRet = new Gats::List(); - for( int j = 0; j < pRoot->childCount(); j++ ) - { - pRet->append( treeToGats( pRoot->child( j ) ) ); - } - return pRet; - } - else if( sType == "dict" ) - { - Gats::Dictionary *pRet = new Gats::Dictionary(); - for( int j = 0; j < pRoot->childCount(); j++ ) - { - QTreeWidgetItem *pChild = pRoot->child( j ); - pRet->insert( - pChild->text( 0 ).toAscii().constData(), - treeToGats( pChild ) - ); - } - return pRet; - } - - throw Bu::ExceptionBase("Unhandled type found."); -} - diff --git a/src/gatscon/treetogats.h b/src/gatscon/treetogats.h deleted file mode 100644 index 931623d..0000000 --- a/src/gatscon/treetogats.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef TREE_TO_GATS_H -#define TREE_TO_GATS_H - -class QTreeWidgetItem; - -namespace Gats -{ - class Object; -}; - -Gats::Object *treeToGats( QTreeWidgetItem *pRoot ); - -#endif -- cgit v1.2.3