#846 Removed obsolete flag to closeProject and make sure project is closed when last main window is closed

This commit is contained in:
Magne Sjaastad 2016-10-04 11:02:56 +02:00
parent d57db25820
commit 16f8fc186e
4 changed files with 13 additions and 35 deletions

View File

@ -325,7 +325,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
{
// First Close the current project
if (!closeProject(true)) return false;
closeProject();
// Open the project file and read the serialized data.
// Will initialize itself.
@ -349,7 +349,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
if (m_project->projectFileVersionString().isEmpty())
{
closeProject(false);
closeProject();
QString tmp = QString("Unknown project file version detected in file \n%1\n\nCould not open project.").arg(projectFileName);
QMessageBox::warning(NULL, "Error when opening project file", tmp);
@ -678,7 +678,7 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaApplication::closeProject(bool askToSaveIfDirty)
void RiaApplication::closeProject()
{
RiuMainWindow* mainWnd = RiuMainWindow::instance();
@ -686,26 +686,6 @@ bool RiaApplication::closeProject(bool askToSaveIfDirty)
terminateProcess();
if (false)
{
QMessageBox msgBox(mainWnd);
msgBox.setIcon(QMessageBox::Warning);
msgBox.setText("The project being closed has been modified.");
msgBox.setInformativeText("Do you want to save your changes?");
msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
//msgBox.setDefaultButton(QMessageBox::Save);
int ret = msgBox.exec();
if (ret == QMessageBox::Save)
{
//m_sceneManager->saveAll();
}
else if (ret == QMessageBox::Cancel)
{
return false;
}
}
RiuSelectionManager::instance()->deleteAllItems();
mainWnd->cleanupGuiBeforeProjectClose();
@ -724,8 +704,6 @@ bool RiaApplication::closeProject(bool askToSaveIfDirty)
// Make sure all project windows are closed down properly before returning
processEvents();
return true;
}
//--------------------------------------------------------------------------------------------------
@ -1205,7 +1183,7 @@ bool RiaApplication::parseArguments()
std::vector<QString> gridFiles = readFileListFromTextFile(gridListFile);
runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots");
closeProject(false);
closeProject();
return false;
}
@ -1292,7 +1270,7 @@ bool RiaApplication::parseArguments()
mainWnd->loadWinGeoAndDockToolBarLayout();
closeProject(false);
closeProject();
}
// Returning false will exit the application
@ -2092,7 +2070,7 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
}
}
closeProject(false);
closeProject();
}
}

View File

@ -123,7 +123,7 @@ public:
bool saveProject();
bool saveProjectAs(const QString& fileName);
bool saveProjectPromptForFileName();
bool closeProject(bool askToSaveIfDirty);
void closeProject();
void addWellPathsToModel(QList<QString> wellPathFilePaths);
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);

View File

@ -119,7 +119,9 @@ void RiuMainPlotWindow::closeEvent(QCloseEvent* event)
{
saveWinGeoAndDockToolBarLayout();
RiaApplication::instance()->tryClosePlotWindow();
if (!RiaApplication::instance()->tryCloseMainWindow()) return;
RiaApplication::instance()->closeProject();
}
//--------------------------------------------------------------------------------------------------

View File

@ -221,10 +221,7 @@ void RiuMainWindow::closeEvent(QCloseEvent* event)
if (!app->tryClosePlotWindow()) return;
if (!RiaApplication::instance()->closeProject(true))
{
return;
}
RiaApplication::instance()->closeProject();
event->accept();
}
@ -984,7 +981,8 @@ bool RiuMainWindow::checkForDocumentModifications()
void RiuMainWindow::slotCloseProject()
{
RiaApplication* app = RiaApplication::instance();
app->closeProject(true);
app->closeProject();
}
//--------------------------------------------------------------------------------------------------