From d534a56d95bca7bdd812be024d9eacba4734e2b7 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 9 Nov 2012 17:20:11 +0000 Subject: Many changes: tabconv'd the C++ code, added a license, BSD, and docs. --- c++-libbu++/src/gatscon/filewidget.cpp | 75 +++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 34 deletions(-) (limited to 'c++-libbu++/src/gatscon/filewidget.cpp') 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 @@ +/* + * Copyright (C) 2007-2012 Xagasoft, All rights reserved. + * + * This file is part of the libgats library and is released under the + * terms of the license contained in the file LICENSE. + */ + #include "filewidget.h" #include "gatstotree.h" @@ -12,28 +19,28 @@ using namespace Bu; FileWidget::FileWidget( QWidget *pParent ) : - QWidget( pParent ) + QWidget( pParent ) { - setupUi( this ); + setupUi( this ); } FileWidget::FileWidget( QWidget *pParent, QString sFile ) : - QWidget( pParent ) + QWidget( pParent ) { - setupUi( this ); + 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; - } + 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() @@ -42,28 +49,28 @@ 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; - } + 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; + 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() -- cgit v1.2.3