2012-05-18 09:45:23 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
//
|
2014-09-23 15:04:57 +02:00
|
|
|
// Copyright (C) 2011- Statoil ASA
|
|
|
|
|
// Copyright (C) 2013- Ceetron Solutions AS
|
|
|
|
|
// Copyright (C) 2011-2012 Ceetron AS
|
2012-05-18 09:45:23 +02:00
|
|
|
//
|
|
|
|
|
// ResInsight is free software: you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
// (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
//
|
|
|
|
|
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
|
// for more details.
|
|
|
|
|
//
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#pragma once
|
2013-05-06 10:55:00 +02:00
|
|
|
#include <QApplication>
|
2012-05-18 09:45:23 +02:00
|
|
|
#include <QProcess>
|
2013-09-13 09:23:33 +02:00
|
|
|
#include <QMutex>
|
|
|
|
|
|
2013-05-06 10:55:00 +02:00
|
|
|
#include "cafPdmObject.h"
|
|
|
|
|
#include "cafPdmField.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
#include "cvfBase.h"
|
|
|
|
|
#include "cvfObject.h"
|
2013-05-06 10:55:00 +02:00
|
|
|
#include "cvfFont.h"
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
class RIProcess;
|
2013-03-22 15:43:42 +01:00
|
|
|
class RigCaseData;
|
2015-05-15 08:40:27 +02:00
|
|
|
class RimEclipseCase;
|
2012-05-18 09:45:23 +02:00
|
|
|
class Drawable;
|
|
|
|
|
class RiaSocketServer;
|
2013-03-22 15:50:44 +01:00
|
|
|
class RiaPreferences;
|
2015-05-21 10:05:33 +02:00
|
|
|
class RimEclipseView;
|
2015-04-30 10:34:15 +02:00
|
|
|
class RimView;
|
2013-05-06 10:55:00 +02:00
|
|
|
class RimProject;
|
2013-09-12 08:11:56 +02:00
|
|
|
class RimCommandObject;
|
2013-12-04 12:04:42 +01:00
|
|
|
class RiaProjectModifier;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
namespace caf
|
|
|
|
|
{
|
|
|
|
|
class UiProcess;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
//==================================================================================================
|
2013-03-22 15:50:44 +01:00
|
|
|
class RiaApplication : public QApplication
|
2012-05-18 09:45:23 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum RINavigationPolicy
|
|
|
|
|
{
|
|
|
|
|
NAVIGATION_POLICY_CEETRON,
|
|
|
|
|
NAVIGATION_POLICY_CAD
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
public:
|
2013-03-22 15:50:44 +01:00
|
|
|
RiaApplication(int& argc, char** argv);
|
|
|
|
|
~RiaApplication();
|
|
|
|
|
static RiaApplication* instance();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
bool parseArguments();
|
|
|
|
|
|
2013-09-27 10:04:10 +02:00
|
|
|
void executeRegressionTests(const QString& regressionTestPath);
|
|
|
|
|
|
2015-05-08 14:13:26 +02:00
|
|
|
void setActiveReservoirView(RimView*);
|
|
|
|
|
RimView* activeReservoirView();
|
|
|
|
|
const RimView* activeReservoirView() const;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2015-04-30 10:34:15 +02:00
|
|
|
void scheduleDisplayModelUpdateAndRedraw(RimView* resViewToUpdate);
|
2013-09-07 10:27:22 +02:00
|
|
|
|
2013-05-06 10:55:00 +02:00
|
|
|
RimProject* project();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
void createMockModel();
|
|
|
|
|
void createResultsMockModel();
|
|
|
|
|
void createLargeResultsMockModel();
|
2013-10-28 10:32:24 +01:00
|
|
|
void createMockModelCustomized();
|
2012-06-26 16:10:41 +02:00
|
|
|
void createInputMockModel();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2012-10-23 09:59:57 +02:00
|
|
|
QString defaultFileDialogDirectory(const QString& dialogName);
|
|
|
|
|
void setDefaultFileDialogDirectory(const QString& dialogName, const QString& defaultDirectory);
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
bool openEclipseCaseFromFile(const QString& fileName);
|
2012-06-26 16:10:41 +02:00
|
|
|
bool openEclipseCase(const QString& caseName, const QString& caseFileName);
|
2013-02-27 15:27:33 +01:00
|
|
|
bool addEclipseCases(const QStringList& fileNames);
|
2013-10-08 14:28:01 +02:00
|
|
|
bool openInputEclipseCaseFromFileNames(const QStringList& fileNames);
|
2012-06-26 16:10:41 +02:00
|
|
|
|
2015-04-20 09:02:33 +02:00
|
|
|
bool openOdbCaseFromFile(const QString& fileName);
|
|
|
|
|
|
2012-06-26 16:10:41 +02:00
|
|
|
QString currentProjectFileName() const;
|
2013-12-04 12:04:42 +01:00
|
|
|
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
|
|
|
|
|
bool loadProject(const QString& projectFileName);
|
2012-05-18 09:45:23 +02:00
|
|
|
bool saveProject();
|
|
|
|
|
bool saveProjectAs(const QString& fileName);
|
|
|
|
|
bool saveProjectPromptForFileName();
|
|
|
|
|
bool closeProject(bool askToSaveIfDirty);
|
2013-05-16 14:10:22 +02:00
|
|
|
void addWellPathsToModel(QList<QString> wellPathFilePaths);
|
|
|
|
|
|
2013-02-06 11:43:26 +01:00
|
|
|
void copySnapshotToClipboard();
|
|
|
|
|
void saveSnapshotPromtpForFilename();
|
|
|
|
|
void saveSnapshotAs(const QString& fileName);
|
2013-02-08 17:04:35 +01:00
|
|
|
void saveSnapshotForAllViews(const QString& snapshotFolderName);
|
2013-12-04 12:04:42 +01:00
|
|
|
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
2013-02-08 17:04:35 +01:00
|
|
|
void runRegressionTest(const QString& testRootPath);
|
|
|
|
|
void updateRegressionTest(const QString& testRootPath );
|
2014-01-23 13:17:49 +01:00
|
|
|
void regressionTestConfigureProject();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
void processNonGuiEvents();
|
|
|
|
|
|
2013-12-04 12:04:42 +01:00
|
|
|
static const char* getVersionStringApp(bool includeCrtInfo);
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
void setUseShaders(bool enable);
|
|
|
|
|
bool useShaders() const;
|
|
|
|
|
|
|
|
|
|
void setShowPerformanceInfo(bool enable);
|
|
|
|
|
bool showPerformanceInfo() const;
|
|
|
|
|
|
|
|
|
|
RINavigationPolicy navigationPolicy() const;
|
2013-04-24 07:35:31 +02:00
|
|
|
QString scriptDirectories() const;
|
2012-05-18 09:45:23 +02:00
|
|
|
QString scriptEditorPath() const;
|
2014-07-22 12:11:48 +02:00
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
QString octavePath() const;
|
2014-07-22 12:11:48 +02:00
|
|
|
QStringList octaveArguments() const;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
bool launchProcess(const QString& program, const QStringList& arguments);
|
2013-05-27 15:38:03 +02:00
|
|
|
bool launchProcessForMultipleCases(const QString& program, const QStringList& arguments, const std::vector<int>& caseIds);
|
2012-08-31 19:12:47 +02:00
|
|
|
void terminateProcess();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2013-04-19 08:02:36 +02:00
|
|
|
RiaPreferences* preferences();
|
2014-07-31 10:05:16 +02:00
|
|
|
void readFieldsFromApplicationStore(caf::PdmObject* object, const QString context = "");
|
|
|
|
|
void writeFieldsToApplicationStore(const caf::PdmObject* object, const QString context = "");
|
2012-05-18 09:45:23 +02:00
|
|
|
void applyPreferences();
|
|
|
|
|
|
2013-04-19 08:02:36 +02:00
|
|
|
cvf::Font* standardFont();
|
|
|
|
|
|
2013-08-08 11:09:18 +02:00
|
|
|
QString commandLineParameterHelp() const;
|
|
|
|
|
void showFormattedTextInMessageBox(const QString& text);
|
|
|
|
|
|
2013-09-08 10:53:25 +02:00
|
|
|
void setCacheDataObject(const QString& key, const QVariant& dataObject);
|
|
|
|
|
QVariant cacheDataObject(const QString& key) const;
|
|
|
|
|
|
2013-09-12 08:11:56 +02:00
|
|
|
void addCommandObject(RimCommandObject* commandObject);
|
|
|
|
|
void executeCommandObjects();
|
|
|
|
|
|
2012-05-18 09:45:23 +02:00
|
|
|
private:
|
2013-12-04 12:04:42 +01:00
|
|
|
enum ProjectLoadAction
|
|
|
|
|
{
|
|
|
|
|
PLA_NONE = 0,
|
|
|
|
|
PLA_CALCULATE_STATISTICS = 1
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
|
|
|
|
|
void onProjectOpenedOrClosed();
|
|
|
|
|
std::vector<QString> readFileListFromTextFile(QString listFileName);
|
|
|
|
|
void setWindowCaptionFromAppState();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2013-12-04 12:04:42 +01:00
|
|
|
QImage grabFrameBufferImage();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
2013-02-08 17:04:35 +01:00
|
|
|
|
2013-09-07 10:27:22 +02:00
|
|
|
void slotUpdateScheduledDisplayModels();
|
2012-05-18 09:45:23 +02:00
|
|
|
|
|
|
|
|
private:
|
2015-05-08 14:13:26 +02:00
|
|
|
caf::PdmPointer<RimView> m_activeReservoirView;
|
2013-04-19 08:02:36 +02:00
|
|
|
caf::PdmPointer<RimProject> m_project;
|
|
|
|
|
|
2015-04-30 10:34:15 +02:00
|
|
|
std::vector<caf::PdmPointer<RimView> > m_resViewsToUpdate;
|
2013-09-07 10:27:22 +02:00
|
|
|
QTimer* m_resViewUpdateTimer;
|
|
|
|
|
|
2013-04-19 08:02:36 +02:00
|
|
|
RiaSocketServer* m_socketServer;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2013-04-19 08:02:36 +02:00
|
|
|
caf::UiProcess* m_workerProcess;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2013-05-27 15:38:03 +02:00
|
|
|
// Execute for all settings
|
|
|
|
|
std::list<int> m_currentCaseIds;
|
|
|
|
|
QString m_currentProgram;
|
|
|
|
|
QStringList m_currentArguments;
|
|
|
|
|
|
2013-04-19 08:02:36 +02:00
|
|
|
RiaPreferences* m_preferences;
|
2012-05-18 09:45:23 +02:00
|
|
|
|
2013-04-19 08:02:36 +02:00
|
|
|
std::map<QString, QString> m_fileDialogDefaultDirectories;
|
|
|
|
|
QString m_startupDefaultDirectory;
|
2012-10-23 09:59:57 +02:00
|
|
|
|
2013-04-19 08:02:36 +02:00
|
|
|
cvf::ref<cvf::Font> m_standardFont;
|
2013-09-08 10:53:25 +02:00
|
|
|
|
|
|
|
|
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
|
2013-09-12 08:11:56 +02:00
|
|
|
|
|
|
|
|
std::list<RimCommandObject*> m_commandQueue;
|
2013-09-13 09:23:33 +02:00
|
|
|
QMutex m_commandQueueLock;
|
2013-12-19 10:45:15 +01:00
|
|
|
|
|
|
|
|
QString m_helpText;
|
2012-05-18 09:45:23 +02:00
|
|
|
};
|