diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-05-17 13:24:19 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-05-17 13:24:19 +0000 |
| commit | d269a39f27e2dcd57d0e3362ef3a7fd9ad3f3639 (patch) | |
| tree | 8fa45d8c6dd61e3949ecf1727c6facb78bfe5305 /src/gatscon/filewidget.cpp | |
| parent | 6aefa6632023c99c5b91bae0e099df94fa69d890 (diff) | |
| download | libgats-d269a39f27e2dcd57d0e3362ef3a7fd9ad3f3639.tar.gz libgats-d269a39f27e2dcd57d0e3362ef3a7fd9ad3f3639.tar.bz2 libgats-d269a39f27e2dcd57d0e3362ef3a7fd9ad3f3639.tar.xz libgats-d269a39f27e2dcd57d0e3362ef3a7fd9ad3f3639.zip | |
GatsCon can read files now, but it can't save them, or edit them yet. That'll
be coming eventually.
Diffstat (limited to 'src/gatscon/filewidget.cpp')
| -rw-r--r-- | src/gatscon/filewidget.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
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 @@ | |||
| 1 | #include "filewidget.h" | ||
| 2 | |||
| 3 | #include "gatstotree.h" | ||
| 4 | |||
| 5 | #include <gats/types.h> | ||
| 6 | #include <gats/gatsstream.h> | ||
| 7 | #include <bu/file.h> | ||
| 8 | |||
| 9 | using namespace Bu; | ||
| 10 | |||
| 11 | FileWidget::FileWidget( QWidget *pParent ) : | ||
| 12 | QWidget( pParent ) | ||
| 13 | { | ||
| 14 | setupUi( this ); | ||
| 15 | } | ||
| 16 | |||
| 17 | FileWidget::FileWidget( QWidget *pParent, QString sFile ) : | ||
| 18 | QWidget( pParent ) | ||
| 19 | { | ||
| 20 | setupUi( this ); | ||
| 21 | |||
| 22 | File fIn( sFile.toAscii().constData(), File::Read ); | ||
| 23 | Gats::GatsStream gsIn( fIn ); | ||
| 24 | Gats::Object *pObj; | ||
| 25 | while( (pObj = gsIn.readObject()) ) | ||
| 26 | { | ||
| 27 | QTreeWidgetItem *pNew = new QTreeWidgetItem( | ||
| 28 | twGats->invisibleRootItem() | ||
| 29 | ); | ||
| 30 | pNew->setText( 0, "<root>" ); | ||
| 31 | gatsToTree( pNew, pObj ); | ||
| 32 | delete pObj; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | |||
| 36 | FileWidget::~FileWidget() | ||
| 37 | { | ||
| 38 | } | ||
| 39 | |||
