[vlmc-devel] ProjectManager: Remove clean state from projectUpdated signal

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


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Sun Mar 30 22:37:06 2014 +0300| [3822f254fdf04a12d6e0065479f5a2b0574f1cea] | committer: Hugo Beauzée-Luyssen

ProjectManager: Remove clean state from projectUpdated signal

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

 src/Gui/MainWindow.cpp         |   13 +++++++++++--
 src/Gui/MainWindow.h           |    3 ++-
 src/Project/ProjectManager.cpp |   14 ++++----------
 src/Project/ProjectManager.h   |    2 +-
 4 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index bb7e341..8062773 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -772,12 +772,21 @@ MainWindow::closeEvent( QCloseEvent* e )
 }
 
 void
-MainWindow::projectUpdated( const QString& projectName, bool savedStatus )
+MainWindow::projectUpdated( const QString& projectName )
 {
     QString title = tr( "VideoLAN Movie Creator" );
     title += " - ";
     title += projectName;
-    if ( savedStatus == false )
+    setWindowTitle( title );
+}
+
+void
+MainWindow::cleanStateChanged( bool isClean )
+{
+    QString title = windowTitle();
+    if ( isClean == true )
+        title.replace(" *", "");
+    else
         title += " *";
     setWindowTitle( title );
 }
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index b3f4e4b..4b510fc 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -155,7 +155,8 @@ private slots:
     void                    on_actionCrash_triggered();
     void                    on_actionImport_triggered();
     void                    toolButtonClicked( QAction *action );
-    void                    projectUpdated( const QString& projectName, bool savedStatus );
+    void                    projectUpdated(const QString& projectName);
+    void                    cleanStateChanged( bool isClean );
     void                    canUndoChanged( bool canUndo );
     void                    canRedoChanged( bool canRedo );
 
diff --git a/src/Project/ProjectManager.cpp b/src/Project/ProjectManager.cpp
index 7016463..59ddef8 100644
--- a/src/Project/ProjectManager.cpp
+++ b/src/Project/ProjectManager.cpp
@@ -122,15 +122,9 @@ void
 ProjectManager::loadWorkflow()
 {
     QDomElement     root = m_domDocument->documentElement();
-    bool            savedState;
 
     Project::getInstance()->workflow()->loadProject( root );
     loadTimeline( root );
-    if ( m_projectFile != NULL )
-        savedState = true;
-    else
-        savedState = false;
-    emit projectUpdated( projectName(), savedState );
     emit projectLoaded( projectName(), m_projectFile->fileName() );
 
     delete m_domDocument;
@@ -228,7 +222,7 @@ ProjectManager::saveAs()
     if ( fileName.isEmpty() )
         return ;
     saveProject( fileName );
-    emit projectUpdated( projectName(), true );
+    emit projectUpdated( projectName() );
 }
 
 bool
@@ -280,14 +274,14 @@ void
 ProjectManager::cleanChanged( bool val )
 {
     m_needSave = !val;
-    emit projectUpdated( projectName(), val );
+    emit projectUpdated( projectName() );
 }
 
 void
 ProjectManager::projectNameChanged( const QVariant& name )
 {
     m_projectName = name.toString();
-    emit projectUpdated( m_projectName, !m_needSave );
+    emit projectUpdated( m_projectName );
 }
 
 void
@@ -405,7 +399,7 @@ ProjectManager::closeProject()
     m_projectName = QString();
     //This one is for the mainwindow, to update the title bar
     Project::getInstance()->undoStack()->clear();
-    emit projectUpdated( projectName(), true );
+    emit projectUpdated( projectName() );
     return true;
 }
 
diff --git a/src/Project/ProjectManager.h b/src/Project/ProjectManager.h
index 71eb70d..28d2ab2 100644
--- a/src/Project/ProjectManager.h
+++ b/src/Project/ProjectManager.h
@@ -162,7 +162,7 @@ signals:
      *      - The clean state has changed
      *      - The revision (if activated) has changed
      */
-    void            projectUpdated( const QString& projectName, bool savedState );
+    void            projectUpdated( const QString& projectName );
 
     /**
      *  \brief      Used to signal that the project has been saved.



More information about the Vlmc-devel mailing list