Load .typ file.

--HG--
branch : dfighter-tools
hg/feature/qt5
dfighter1985 10 years ago
parent 24a7cc4a6d
commit cfaebcc1ff

@ -318,6 +318,12 @@ namespace GeorgesQt
GeorgesDockWidget* GeorgesEditorForm::loadTypDialog( const QString &fileName ) GeorgesDockWidget* GeorgesEditorForm::loadTypDialog( const QString &fileName )
{ {
GeorgesTypDialog *d = new GeorgesTypDialog(); GeorgesTypDialog *d = new GeorgesTypDialog();
if( !d->load( fileName ) )
{
delete d;
return NULL;
}
return d; return d;
} }

@ -1,14 +1,49 @@
#include "georges_typ_dialog.h" #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 ) : GeorgesTypDialog::GeorgesTypDialog( QWidget *parent ) :
GeorgesDockWidget( parent ) GeorgesDockWidget( parent )
{ {
m_ui.setupUi( this ); m_ui.setupUi( this );
m_pvt = new GeorgesTypDialogPvt();
setupConnections(); setupConnections();
} }
GeorgesTypDialog::~GeorgesTypDialog() 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 ) void GeorgesTypDialog::log( const QString &msg )
{ {
QString logMsg = buildLogMsg( msg );
m_ui.logEdit->appendPlainText( logMsg );
} }

@ -4,6 +4,7 @@
#include "georges_dock_widget.h" #include "georges_dock_widget.h"
#include "ui_georges_typ_dialog.h" #include "ui_georges_typ_dialog.h"
class GeorgesTypDialogPvt;
class GeorgesTypDialog : public GeorgesDockWidget class GeorgesTypDialog : public GeorgesDockWidget
{ {
@ -12,6 +13,7 @@ public:
GeorgesTypDialog( QWidget *parent = NULL ); GeorgesTypDialog( QWidget *parent = NULL );
~GeorgesTypDialog(); ~GeorgesTypDialog();
bool load( const QString &fileName );
void write(); void write();
private Q_SLOTS: private Q_SLOTS:
@ -22,8 +24,8 @@ private:
void setupConnections(); void setupConnections();
void log( const QString &msg ); void log( const QString &msg );
Ui::GeorgesTypDialog m_ui; Ui::GeorgesTypDialog m_ui;
GeorgesTypDialogPvt *m_pvt;
}; };

Loading…
Cancel
Save