From 0392694560d530c14aced7ac21f85b18b676a685 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Tue, 21 Feb 2012 22:30:21 +0000 Subject: Initial support to preserve ini file comments --- src/editorwindow.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/editorwindow.cc') diff --git a/src/editorwindow.cc b/src/editorwindow.cc index 446f6d7..a15ed43 100644 --- a/src/editorwindow.cc +++ b/src/editorwindow.cc @@ -77,6 +77,7 @@ bool EditorWindow::loadFile(const QString &filename) in_subsection = false; if (ini.got_section("zone")) { + editorwindow_zoneproperties.set_comment(ini.comment()); in_entity = false; } else if (ini.got_section("entity")) { @@ -116,9 +117,10 @@ bool EditorWindow::loadFile(const QString &filename) if (in_entity) { entity = editorwindow_mapwidget->addEntity(); entity->properties()->set_type(ini.section()); + entity->properties()->set_comment(ini.comment()); } if (entity && in_subsection) { - entity->properties()->add_subsection_header(ini.section()); + entity->properties()->add_subsection_header(ini.section(), ini.comment()); } } else if(ini.got_key()) { @@ -143,11 +145,11 @@ bool EditorWindow::loadFile(const QString &filename) entity->properties()->add_info(str); } else if (ini.got_key()) { - entity->properties()->add_value(ini.key(), ini.value()); + entity->properties()->add_value(ini.key(), ini.value(), ini.comment()); } } else if (entity && in_subsection) { - entity->properties()->add_subsection_value(ini.key(), ini.value()); + entity->properties()->add_subsection_value(ini.key(), ini.value(), ini.comment()); } else if (ini.in_section("zone")) { @@ -159,7 +161,7 @@ bool EditorWindow::loadFile(const QString &filename) editorwindow_zoneproperties.add_info(str); } else if (ini.got_key()) { - editorwindow_zoneproperties.add_value(ini.key(), ini.value()); + editorwindow_zoneproperties.add_value(ini.key(), ini.value(), ini.comment()); } } -- cgit v1.2.3