aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/gatscon/filewidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'c++-libbu++/src/gatscon/filewidget.cpp')
-rw-r--r--c++-libbu++/src/gatscon/filewidget.cpp75
1 files changed, 41 insertions, 34 deletions
diff --git a/c++-libbu++/src/gatscon/filewidget.cpp b/c++-libbu++/src/gatscon/filewidget.cpp
index dbd70fd..23f6839 100644
--- a/c++-libbu++/src/gatscon/filewidget.cpp
+++ b/c++-libbu++/src/gatscon/filewidget.cpp
@@ -1,3 +1,10 @@
1/*
2 * Copyright (C) 2007-2012 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libgats library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
1#include "filewidget.h" 8#include "filewidget.h"
2 9
3#include "gatstotree.h" 10#include "gatstotree.h"
@@ -12,28 +19,28 @@
12using namespace Bu; 19using namespace Bu;
13 20
14FileWidget::FileWidget( QWidget *pParent ) : 21FileWidget::FileWidget( QWidget *pParent ) :
15 QWidget( pParent ) 22 QWidget( pParent )
16{ 23{
17 setupUi( this ); 24 setupUi( this );
18} 25}
19 26
20FileWidget::FileWidget( QWidget *pParent, QString sFile ) : 27FileWidget::FileWidget( QWidget *pParent, QString sFile ) :
21 QWidget( pParent ) 28 QWidget( pParent )
22{ 29{
23 setupUi( this ); 30 setupUi( this );
24 31
25 File fIn( sFile.toAscii().constData(), File::Read ); 32 File fIn( sFile.toAscii().constData(), File::Read );
26 Gats::GatsStream gsIn( fIn ); 33 Gats::GatsStream gsIn( fIn );
27 Gats::Object *pObj; 34 Gats::Object *pObj;
28 while( (pObj = gsIn.readObject()) ) 35 while( (pObj = gsIn.readObject()) )
29 { 36 {
30 QTreeWidgetItem *pNew = new QTreeWidgetItem( 37 QTreeWidgetItem *pNew = new QTreeWidgetItem(
31 twGats->invisibleRootItem() 38 twGats->invisibleRootItem()
32 ); 39 );
33 pNew->setText( 0, "<root>" ); 40 pNew->setText( 0, "<root>" );
34 gatsToTree( pNew, pObj ); 41 gatsToTree( pNew, pObj );
35 delete pObj; 42 delete pObj;
36 } 43 }
37} 44}
38 45
39FileWidget::~FileWidget() 46FileWidget::~FileWidget()
@@ -42,28 +49,28 @@ FileWidget::~FileWidget()
42 49
43void FileWidget::saveTo( const QString &sFile ) 50void FileWidget::saveTo( const QString &sFile )
44{ 51{
45 File fOut( sFile.toAscii().constData(), File::WriteNew ); 52 File fOut( sFile.toAscii().constData(), File::WriteNew );
46 Gats::GatsStream gsOut( fOut ); 53 Gats::GatsStream gsOut( fOut );
47 QTreeWidgetItem *pRoot = twGats->invisibleRootItem(); 54 QTreeWidgetItem *pRoot = twGats->invisibleRootItem();
48 for( int j = 0; j < pRoot->childCount(); j++ ) 55 for( int j = 0; j < pRoot->childCount(); j++ )
49 { 56 {
50 Gats::Object *pObj = treeToGats( pRoot->child( j ) ); 57 Gats::Object *pObj = treeToGats( pRoot->child( j ) );
51 gsOut.writeObject( pObj ); 58 gsOut.writeObject( pObj );
52 delete pObj; 59 delete pObj;
53 } 60 }
54} 61}
55 62
56void FileWidget::addRootItem() 63void FileWidget::addRootItem()
57{ 64{
58 QString sText = QInputDialog::getText( this, "Gats Console - Add Root Item", 65 QString sText = QInputDialog::getText( this, "Gats Console - Add Root Item",
59 "Gats:"); 66 "Gats:");
60 Gats::Object *pObj = Gats::Object::strToGats( sText.toAscii().constData() ); 67 Gats::Object *pObj = Gats::Object::strToGats( sText.toAscii().constData() );
61 QTreeWidgetItem *pNew = new QTreeWidgetItem( 68 QTreeWidgetItem *pNew = new QTreeWidgetItem(
62 twGats->invisibleRootItem() 69 twGats->invisibleRootItem()
63 ); 70 );
64 pNew->setText( 0, "<root>" ); 71 pNew->setText( 0, "<root>" );
65 gatsToTree( pNew, pObj ); 72 gatsToTree( pNew, pObj );
66 delete pObj; 73 delete pObj;
67} 74}
68 75
69void FileWidget::delRootItem() 76void FileWidget::delRootItem()