#4538 Skip Save project at exit when no data has changed

Guard changes in preferences and reset change detector when project is closed
This commit is contained in:
Magne Sjaastad
2019-08-07 14:21:37 +02:00
parent 5e2485863c
commit 58cef265ec
5 changed files with 26 additions and 6 deletions

View File

@@ -84,6 +84,7 @@
#include "RimWellRftPlot.h"
#include "cafPdmSettings.h"
#include "cafPdmUiModelChangeDetector.h"
#include "cafProgressInfo.h"
#include "cafUiProcess.h"
#include "cafUtils.h"
@@ -305,6 +306,16 @@ bool RiaApplication::openFile(const QString& fileName)
return loadingSucceded;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::isProjectSavedToDisc() const
{
if (m_project.isNull()) return false;
return caf::Utils::fileExists(m_project->fileName());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -370,7 +381,7 @@ bool RiaApplication::loadProject(const QString& projectFileName,
// Create a absolute path file name, as this is required for update of file references in the project modifier object
QString fullPathProjectFileName = caf::Utils::absoluteFileName(projectFileName);
if (!caf::Utils::fileExists(fullPathProjectFileName))
if (!isProjectSavedToDisc())
{
RiaLogging::info(QString("File does not exist : '%1'").arg(fullPathProjectFileName));
return false;
@@ -677,6 +688,8 @@ void RiaApplication::closeProject()
m_commandQueue.clear();
onProjectClosed();
caf::PdmUiModelChangeDetector::instance()->reset();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -121,6 +121,7 @@ public:
bool openFile(const QString& fileName);
bool isProjectSavedToDisc() const;
QString currentProjectPath() const;
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
bool loadProject(const QString& projectFileName);

View File

@@ -204,7 +204,7 @@ bool RiaGuiApplication::saveProject()
{
CVF_ASSERT(m_project.notNull());
if (!caf::Utils::fileExists(m_project->fileName()))
if (!isProjectSavedToDisc())
{
return saveProjectPromptForFileName();
}