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
+59 -91
+59 -91
View File
@@ -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,7 +105,6 @@
#include <QProcessEnvironment>
#include <QTreeView>
#ifndef WIN32
#include <unistd.h> // for usleep
#endif // WIN32
@@ -125,10 +124,7 @@ void AppEnum< RiaApplication::RINavigationPolicy >::setUp()
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()
///
//==================================================================================================
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -154,7 +149,8 @@ bool RiaApplication::notify(QObject* receiver, QEvent* event)
allocatingMessageBox = true;
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;
@@ -165,7 +161,9 @@ bool RiaApplication::notify(QObject* receiver, QEvent* event)
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;
}
@@ -229,7 +227,6 @@ RiaApplication::RiaApplication(int& argc, char** argv)
m_recentFileActionProvider = std::unique_ptr<RiuRecentFileActionProvider>(new RiuRecentFileActionProvider);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -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
@@ -457,7 +452,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
}
}
// Add well paths for each oil field
for (size_t oilFieldIdx = 0; oilFieldIdx < m_project->oilFields().size(); oilFieldIdx++)
{
@@ -513,7 +507,6 @@ bool RiaApplication::loadProject(const QString& projectFileName, ProjectLoadActi
fracture->loadDataAndUpdate();
}
}
}
// 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
// Add all "native" cases in the project
std::vector<RimCase*> casesToLoad;
@@ -863,7 +854,6 @@ void RiaApplication::addWellLogsToModel(const QList<QString>& wellLogFilePaths)
RiuMainWindow::instance()->selectAsCurrentItem(wellLogFile);
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -881,7 +871,6 @@ bool RiaApplication::saveProject()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -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;
}
@@ -1110,7 +1105,8 @@ bool RiaApplication::openOdbCaseFromFile(const QString& fileName, bool applyTime
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)
@@ -1162,7 +1158,6 @@ void RiaApplication::createResultsMockModel()
RiaImportEclipseCaseTools::openMockModel(RiaDefines::mockModelBasicWithResults());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1171,7 +1166,6 @@ void RiaApplication::createLargeResultsMockModel()
RiaImportEclipseCaseTools::openMockModel(RiaDefines::mockModelLargeWithResults());
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -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;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -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;
}
//--------------------------------------------------------------------------------------------------
@@ -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();
@@ -1702,10 +1694,8 @@ void RiaApplication::slotWorkerProcessFinished(int exitCode, QProcess::ExitStatu
return;
}
executeCommandObjects();
// Exit code != 0 means we have an error
if (exitCode != 0)
{
@@ -1755,28 +1745,34 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
#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", "");
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);
#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);
@@ -1789,7 +1785,8 @@ bool RiaApplication::launchProcess(const QString& program, const QStringList& ar
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,7 +1805,9 @@ 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));
@@ -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;
@@ -1987,7 +1990,6 @@ void RiaApplication::setLastUsedDialogDirectory(const QString& dialogName, const
m_fileDialogDefaultDirectories[dialogName] = directory;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -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;
*/
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------