Version 0.8.6

This commit is contained in:
Magne Sjaastad
2012-08-31 19:12:47 +02:00
parent 651d908709
commit 27d8808c5c
42 changed files with 622 additions and 175 deletions

View File

@@ -331,6 +331,8 @@ bool RIApplication::closeProject(bool askToSaveIfDirty)
{
RIMainWindow* mainWnd = RIMainWindow::instance();
terminateProcess();
if (false)
{
QMessageBox msgBox(mainWnd);
@@ -353,7 +355,7 @@ bool RIApplication::closeProject(bool askToSaveIfDirty)
mainWnd->cleanupGuiBeforeProjectClose();
caf::EffectCache::instance()->clear();
caf::EffectGenerator::clearEffectCache();
m_project->close();
onProjectOpenedOrClosed();
@@ -417,16 +419,19 @@ bool RIApplication::openEclipseCase(const QString& caseName, const QString& case
RimReservoirView* riv = rimResultReservoir->createAndAddReservoirView();
// Select SOIL as default result variable
riv->cellResult()->resultType = RimDefines::DYNAMIC_NATIVE;
riv->cellResult()->resultVariable = "SOIL";
riv->animationMode = true;
if (m_preferences->autocomputeSOIL)
{
// Select SOIL as default result variable
riv->cellResult()->resultType = RimDefines::DYNAMIC_NATIVE;
riv->cellResult()->resultVariable = "SOIL";
riv->animationMode = true;
}
riv->loadDataAndUpdate();
if (!riv->cellResult()->hasResult())
{
riv->cellResult()->resultVariable = RimDefines::nonSelectedResultName();
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
}
onProjectOpenedOrClosed();
@@ -455,7 +460,7 @@ bool RIApplication::openInputEclipseCase(const QString& caseName, const QStringL
if (!riv->cellResult()->hasResult())
{
riv->cellResult()->resultVariable = RimDefines::nonSelectedResultName();
riv->cellResult()->resultVariable = RimDefines::undefinedResultName();
}
onProjectOpenedOrClosed();
@@ -536,10 +541,12 @@ void RIApplication::setUseShaders(bool enable)
//--------------------------------------------------------------------------------------------------
bool RIApplication::useShaders() const
{
if (!m_preferences->useShaders) return false;
bool isShadersSupported = caf::Viewer::isShadersSupported();
if (!isShadersSupported) return false;
return m_preferences->useShaders;
return true;
}
@@ -721,7 +728,7 @@ void RIApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus
// get a chance to run before we delete the object
if (m_workerProcess)
{
m_workerProcess->deleteLater();
m_workerProcess->close();
}
m_workerProcess = NULL;
@@ -749,23 +756,33 @@ void RIApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus
//--------------------------------------------------------------------------------------------------
bool RIApplication::launchProcess(const QString& program, const QStringList& arguments)
{
m_workerProcess = new caf::UiProcess(this);
connect(m_workerProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(slotWorkerProcessFinished(int, QProcess::ExitStatus)));
RIMainWindow::instance()->processMonitor()->startMonitorWorkProcess(m_workerProcess);
m_workerProcess->start(program, arguments);
if (!m_workerProcess->waitForStarted(1000))
if (m_workerProcess == NULL)
{
m_workerProcess->deleteLater();
m_workerProcess = NULL;
m_workerProcess = new caf::UiProcess(this);
connect(m_workerProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(slotWorkerProcessFinished(int, QProcess::ExitStatus)));
RIMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
RIMainWindow::instance()->processMonitor()->startMonitorWorkProcess(m_workerProcess);
m_workerProcess->start(program, arguments);
if (!m_workerProcess->waitForStarted(1000))
{
m_workerProcess->close();
m_workerProcess = NULL;
RIMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
QMessageBox::warning(RIMainWindow::instance(), "Script execution", "Failed to start script executable located at\n" + program);
return false;
}
return true;
}
else
{
QMessageBox::warning(NULL, "Script execution", "An Octave process is still running. Please stop this process before executing a new script.");
return false;
}
return true;
}
//--------------------------------------------------------------------------------------------------
@@ -853,3 +870,16 @@ void RIApplication::applyPreferences()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RIApplication::terminateProcess()
{
if (m_workerProcess)
{
m_workerProcess->close();
}
m_workerProcess = NULL;
}

View File

@@ -103,6 +103,7 @@ public:
QString octavePath() const;
bool launchProcess(const QString& program, const QStringList& arguments);
void terminateProcess();
RIPreferences* preferences();
void readPreferences();

View File

@@ -42,6 +42,8 @@ RIPreferences::RIPreferences(void)
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
lastUsedProjectFileName.setUiHidden(true);
CAF_PDM_InitField(&autocomputeSOIL, "autocomputeSOIL", true, "Compute SOIL if not on disk", "", "", "");
}
//--------------------------------------------------------------------------------------------------

View File

@@ -41,6 +41,9 @@ public: // Pdm Fields
caf::PdmField<QString> lastUsedProjectFileName;
caf::PdmField<bool> autocomputeSOIL;
protected:
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
};