From b68b658f89e9c8cda756a98217fd3d4a21005ea2 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Wed, 3 Sep 2014 16:42:12 +0200 Subject: [PATCH] Log changes and save log. --HG-- branch : dfighter-tools --- .../georges_editor/georges_typ_dialog.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) 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 f6f470288..b167913b7 100644 --- a/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp +++ b/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp @@ -77,6 +77,7 @@ void GeorgesTypDialog::write() NLMISC::COXml xml; xml.init( &file ); + m_pvt->typ->Header.Log = m_ui.logEdit->toPlainText().toUtf8().constData(); m_pvt->typ->write( xml.getDocument() ); xml.flush(); @@ -114,6 +115,8 @@ void GeorgesTypDialog::onAddClicked() def.Value = ""; m_pvt->typ->Definitions.push_back( def ); + log( "Added definition " + label ); + onModified(); } @@ -130,12 +133,16 @@ void GeorgesTypDialog::onRemoveClicked() break; } + QString definition = item->text( 0 ); + m_ui.tree->takeTopLevelItem( i ); delete item; std::vector< NLGEORGES::CType::CDefinition >::iterator itr = m_pvt->typ->Definitions.begin() + i; m_pvt->typ->Definitions.erase( itr ); + log( "Removed definition" + definition ); + onModified(); } @@ -149,11 +156,24 @@ void GeorgesTypDialog::onItemChanged( QTreeWidgetItem *item, int column ) } NLGEORGES::CType::CDefinition &def = m_pvt->typ->Definitions[ i ]; + + QString logMsg; + logMsg = "Changed definition" + QString( def.Label.c_str() ); if( i == 0 ) + { + logMsg += ".label = "; + logMsg += item->text( 0 ); def.Label = item->text( 0 ).toUtf8().constData(); + } else + { + logMsg += ".value = "; + logMsg += item->text( 1 ); def.Value = item->text( 1 ).toUtf8().constData(); + } + + log( logMsg ); onModified(); } @@ -171,6 +191,7 @@ void GeorgesTypDialog::onModified() void GeorgesTypDialog::onModified( const QString &k, const QString &v ) { + log( "Changed " + k + " = " + v ); onModified(); }