Commit feadb76a authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

ProjectManager: Have a specific handling for Library clean state

parent 3822f254
......@@ -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
......
......@@ -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
......
......@@ -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();
......@@ -171,6 +176,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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment