[vlmc-devel] commit: ProjectManager: Dump the file only at the end of the saving process . ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Wed Apr 21 02:23:55 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Wed Apr 21 02:22:53 2010 +0200| [91e276193f8315957b6a2669d47778e7f84b7de0] | committer: Hugo Beauzée-Luyssen
ProjectManager: Dump the file only at the end of the saving process.
This avoid flushing the current project file if any problem occurs.
Fixes #40
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=91e276193f8315957b6a2669d47778e7f84b7de0
---
src/Project/ProjectManager.cpp | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/Project/ProjectManager.cpp b/src/Project/ProjectManager.cpp
index 3c64e01..de9769b 100644
--- a/src/Project/ProjectManager.cpp
+++ b/src/Project/ProjectManager.cpp
@@ -127,10 +127,9 @@ void ProjectManager::loadProject( const QString& fileName )
void ProjectManager::__saveProject( const QString &fileName )
{
- QFile file( fileName );
- file.open( QFile::WriteOnly );
+ QByteArray projectString;
- QXmlStreamWriter project( &file );
+ QXmlStreamWriter project( &projectString );
project.setAutoFormatting( true );
project.writeStartDocument();
@@ -142,6 +141,10 @@ void ProjectManager::__saveProject( const QString &fileName )
project.writeEndElement();
project.writeEndDocument();
+
+ QFile file( fileName );
+ file.open( QFile::WriteOnly );
+ file.write( projectString );
}
void ProjectManager::emergencyBackup()
More information about the Vlmc-devel
mailing list