Added support for new DFN document creation.
--HG-- branch : dfighter-tools
This commit is contained in:
parent
ca127f756c
commit
37bbb6be32
3 changed files with 47 additions and 16 deletions
|
@ -77,22 +77,8 @@ bool GeorgesDFNDialog::load( const QString &fileName )
|
|||
|
||||
NLGEORGES::CFormDfn *cdfn = static_cast< NLGEORGES::CFormDfn* >( udfn );
|
||||
m_pvt->dfn = cdfn;
|
||||
m_pvt->ctrl->setDFN( cdfn );
|
||||
|
||||
uint c = m_pvt->dfn->getNumEntry();
|
||||
for( uint i = 0; i < c; i++ )
|
||||
{
|
||||
NLGEORGES::CFormDfn::CEntry &entry = m_pvt->dfn->getEntry( i );
|
||||
m_ui.list->addItem( entry.getName().c_str() );
|
||||
}
|
||||
|
||||
if( c > 0 )
|
||||
{
|
||||
m_ui.list->setCurrentRow( 0 );
|
||||
}
|
||||
|
||||
m_ui.commentsEdit->setPlainText( cdfn->getComment().c_str() );
|
||||
m_ui.logEdit->setPlainText( cdfn->Header.Log.c_str() );
|
||||
loadDfn();
|
||||
|
||||
m_fileName = fileName;
|
||||
|
||||
|
@ -119,6 +105,18 @@ void GeorgesDFNDialog::write()
|
|||
file.close();
|
||||
}
|
||||
|
||||
void GeorgesDFNDialog::newDocument( const QString &fileName )
|
||||
{
|
||||
m_fileName = fileName;
|
||||
QFileInfo info( fileName );
|
||||
setWindowTitle( info.fileName() + "*" );
|
||||
setModified( true );
|
||||
|
||||
m_pvt->dfn = new NLGEORGES::CFormDfn();
|
||||
|
||||
loadDfn();
|
||||
}
|
||||
|
||||
void GeorgesDFNDialog::onAddClicked()
|
||||
{
|
||||
QString name = QInputDialog::getText( this,
|
||||
|
@ -178,6 +176,26 @@ void GeorgesDFNDialog::onValueChanged( const QString &key, const QString &value
|
|||
}
|
||||
}
|
||||
|
||||
void GeorgesDFNDialog::loadDfn()
|
||||
{
|
||||
m_pvt->ctrl->setDFN( m_pvt->dfn );
|
||||
|
||||
uint c = m_pvt->dfn->getNumEntry();
|
||||
for( uint i = 0; i < c; i++ )
|
||||
{
|
||||
NLGEORGES::CFormDfn::CEntry &entry = m_pvt->dfn->getEntry( i );
|
||||
m_ui.list->addItem( entry.getName().c_str() );
|
||||
}
|
||||
|
||||
if( c > 0 )
|
||||
{
|
||||
m_ui.list->setCurrentRow( 0 );
|
||||
}
|
||||
|
||||
m_ui.commentsEdit->setPlainText( m_pvt->dfn->getComment().c_str() );
|
||||
m_ui.logEdit->setPlainText( m_pvt->dfn->Header.Log.c_str() );
|
||||
}
|
||||
|
||||
void GeorgesDFNDialog::onModified()
|
||||
{
|
||||
if( !isModified() )
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
|
||||
bool load( const QString &fileName );
|
||||
void write();
|
||||
void newDocument( const QString &fileName );
|
||||
|
||||
Q_SIGNALS:
|
||||
void modified();
|
||||
|
@ -45,6 +46,7 @@ private Q_SLOTS:
|
|||
void onValueChanged( const QString& key, const QString &value );
|
||||
|
||||
private:
|
||||
void loadDfn();
|
||||
void onModified();
|
||||
void log( const QString &msg );
|
||||
void setupConnections();
|
||||
|
|
|
@ -158,6 +158,17 @@ namespace GeorgesQt
|
|||
|
||||
void GeorgesEditorForm::newDfn()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName( this,
|
||||
tr( "New Definition" ),
|
||||
"",
|
||||
"Definition files (*.dfn)" );
|
||||
if( fileName.isEmpty() )
|
||||
return;
|
||||
|
||||
GeorgesDFNDialog *d = new GeorgesDFNDialog();
|
||||
d->newDocument( fileName );
|
||||
addGeorgesWidget( d );
|
||||
setModified();
|
||||
}
|
||||
|
||||
void GeorgesEditorForm::newForm()
|
||||
|
|
Loading…
Reference in a new issue