mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Updated to version 0.8.0
This commit is contained in:
@@ -35,17 +35,17 @@
|
||||
#include "RIProcessMonitor.h"
|
||||
#include "RIPreferences.h"
|
||||
|
||||
#include "RimReservoir.h"
|
||||
#include "RimResultReservoir.h"
|
||||
#include "RimInputReservoir.h"
|
||||
#include "RimReservoirView.h"
|
||||
|
||||
#include "RigReservoir.h"
|
||||
#include "RigCell.h"
|
||||
#include "RigReservoirBuilderMock.h"
|
||||
|
||||
#include "RimReservoirView.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include "cafPdmDocument.h"
|
||||
#include "RifReaderInterfaceMock.h"
|
||||
#include "RifReaderMockModel.h"
|
||||
|
||||
#include "cafCeetronNavigation.h"
|
||||
#include "cafCadNavigation.h"
|
||||
@@ -149,7 +149,7 @@ void RIApplication::setWindowCaptionFromAppState()
|
||||
#endif
|
||||
|
||||
{
|
||||
QString projFileName = m_currentProjectFileName;
|
||||
QString projFileName = m_project->fileName();
|
||||
if (projFileName.isEmpty()) projFileName = "Untitled project";
|
||||
|
||||
capt = projFileName + QString("[*]") + QString(" - ") + capt;
|
||||
@@ -222,7 +222,6 @@ bool RIApplication::loadProject(const QString& projectFileName)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_currentProjectFileName = projectFileName;
|
||||
m_preferences->lastUsedProjectFileName = projectFileName;
|
||||
writePreferences();
|
||||
|
||||
@@ -263,13 +262,15 @@ bool RIApplication::loadLastUsedProject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RIApplication::saveProject()
|
||||
{
|
||||
if (!QFile::exists(m_currentProjectFileName))
|
||||
CVF_ASSERT(m_project.notNull());
|
||||
|
||||
if (!QFile::exists(m_project->fileName()))
|
||||
{
|
||||
return saveProjectPromptForFileName();
|
||||
}
|
||||
else
|
||||
{
|
||||
return saveProjectAs(m_currentProjectFileName);
|
||||
return saveProjectAs(m_project->fileName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,9 +283,9 @@ bool RIApplication::saveProjectPromptForFileName()
|
||||
//if (m_project.isNull()) return true;
|
||||
|
||||
QString startPath;
|
||||
if (!m_currentProjectFileName.isEmpty())
|
||||
if (!m_project->fileName().isEmpty())
|
||||
{
|
||||
QFileInfo fi(m_currentProjectFileName);
|
||||
QFileInfo fi(m_project->fileName());
|
||||
startPath = fi.absolutePath();
|
||||
}
|
||||
else
|
||||
@@ -316,7 +317,6 @@ bool RIApplication::saveProjectAs(const QString& fileName)
|
||||
m_project->fileName = fileName;
|
||||
m_project->writeFile();
|
||||
|
||||
m_currentProjectFileName = fileName;
|
||||
m_preferences->lastUsedProjectFileName = fileName;
|
||||
writePreferences();
|
||||
|
||||
@@ -380,9 +380,9 @@ void RIApplication::onProjectOpenedOrClosed()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RIApplication::lastProjectFileName() const
|
||||
QString RIApplication::currentProjectFileName() const
|
||||
{
|
||||
return "";
|
||||
return m_project->fileName();
|
||||
}
|
||||
|
||||
|
||||
@@ -395,24 +395,27 @@ bool RIApplication::openEclipseCaseFromFile(const QString& fileName)
|
||||
|
||||
QFileInfo gridFileName(fileName);
|
||||
QString caseName = gridFileName.completeBaseName();
|
||||
QString casePath = gridFileName.absolutePath();
|
||||
|
||||
return openEclipseCase(caseName, casePath);
|
||||
return openEclipseCase(caseName, fileName);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RIApplication::openEclipseCase(const QString& caseName, const QString& casePath)
|
||||
bool RIApplication::openEclipseCase(const QString& caseName, const QString& caseFileName)
|
||||
{
|
||||
RimReservoir* rimReservoir = new RimReservoir();
|
||||
rimReservoir->caseName = caseName;
|
||||
rimReservoir->caseDirectory = casePath;
|
||||
QFileInfo gridFileName(caseFileName);
|
||||
QString casePath = gridFileName.absolutePath();
|
||||
|
||||
m_project->reservoirs.push_back(rimReservoir);
|
||||
RimResultReservoir* rimResultReservoir = new RimResultReservoir();
|
||||
rimResultReservoir->caseName = caseName;
|
||||
rimResultReservoir->caseFileName = caseFileName;
|
||||
rimResultReservoir->caseDirectory = casePath;
|
||||
|
||||
RimReservoirView* riv = rimReservoir->createAndAddReservoirView();
|
||||
m_project->reservoirs.push_back(rimResultReservoir);
|
||||
|
||||
RimReservoirView* riv = rimResultReservoir->createAndAddReservoirView();
|
||||
|
||||
// Select SOIL as default result variable
|
||||
riv->cellResult()->resultType = RimDefines::DYNAMIC_NATIVE;
|
||||
@@ -423,7 +426,36 @@ bool RIApplication::openEclipseCase(const QString& caseName, const QString& case
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->resultVariable = "";
|
||||
riv->cellResult()->resultVariable = RimDefines::nonSelectedResultName();
|
||||
}
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RIApplication::openInputEclipseCase(const QString& caseName, const QStringList& caseFileNames)
|
||||
{
|
||||
RimInputReservoir* rimInputReservoir = new RimInputReservoir();
|
||||
rimInputReservoir->caseName = caseName;
|
||||
rimInputReservoir->openDataFileSet(caseFileNames);
|
||||
|
||||
m_project->reservoirs.push_back(rimInputReservoir);
|
||||
|
||||
RimReservoirView* riv = rimInputReservoir->createAndAddReservoirView();
|
||||
|
||||
riv->cellResult()->resultType = RimDefines::INPUT_PROPERTY;
|
||||
riv->animationMode = true;
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
if (!riv->cellResult()->hasResult())
|
||||
{
|
||||
riv->cellResult()->resultVariable = RimDefines::nonSelectedResultName();
|
||||
}
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
@@ -438,7 +470,7 @@ bool RIApplication::openEclipseCase(const QString& caseName, const QString& case
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIApplication::createMockModel()
|
||||
{
|
||||
openEclipseCase("Mock Debug Model Simple", "");
|
||||
openEclipseCase("Result Mock Debug Model Simple", "Result Mock Debug Model Simple");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -446,7 +478,7 @@ void RIApplication::createMockModel()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIApplication::createResultsMockModel()
|
||||
{
|
||||
openEclipseCase("Mock Debug Model With Results", "");
|
||||
openEclipseCase("Result Mock Debug Model With Results", "Result Mock Debug Model With Results");
|
||||
}
|
||||
|
||||
|
||||
@@ -455,9 +487,16 @@ void RIApplication::createResultsMockModel()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIApplication::createLargeResultsMockModel()
|
||||
{
|
||||
openEclipseCase("Mock Debug Model Large With Results", "");
|
||||
openEclipseCase("Result Mock Debug Model Large With Results", "Result Mock Debug Model Large With Results");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIApplication::createInputMockModel()
|
||||
{
|
||||
openInputEclipseCase("Input Mock Debug Model Simple", QStringList("Input Mock Debug Model Simple"));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
||||
@@ -73,11 +73,14 @@ public:
|
||||
void createMockModel();
|
||||
void createResultsMockModel();
|
||||
void createLargeResultsMockModel();
|
||||
void createInputMockModel();
|
||||
|
||||
bool openEclipseCaseFromFile(const QString& fileName);
|
||||
bool openEclipseCase(const QString& caseName, const QString& casePath);
|
||||
bool openEclipseCase(const QString& caseName, const QString& caseFileName);
|
||||
bool openInputEclipseCase(const QString& caseName, const QStringList& caseFileNames);
|
||||
|
||||
bool loadLastUsedProject();
|
||||
QString lastProjectFileName() const;
|
||||
QString currentProjectFileName() const;
|
||||
bool loadProject(const QString& fileName);
|
||||
bool saveProject();
|
||||
bool saveProjectAs(const QString& fileName);
|
||||
@@ -110,6 +113,7 @@ private:
|
||||
void onProjectOpenedOrClosed();
|
||||
void setWindowCaptionFromAppState();
|
||||
|
||||
|
||||
|
||||
private slots:
|
||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
@@ -119,7 +123,6 @@ private:
|
||||
caf::PdmPointer<RimReservoirView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
|
||||
QString m_currentProjectFileName;
|
||||
RiaSocketServer* m_socketServer;
|
||||
|
||||
caf::UiProcess* m_workerProcess;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "RIStdInclude.h"
|
||||
#include "RIPreferences.h"
|
||||
#include "cafPdmUiFilePathEditor.h"
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RIPreferences, "RIPreferences");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -28,14 +29,19 @@ RIPreferences::RIPreferences(void)
|
||||
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RIApplication::RINavigationPolicy>(RIApplication::NAVIGATION_POLICY_CAD), "Navigation mode", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&scriptDirectory, "scriptDirectory", "Shared Script Folder", "", "", "");
|
||||
scriptDirectory.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&scriptEditorExecutable, "scriptEditorExecutable", QString("kate"), "Script Editor", "", "", "");
|
||||
scriptEditorExecutable.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&octaveExecutable, "octaveExecutable", QString("octave"), "Octave", "", "", "");
|
||||
octaveExecutable.setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
||||
CAF_PDM_InitField(&useShaders, "useShaders", true, "Use Shaders", "", "", "");
|
||||
CAF_PDM_InitField(&showHud, "showHud", true, "Show 3D Information", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&lastUsedProjectFileName,"lastUsedProjectFileName", "Last Used Project File", "", "", "");
|
||||
lastUsedProjectFileName.setHidden(true);
|
||||
lastUsedProjectFileName.setUiHidden(true);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -45,3 +51,19 @@ RIPreferences::~RIPreferences(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RIPreferences::defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute * attribute)
|
||||
{
|
||||
if (field == &scriptDirectory)
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = static_cast<caf::PdmUiFilePathEditorAttribute*>(attribute);
|
||||
if (myAttr)
|
||||
{
|
||||
myAttr->m_selectDirectory = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,4 +40,7 @@ public: // Pdm Fields
|
||||
caf::PdmField<bool> showHud;
|
||||
|
||||
caf::PdmField<QString> lastUsedProjectFileName;
|
||||
|
||||
protected:
|
||||
virtual void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user