mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-27 17:26:16 +00:00
Added support for new DFN document creation.
This commit is contained in:
parent
b21b19c90c
commit
83cc99bede
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 );
|
NLGEORGES::CFormDfn *cdfn = static_cast< NLGEORGES::CFormDfn* >( udfn );
|
||||||
m_pvt->dfn = cdfn;
|
m_pvt->dfn = cdfn;
|
||||||
m_pvt->ctrl->setDFN( cdfn );
|
|
||||||
|
loadDfn();
|
||||||
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() );
|
|
||||||
|
|
||||||
m_fileName = fileName;
|
m_fileName = fileName;
|
||||||
|
|
||||||
|
@ -119,6 +105,18 @@ void GeorgesDFNDialog::write()
|
||||||
file.close();
|
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()
|
void GeorgesDFNDialog::onAddClicked()
|
||||||
{
|
{
|
||||||
QString name = QInputDialog::getText( this,
|
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()
|
void GeorgesDFNDialog::onModified()
|
||||||
{
|
{
|
||||||
if( !isModified() )
|
if( !isModified() )
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
|
|
||||||
bool load( const QString &fileName );
|
bool load( const QString &fileName );
|
||||||
void write();
|
void write();
|
||||||
|
void newDocument( const QString &fileName );
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void modified();
|
void modified();
|
||||||
|
@ -45,6 +46,7 @@ private Q_SLOTS:
|
||||||
void onValueChanged( const QString& key, const QString &value );
|
void onValueChanged( const QString& key, const QString &value );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void loadDfn();
|
||||||
void onModified();
|
void onModified();
|
||||||
void log( const QString &msg );
|
void log( const QString &msg );
|
||||||
void setupConnections();
|
void setupConnections();
|
||||||
|
|
|
@ -158,6 +158,17 @@ namespace GeorgesQt
|
||||||
|
|
||||||
void GeorgesEditorForm::newDfn()
|
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()
|
void GeorgesEditorForm::newForm()
|
||||||
|
|
Loading…
Reference in a new issue