aboutsummaryrefslogtreecommitdiff
path: root/src/gatscon/filewidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gatscon/filewidget.cpp')
-rw-r--r--src/gatscon/filewidget.cpp33
1 files changed, 33 insertions, 0 deletions
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 @@
1#include "filewidget.h" 1#include "filewidget.h"
2 2
3#include "gatstotree.h" 3#include "gatstotree.h"
4#include "treetogats.h"
4 5
5#include <gats/types.h> 6#include <gats/types.h>
6#include <gats/gatsstream.h> 7#include <gats/gatsstream.h>
7#include <bu/file.h> 8#include <bu/file.h>
8 9
10#include <QInputDialog>
11
9using namespace Bu; 12using namespace Bu;
10 13
11FileWidget::FileWidget( QWidget *pParent ) : 14FileWidget::FileWidget( QWidget *pParent ) :
@@ -37,3 +40,33 @@ FileWidget::~FileWidget()
37{ 40{
38} 41}
39 42
43void FileWidget::saveTo( const QString &sFile )
44{
45 File fOut( sFile.toAscii().constData(), File::WriteNew );
46 Gats::GatsStream gsOut( fOut );
47 QTreeWidgetItem *pRoot = twGats->invisibleRootItem();
48 for( int j = 0; j < pRoot->childCount(); j++ )
49 {
50 Gats::Object *pObj = treeToGats( pRoot->child( j ) );
51 gsOut.writeObject( pObj );
52 delete pObj;
53 }
54}
55
56void FileWidget::addRootItem()
57{
58 QString sText = QInputDialog::getText( this, "GatsCon - Add Root Item",
59 "Gats:");
60 Gats::Object *pObj = Gats::Object::strToGats( sText.toAscii().constData() );
61 QTreeWidgetItem *pNew = new QTreeWidgetItem(
62 twGats->invisibleRootItem()
63 );
64 pNew->setText( 0, "<root>" );
65 gatsToTree( pNew, pObj );
66 delete pObj;
67}
68
69void FileWidget::delRootItem()
70{
71}
72