CHANGED: #1471 Serialize links that belong to the root group too. Also deactivate the active group when serializing.
--HG-- branch : gsoc2012-gui-editor
This commit is contained in:
parent
0da667bffb
commit
efc9890e08
3 changed files with 19 additions and 0 deletions
|
@ -233,6 +233,7 @@ namespace GUIEditor
|
|||
|
||||
WidgetSerializer widgetSerializer;
|
||||
widgetSerializer.setFile( guiFile );
|
||||
widgetSerializer.setActiveGroup( projectFiles.activeGroup );
|
||||
if( !widgetSerializer.serialize( projectFiles.masterGroup ) )
|
||||
{
|
||||
QMessageBox::critical( this,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue