Log changes and save log.

--HG--
branch : dfighter-tools
This commit is contained in:
dfighter1985 2014-09-03 16:42:12 +02:00
parent d289b7e030
commit b68b658f89

View file

@ -77,6 +77,7 @@ void GeorgesTypDialog::write()
NLMISC::COXml xml; NLMISC::COXml xml;
xml.init( &file ); xml.init( &file );
m_pvt->typ->Header.Log = m_ui.logEdit->toPlainText().toUtf8().constData();
m_pvt->typ->write( xml.getDocument() ); m_pvt->typ->write( xml.getDocument() );
xml.flush(); xml.flush();
@ -114,6 +115,8 @@ void GeorgesTypDialog::onAddClicked()
def.Value = ""; def.Value = "";
m_pvt->typ->Definitions.push_back( def ); m_pvt->typ->Definitions.push_back( def );
log( "Added definition " + label );
onModified(); onModified();
} }
@ -130,12 +133,16 @@ void GeorgesTypDialog::onRemoveClicked()
break; break;
} }
QString definition = item->text( 0 );
m_ui.tree->takeTopLevelItem( i ); m_ui.tree->takeTopLevelItem( i );
delete item; delete item;
std::vector< NLGEORGES::CType::CDefinition >::iterator itr = m_pvt->typ->Definitions.begin() + i; std::vector< NLGEORGES::CType::CDefinition >::iterator itr = m_pvt->typ->Definitions.begin() + i;
m_pvt->typ->Definitions.erase( itr ); m_pvt->typ->Definitions.erase( itr );
log( "Removed definition" + definition );
onModified(); onModified();
} }
@ -150,10 +157,23 @@ void GeorgesTypDialog::onItemChanged( QTreeWidgetItem *item, int column )
NLGEORGES::CType::CDefinition &def = m_pvt->typ->Definitions[ i ]; NLGEORGES::CType::CDefinition &def = m_pvt->typ->Definitions[ i ];
QString logMsg;
logMsg = "Changed definition" + QString( def.Label.c_str() );
if( i == 0 ) if( i == 0 )
{
logMsg += ".label = ";
logMsg += item->text( 0 );
def.Label = item->text( 0 ).toUtf8().constData(); def.Label = item->text( 0 ).toUtf8().constData();
}
else else
{
logMsg += ".value = ";
logMsg += item->text( 1 );
def.Value = item->text( 1 ).toUtf8().constData(); def.Value = item->text( 1 ).toUtf8().constData();
}
log( logMsg );
onModified(); onModified();
} }
@ -171,6 +191,7 @@ void GeorgesTypDialog::onModified()
void GeorgesTypDialog::onModified( const QString &k, const QString &v ) void GeorgesTypDialog::onModified( const QString &k, const QString &v )
{ {
log( "Changed " + k + " = " + v );
onModified(); onModified();
} }