From d269a39f27e2dcd57d0e3362ef3a7fd9ad3f3639 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 17 May 2011 13:24:19 +0000 Subject: GatsCon can read files now, but it can't save them, or edit them yet. That'll be coming eventually. --- src/gatscon/filewidget.cpp | 39 +++++++++++++++++++++++++++++++++++++++ src/gatscon/filewidget.h | 22 ++++++++++++++++++++++ src/gatscon/filewidget.ui | 40 ++++++++++++++++++++++++++++++++++++++++ src/gatscon/mainwnd.cpp | 12 ++++++++++++ src/gatscon/mainwnd.ui | 31 ++++++++++++++++++++++++++++--- 5 files changed, 141 insertions(+), 3 deletions(-) create mode 100644 src/gatscon/filewidget.cpp create mode 100644 src/gatscon/filewidget.h create mode 100644 src/gatscon/filewidget.ui (limited to 'src') diff --git a/src/gatscon/filewidget.cpp b/src/gatscon/filewidget.cpp new file mode 100644 index 0000000..b2dd09e --- /dev/null +++ b/src/gatscon/filewidget.cpp @@ -0,0 +1,39 @@ +#include "filewidget.h" + +#include "gatstotree.h" + +#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() +{ +} + diff --git a/src/gatscon/filewidget.h b/src/gatscon/filewidget.h new file mode 100644 index 0000000..ac46685 --- /dev/null +++ b/src/gatscon/filewidget.h @@ -0,0 +1,22 @@ +#ifndef FILE_WIDGET_H +#define FILE_WIDGET_H + +#include "ui_filewidget.h" + +namespace Gats +{ + class Object; +}; + +class FileWidget : public QWidget, protected Ui::FileWidget +{ + Q_OBJECT; +public: + FileWidget( QWidget *pParent=NULL ); + FileWidget( QWidget *pParent, QString sFile ); + virtual ~FileWidget(); + +private: +}; + +#endif diff --git a/src/gatscon/filewidget.ui b/src/gatscon/filewidget.ui new file mode 100644 index 0000000..6557035 --- /dev/null +++ b/src/gatscon/filewidget.ui @@ -0,0 +1,40 @@ + + + FileWidget + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + Name + + + + + Type + + + + + Value + + + + + + + + + diff --git a/src/gatscon/mainwnd.cpp b/src/gatscon/mainwnd.cpp index f20a531..628988e 100644 --- a/src/gatscon/mainwnd.cpp +++ b/src/gatscon/mainwnd.cpp @@ -2,10 +2,13 @@ #include "clientwidget.h" #include "proxywidget.h" +#include "filewidget.h" #include "connectdlg.h" #include "setupproxydlg.h" +#include + MainWnd::MainWnd() { setupUi( this ); @@ -44,5 +47,14 @@ void MainWnd::proxy() void MainWnd::open() { + QString sFile = QFileDialog::getOpenFileName( + this, "GatsCon - open gats file" + ); + if( sFile.isEmpty() ) + return; + + setCentralWidget( + new FileWidget( this, sFile ) + ); } diff --git a/src/gatscon/mainwnd.ui b/src/gatscon/mainwnd.ui index e080dd3..dbf5e11 100644 --- a/src/gatscon/mainwnd.ui +++ b/src/gatscon/mainwnd.ui @@ -28,6 +28,11 @@ &File + + + + + @@ -52,7 +57,27 @@ - &Open gats file... + &Open Gats File... + + + + + &New Gats File + + + + + &Save + + + + + &Save As... + + + + + E&xit @@ -65,8 +90,8 @@ connect() - 215 - 159 + -1 + -1 215 -- cgit v1.2.3