From 6d8bc516acf7a5995736423e838c987d08e69c09 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 17 May 2011 14:56:28 +0000 Subject: Ok, you can now open files, save files, save files from proxies and clients, and add new root items to files. Later I'll add some actual editing capabilities, should be really easy. --- src/gatscon/filewidget.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/gatscon/filewidget.cpp') diff --git a/src/gatscon/filewidget.cpp b/src/gatscon/filewidget.cpp index b2dd09e..70f7b03 100644 --- a/src/gatscon/filewidget.cpp +++ b/src/gatscon/filewidget.cpp @@ -1,11 +1,14 @@ #include "filewidget.h" #include "gatstotree.h" +#include "treetogats.h" #include #include #include +#include + using namespace Bu; FileWidget::FileWidget( QWidget *pParent ) : @@ -37,3 +40,33 @@ 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, "GatsCon - 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() +{ +} + -- cgit v1.2.3