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

ProjectManager: Avoid having one clean state and one dirty state.

Stick to clean state for all components
parent feadb76a
...@@ -49,7 +49,7 @@ const QString ProjectManager::backupSuffix = "~"; ...@@ -49,7 +49,7 @@ const QString ProjectManager::backupSuffix = "~";
ProjectManager::ProjectManager( Settings* projectSettings, Settings* vlmcSettings ) ProjectManager::ProjectManager( Settings* projectSettings, Settings* vlmcSettings )
: m_projectFile( NULL ) : m_projectFile( NULL )
, m_needSave( false ) , m_isClean( true )
, m_libraryCleanState( true ) , m_libraryCleanState( true )
, m_projectSettings( projectSettings ) , m_projectSettings( projectSettings )
, m_vlmcSettings( vlmcSettings ) , m_vlmcSettings( vlmcSettings )
...@@ -233,7 +233,7 @@ ProjectManager::loadEmergencyBackup() ...@@ -233,7 +233,7 @@ ProjectManager::loadEmergencyBackup()
if ( QFile::exists( lastProject ) == true ) if ( QFile::exists( lastProject ) == true )
{ {
loadProject( lastProject ); loadProject( lastProject );
m_needSave = true; m_isClean = false;
return true; return true;
} }
return false; return false;
...@@ -276,8 +276,8 @@ ProjectManager::cleanChanged( bool val ) ...@@ -276,8 +276,8 @@ ProjectManager::cleanChanged( bool val )
{ {
// This doesn't have to be different since we can force needSave = true when loading // This doesn't have to be different since we can force needSave = true when loading
// a backup project file. This definitely needs testing though // a backup project file. This definitely needs testing though
m_needSave = val; m_isClean = val;
if ( m_libraryCleanState == m_needSave ) if ( m_libraryCleanState == m_isClean )
emit cleanStateChanged( val ); emit cleanStateChanged( val );
} }
...@@ -286,7 +286,7 @@ ProjectManager::libraryCleanChanged(bool val) ...@@ -286,7 +286,7 @@ ProjectManager::libraryCleanChanged(bool val)
{ {
Q_ASSERT( m_libraryCleanState != val); Q_ASSERT( m_libraryCleanState != val);
m_libraryCleanState = val; m_libraryCleanState = val;
if ( m_libraryCleanState == m_needSave ) if ( m_libraryCleanState == m_isClean )
emit cleanStateChanged( val ); emit cleanStateChanged( val );
} }
...@@ -370,7 +370,7 @@ ProjectManager::loadProject( const QString &fileName ) ...@@ -370,7 +370,7 @@ ProjectManager::loadProject( const QString &fileName )
//saves its project, vlmc will ask him where to save it. //saves its project, vlmc will ask him where to save it.
delete m_projectFile; delete m_projectFile;
m_projectFile = NULL; m_projectFile = NULL;
m_needSave = true; m_isClean = true;
} }
QDomElement root = m_domDocument->documentElement(); QDomElement root = m_domDocument->documentElement();
...@@ -408,7 +408,7 @@ ProjectManager::closeProject() ...@@ -408,7 +408,7 @@ ProjectManager::closeProject()
} }
delete m_projectFile; delete m_projectFile;
m_projectFile = NULL; m_projectFile = NULL;
m_needSave = false; m_isClean = true;
m_projectName = QString(); m_projectName = QString();
//This one is for the mainwindow, to update the title bar //This one is for the mainwindow, to update the title bar
Project::getInstance()->undoStack()->clear(); Project::getInstance()->undoStack()->clear();
......
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