Whitespace

This commit is contained in:
Magne Sjaastad committed 2019-01-17 07:48:07 +01:00
1 parent 84b0a23512
commit e846e50da4
1 file changed
+87 -119
+87 -119
View File
@@ -32,10 +32,10 @@
#include "RiaVersionInfo.h" #include "RiaVersionInfo.h"
#include "RiaViewRedrawScheduler.h" #include "RiaViewRedrawScheduler.h"
#include "RicImportInputEclipseCaseFeature.h"
#include "RicImportSummaryCasesFeature.h"
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
#include "HoloLensCommands/RicHoloLensSessionManager.h" #include "HoloLensCommands/RicHoloLensSessionManager.h"
#include "RicImportInputEclipseCaseFeature.h"
#include "RicImportSummaryCasesFeature.h"
#include "Rim2dIntersectionViewCollection.h" #include "Rim2dIntersectionViewCollection.h"
#include "RimAnnotationCollection.h" #include "RimAnnotationCollection.h"
@@ -75,12 +75,12 @@
#include "RimWellPltPlot.h" #include "RimWellPltPlot.h"
#include "RimWellRftPlot.h" #include "RimWellRftPlot.h"
#include "Riu3dSelectionManager.h"
#include "RiuDockWidgetTools.h" #include "RiuDockWidgetTools.h"
#include "RiuPlotMainWindow.h"
#include "RiuMainWindow.h" #include "RiuMainWindow.h"
#include "RiuPlotMainWindow.h"
#include "RiuProcessMonitor.h" #include "RiuProcessMonitor.h"
#include "RiuRecentFileActionProvider.h" #include "RiuRecentFileActionProvider.h"
#include "Riu3dSelectionManager.h"
#include "RiuViewer.h" #include "RiuViewer.h"
#include "cafAppEnum.h" #include "cafAppEnum.h"
@@ -105,10 +105,9 @@
#include <QProcessEnvironment> #include <QProcessEnvironment>
#include <QTreeView> #include <QTreeView>
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> // for usleep #include <unistd.h> // for usleep
#endif //WIN32 #endif // WIN32
#ifdef USE_UNIT_TESTS #ifdef USE_UNIT_TESTS
#include "gtest/gtest.h" #include "gtest/gtest.h"
@@ -117,7 +116,7 @@
namespace caf namespace caf
{ {
template<> template<>
void AppEnum< RiaApplication::RINavigationPolicy >::setUp() void AppEnum<RiaApplication::RINavigationPolicy>::setUp()
{ {
addItem(RiaApplication::NAVIGATION_POLICY_CEETRON, "NAVIGATION_POLICY_CEETRON", "Ceetron"); addItem(RiaApplication::NAVIGATION_POLICY_CEETRON, "NAVIGATION_POLICY_CEETRON", "Ceetron");
addItem(RiaApplication::NAVIGATION_POLICY_CAD, "NAVIGATION_POLICY_CAD", "CAD"); addItem(RiaApplication::NAVIGATION_POLICY_CAD, "NAVIGATION_POLICY_CAD", "CAD");
@@ -125,10 +124,7 @@ void AppEnum< RiaApplication::RINavigationPolicy >::setUp()
addItem(RiaApplication::NAVIGATION_POLICY_RMS, "NAVIGATION_POLICY_RMS", "RMS"); addItem(RiaApplication::NAVIGATION_POLICY_RMS, "NAVIGATION_POLICY_RMS", "RMS");
setDefault(RiaApplication::NAVIGATION_POLICY_RMS); setDefault(RiaApplication::NAVIGATION_POLICY_RMS);
} }
} } // namespace caf
//================================================================================================== //==================================================================================================
/// ///
@@ -138,7 +134,6 @@ void AppEnum< RiaApplication::RINavigationPolicy >::setUp()
/// ///
//================================================================================================== //==================================================================================================
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -154,7 +149,8 @@ bool RiaApplication::notify(QObject* receiver, QEvent* event)
allocatingMessageBox = true; allocatingMessageBox = true;
memoryExhaustedBox = new QMessageBox(QMessageBox::Critical, memoryExhaustedBox = new QMessageBox(QMessageBox::Critical,
"ResInsight Exhausted Memory", "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; bool done = true;
@@ -162,10 +158,12 @@ bool RiaApplication::notify(QObject* receiver, QEvent* event)
{ {
done = QApplication::notify(receiver, event); done = QApplication::notify(receiver, event);
} }
catch ( const std::bad_alloc& ) catch (const std::bad_alloc&)
{ {
if (memoryExhaustedBox) memoryExhaustedBox->exec(); 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: // If we really want to crash instead of limping forward:
// throw; // throw;
} }
@@ -177,17 +175,17 @@ bool RiaApplication::notify(QObject* receiver, QEvent* event)
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaApplication::RiaApplication(int& argc, char** argv) RiaApplication::RiaApplication(int& argc, char** argv)
: QApplication(argc, argv) : QApplication(argc, argv)
{ {
// USed to get registry settings in the right place // USed to get registry settings in the right place
QCoreApplication::setOrganizationName(RI_COMPANY_NAME); QCoreApplication::setOrganizationName(RI_COMPANY_NAME);
QCoreApplication::setApplicationName(RI_APPLICATION_NAME); QCoreApplication::setApplicationName(RI_APPLICATION_NAME);
// For idle processing // For idle processing
// m_idleTimerStarted = false; // m_idleTimerStarted = false;
installEventFilter(this); installEventFilter(this);
//cvf::Trace::enable(false); // cvf::Trace::enable(false);
m_preferences = new RiaPreferences; m_preferences = new RiaPreferences;
caf::PdmSettings::readFieldsFromApplicationStore(m_preferences); caf::PdmSettings::readFieldsFromApplicationStore(m_preferences);
@@ -207,7 +205,7 @@ RiaApplication::RiaApplication(int& argc, char** argv)
setWindowIcon(QIcon(":/AppLogo48x48.png")); setWindowIcon(QIcon(":/AppLogo48x48.png"));
m_socketServer = new RiaSocketServer( this); m_socketServer = new RiaSocketServer(this);
m_workerProcess = nullptr; m_workerProcess = nullptr;
#ifdef WIN32 #ifdef WIN32
@@ -229,7 +227,6 @@ RiaApplication::RiaApplication(int& argc, char** argv)
m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider); m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -247,7 +244,7 @@ RiaApplication::~RiaApplication()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiaApplication* RiaApplication::instance() RiaApplication* RiaApplication::instance()
{ {
return static_cast<RiaApplication*>qApp; return static_cast<RiaApplication*> qApp;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -306,7 +303,6 @@ void RiaApplication::setWindowCaptionFromAppState()
mainWnd->setWindowTitle(capt); mainWnd->setWindowTitle(capt);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -315,7 +311,6 @@ void RiaApplication::processNonGuiEvents()
processEvents(QEventLoop::ExcludeUserInputEvents); processEvents(QEventLoop::ExcludeUserInputEvents);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -341,12 +336,12 @@ const char* RiaApplication::getVersionStringApp(bool includeCrtInfo)
return szBuf; 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 // First Close the current project
@@ -381,7 +376,8 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
{ {
closeProject(); 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); QMessageBox::warning(nullptr, "Error when opening project file", tmp);
RiuMainWindow* mainWnd = RiuMainWindow::instance(); RiuMainWindow* mainWnd = RiuMainWindow::instance();
@@ -423,7 +419,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
mainPlotWindow()->hide(); mainPlotWindow()->hide();
} }
/////// ///////
// Load the external data, and initialize stuff that needs specific ordering // Load the external data, and initialize stuff that needs specific ordering
@@ -448,16 +443,15 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
// Load the formation names // Load the formation names
for(RimOilField* oilField: m_project->oilFields) for (RimOilField* oilField : m_project->oilFields)
{ {
if (oilField == nullptr) continue; if (oilField == nullptr) continue;
if(oilField->formationNamesCollection() != nullptr) if (oilField->formationNamesCollection() != nullptr)
{ {
oilField->formationNamesCollection()->readAllFormationNames(); oilField->formationNamesCollection()->readAllFormationNames();
} }
} }
// Add well paths for each oil field // Add well paths for each oil field
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++) 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 == nullptr) continue;
if (oilField->wellPathCollection == nullptr) 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(); 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; if (oilField == nullptr) continue;
// Temporary // Temporary
if(!oilField->summaryCaseMainCollection()) if (!oilField->summaryCaseMainCollection())
{ {
oilField->summaryCaseMainCollection = new RimSummaryCaseMainCollection(); oilField->summaryCaseMainCollection = new RimSummaryCaseMainCollection();
} }
@@ -513,7 +507,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
fracture->loadDataAndUpdate(); fracture->loadDataAndUpdate();
} }
} }
} }
// If load action is specified to recalculate statistics, do it now. // If load action is specified to recalculate statistics, do it now.
@@ -531,8 +524,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
} }
} }
// Now load the ReservoirViews for the cases // Now load the ReservoirViews for the cases
// Add all "native" cases in the project // Add all "native" cases in the project
std::vector<RimCase*> casesToLoad; std::vector<RimCase*> casesToLoad;
@@ -551,7 +542,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
caf::ProgressInfo viewProgress(views.size(), "Creating Views"); caf::ProgressInfo viewProgress(views.size(), "Creating Views");
size_t j; size_t j;
for ( j = 0; j < views.size(); j++ ) for (j = 0; j < views.size(); j++)
{ {
Rim3dView* riv = views[j]; Rim3dView* riv = views[j];
CVF_ASSERT(riv); CVF_ASSERT(riv);
@@ -570,10 +561,10 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
riv->loadDataAndUpdate(); riv->loadDataAndUpdate();
if ( m_project->isProjectFileVersionEqualOrOlderThan("2018.1.1.110") ) if (m_project->isProjectFileVersionEqualOrOlderThan("2018.1.1.110"))
{ {
auto* geoView = dynamic_cast<RimGeoMechView*>(riv); auto* geoView = dynamic_cast<RimGeoMechView*>(riv);
if ( geoView ) if (geoView)
{ {
geoView->convertCameraPositionFromOldProjectFiles(); geoView->convertCameraPositionFromOldProjectFiles();
} }
@@ -598,7 +589,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
// Intersection Views: Sync from intersections in the case. // Intersection Views: Sync from intersections in the case.
for (RimCase* cas: casesToLoad) for (RimCase* cas : casesToLoad)
{ {
cas->intersectionViewCollection()->syncFromExistingIntersections(false); cas->intersectionViewCollection()->syncFromExistingIntersections(false);
} }
@@ -607,7 +598,7 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
for (RimOilField* oilField : m_project->oilFields) for (RimOilField* oilField : m_project->oilFields)
{ {
auto sumMainCollection = oilField->summaryCaseMainCollection(); auto sumMainCollection = oilField->summaryCaseMainCollection();
if(!sumMainCollection) continue; if (!sumMainCollection) continue;
for (auto sumCaseGroup : sumMainCollection->summaryCaseCollections()) for (auto sumCaseGroup : sumMainCollection->summaryCaseCollections())
{ {
@@ -803,7 +794,7 @@ void RiaApplication::addWellPathsToModel(QList<QString> wellPathFilePaths)
if (oilField->wellPathCollection == nullptr) if (oilField->wellPathCollection == nullptr)
{ {
//printf("Create well path collection.\n"); // printf("Create well path collection.\n");
oilField->wellPathCollection = new RimWellPathCollection(); oilField->wellPathCollection = new RimWellPathCollection();
m_project->updateConnectedEditors(); m_project->updateConnectedEditors();
@@ -863,7 +854,6 @@ void RiaApplication::addWellLogsToModel(const QList<QString>& wellLogFilePaths)
RiuMainWindow::instance()->selectAsCurrentItem(wellLogFile); RiuMainWindow::instance()->selectAsCurrentItem(wellLogFile);
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -881,13 +871,12 @@ bool RiaApplication::saveProject()
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RiaApplication::saveProjectPromptForFileName() bool RiaApplication::saveProjectPromptForFileName()
{ {
//if (m_project.isNull()) return true; // if (m_project.isNull()) return true;
RiaApplication* app = RiaApplication::instance(); RiaApplication* app = RiaApplication::instance();
@@ -902,7 +891,8 @@ bool RiaApplication::saveProjectPromptForFileName()
startPath += "/ResInsightProject.rsp"; 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()) if (fileName.isEmpty())
{ {
return false; return false;
@@ -980,7 +970,12 @@ bool RiaApplication::saveProjectAs(const QString& fileName)
if (!m_project->writeFile()) 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; return false;
} }
@@ -1110,7 +1105,8 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName, bool applyTime
geoMechCase->caseUserDescription = caseName; geoMechCase->caseUserDescription = caseName;
geoMechCase->setApplyTimeFilter(applyTimeStepFilter); 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 // Create the geoMech model container if it is not there already
if (geoMechModelCollection == nullptr) if (geoMechModelCollection == nullptr)
@@ -1132,7 +1128,7 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName, bool applyTime
} }
geoMechModelCollection->cases.push_back(geoMechCase); geoMechModelCollection->cases.push_back(geoMechCase);
//if (!riv->cellResult()->hasResult()) // if (!riv->cellResult()->hasResult())
//{ //{
// riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName()); // riv->cellResult()->setResultVariable(RiaDefines::undefinedResultName());
//} //}
@@ -1162,7 +1158,6 @@ void RiaApplication::createResultsMockModel()
RiaImportEclipseCaseTools::openMockModel(RiaDefines::mockModelBasicWithResults()); RiaImportEclipseCaseTools::openMockModel(RiaDefines::mockModelBasicWithResults());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1171,7 +1166,6 @@ void RiaApplication::createLargeResultsMockModel()
RiaImportEclipseCaseTools::openMockModel(RiaDefines::mockModelLargeWithResults()); RiaImportEclipseCaseTools::openMockModel(RiaDefines::mockModelLargeWithResults());
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1209,7 +1203,7 @@ Rim3dView* RiaApplication::activeReservoirView()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimGridView* RiaApplication::activeGridView() 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; RimViewWindow* viewWindow = nullptr;
if ( m_mainPlotWindow ) if (m_mainPlotWindow)
{ {
QList<QMdiSubWindow*> subwindows = m_mainPlotWindow->subWindowList(QMdiArea::StackingOrder); QList<QMdiSubWindow*> subwindows = m_mainPlotWindow->subWindowList(QMdiArea::StackingOrder);
if ( subwindows.size() > 0 ) if (subwindows.size() > 0)
{ {
viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget()); viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget(subwindows.back()->widget());
} }
@@ -1254,7 +1248,6 @@ bool RiaApplication::useShaders() const
return true; return true;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1263,7 +1256,6 @@ RiaApplication::RINavigationPolicy RiaApplication::navigationPolicy() const
return m_preferences->navigationPolicy(); return m_preferences->navigationPolicy();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1272,7 +1264,6 @@ bool RiaApplication::showPerformanceInfo() const
return m_preferences->showHud; return m_preferences->showHud;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1435,9 +1426,12 @@ RiuPlotMainWindow* RiaApplication::mainPlotWindow()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID) RiuMainWindowBase* RiaApplication::mainWindowByID(int mainWindowID)
{ {
if (mainWindowID == 0) return RiuMainWindow::instance(); if (mainWindowID == 0)
else if (mainWindowID == 1) return m_mainPlotWindow; return RiuMainWindow::instance();
else return nullptr; else if (mainWindowID == 1)
return m_mainPlotWindow;
else
return nullptr;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -1605,7 +1599,6 @@ void RiaApplication::saveWinGeoAndDockToolBarLayout()
{ {
RiuMainWindow::instance()->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 // 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. // user startup files that set the internal load path through one of the path functions.
QStringList arguments; QStringList arguments;
arguments.append("--path"); arguments.append("--path");
arguments << QApplication::applicationDirPath(); arguments << QApplication::applicationDirPath();
@@ -1702,10 +1694,8 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
return; return;
} }
executeCommandObjects(); executeCommandObjects();
// Exit code != 0 means we have an error // Exit code != 0 means we have an error
if (exitCode != 0) if (exitCode != 0)
{ {
@@ -1755,28 +1745,34 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
#ifdef WIN32 #ifdef WIN32
// Octave plugins compiled by ResInsight are dependent on Qt (currently Qt 32-bit only) // 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, // Some Octave installations for Windows have included Qt, and some don't. To make sure these plugins always can be
// the path to octave_plugin_dependencies is added to global path // executed, the path to octave_plugin_dependencies is added to global path
QString pathString = penv.value("PATH", ""); QString pathString = penv.value("PATH", "");
if (pathString == "") pathString = QApplication::applicationDirPath() + "\\octave_plugin_dependencies"; if (pathString == "")
else pathString = QApplication::applicationDirPath() + "\\octave_plugin_dependencies" + ";" + pathString; pathString = QApplication::applicationDirPath() + "\\octave_plugin_dependencies";
else
pathString = QApplication::applicationDirPath() + "\\octave_plugin_dependencies" + ";" + pathString;
penv.insert("PATH", pathString); penv.insert("PATH", pathString);
#else #else
// Set the LD_LIBRARY_PATH to make the octave plugins find the embedded Qt // Set the LD_LIBRARY_PATH to make the octave plugins find the embedded Qt
QString ldPath = penv.value("LD_LIBRARY_PATH", ""); QString ldPath = penv.value("LD_LIBRARY_PATH", "");
if (ldPath == "") ldPath = QApplication::applicationDirPath(); if (ldPath == "")
else ldPath = QApplication::applicationDirPath() + ":" + ldPath; ldPath = QApplication::applicationDirPath();
else
ldPath = QApplication::applicationDirPath() + ":" + ldPath;
penv.insert("LD_LIBRARY_PATH", ldPath); penv.insert("LD_LIBRARY_PATH", ldPath);
#endif #endif
m_workerProcess->setProcessEnvironment(penv); 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); RiuMainWindow::instance()->processMonitor()->startMonitorWorkProcess(m_workerProcess);
@@ -1789,7 +1785,8 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
RiuMainWindow::instance()->processMonitor()->stopMonitorWorkProcess(); 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; return false;
} }
@@ -1798,7 +1795,9 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
} }
else 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; return false;
} }
} }
@@ -1806,10 +1805,12 @@ 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(); 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; m_currentArguments = arguments;
@@ -1847,8 +1848,10 @@ void RiaApplication::applyPreferences()
if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView()) if (RiuMainWindow::instance() && RiuMainWindow::instance()->projectTreeView())
{ {
RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText()); RiuMainWindow::instance()->projectTreeView()->enableAppendOfClassNameToUiItemText(
if (mainPlotWindow()) mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText()); m_preferences->appendClassNameToUiText());
if (mainPlotWindow())
mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText(m_preferences->appendClassNameToUiText());
} }
RiaFontCache::FontSize fontSizeType = RiaFontCache::FONT_SIZE_16; RiaFontCache::FontSize fontSizeType = RiaFontCache::FONT_SIZE_16;
@@ -1987,7 +1990,6 @@ void RiaApplication::setLastUsedDialogDirectory(const QString& dialogName, const
m_fileDialogDefaultDirectories[dialogName] = directory; 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)) 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)) else if (fileName.contains(".grdecl", Qt::CaseInsensitive))
{ {
@@ -2015,7 +2017,7 @@ bool RiaApplication::openFile(const QString& fileName)
} }
else if (fileName.contains(".smspec", Qt::CaseInsensitive)) else if (fileName.contains(".smspec", Qt::CaseInsensitive))
{ {
loadingSucceded = RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(QStringList({ fileName })); loadingSucceded = RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(QStringList({fileName}));
if (loadingSucceded) if (loadingSucceded)
{ {
getOrCreateAndShowMainPlotWindow(); 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(); RiuMainWindow* mainWnd = RiuMainWindow::instance();
if (!mainWnd) return; if (!mainWnd) return;
@@ -2116,44 +2120,8 @@ void RiaApplication::showFormattedTextInMessageBox(const QString& text)
QString RiaApplication::commandLineParameterHelp() const QString RiaApplication::commandLineParameterHelp() const
{ {
return m_helpText; 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()) if (!m_commandQueue.empty())
{ {
std::list< RimCommandObject* >::iterator it = m_commandQueue.begin(); std::list<RimCommandObject*>::iterator it = m_commandQueue.begin();
RimCommandObject* first = *it; RimCommandObject* first = *it;
first->redo(); first->redo();