[vlmc-devel] ProjectManager: Have a specific handling for Library clean state
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 23:58:37 2014 +0300| [feadb76ab07b01483fa196927462499a741715a8] | committer: Hugo Beauzée-Luyssen
ProjectManager: Have a specific handling for Library clean state
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=feadb76ab07b01483fa196927462499a741715a8
---
src/Library/Library.cpp | 2 +-
src/Project/ProjectManager.cpp | 17 +++++++++++++++--
src/Project/ProjectManager.h | 14 +++++++++++++-
3 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/src/Library/Library.cpp b/src/Library/Library.cpp
index 22f19ff..df3c54b 100644
--- a/src/Library/Library.cpp
+++ b/src/Library/Library.cpp
@@ -45,7 +45,7 @@ Library::Library( Workspace *workspace , ProjectManager *projectManager )
, m_workspace( workspace )
{
connect( this, SIGNAL( cleanStateChanged( bool ) ),
- projectManager, SLOT( cleanChanged( bool ) ) );
+ projectManager, SLOT( libraryCleanChanged( bool ) ) );
}
void
diff --git a/src/Project/ProjectManager.cpp b/src/Project/ProjectManager.cpp
index 59ddef8..121b579 100644
--- a/src/Project/ProjectManager.cpp
+++ b/src/Project/ProjectManager.cpp
@@ -50,6 +50,7 @@ const QString ProjectManager::backupSuffix = "~";
ProjectManager::ProjectManager( Settings* projectSettings, Settings* vlmcSettings )
: m_projectFile( NULL )
, m_needSave( false )
+ , m_libraryCleanState( true )
, m_projectSettings( projectSettings )
, m_vlmcSettings( vlmcSettings )
{
@@ -273,8 +274,20 @@ ProjectManager::automaticSaveIntervalChanged( const QVariant& val )
void
ProjectManager::cleanChanged( bool val )
{
- m_needSave = !val;
- emit projectUpdated( projectName() );
+ // This doesn't have to be different since we can force needSave = true when loading
+ // a backup project file. This definitely needs testing though
+ m_needSave = val;
+ if ( m_libraryCleanState == m_needSave )
+ emit cleanStateChanged( val );
+}
+
+void
+ProjectManager::libraryCleanChanged(bool val)
+{
+ Q_ASSERT( m_libraryCleanState != val);
+ m_libraryCleanState = val;
+ if ( m_libraryCleanState == m_needSave )
+ emit cleanStateChanged( val );
}
void
diff --git a/src/Project/ProjectManager.h b/src/Project/ProjectManager.h
index 28d2ab2..4abea44 100644
--- a/src/Project/ProjectManager.h
+++ b/src/Project/ProjectManager.h
@@ -142,16 +142,21 @@ protected:
QString m_projectDescription;
QDomDocument* m_domDocument;
bool m_needSave;
+ bool m_libraryCleanState;
QTimer* m_timer;
IProjectManagerUiCb* m_projectManagerUi;
Settings* m_projectSettings;
Settings* m_vlmcSettings;
+public slots:
+ void cleanChanged( bool val );
+ void libraryCleanChanged( bool val );
+
+
private slots:
void loadWorkflow();
void automaticSaveEnabledChanged( const QVariant& enabled );
void automaticSaveIntervalChanged( const QVariant& interval );
- void cleanChanged( bool val );
void projectNameChanged( const QVariant& projectName );
void autoSaveRequired();
@@ -172,6 +177,13 @@ signals:
void projectSaved();
/**
+ * @brief cleanStateChanged Emited when the clean state changes.
+ *
+ * This state is a combination of both library & undoStack clean states.
+ */
+ void cleanStateChanged( bool value );
+
+ /**
* @brief projectLoaded Emited when a project is loaded (which also include a project
* being created)
* @param projectName The project name
More information about the Vlmc-devel
mailing list