From 83de816afcbcad6ecf71a131f72d31c0b261d475 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Thu, 9 Aug 2012 01:48:51 +0200 Subject: [PATCH] CHANGED: #1471 Partially implemented save-as(only the project file is saved for now ) --- .../plugins/gui_editor/gui_editor_window.cpp | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp index e3667d70c..3f8f8c823 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/gui_editor_window.cpp @@ -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()