[vlmc-devel] ProjectManager: Assume a project file will be loaded for most actions.

Hugo Beauzée-Luyssen git at videolan.org
Mon Mar 31 17:59:21 CEST 2014


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Mar 31 01:10:47 2014 +0300| [d60edce3f807d0e7cedda55084f3b3f0020dac58] | committer: Hugo Beauzée-Luyssen

ProjectManager: Assume a project file will be loaded for most actions.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=d60edce3f807d0e7cedda55084f3b3f0020dac58
---

 src/Project/ProjectManager.cpp |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/src/Project/ProjectManager.cpp b/src/Project/ProjectManager.cpp
index 2d7c7d6..841ebff 100644
--- a/src/Project/ProjectManager.cpp
+++ b/src/Project/ProjectManager.cpp
@@ -108,12 +108,8 @@ ProjectManager::saveProject( const QString& fileName )
 void
 ProjectManager::emergencyBackup()
 {
-    QString     name;
-
-    if ( m_projectFile != NULL )
-        name = m_projectFile->fileName() + ProjectManager::backupSuffix;
-    else
-       name = QDir::currentPath() + "/unsavedproject" + ProjectManager::backupSuffix;
+    Q_ASSERT( m_projectFile != NULL );
+    const QString& name = m_projectFile->fileName() + ProjectManager::backupSuffix;
     saveProject( name );
     Core::getInstance()->settings()->setValue( "private/EmergencyBackup", name );
 }
@@ -328,8 +324,7 @@ ProjectManager::autoSaveRequired()
 bool
 ProjectManager::closeProject()
 {
-    if ( m_projectFile == NULL )
-        return true;
+    Q_ASSERT( m_projectFile != NULL );
     if ( m_projectManagerUi != NULL )
     {
         IProjectManagerUiCb::SaveMode mode = m_projectManagerUi->shouldSaveBeforeClose();



More information about the Vlmc-devel mailing list