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

This commit is contained in:
dfighter1985 2012-08-09 01:48:51 +02:00
parent 074e742900
commit 83de816afc

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