From cfaebcc1ffb6cc5026e0935738bf86aba1ef5dcb Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 2 Sep 2014 22:46:19 +0200 Subject: [PATCH] Load .typ file. --HG-- branch : dfighter-tools --- .../georges_editor/georges_editor_form.cpp | 6 +++ .../georges_editor/georges_typ_dialog.cpp | 37 +++++++++++++++++++ .../georges_editor/georges_typ_dialog.h | 4 +- 3 files changed, 46 insertions(+), 1 deletion(-) diff --git a/code/studio/src/plugins/georges_editor/georges_editor_form.cpp b/code/studio/src/plugins/georges_editor/georges_editor_form.cpp index f2c1c3528..47bd9de3d 100644 --- a/code/studio/src/plugins/georges_editor/georges_editor_form.cpp +++ b/code/studio/src/plugins/georges_editor/georges_editor_form.cpp @@ -318,6 +318,12 @@ namespace GeorgesQt GeorgesDockWidget* GeorgesEditorForm::loadTypDialog( const QString &fileName ) { GeorgesTypDialog *d = new GeorgesTypDialog(); + if( !d->load( fileName ) ) + { + delete d; + return NULL; + } + return d; } diff --git a/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp b/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp index cf0102c71..d91134df6 100644 --- a/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp +++ b/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp @@ -1,14 +1,49 @@ #include "georges_typ_dialog.h" +#include "georges.h" + +class GeorgesTypDialogPvt +{ +public: + GeorgesTypDialogPvt() + { + typ = NULL; + } + + ~GeorgesTypDialogPvt() + { + delete typ; + typ = NULL; + } + + + NLGEORGES::CType *typ; +}; GeorgesTypDialog::GeorgesTypDialog( QWidget *parent ) : GeorgesDockWidget( parent ) { m_ui.setupUi( this ); + m_pvt = new GeorgesTypDialogPvt(); setupConnections(); } GeorgesTypDialog::~GeorgesTypDialog() { + delete m_pvt; + m_pvt = NULL; +} + + +bool GeorgesTypDialog::load( const QString &fileName ) +{ + GeorgesQt::CGeorges georges; + NLGEORGES::UType *utyp = georges.loadFormType( fileName.toUtf8().constData() ); + if( utyp == NULL ) + return false; + + m_pvt->typ = dynamic_cast< NLGEORGES::CType* >( utyp ); + + return true; } @@ -32,5 +67,7 @@ void GeorgesTypDialog::setupConnections() void GeorgesTypDialog::log( const QString &msg ) { + QString logMsg = buildLogMsg( msg ); + m_ui.logEdit->appendPlainText( logMsg ); } diff --git a/code/studio/src/plugins/georges_editor/georges_typ_dialog.h b/code/studio/src/plugins/georges_editor/georges_typ_dialog.h index 3808e019a..0e4346d79 100644 --- a/code/studio/src/plugins/georges_editor/georges_typ_dialog.h +++ b/code/studio/src/plugins/georges_editor/georges_typ_dialog.h @@ -4,6 +4,7 @@ #include "georges_dock_widget.h" #include "ui_georges_typ_dialog.h" +class GeorgesTypDialogPvt; class GeorgesTypDialog : public GeorgesDockWidget { @@ -12,6 +13,7 @@ public: GeorgesTypDialog( QWidget *parent = NULL ); ~GeorgesTypDialog(); + bool load( const QString &fileName ); void write(); private Q_SLOTS: @@ -22,8 +24,8 @@ private: void setupConnections(); void log( const QString &msg ); - Ui::GeorgesTypDialog m_ui; + GeorgesTypDialogPvt *m_pvt; };