From efc9890e08375f61e529e011fcd590d129e480d4 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Mon, 20 Aug 2012 03:34:09 +0200 Subject: [PATCH] CHANGED: #1471 Serialize links that belong to the root group too. Also deactivate the active group when serializing. --HG-- branch : gsoc2012-gui-editor --- .../src/plugins/gui_editor/gui_editor_window.cpp | 1 + .../src/plugins/gui_editor/widget_serializer.cpp | 16 ++++++++++++++++ .../src/plugins/gui_editor/widget_serializer.h | 2 ++ 3 files changed, 19 insertions(+) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp index c991e458a..c56f181bf 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp @@ -233,6 +233,7 @@ namespace GUIEditor WidgetSerializer widgetSerializer; widgetSerializer.setFile( guiFile ); + widgetSerializer.setActiveGroup( projectFiles.activeGroup ); if( !widgetSerializer.serialize( projectFiles.masterGroup ) ) { QMessageBox::critical( this, diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp index 445fa184e..9e17e97b5 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.cpp @@ -32,6 +32,11 @@ namespace GUIEditor if( mg == NULL ) return false; + CInterfaceElement *ag = + CWidgetManager::getInstance()->getElementFromId( activeGroup ); + if( ag == NULL ) + return false; + out.open( fileName.c_str() ); if( !out.is_open() ) return false; @@ -88,8 +93,19 @@ namespace GUIEditor return false; } + ag->setActive( false ); if( mg->serializeSubGroups( root ) == NULL ) + { + ag->setActive( true ); + xmlFreeNode( root ); + out.close(); + return false; + } + + ag->setActive( true ); + + if( !mg->serializeLinks( root ) ) { xmlFreeNode( root ); out.close(); diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.h index a67adf6fb..ba199a507 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_serializer.h @@ -37,12 +37,14 @@ namespace GUIEditor ~WidgetSerializer(){} void setFile( const std::string &name ){ fileName = name; } + void setActiveGroup( const std::string &name ){ activeGroup = name; } bool serialize( const std::string &masterGroup ); private: bool serializeTree( _xmlNode *node ); std::string fileName; + std::string activeGroup; std::ofstream out; long level; };