[vlmc-devel] Project: Don't bother keeping a copy of the project name

Hugo Beauzée-Luyssen git at videolan.org
Fri Mar 4 17:14:26 CET 2016


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Mar  4 17:12:50 2016 +0100| [7c1255a0e999913d7d8ef125d3432e6e991169e1] | committer: Hugo Beauzée-Luyssen

Project: Don't bother keeping a copy of the project name

> https://code.videolan.org/videolan/vlmc/commit/7c1255a0e999913d7d8ef125d3432e6e991169e1
---

 src/Project/Project.cpp | 24 ++++--------------------
 src/Project/Project.h   |  5 -----
 2 files changed, 4 insertions(+), 25 deletions(-)

diff --git a/src/Project/Project.cpp b/src/Project/Project.cpp
index d819eed..af3eeaf 100644
--- a/src/Project/Project.cpp
+++ b/src/Project/Project.cpp
@@ -116,7 +116,8 @@ Project::load( const QString& path )
     }
 
     m_settings->load( doc );
-    emit projectLoading( m_projectName );
+    auto projectName = m_settings->value( "vlmc/ProjectName" )->get().toString();
+    emit projectLoading( projectName );
     Core::getInstance()->library()->load( doc );
     Core::getInstance()->workflow()->load( doc );
     Core::getInstance()->workflowRenderer()->load( doc );
@@ -124,7 +125,7 @@ Project::load( const QString& path )
     emit cleanStateChanged( m_isClean );
     if ( autoBackupFound == false )
         m_projectFile->close();
-    emit projectLoaded( m_projectName );
+    emit projectLoaded( projectName );
     if ( outdatedBackupFound == true )
         emit outdatedBackupFileFound();
     if ( autoBackupFound == true )
@@ -193,16 +194,7 @@ Project::initSettings()
 									QT_TRANSLATE_NOOP( "PreferenceWidget", "Project name" ),
 									QT_TRANSLATE_NOOP( "PreferenceWidget", "The project name" ),
 									SettingValue::NotEmpty );
-    // Use direct connection to have the project name stored in m_projectName as soon as we
-    // are done loading the settings.
-    connect( pName, SIGNAL( changed( QVariant ) ),
-             this, SLOT( projectNameChanged( QVariant ) ), Qt::DirectConnection );
-}
-
-const QString&
-Project::name()
-{
-    return m_projectName;
+    connect( pName, SIGNAL( changed( QVariant ) ), this, SIGNAL( projectUpdated( QVariant ) ) );
 }
 
 void
@@ -256,7 +248,6 @@ Project::closeProject()
     emit projectClosed();
     delete m_projectFile;
     m_projectFile = nullptr;
-    m_projectName.clear();
 }
 
 bool
@@ -302,13 +293,6 @@ Project::libraryCleanChanged(bool val)
 }
 
 void
-Project::projectNameChanged( const QVariant& name )
-{
-    m_projectName = name.toString();
-    emit projectUpdated( m_projectName );
-}
-
-void
 Project::autoSaveRequired()
 {
     if ( m_projectFile == NULL )
diff --git a/src/Project/Project.h b/src/Project/Project.h
index 315bebc..0c8b53a 100644
--- a/src/Project/Project.h
+++ b/src/Project/Project.h
@@ -77,7 +77,6 @@ class Project : public QObject
 
     private:
         void                initSettings();
-        const QString&      name();
         void                saveProject( const QString& filename );
 
 
@@ -86,9 +85,6 @@ class Project : public QObject
         void                libraryCleanChanged( bool val );
         void                autoSaveRequired();
 
-    private slots:
-        void                projectNameChanged( const QVariant& projectName );
-
     signals:
         /**
          *  This signal is emitted when :
@@ -122,7 +118,6 @@ private:
 
     private:
         QFile*              m_projectFile;
-        QString             m_projectName;
         bool                m_isClean;
         bool                m_libraryCleanState;
 



More information about the Vlmc-devel mailing list