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

--HG--
branch : gsoc2012-gui-editor
hg/feature/sse2
dfighter1985 12 years ago
parent 0da667bffb
commit efc9890e08

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

@ -32,6 +32,11 @@ namespace GUIEditor
if( mg == NULL ) if( mg == NULL )
return false; return false;
CInterfaceElement *ag =
CWidgetManager::getInstance()->getElementFromId( activeGroup );
if( ag == NULL )
return false;
out.open( fileName.c_str() ); out.open( fileName.c_str() );
if( !out.is_open() ) if( !out.is_open() )
return false; return false;
@ -88,8 +93,19 @@ namespace GUIEditor
return false; return false;
} }
ag->setActive( false );
if( mg->serializeSubGroups( root ) == NULL ) if( mg->serializeSubGroups( root ) == NULL )
{
ag->setActive( true );
xmlFreeNode( root );
out.close();
return false;
}
ag->setActive( true );
if( !mg->serializeLinks( root ) )
{ {
xmlFreeNode( root ); xmlFreeNode( root );
out.close(); out.close();

@ -37,12 +37,14 @@ namespace GUIEditor
~WidgetSerializer(){} ~WidgetSerializer(){}
void setFile( const std::string &name ){ fileName = name; } void setFile( const std::string &name ){ fileName = name; }
void setActiveGroup( const std::string &name ){ activeGroup = name; }
bool serialize( const std::string &masterGroup ); bool serialize( const std::string &masterGroup );
private: private:
bool serializeTree( _xmlNode *node ); bool serializeTree( _xmlNode *node );
std::string fileName; std::string fileName;
std::string activeGroup;
std::ofstream out; std::ofstream out;
long level; long level;
}; };

Loading…
Cancel
Save