mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Prototyped command object infrastructure to be used in regression tests of Octave scripts
p4#: 22387
This commit is contained in:
@@ -350,6 +350,14 @@ bool RiaApplication::loadProject(const QString& projectFileName)
|
||||
caseProgress.incrementProgress();
|
||||
}
|
||||
|
||||
// Loop over command objects and execute them
|
||||
for (size_t i = 0; i < m_project->commandObjects.size(); i++)
|
||||
{
|
||||
m_commandQueue.push_back(m_project->commandObjects[i]);
|
||||
}
|
||||
|
||||
executeCommandObjects();
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
|
||||
return true;
|
||||
@@ -495,6 +503,8 @@ bool RiaApplication::closeProject(bool askToSaveIfDirty)
|
||||
caf::EffectGenerator::clearEffectCache();
|
||||
m_project->close();
|
||||
|
||||
m_commandQueue.clear();
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
|
||||
return true;
|
||||
@@ -959,6 +969,10 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
executeCommandObjects();
|
||||
|
||||
|
||||
// Exit code != 0 means we have an error
|
||||
if (exitCode != 0)
|
||||
{
|
||||
@@ -1678,3 +1692,27 @@ QVariant RiaApplication::cacheDataObject(const QString& key) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::addCommandObject(RimCommandObject* commandObject)
|
||||
{
|
||||
m_commandQueue.push_back(commandObject);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::executeCommandObjects()
|
||||
{
|
||||
if (m_commandQueue.size() > 0)
|
||||
{
|
||||
std::list< RimCommandObject* >::iterator it = m_commandQueue.begin();
|
||||
|
||||
RimCommandObject* first = *it;
|
||||
first->redo();
|
||||
|
||||
m_commandQueue.pop_front();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user