CHANGED: #1471 Serialize links that belong to the root group too. Also deactivate the active group when serializing.

This commit is contained in:
dfighter1985 2012-08-20 03:34:09 +02:00
parent efb7bb5d14
commit 80df3293f5
3 changed files with 19 additions and 0 deletions

View file

@ -233,6 +233,7 @@ namespace GUIEditor
WidgetSerializer widgetSerializer;
widgetSerializer.setFile( guiFile );
widgetSerializer.setActiveGroup( projectFiles.activeGroup );
if( !widgetSerializer.serialize( projectFiles.masterGroup ) )
{
QMessageBox::critical( this,

View file

@ -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();

View file

@ -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;
};