mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-12 16:32:12 -05:00
Whitespace
This commit is contained in:
1 parent
84b0a23512
commit
e846e50da4
1 file changed
+121
-153
@@ -32,10 +32,10 @@
|
||||
#include "RiaVersionInfo.h"
|
||||
#include "RiaViewRedrawScheduler.h"
|
||||
|
||||
#include "RicImportInputEclipseCaseFeature.h"
|
||||
#include "RicImportSummaryCasesFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
#include "HoloLensCommands/RicHoloLensSessionManager.h"
|
||||
#include "RicImportInputEclipseCaseFeature.h"
|
||||
#include "RicImportSummaryCasesFeature.h"
|
||||
|
||||
#include "Rim2dIntersectionViewCollection.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
@@ -75,12 +75,12 @@
|
||||
#include "RimWellPltPlot.h"
|
||||
#include "RimWellRftPlot.h"
|
||||
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuDockWidgetTools.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuProcessMonitor.h"
|
||||
#include "RiuRecentFileActionProvider.h"
|
||||
#include "Riu3dSelectionManager.h"
|
||||
#include "RiuViewer.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
@@ -105,10 +105,9 @@
|
||||
#include <QProcessEnvironment>
|
||||
#include <QTreeView>
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h> // for usleep
|
||||
#endif //WIN32
|
||||
#include <unistd.h> // for usleep
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef USE_UNIT_TESTS
|
||||
#include "gtest/gtest.h"
|
||||
@@ -117,18 +116,15 @@
|
||||
namespace caf
|
||||
{
|
||||
template<>
|
||||
void AppEnum< RiaApplication::RINavigationPolicy >::setUp()
|
||||
void AppEnum<RiaApplication::RINavigationPolicy>::setUp()
|
||||
{
|
||||
addItem(RiaApplication::NAVIGATION_POLICY_CEETRON, "NAVIGATION_POLICY_CEETRON", "Ceetron");
|
||||
addItem(RiaApplication::NAVIGATION_POLICY_CAD, "NAVIGATION_POLICY_CAD", "CAD");
|
||||
addItem(RiaApplication::NAVIGATION_POLICY_GEOQUEST, "NAVIGATION_POLICY_GEOQUEST", "GEOQUEST");
|
||||
addItem(RiaApplication::NAVIGATION_POLICY_RMS, "NAVIGATION_POLICY_RMS", "RMS");
|
||||
addItem(RiaApplication::NAVIGATION_POLICY_CEETRON, "NAVIGATION_POLICY_CEETRON", "Ceetron");
|
||||
addItem(RiaApplication::NAVIGATION_POLICY_CAD, "NAVIGATION_POLICY_CAD", "CAD");
|
||||
addItem(RiaApplication::NAVIGATION_POLICY_GEOQUEST, "NAVIGATION_POLICY_GEOQUEST", "GEOQUEST");
|
||||
addItem(RiaApplication::NAVIGATION_POLICY_RMS, "NAVIGATION_POLICY_RMS", "RMS");
|
||||
setDefault(RiaApplication::NAVIGATION_POLICY_RMS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace caf
|
||||
|
||||
//==================================================================================================
|
||||
///
|
||||
@@ -138,7 +134,6 @@ void AppEnum< RiaApplication::RINavigationPolicy >::setUp()
|
||||
///
|
||||
//==================================================================================================
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -147,14 +142,15 @@ bool RiaApplication::notify(QObject* receiver, QEvent* event)
|
||||
// Pre-allocating a memory exhaustion message
|
||||
// Doing som e trickery to avoid deadlock, as creating a messagebox actually triggers a call to this notify method.
|
||||
|
||||
static QMessageBox* memoryExhaustedBox = nullptr;
|
||||
static bool allocatingMessageBox = false;
|
||||
static QMessageBox* memoryExhaustedBox = nullptr;
|
||||
static bool allocatingMessageBox = false;
|
||||
if (!memoryExhaustedBox && !allocatingMessageBox)
|
||||
{
|
||||
allocatingMessageBox = true;
|
||||
memoryExhaustedBox = new QMessageBox(QMessageBox::Critical,
|
||||
memoryExhaustedBox = new QMessageBox(QMessageBox::Critical,
|
||||
"ResInsight Exhausted Memory",
|
||||
"Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now unstable and will probably crash soon.");
|
||||
"Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now "
|
||||
"unstable and will probably crash soon.");
|
||||
}
|
||||
|
||||
bool done = true;
|
||||
@@ -162,10 +158,12 @@ bool RiaApplication::notify(QObject* receiver, QEvent* event)
|
||||
{
|
||||
done = QApplication::notify(receiver, event);
|
||||
}
|
||||
catch ( const std::bad_alloc& )
|
||||
catch (const std::bad_alloc&)
|
||||
{
|
||||
if (memoryExhaustedBox) memoryExhaustedBox->exec();
|
||||
std::cout << "ResInsight: Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now unstable and will probably crash soon." << std::endl;
|
||||
std::cout << "ResInsight: Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now unstable "
|
||||
"and will probably crash soon."
|
||||
<< std::endl;
|
||||
// If we really want to crash instead of limping forward:
|
||||
// throw;
|
||||
}
|
||||
@@ -177,17 +175,17 @@ bool RiaApplication::notify(QObject* receiver, QEvent* event)
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
: QApplication(argc, argv)
|
||||
: QApplication(argc, argv)
|
||||
{
|
||||
// USed to get registry settings in the right place
|
||||
QCoreApplication::setOrganizationName(RI_COMPANY_NAME);
|
||||
QCoreApplication::setApplicationName(RI_APPLICATION_NAME);
|
||||
|
||||
// For idle processing
|
||||
// m_idleTimerStarted = false;
|
||||
// m_idleTimerStarted = false;
|
||||
installEventFilter(this);
|
||||
|
||||
//cvf::Trace::enable(false);
|
||||
// cvf::Trace::enable(false);
|
||||
|
||||
m_preferences = new RiaPreferences;
|
||||
caf::PdmSettings::readFieldsFromApplicationStore(m_preferences);
|
||||
@@ -207,7 +205,7 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
|
||||
setWindowIcon(QIcon(":/AppLogo48x48.png"));
|
||||
|
||||
m_socketServer = new RiaSocketServer( this);
|
||||
m_socketServer = new RiaSocketServer(this);
|
||||
m_workerProcess = nullptr;
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -229,7 +227,6 @@ RiaApplication::RiaApplication(int& argc, char** argv)
|
||||
m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -247,7 +244,7 @@ RiaApplication::~RiaApplication()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaApplication* RiaApplication::instance()
|
||||
{
|
||||
return static_cast<RiaApplication*>qApp;
|
||||
return static_cast<RiaApplication*> qApp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -298,7 +295,7 @@ void RiaApplication::setWindowCaptionFromAppState()
|
||||
|
||||
{
|
||||
QString projFileName = m_project->fileName();
|
||||
if (projFileName.isEmpty()) projFileName = "Untitled project";
|
||||
if (projFileName.isEmpty()) projFileName = "Untitled project";
|
||||
|
||||
capt = projFileName + QString("[*]") + QString(" - ") + capt;
|
||||
}
|
||||
@@ -306,7 +303,6 @@ void RiaApplication::setWindowCaptionFromAppState()
|
||||
mainWnd->setWindowTitle(capt);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -315,7 +311,6 @@ void RiaApplication::processNonGuiEvents()
|
||||
processEvents(QEventLoop::ExcludeUserInputEvents);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -341,12 +336,12 @@ const char* RiaApplication::getVersionStringApp(bool includeCrtInfo)
|
||||
return szBuf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier)
|
||||
bool RiaApplication::loadProject(const QString& projectFileName,
|
||||
ProjectLoadAction loadAction,
|
||||
RiaProjectModifier* projectModifier)
|
||||
{
|
||||
// First Close the current project
|
||||
|
||||
@@ -381,7 +376,8 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
{
|
||||
closeProject();
|
||||
|
||||
QString tmp = QString("Unknown project file version detected in file \n%1\n\nCould not open project.").arg(fullPathProjectFileName);
|
||||
QString tmp =
|
||||
QString("Unknown project file version detected in file \n%1\n\nCould not open project.").arg(fullPathProjectFileName);
|
||||
QMessageBox::warning(nullptr, "Error when opening project file", tmp);
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
@@ -423,7 +419,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
mainPlotWindow()->hide();
|
||||
}
|
||||
|
||||
|
||||
///////
|
||||
// Load the external data, and initialize stuff that needs specific ordering
|
||||
|
||||
@@ -434,7 +429,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
|
||||
{
|
||||
RimOilField* oilField = m_project->oilFields[oilFieldIdx];
|
||||
RimOilField* oilField = m_project->oilFields[oilFieldIdx];
|
||||
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
|
||||
if (analysisModels == nullptr) continue;
|
||||
|
||||
@@ -448,16 +443,15 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
|
||||
// Load the formation names
|
||||
|
||||
for(RimOilField* oilField: m_project->oilFields)
|
||||
for (RimOilField* oilField : m_project->oilFields)
|
||||
{
|
||||
if (oilField == nullptr) continue;
|
||||
if(oilField->formationNamesCollection() != nullptr)
|
||||
if (oilField->formationNamesCollection() != nullptr)
|
||||
{
|
||||
oilField->formationNamesCollection()->readAllFormationNames();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Add well paths for each oil field
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
|
||||
{
|
||||
@@ -465,7 +459,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
if (oilField == nullptr) continue;
|
||||
if (oilField->wellPathCollection == nullptr)
|
||||
{
|
||||
//printf("Create well path collection for oil field %i in loadProject.\n", oilFieldIdx);
|
||||
// printf("Create well path collection for oil field %i in loadProject.\n", oilFieldIdx);
|
||||
oilField->wellPathCollection = new RimWellPathCollection();
|
||||
}
|
||||
|
||||
@@ -476,11 +470,11 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
}
|
||||
}
|
||||
|
||||
for (RimOilField* oilField: m_project->oilFields)
|
||||
for (RimOilField* oilField : m_project->oilFields)
|
||||
{
|
||||
if (oilField == nullptr) continue;
|
||||
// Temporary
|
||||
if(!oilField->summaryCaseMainCollection())
|
||||
if (!oilField->summaryCaseMainCollection())
|
||||
{
|
||||
oilField->summaryCaseMainCollection = new RimSummaryCaseMainCollection();
|
||||
}
|
||||
@@ -513,7 +507,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
fracture->loadDataAndUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// If load action is specified to recalculate statistics, do it now.
|
||||
@@ -522,7 +515,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
{
|
||||
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
|
||||
{
|
||||
RimOilField* oilField = m_project->oilFields[oilFieldIdx];
|
||||
RimOilField* oilField = m_project->oilFields[oilFieldIdx];
|
||||
RimEclipseCaseCollection* analysisModels = oilField ? oilField->analysisModels() : nullptr;
|
||||
if (analysisModels)
|
||||
{
|
||||
@@ -531,8 +524,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Now load the ReservoirViews for the cases
|
||||
// Add all "native" cases in the project
|
||||
std::vector<RimCase*> casesToLoad;
|
||||
@@ -551,7 +542,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
caf::ProgressInfo viewProgress(views.size(), "Creating Views");
|
||||
|
||||
size_t j;
|
||||
for ( j = 0; j < views.size(); j++ )
|
||||
for (j = 0; j < views.size(); j++)
|
||||
{
|
||||
Rim3dView* riv = views[j];
|
||||
CVF_ASSERT(riv);
|
||||
@@ -570,10 +561,10 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
|
||||
riv->loadDataAndUpdate();
|
||||
|
||||
if ( m_project->isProjectFileVersionEqualOrOlderThan("2018.1.1.110") )
|
||||
if (m_project->isProjectFileVersionEqualOrOlderThan("2018.1.1.110"))
|
||||
{
|
||||
auto* geoView = dynamic_cast<RimGeoMechView*>(riv);
|
||||
if ( geoView )
|
||||
if (geoView)
|
||||
{
|
||||
geoView->convertCameraPositionFromOldProjectFiles();
|
||||
}
|
||||
@@ -598,7 +589,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
|
||||
// Intersection Views: Sync from intersections in the case.
|
||||
|
||||
for (RimCase* cas: casesToLoad)
|
||||
for (RimCase* cas : casesToLoad)
|
||||
{
|
||||
cas->intersectionViewCollection()->syncFromExistingIntersections(false);
|
||||
}
|
||||
@@ -607,7 +598,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
|
||||
for (RimOilField* oilField : m_project->oilFields)
|
||||
{
|
||||
auto sumMainCollection = oilField->summaryCaseMainCollection();
|
||||
if(!sumMainCollection) continue;
|
||||
if (!sumMainCollection) continue;
|
||||
|
||||
for (auto sumCaseGroup : sumMainCollection->summaryCaseCollections())
|
||||
{
|
||||
@@ -656,12 +647,12 @@ bool RiaApplication::loadProject(const QString& projectFileName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::loadAndUpdatePlotData()
|
||||
{
|
||||
RimWellLogPlotCollection* wlpColl = nullptr;
|
||||
RimSummaryPlotCollection* spColl = nullptr;
|
||||
RimSummaryCrossPlotCollection* scpColl = nullptr;
|
||||
RimFlowPlotCollection* flowColl = nullptr;
|
||||
RimRftPlotCollection* rftColl = nullptr;
|
||||
RimPltPlotCollection* pltColl = nullptr;
|
||||
RimWellLogPlotCollection* wlpColl = nullptr;
|
||||
RimSummaryPlotCollection* spColl = nullptr;
|
||||
RimSummaryCrossPlotCollection* scpColl = nullptr;
|
||||
RimFlowPlotCollection* flowColl = nullptr;
|
||||
RimRftPlotCollection* rftColl = nullptr;
|
||||
RimPltPlotCollection* pltColl = nullptr;
|
||||
|
||||
if (m_project->mainPlotCollection() && m_project->mainPlotCollection()->wellLogPlotCollection())
|
||||
{
|
||||
@@ -768,7 +759,7 @@ void RiaApplication::storeTreeViewState()
|
||||
QString encodedModelIndexString;
|
||||
caf::QTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
project()->plotWindowTreeViewState = treeViewState;
|
||||
project()->plotWindowTreeViewState = treeViewState;
|
||||
project()->plotWindowCurrentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
@@ -785,7 +776,7 @@ void RiaApplication::storeTreeViewState()
|
||||
QString encodedModelIndexString;
|
||||
caf::QTreeViewStateSerializer::encodeStringFromModelIndex(mi, encodedModelIndexString);
|
||||
|
||||
project()->mainWindowTreeViewState = treeViewState;
|
||||
project()->mainWindowTreeViewState = treeViewState;
|
||||
project()->mainWindowCurrentModelIndexPath = encodedModelIndexString;
|
||||
}
|
||||
}
|
||||
@@ -803,7 +794,7 @@ void RiaApplication::addWellPathsToModel(QList<QString> wellPathFilePaths)
|
||||
|
||||
if (oilField->wellPathCollection == nullptr)
|
||||
{
|
||||
//printf("Create well path collection.\n");
|
||||
// printf("Create well path collection.\n");
|
||||
oilField->wellPathCollection = new RimWellPathCollection();
|
||||
|
||||
m_project->updateConnectedEditors();
|
||||
@@ -863,7 +854,6 @@ void RiaApplication::addWellLogsToModel(const QList<QString>& wellLogFilePaths)
|
||||
RiuMainWindow::instance()->selectAsCurrentItem(wellLogFile);
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -881,13 +871,12 @@ bool RiaApplication::saveProject()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaApplication::saveProjectPromptForFileName()
|
||||
{
|
||||
//if (m_project.isNull()) return true;
|
||||
// if (m_project.isNull()) return true;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
@@ -902,7 +891,8 @@ bool RiaApplication::saveProjectPromptForFileName()
|
||||
startPath += "/ResInsightProject.rsp";
|
||||
}
|
||||
|
||||
QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save File"), startPath, tr("Project Files (*.rsp);;All files(*.*)"));
|
||||
QString fileName =
|
||||
QFileDialog::getSaveFileName(nullptr, tr("Save File"), startPath, tr("Project Files (*.rsp);;All files(*.*)"));
|
||||
if (fileName.isEmpty())
|
||||
{
|
||||
return false;
|
||||
@@ -980,7 +970,12 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
|
||||
|
||||
if (!m_project->writeFile())
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Error when saving project file", QString("Not possible to save project file. Make sure you have sufficient access rights.\n\nProject file location : %1").arg(fileName));
|
||||
QMessageBox::warning(
|
||||
nullptr,
|
||||
"Error when saving project file",
|
||||
QString(
|
||||
"Not possible to save project file. Make sure you have sufficient access rights.\n\nProject file location : %1")
|
||||
.arg(fileName));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1103,23 +1098,24 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName, bool applyTime
|
||||
if (!caf::Utils::fileExists(fileName)) return false;
|
||||
|
||||
QFileInfo gridFileName(fileName);
|
||||
QString caseName = gridFileName.completeBaseName();
|
||||
QString caseName = gridFileName.completeBaseName();
|
||||
|
||||
RimGeoMechCase* geoMechCase = new RimGeoMechCase();
|
||||
geoMechCase->setFileName(fileName);
|
||||
geoMechCase->caseUserDescription = caseName;
|
||||
geoMechCase->setApplyTimeFilter(applyTimeStepFilter);
|
||||
|
||||
RimGeoMechModels* geoMechModelCollection = m_project->activeOilField() ? m_project->activeOilField()->geoMechModels() : nullptr;
|
||||
RimGeoMechModels* geoMechModelCollection =
|
||||
m_project->activeOilField() ? m_project->activeOilField()->geoMechModels() : nullptr;
|
||||
|
||||
// Create the geoMech model container if it is not there already
|
||||
if (geoMechModelCollection == nullptr)
|
||||
{
|
||||
geoMechModelCollection = new RimGeoMechModels();
|
||||
geoMechModelCollection = new RimGeoMechModels();
|
||||
m_project->activeOilField()->geoMechModels = geoMechModelCollection;
|
||||
}
|
||||
|
||||
RimGeoMechView* riv = geoMechCase->createAndAddReservoirView();
|
||||
RimGeoMechView* riv = geoMechCase->createAndAddReservoirView();
|
||||
caf::ProgressInfo progress(11, "Loading Case");
|
||||
progress.setNextProgressIncrement(10);
|
||||
|
||||
@@ -1132,7 +1128,7 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName, bool applyTime
|
||||
}
|
||||
geoMechModelCollection->cases.push_back(geoMechCase);
|
||||
|
||||
//if (!riv->cellResult()->hasResult())
|
||||
// if (!riv->cellResult()->hasResult())
|
||||
//{
|
||||
// riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName());
|
||||
//}
|
||||
@@ -1162,7 +1158,6 @@ void RiaApplication::createResultsMockModel()
|
||||
RiaImportEclipseCaseTools::openMockModel(RiaDefines::mockModelBasicWithResults());
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1171,7 +1166,6 @@ void RiaApplication::createLargeResultsMockModel()
|
||||
RiaImportEclipseCaseTools::openMockModel(RiaDefines::mockModelLargeWithResults());
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1201,7 +1195,7 @@ const Rim3dView* RiaApplication::activeReservoirView() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dView* RiaApplication::activeReservoirView()
|
||||
{
|
||||
return m_activeReservoirView;
|
||||
return m_activeReservoirView;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1209,7 +1203,7 @@ Rim3dView* RiaApplication::activeReservoirView()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimGridView* RiaApplication::activeGridView()
|
||||
{
|
||||
return dynamic_cast<RimGridView*>( m_activeReservoirView.p());
|
||||
return dynamic_cast<RimGridView*>(m_activeReservoirView.p());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1219,10 +1213,10 @@ RimViewWindow* RiaApplication::activePlotWindow() const
|
||||
{
|
||||
RimViewWindow* viewWindow = nullptr;
|
||||
|
||||
if ( m_mainPlotWindow )
|
||||
if (m_mainPlotWindow)
|
||||
{
|
||||
QList<QMdiSubWindow*> subwindows = m_mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
|
||||
if ( subwindows.size() > 0 )
|
||||
if (subwindows.size() > 0)
|
||||
{
|
||||
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
|
||||
}
|
||||
@@ -1254,7 +1248,6 @@ bool RiaApplication::useShaders() const
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1263,7 +1256,6 @@ RiaApplication::RINavigationPolicy RiaApplication::navigationPolicy() const
|
||||
return m_preferences->navigationPolicy();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1272,7 +1264,6 @@ bool RiaApplication::showPerformanceInfo() const
|
||||
return m_preferences->showHud;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1297,7 +1288,7 @@ int RiaApplication::launchUnitTests()
|
||||
cvf::Assert::setReportMode(cvf::Assert::CONSOLE);
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
int argc = QCoreApplication::argc();
|
||||
int argc = QCoreApplication::argc();
|
||||
char** argv = QCoreApplication::argv();
|
||||
#else
|
||||
int argc = QCoreApplication::arguments().size();
|
||||
@@ -1435,9 +1426,12 @@ RiuPlotMainWindow* RiaApplication::mainPlotWindow()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID)
|
||||
{
|
||||
if (mainWindowID == 0) return RiuMainWindow::instance();
|
||||
else if (mainWindowID == 1) return m_mainPlotWindow;
|
||||
else return nullptr;
|
||||
if (mainWindowID == 0)
|
||||
return RiuMainWindow::instance();
|
||||
else if (mainWindowID == 1)
|
||||
return m_mainPlotWindow;
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1559,7 +1553,7 @@ std::vector<QString> RiaApplication::readFileListFromTextFile(QString listFileNa
|
||||
}
|
||||
|
||||
QTextStream in(&file);
|
||||
QString line = in.readLine();
|
||||
QString line = in.readLine();
|
||||
while (!line.isNull())
|
||||
{
|
||||
line = line.trimmed();
|
||||
@@ -1605,7 +1599,6 @@ void RiaApplication::saveWinGeoAndDockToolBarLayout()
|
||||
{
|
||||
RiuMainWindow::instance()->saveWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1663,7 +1656,6 @@ QStringList RiaApplication::octaveArguments() const
|
||||
// will override any value of OCTAVE_PATH found in the environment, but not any commands in the system or
|
||||
// user startup files that set the internal load path through one of the path functions.
|
||||
|
||||
|
||||
QStringList arguments;
|
||||
arguments.append("--path");
|
||||
arguments << QApplication::applicationDirPath();
|
||||
@@ -1697,19 +1689,17 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
|
||||
// Either the work process crashed or was aborted by the user
|
||||
if (exitStatus == QProcess::CrashExit)
|
||||
{
|
||||
// MFLog::error("Simulation execution crashed or was aborted.");
|
||||
// MFLog::error("Simulation execution crashed or was aborted.");
|
||||
m_runningWorkerProcess = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
executeCommandObjects();
|
||||
|
||||
|
||||
// Exit code != 0 means we have an error
|
||||
if (exitCode != 0)
|
||||
{
|
||||
// MFLog::error(QString("Simulation execution failed (exit code %1).").arg(exitCode));
|
||||
// MFLog::error(QString("Simulation execution failed (exit code %1).").arg(exitCode));
|
||||
m_runningWorkerProcess = false;
|
||||
return;
|
||||
}
|
||||
@@ -1749,34 +1739,40 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
|
||||
}
|
||||
|
||||
m_runningWorkerProcess = true;
|
||||
m_workerProcess = new caf::UiProcess(this);
|
||||
m_workerProcess = new caf::UiProcess(this);
|
||||
|
||||
QProcessEnvironment penv = QProcessEnvironment::systemEnvironment();
|
||||
|
||||
#ifdef WIN32
|
||||
// Octave plugins compiled by ResInsight are dependent on Qt (currently Qt 32-bit only)
|
||||
// Some Octave installations for Windows have included Qt, and some don't. To make sure these plugins always can be executed,
|
||||
// the path to octave_plugin_dependencies is added to global path
|
||||
// Some Octave installations for Windows have included Qt, and some don't. To make sure these plugins always can be
|
||||
// executed, the path to octave_plugin_dependencies is added to global path
|
||||
|
||||
QString pathString = penv.value("PATH", "");
|
||||
|
||||
if (pathString == "") pathString = QApplication::applicationDirPath() + "\\octave_plugin_dependencies";
|
||||
else pathString = QApplication::applicationDirPath() + "\\octave_plugin_dependencies" + ";" + pathString;
|
||||
if (pathString == "")
|
||||
pathString = QApplication::applicationDirPath() + "\\octave_plugin_dependencies";
|
||||
else
|
||||
pathString = QApplication::applicationDirPath() + "\\octave_plugin_dependencies" + ";" + pathString;
|
||||
|
||||
penv.insert("PATH", pathString);
|
||||
#else
|
||||
// Set the LD_LIBRARY_PATH to make the octave plugins find the embedded Qt
|
||||
QString ldPath = penv.value("LD_LIBRARY_PATH", "");
|
||||
// Set the LD_LIBRARY_PATH to make the octave plugins find the embedded Qt
|
||||
QString ldPath = penv.value("LD_LIBRARY_PATH", "");
|
||||
|
||||
if (ldPath == "") ldPath = QApplication::applicationDirPath();
|
||||
else ldPath = QApplication::applicationDirPath() + ":" + ldPath;
|
||||
if (ldPath == "")
|
||||
ldPath = QApplication::applicationDirPath();
|
||||
else
|
||||
ldPath = QApplication::applicationDirPath() + ":" + ldPath;
|
||||
|
||||
penv.insert("LD_LIBRARY_PATH", ldPath);
|
||||
penv.insert("LD_LIBRARY_PATH", ldPath);
|
||||
#endif
|
||||
|
||||
m_workerProcess->setProcessEnvironment(penv);
|
||||
|
||||
connect(m_workerProcess, SIGNAL(finished(int, QProcess::ExitStatus)), SLOT(slotWorkerProcessFinished(int, QProcess::ExitStatus)));
|
||||
connect(m_workerProcess,
|
||||
SIGNAL(finished(int, QProcess::ExitStatus)),
|
||||
SLOT(slotWorkerProcessFinished(int, QProcess::ExitStatus)));
|
||||
|
||||
RiuMainWindow::instance()->processMonitor()->startMonitorWorkProcess(m_workerProcess);
|
||||
|
||||
@@ -1784,12 +1780,13 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
|
||||
if (!m_workerProcess->waitForStarted(1000))
|
||||
{
|
||||
m_workerProcess->close();
|
||||
m_workerProcess = nullptr;
|
||||
m_workerProcess = nullptr;
|
||||
m_runningWorkerProcess = false;
|
||||
|
||||
RiuMainWindow::instance()->processMonitor()->stopMonitorWorkProcess();
|
||||
|
||||
QMessageBox::warning(RiuMainWindow::instance(), "Script execution", "Failed to start script executable located at\n" + program);
|
||||
QMessageBox::warning(
|
||||
RiuMainWindow::instance(), "Script execution", "Failed to start script executable located at\n" + program);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1798,7 +1795,9 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::warning(nullptr, "Script execution", "An Octave process is still running. Please stop this process before executing a new script.");
|
||||
QMessageBox::warning(nullptr,
|
||||
"Script execution",
|
||||
"An Octave process is still running. Please stop this process before executing a new script.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1806,12 +1805,14 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaApplication::launchProcessForMultipleCases(const QString& program, const QStringList& arguments, const std::vector<int>& caseIds)
|
||||
bool RiaApplication::launchProcessForMultipleCases(const QString& program,
|
||||
const QStringList& arguments,
|
||||
const std::vector<int>& caseIds)
|
||||
{
|
||||
m_currentCaseIds.clear();
|
||||
std::copy( caseIds.begin(), caseIds.end(), std::back_inserter( m_currentCaseIds ) );
|
||||
std::copy(caseIds.begin(), caseIds.end(), std::back_inserter(m_currentCaseIds));
|
||||
|
||||
m_currentProgram = program;
|
||||
m_currentProgram = program;
|
||||
m_currentArguments = arguments;
|
||||
|
||||
return launchProcess(m_currentProgram, m_currentArguments);
|
||||
@@ -1847,8 +1848,10 @@ void RiaApplication::applyPreferences()
|
||||
|
||||
if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView())
|
||||
{
|
||||
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
||||
if (mainPlotWindow()) mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
||||
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(
|
||||
m_preferences->appendClassNameToUiText());
|
||||
if (mainPlotWindow())
|
||||
mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
|
||||
}
|
||||
|
||||
RiaFontCache::FontSize fontSizeType = RiaFontCache::FONT_SIZE_16;
|
||||
@@ -1916,7 +1919,7 @@ void RiaApplication::terminateProcess()
|
||||
}
|
||||
|
||||
m_runningWorkerProcess = false;
|
||||
m_workerProcess = nullptr;
|
||||
m_workerProcess = nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1987,7 +1990,6 @@ void RiaApplication::setLastUsedDialogDirectory(const QString& dialogName, const
|
||||
m_fileDialogDefaultDirectories[dialogName] = directory;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2003,7 +2005,7 @@ bool RiaApplication::openFile(const QString& fileName)
|
||||
}
|
||||
else if (fileName.contains(".egrid", Qt::CaseInsensitive) || fileName.contains(".grid", Qt::CaseInsensitive))
|
||||
{
|
||||
loadingSucceded = RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({ fileName }));
|
||||
loadingSucceded = RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({fileName}));
|
||||
}
|
||||
else if (fileName.contains(".grdecl", Qt::CaseInsensitive))
|
||||
{
|
||||
@@ -2015,7 +2017,7 @@ bool RiaApplication::openFile(const QString& fileName)
|
||||
}
|
||||
else if (fileName.contains(".smspec", Qt::CaseInsensitive))
|
||||
{
|
||||
loadingSucceded = RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(QStringList({ fileName }));
|
||||
loadingSucceded = RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(QStringList({fileName}));
|
||||
if (loadingSucceded)
|
||||
{
|
||||
getOrCreateAndShowMainPlotWindow();
|
||||
@@ -2033,7 +2035,9 @@ bool RiaApplication::openFile(const QString& fileName)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName)
|
||||
void RiaApplication::runMultiCaseSnapshots(const QString& templateProjectFileName,
|
||||
std::vector<QString> gridFileNames,
|
||||
const QString& snapshotFolderName)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
if (!mainWnd) return;
|
||||
@@ -2116,44 +2120,8 @@ void RiaApplication::showFormattedTextInMessageBox(const QString& text)
|
||||
QString RiaApplication::commandLineParameterHelp() const
|
||||
{
|
||||
return m_helpText;
|
||||
|
||||
/*
|
||||
QString text = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(getVersionStringApp(false));
|
||||
text += "Copyright Statoil ASA, Ceetron AS 2011, 2012\n\n";
|
||||
|
||||
text +=
|
||||
"\nParameter Description\n"
|
||||
"-----------------------------------------------------------------\n"
|
||||
"-last Open last used project\n"
|
||||
"\n"
|
||||
"-project <filename> Open project file <filename>\n"
|
||||
"\n"
|
||||
"-case <casename> Import Eclipse case <casename>\n"
|
||||
" (do not include .GRID/.EGRID)\n"
|
||||
"\n"
|
||||
"-savesnapshots Save snapshot of all views to 'snapshots' folder in project file folder\n"
|
||||
" Application closes after snapshots are written to file\n"
|
||||
"\n"
|
||||
"-regressiontest <folder> Run a regression test on all sub-folders starting with \"" + RegTestNames::testFolderFilter + "\" of the given folder: \n"
|
||||
" " + RegTestNames::testProjectName + " files in the sub-folders will be opened and \n"
|
||||
" snapshots of all the views is written to the sub-sub-folder " + RegTestNames::generatedFolderName + ". \n"
|
||||
" Then difference images is generated in the sub-sub-folder " + RegTestNames::diffFolderName + " based \n"
|
||||
" on the images in sub-sub-folder " + RegTestNames::baseFolderName + ".\n"
|
||||
" The results are presented in " + RegTestNames::reportFileName + " that is\n"
|
||||
" written in the given folder.\n"
|
||||
"\n"
|
||||
"-updateregressiontestbase <folder> For all sub-folders starting with \"" + RegTestNames::testFolderFilter + "\" of the given folder: \n"
|
||||
" Copy the images in the sub-sub-folder " + RegTestNames::generatedFolderName + " to the sub-sub-folder\n"
|
||||
" " + RegTestNames::baseFolderName + " after deleting " + RegTestNames::baseFolderName + " completely.\n"
|
||||
"\n"
|
||||
"-help, -? Displays help text\n"
|
||||
"-----------------------------------------------------------------";
|
||||
|
||||
return text;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -2211,7 +2179,7 @@ void RiaApplication::executeCommandObjects()
|
||||
|
||||
if (!m_commandQueue.empty())
|
||||
{
|
||||
std::list< RimCommandObject* >::iterator it = m_commandQueue.begin();
|
||||
std::list<RimCommandObject*>::iterator it = m_commandQueue.begin();
|
||||
|
||||
RimCommandObject* first = *it;
|
||||
first->redo();
|
||||
|
||||
Reference in new issue
Block a user