CHANGED: #1471 Partially implemented save-as(only the project file is saved for now )

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2012-08-09 01:48:51 +02:00
parent f10ef64bee
commit 498a1a2ef1

View file

@ -184,7 +184,13 @@ namespace GUIEditor
CProjectFileSerializer serializer;
serializer.setFile( currentProjectFile.toStdString() );
serializer.serialize( projectFiles );
if( !serializer.serialize( projectFiles ) )
{
QMessageBox::critical( this,
tr( "Failed to save project" ),
tr( "There was an error while trying to save the project." ) );
return;
}
// Can't save old projects any further, since the widgets are in multiple files in them
// using templates, styles and whatnot. There's no way to restore the original XML structure
@ -198,6 +204,27 @@ namespace GUIEditor
if( currentProject.isEmpty() )
return;
QString dir =
QFileDialog::getExistingDirectory( this, tr( "Save project as..." ) );
if( dir.isEmpty() )
return;
projectFiles.guiFiles.clear();
projectFiles.guiFiles.push_back( "ui_" + projectFiles.projectName + ".xml" );
projectFiles.version = NEW;
QString newFile = dir + "/" + projectFiles.projectName.c_str() + ".xml";
CProjectFileSerializer serializer;
serializer.setFile( newFile.toStdString() );
if( !serializer.serialize( projectFiles ) )
{
QMessageBox::critical( this,
tr( "Failed to save project" ),
tr( "There was an error while trying to save the project." ) );
return;
}
}
void GUIEditorWindow::close()