mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
First implementation of Headless (#4392)
* Revert "#4377 Octave : Use RiaLogging for error messages instead of QErrorMessage " This reverts commitf758a8edb2
. * Revert "#4380 Preferences : Changing scene font size when geo mech view is open causes crash" This reverts commitdf62a41397
. * Revert "#4379 Documentation : Update command line parser for import of summary files" This reverts commitd0b5357ed4
. * Unfinished WIP * Builds but crashes * Refactored code now builds and runs * ResInsight can now run the unittests headless * Can run some command files successfully * Build on Linux * Extra headless hack header * Moved PdmUiItem hack to cpp file * Fix headless crash in RimWellAllocationPlot * Handle error gracefully if ExportSnapshots command is executed from console * Add caf::QIconProvider and remove some hacks * Also made the greying out of disabled icons work for a couple of cases where it didn't. * Linux build fix * #4380 Reimplement fixdf62a41397
by @magnesj on top of Headless code changes * #4379 Reintroduce kode fromd0b5357ed4
by @magnesj * #4377 Restoref758a8edb2
in new Headless code
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaDefines.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFractureDefines.h
|
||||
@@ -17,6 +19,8 @@ ${CMAKE_CURRENT_LIST_DIR}/RiaEclipseFileNameTools.h
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaDefines.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaFractureDefines.cpp
|
||||
@@ -42,7 +46,8 @@ ${SOURCE_GROUP_SOURCE_FILES}
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h
|
||||
)
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,21 +16,21 @@
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
#include <QMutex>
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
#include "cvfFont.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include "RiaFontCache.h"
|
||||
#include <QApplication>
|
||||
#include <QMutex>
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
@@ -69,48 +69,44 @@ namespace caf
|
||||
class UiProcess;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaApplication : public QApplication
|
||||
namespace cvf
|
||||
{
|
||||
Q_OBJECT
|
||||
class ProgramOptions;
|
||||
}
|
||||
|
||||
//==================================================================================================
|
||||
/// Base class for all ResInsight applications. I.e. console and GUI
|
||||
///
|
||||
//==================================================================================================
|
||||
class RiaApplication
|
||||
{
|
||||
public:
|
||||
enum RINavigationPolicy
|
||||
{
|
||||
NAVIGATION_POLICY_CEETRON,
|
||||
NAVIGATION_POLICY_CAD,
|
||||
NAVIGATION_POLICY_GEOQUEST,
|
||||
NAVIGATION_POLICY_RMS
|
||||
};
|
||||
|
||||
enum ProjectLoadAction
|
||||
{
|
||||
PLA_NONE = 0,
|
||||
PLA_CALCULATE_STATISTICS = 1
|
||||
};
|
||||
|
||||
typedef RiaFontCache::FontSize FontSize;
|
||||
enum ApplicationStatus
|
||||
{
|
||||
KEEP_GOING = 0,
|
||||
EXIT_COMPLETED,
|
||||
EXIT_WITH_ERROR
|
||||
};
|
||||
|
||||
public:
|
||||
RiaApplication(int& argc, char** argv);
|
||||
~RiaApplication() override;
|
||||
|
||||
static RiaApplication* instance();
|
||||
RiaApplication();
|
||||
virtual ~RiaApplication();
|
||||
|
||||
int parseArgumentsAndRunUnitTestsIfRequested();
|
||||
bool parseArguments();
|
||||
static const char* getVersionStringApp(bool includeCrtInfo);
|
||||
static bool enableDevelopmentFeatures();
|
||||
|
||||
void setActiveReservoirView(Rim3dView*);
|
||||
Rim3dView* activeReservoirView();
|
||||
const Rim3dView* activeReservoirView() const;
|
||||
RimGridView* activeGridView();
|
||||
|
||||
RimViewWindow* activePlotWindow() const;
|
||||
|
||||
RimProject* project();
|
||||
|
||||
void createMockModel();
|
||||
@@ -119,42 +115,27 @@ public:
|
||||
void createMockModelCustomized();
|
||||
void createInputMockModel();
|
||||
|
||||
QString lastUsedDialogDirectory(const QString& dialogName);
|
||||
QString lastUsedDialogDirectoryWithFallbackToProjectFolder(const QString& dialogName);
|
||||
QString lastUsedDialogDirectoryWithFallback(const QString& dialogName, const QString& fallbackDirectory);
|
||||
void setLastUsedDialogDirectory(const QString& dialogName, const QString& directory);
|
||||
|
||||
bool openFile(const QString& fileName);
|
||||
|
||||
bool openOdbCaseFromFile(const QString& fileName, bool applyTimeStepFilter = false);
|
||||
|
||||
QString currentProjectPath() const;
|
||||
QString createAbsolutePathFromProjectRelativePath(QString projectRelativePath);
|
||||
bool loadProject(const QString& projectFileName);
|
||||
bool loadProject(const QString& projectFileName, ProjectLoadAction loadAction, RiaProjectModifier* projectModifier);
|
||||
bool saveProject();
|
||||
bool saveProjectAs(const QString& fileName);
|
||||
bool saveProjectPromptForFileName();
|
||||
bool saveProjectAs(const QString& fileName, QString* errorMessage);
|
||||
static bool hasValidProjectFileExtension(const QString& fileName);
|
||||
|
||||
bool askUserToSaveModifiedProject();
|
||||
void closeProject();
|
||||
|
||||
QString lastUsedDialogDirectory(const QString& dialogName);
|
||||
QString lastUsedDialogDirectoryWithFallbackToProjectFolder(const QString& dialogName);
|
||||
QString lastUsedDialogDirectoryWithFallback(const QString& dialogName, const QString& fallbackDirectory);
|
||||
void setLastUsedDialogDirectory(const QString& dialogName, const QString& directory);
|
||||
|
||||
bool openOdbCaseFromFile(const QString& fileName, bool applyTimeStepFilter = false);
|
||||
|
||||
void addWellPathsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellPathFormationsToModel(QList<QString> wellPathFilePaths);
|
||||
void addWellLogsToModel(const QList<QString>& wellLogFilePaths);
|
||||
|
||||
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
||||
|
||||
void processNonGuiEvents();
|
||||
|
||||
static const char* getVersionStringApp(bool includeCrtInfo);
|
||||
|
||||
bool useShaders() const;
|
||||
|
||||
bool showPerformanceInfo() const;
|
||||
|
||||
RINavigationPolicy navigationPolicy() const;
|
||||
QString scriptDirectories() const;
|
||||
QString scriptEditorPath() const;
|
||||
|
||||
@@ -169,80 +150,58 @@ public:
|
||||
RiaPreferences* preferences();
|
||||
void applyPreferences(const RiaPreferences* oldPreferences = nullptr);
|
||||
|
||||
cvf::Font* defaultSceneFont();
|
||||
cvf::Font* defaultAnnotationFont();
|
||||
cvf::Font* defaultWellLabelFont();
|
||||
|
||||
QString commandLineParameterHelp() const;
|
||||
void showFormattedTextInMessageBox(const QString& text);
|
||||
static QString commandLineParameterHelp();
|
||||
|
||||
void setCacheDataObject(const QString& key, const QVariant& dataObject);
|
||||
QVariant cacheDataObject(const QString& key) const;
|
||||
|
||||
void executeCommandFile(const QString& commandFile);
|
||||
void addCommandObject(RimCommandObject* commandObject);
|
||||
void executeCommandObjects();
|
||||
void waitUntilCommandObjectsHasBeenProcessed();
|
||||
|
||||
int launchUnitTests();
|
||||
int launchUnitTestsWithConsole();
|
||||
|
||||
RiuMainWindow* getOrCreateAndShowMainWindow();
|
||||
RiuMainWindow* mainWindow();
|
||||
|
||||
RiuPlotMainWindow* getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow();
|
||||
RiuMainWindowBase* mainWindowByID(int mainWindowID);
|
||||
|
||||
static RimViewWindow* activeViewWindow();
|
||||
|
||||
bool isMain3dWindowVisible() const;
|
||||
bool isMainPlotWindowVisible() const;
|
||||
|
||||
void closeMainWindowIfOpenButHidden();
|
||||
void closeMainPlotWindowIfOpenButHidden();
|
||||
|
||||
void addToRecentFiles(const QString& fileName);
|
||||
std::vector<QAction*> recentFileActions() const;
|
||||
|
||||
const QString startDir() const;
|
||||
void setStartDir(const QString& startDir);
|
||||
|
||||
static std::vector<QString> readFileListFromTextFile(QString listFileName);
|
||||
|
||||
void waitUntilCommandObjectsHasBeenProcessed();
|
||||
void saveMainWinGeoAndDockToolBarLayout();
|
||||
void savePlotWinGeoAndDockToolBarLayout();
|
||||
cvf::Font* defaultSceneFont();
|
||||
cvf::Font* defaultAnnotationFont();
|
||||
cvf::Font* defaultWellLabelFont();
|
||||
|
||||
static bool enableDevelopmentFeatures();
|
||||
static void clearAllSelections();
|
||||
// Public implementation specific overrides
|
||||
virtual void initialize();
|
||||
virtual ApplicationStatus handleArguments(cvf::ProgramOptions* progOpt) = 0;
|
||||
virtual int launchUnitTestsWithConsole();
|
||||
virtual void addToRecentFiles(const QString& fileName) {}
|
||||
virtual void showInformationMessage(const QString& infoText) = 0;
|
||||
virtual void showErrorMessage(const QString& errMsg) = 0;
|
||||
virtual void cleanupBeforeProgramExit() {}
|
||||
|
||||
private:
|
||||
void onProjectOpenedOrClosed();
|
||||
void setWindowCaptionFromAppState();
|
||||
protected:
|
||||
// Protected implementation specific overrides
|
||||
virtual void handleEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) = 0;
|
||||
virtual void onChangedActiveReservoirView() {}
|
||||
virtual void onFileSuccessfullyLoaded(const QString& fileName, RiaDefines::ImportFileType fileType) {}
|
||||
virtual void onProjectBeingOpened() {}
|
||||
virtual void onProjectOpened() = 0;
|
||||
virtual void onProjectOpeningError(const QString& errMsg) = 0;
|
||||
virtual void onProjectBeingClosed() {}
|
||||
virtual void onProjectClosed() = 0;
|
||||
virtual void startMonitoringWorkProgress(caf::UiProcess* uiProcess) {}
|
||||
virtual void stopMonitoringWorkProgress() {}
|
||||
|
||||
void createMainWindow();
|
||||
void deleteMainWindow();
|
||||
protected:
|
||||
cvf::ref<cvf::Font> m_defaultSceneFont;
|
||||
cvf::ref<cvf::Font> m_defaultAnnotationFont;
|
||||
cvf::ref<cvf::Font> m_defaultWellLabelFont;
|
||||
|
||||
void createMainPlotWindow();
|
||||
void deleteMainPlotWindow();
|
||||
|
||||
void loadAndUpdatePlotData();
|
||||
|
||||
void storeTreeViewState();
|
||||
|
||||
friend RiaArgumentParser;
|
||||
void setHelpText(const QString& helpText);
|
||||
|
||||
bool notify(QObject *, QEvent *) override;
|
||||
|
||||
private slots:
|
||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
caf::PdmPointer<Rim3dView> m_activeReservoirView;
|
||||
caf::PdmPointer<RimProject> m_project;
|
||||
|
||||
RiaSocketServer* m_socketServer;
|
||||
|
||||
caf::UiProcess* m_workerProcess;
|
||||
|
||||
// Execute for all settings
|
||||
@@ -255,21 +214,16 @@ private:
|
||||
std::map<QString, QString> m_fileDialogDefaultDirectories;
|
||||
QString m_startupDefaultDirectory;
|
||||
|
||||
cvf::ref<cvf::Font> m_defaultSceneFont;
|
||||
cvf::ref<cvf::Font> m_defaultAnnotationFont;
|
||||
cvf::ref<cvf::Font> m_defaultWellLabelFont;
|
||||
|
||||
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
|
||||
|
||||
std::list<RimCommandObject*> m_commandQueue;
|
||||
QMutex m_commandQueueLock;
|
||||
|
||||
QString m_helpText;
|
||||
|
||||
bool m_runningWorkerProcess;
|
||||
|
||||
RiuMainWindow* m_mainWindow;
|
||||
RiuPlotMainWindow* m_mainPlotWindow;
|
||||
|
||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||
private:
|
||||
static RiaApplication* s_riaApplication;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
366
ApplicationCode/Application/RiaConsoleApplication.cpp
Normal file
366
ApplicationCode/Application/RiaConsoleApplication.cpp
Normal file
@@ -0,0 +1,366 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RiaConsoleApplication.h"
|
||||
|
||||
#include "RiaArgumentParser.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
#include "RiaSocketServer.h"
|
||||
|
||||
#include "RicImportGeneralDataFeature.h"
|
||||
|
||||
#include "cvfProgramOptions.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaConsoleApplication* RiaConsoleApplication::instance()
|
||||
{
|
||||
RiaConsoleApplication* currentConsoleApp = dynamic_cast<RiaConsoleApplication*>(RiaApplication::instance());
|
||||
CAF_ASSERT(currentConsoleApp && "Should never be called from a method that isn't within the Console context");
|
||||
return currentConsoleApp;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaConsoleApplication::RiaConsoleApplication(int& argc, char** argv)
|
||||
: QCoreApplication(argc, argv)
|
||||
, RiaApplication()
|
||||
{
|
||||
installEventFilter(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaConsoleApplication::~RiaConsoleApplication()
|
||||
{
|
||||
RiaLogging::deleteLoggerInstance();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::initialize()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
#pragma warning(disable : 4996) // Temporarily disables warning 4996.
|
||||
if (AttachConsole(ATTACH_PARENT_PROCESS) || AllocConsole())
|
||||
{
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
}
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
RiaApplication::initialize();
|
||||
|
||||
RiaLogging::setLoggerInstance(new RiaStdOutLogger);
|
||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||
|
||||
m_socketServer = new RiaSocketServer(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments(cvf::ProgramOptions* progOpt)
|
||||
{
|
||||
CVF_ASSERT(progOpt);
|
||||
|
||||
// Handling of the actual command line options
|
||||
// --------------------------------------------------------
|
||||
if (cvf::Option o = progOpt->option("ignoreArgs"))
|
||||
{
|
||||
return KEEP_GOING;
|
||||
}
|
||||
|
||||
// Unit testing
|
||||
// --------------------------------------------------------
|
||||
if (cvf::Option o = progOpt->option("unittest"))
|
||||
{
|
||||
int testReturnValue = launchUnitTestsWithConsole();
|
||||
|
||||
return testReturnValue == 0 ? RiaApplication::EXIT_COMPLETED : RiaApplication::EXIT_WITH_ERROR;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("startdir"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
setStartDir(cvfqt::Utils::toQString(o.value(0)));
|
||||
}
|
||||
|
||||
QString projectFileName;
|
||||
|
||||
if (progOpt->hasOption("last"))
|
||||
{
|
||||
projectFileName = preferences()->lastUsedProjectFileName;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("project"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
projectFileName = cvfqt::Utils::toQString(o.value(0));
|
||||
}
|
||||
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
cvf::ref<RiaProjectModifier> projectModifier;
|
||||
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::PLA_NONE;
|
||||
|
||||
if (cvf::Option o = progOpt->option("replaceCase"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplaceCaseFirstOccurrence(gridFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !gridFileName.isEmpty())
|
||||
{
|
||||
projectModifier->setReplaceCase(caseId, gridFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("replaceSourceCases"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
std::vector<QString> gridFileNames = readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0)));
|
||||
projectModifier->setReplaceSourceCasesFirstOccurrence(gridFileNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int groupId = o.safeValue(optionIdx++).toInt(-1);
|
||||
std::vector<QString> gridFileNames =
|
||||
readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(optionIdx++)));
|
||||
|
||||
if (groupId != -1 && !gridFileNames.empty())
|
||||
{
|
||||
projectModifier->setReplaceSourceCasesById(groupId, gridFileNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectLoadAction = RiaApplication::PLA_CALCULATE_STATISTICS;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("replacePropertiesFolder"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplacePropertiesFolderFirstOccurrence(propertiesFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !propertiesFolder.isEmpty())
|
||||
{
|
||||
projectModifier->setReplacePropertiesFolder(caseId, propertiesFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadProject(projectFileName, projectLoadAction, projectModifier.p());
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("case"))
|
||||
{
|
||||
QStringList caseNames = cvfqt::Utils::toQStringList(o.values());
|
||||
RicImportGeneralDataFeature::OpenCaseResults results =
|
||||
RicImportGeneralDataFeature::openEclipseFilesFromFileNames(caseNames);
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt->option("commandFile"))
|
||||
{
|
||||
QString commandFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
if (!progOpt->hasOption("startdir"))
|
||||
{
|
||||
QFileInfo commandFileInfo(commandFile);
|
||||
QString commandDir = commandFileInfo.absolutePath();
|
||||
setStartDir(commandDir);
|
||||
}
|
||||
|
||||
cvf::Option projectOption = progOpt->option("commandFileProject");
|
||||
cvf::Option caseOption = progOpt->option("commandFileReplaceCases");
|
||||
if (projectOption && caseOption)
|
||||
{
|
||||
projectFileName = cvfqt::Utils::toQString(projectOption.value(0));
|
||||
|
||||
std::vector<int> caseIds;
|
||||
std::vector<QString> caseListFiles;
|
||||
|
||||
if (caseOption.valueCount() == 1)
|
||||
{
|
||||
caseListFiles.push_back(cvfqt::Utils::toQString(caseOption.safeValue(0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < caseOption.valueCount())
|
||||
{
|
||||
const int caseId = caseOption.safeValue(optionIdx++).toInt(-1);
|
||||
QString caseListFile = cvfqt::Utils::toQString(caseOption.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !caseListFile.isEmpty())
|
||||
{
|
||||
caseIds.push_back(caseId);
|
||||
caseListFiles.push_back(caseListFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caseIds.empty() && !caseListFiles.empty())
|
||||
{
|
||||
QString caseListFile = caseListFiles[0];
|
||||
std::vector<QString> caseFiles = readFileListFromTextFile(caseListFile);
|
||||
for (const QString& caseFile : caseFiles)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
projectModifier.setReplaceCaseFirstOccurrence(caseFile);
|
||||
loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(caseIds.size() == caseListFiles.size());
|
||||
|
||||
std::vector<std::vector<QString>> allCaseFiles;
|
||||
size_t maxFiles = 0;
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
std::vector<QString> caseFiles = readFileListFromTextFile(caseListFiles[i]);
|
||||
allCaseFiles.push_back(caseFiles);
|
||||
maxFiles = std::max(caseFiles.size(), maxFiles);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
for (size_t j = 0; j < maxFiles; ++j)
|
||||
{
|
||||
if (allCaseFiles[i].size() > j)
|
||||
{
|
||||
projectModifier.setReplaceCase(caseIds[i], allCaseFiles[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
return EXIT_COMPLETED;
|
||||
}
|
||||
|
||||
return KEEP_GOING;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::showInformationMessage(const QString& text)
|
||||
{
|
||||
RiaLogging::info(text);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::showErrorMessage(const QString& errMsg)
|
||||
{
|
||||
RiaLogging::error(errMsg);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::handleEvents(QEventLoop::ProcessEventsFlags flags /*= QEventLoop::AllEvents*/)
|
||||
{
|
||||
processEvents(flags);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::onProjectOpeningError(const QString& errMsg)
|
||||
{
|
||||
showErrorMessage(errMsg);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::onProjectOpened()
|
||||
{
|
||||
processEvents();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaConsoleApplication::onProjectClosed()
|
||||
{
|
||||
processEvents();
|
||||
}
|
||||
|
52
ApplicationCode/Application/RiaConsoleApplication.h
Normal file
52
ApplicationCode/Application/RiaConsoleApplication.h
Normal file
@@ -0,0 +1,52 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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
|
||||
|
||||
#include "RiaApplication.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ProgramOptions;
|
||||
}
|
||||
|
||||
class RiaConsoleApplication : public QCoreApplication, public RiaApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static RiaConsoleApplication* instance();
|
||||
|
||||
RiaConsoleApplication(int& argc, char** argv);
|
||||
~RiaConsoleApplication() override;
|
||||
|
||||
// Public RiaApplication overrides
|
||||
void initialize() override;
|
||||
ApplicationStatus handleArguments(cvf::ProgramOptions* progOpt) override;
|
||||
void showInformationMessage(const QString& text) override;
|
||||
void showErrorMessage(const QString& errMsg) override;
|
||||
|
||||
protected:
|
||||
// Protected implementation specific overrides
|
||||
void handleEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) override;
|
||||
void onProjectOpeningError(const QString& errMsg) override;
|
||||
void onProjectOpened();
|
||||
void onProjectClosed();
|
||||
};
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafFixedAtlasFont.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
@@ -25,7 +26,6 @@
|
||||
|
||||
namespace caf
|
||||
{
|
||||
class FixedAtlasFont;
|
||||
template<typename T> class AppEnum;
|
||||
}
|
||||
|
||||
|
1708
ApplicationCode/Application/RiaGuiApplication.cpp
Normal file
1708
ApplicationCode/Application/RiaGuiApplication.cpp
Normal file
File diff suppressed because it is too large
Load Diff
174
ApplicationCode/Application/RiaGuiApplication.h
Normal file
174
ApplicationCode/Application/RiaGuiApplication.h
Normal file
@@ -0,0 +1,174 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2019- Equinor ASA
|
||||
//
|
||||
// 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
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cvfBase.h"
|
||||
#include "cvfObject.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QMutex>
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
class QAction;
|
||||
|
||||
class Drawable;
|
||||
|
||||
class RIProcess;
|
||||
|
||||
class RiaPreferences;
|
||||
class RiaProjectModifier;
|
||||
class RiaSocketServer;
|
||||
|
||||
class RigEclipseCaseData;
|
||||
|
||||
class RimCommandObject;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimGridView;
|
||||
class RimProject;
|
||||
class RimSummaryPlot;
|
||||
class Rim3dView;
|
||||
class RimViewWindow;
|
||||
class RimWellLogPlot;
|
||||
class RimWellAllocationPlot;
|
||||
|
||||
class RiuMainWindow;
|
||||
class RiuMainWindowBase;
|
||||
class RiuMdiMaximizeWindowGuard;
|
||||
class RiuPlotMainWindow;
|
||||
class RiuRecentFileActionProvider;
|
||||
class RiaArgumentParser;
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
class RiaGuiApplication : public QApplication, public RiaApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum RINavigationPolicy
|
||||
{
|
||||
NAVIGATION_POLICY_CEETRON,
|
||||
NAVIGATION_POLICY_CAD,
|
||||
NAVIGATION_POLICY_GEOQUEST,
|
||||
NAVIGATION_POLICY_RMS
|
||||
};
|
||||
|
||||
public:
|
||||
static bool isRunning();
|
||||
static RiaGuiApplication* instance();
|
||||
|
||||
RiaGuiApplication(int& argc, char** argv);
|
||||
~RiaGuiApplication() override;
|
||||
|
||||
bool saveProject();
|
||||
bool saveProjectPromptForFileName();
|
||||
bool askUserToSaveModifiedProject();
|
||||
bool saveProjectAs(const QString& fileName);
|
||||
|
||||
void runMultiCaseSnapshots(const QString& templateProjectFileName, std::vector<QString> gridFileNames, const QString& snapshotFolderName);
|
||||
bool useShaders() const;
|
||||
bool showPerformanceInfo() const;
|
||||
|
||||
RINavigationPolicy navigationPolicy() const;
|
||||
|
||||
RiuMainWindow* getOrCreateAndShowMainWindow();
|
||||
RiuMainWindow* mainWindow();
|
||||
RimViewWindow* activePlotWindow() const;
|
||||
|
||||
RiuPlotMainWindow* getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow();
|
||||
RiuMainWindowBase* mainWindowByID(int mainWindowID);
|
||||
|
||||
static RimViewWindow* activeViewWindow();
|
||||
|
||||
bool isMain3dWindowVisible() const;
|
||||
bool isMainPlotWindowVisible() const;
|
||||
|
||||
void closeMainWindowIfOpenButHidden();
|
||||
void closeMainPlotWindowIfOpenButHidden();
|
||||
|
||||
std::vector<QAction*> recentFileActions() const;
|
||||
|
||||
void saveMainWinGeoAndDockToolBarLayout();
|
||||
void savePlotWinGeoAndDockToolBarLayout();
|
||||
|
||||
static void clearAllSelections();
|
||||
void applyGuiPreferences(const RiaPreferences* oldPreferences = nullptr);
|
||||
|
||||
// Public RiaApplication overrides
|
||||
void initialize() override;
|
||||
ApplicationStatus handleArguments(cvf::ProgramOptions* progOpt) override;
|
||||
int launchUnitTestsWithConsole() override;
|
||||
void addToRecentFiles(const QString& fileName) override;
|
||||
void showInformationMessage(const QString& text) override;
|
||||
void showErrorMessage(const QString& errMsg) override;
|
||||
void cleanupBeforeProgramExit() override;
|
||||
protected:
|
||||
// Protected RiaApplication overrides
|
||||
void handleEvents(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents) override;
|
||||
void onChangedActiveReservoirView() override;
|
||||
void onFileSuccessfullyLoaded(const QString& fileName, RiaDefines::ImportFileType fileType) override;
|
||||
void onProjectBeingOpened() override;
|
||||
void onProjectOpeningError(const QString& errMsg);
|
||||
void onProjectOpened() override;
|
||||
void onProjectBeingClosed() override;
|
||||
void onProjectClosed() override;
|
||||
void startMonitoringWorkProgress(caf::UiProcess* uiProcess) override;
|
||||
void stopMonitoringWorkProgress() override;
|
||||
|
||||
private:
|
||||
void setWindowCaptionFromAppState();
|
||||
|
||||
void createMainWindow();
|
||||
void deleteMainWindow();
|
||||
|
||||
void createMainPlotWindow();
|
||||
void deleteMainPlotWindow();
|
||||
|
||||
void loadAndUpdatePlotData();
|
||||
|
||||
void storeTreeViewState();
|
||||
|
||||
bool notify(QObject *, QEvent *) override;
|
||||
|
||||
private slots:
|
||||
void slotWorkerProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
private:
|
||||
RiuMainWindow* m_mainWindow;
|
||||
RiuPlotMainWindow* m_mainPlotWindow;
|
||||
|
||||
std::unique_ptr<RiuRecentFileActionProvider> m_recentFileActionProvider;
|
||||
|
||||
std::unique_ptr<RiuMdiMaximizeWindowGuard> m_maximizeWindowGuard;
|
||||
};
|
@@ -16,30 +16,62 @@
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaArgumentParser.h"
|
||||
#include "RiaConsoleApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "cvfProgramOptions.h"
|
||||
#include "cvfqtUtils.h"
|
||||
|
||||
RiaApplication* createApplication(int &argc, char *argv[])
|
||||
{
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (!qstrcmp(argv[i], "--console") || !qstrcmp(argv[i], "--unittest"))
|
||||
{
|
||||
return new RiaConsoleApplication(argc, argv);
|
||||
}
|
||||
}
|
||||
return new RiaGuiApplication(argc, argv);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
RiaLogging::loggerInstance()->setLevel(RI_LL_DEBUG);
|
||||
|
||||
RiaApplication app(argc, argv);
|
||||
std::unique_ptr<RiaApplication> app (createApplication(argc, argv));
|
||||
app->initialize();
|
||||
|
||||
cvf::ProgramOptions progOpt;
|
||||
|
||||
bool result = RiaArgumentParser::parseArguments(&progOpt);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
const cvf::String usageText = progOpt.usageText(110, 30);
|
||||
app->showInformationMessage(RiaApplication::commandLineParameterHelp() + cvfqt::Utils::toQString(usageText));
|
||||
app->cleanupBeforeProgramExit();
|
||||
}
|
||||
|
||||
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
|
||||
setlocale(LC_NUMERIC,"C");
|
||||
|
||||
int unitTestResult = app.parseArgumentsAndRunUnitTestsIfRequested();
|
||||
if (unitTestResult > -1)
|
||||
RiaApplication::ApplicationStatus status = app->handleArguments(&progOpt);
|
||||
if (status == RiaApplication::EXIT_COMPLETED)
|
||||
{
|
||||
return unitTestResult;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (app.parseArguments())
|
||||
else if (status == RiaApplication::EXIT_WITH_ERROR)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if (status == RiaApplication::KEEP_GOING)
|
||||
{
|
||||
int exitCode = 0;
|
||||
try
|
||||
{
|
||||
exitCode = app.exec();
|
||||
exitCode = QCoreApplication::instance()->exec();
|
||||
}
|
||||
catch (std::exception& exep )
|
||||
{
|
||||
@@ -55,6 +87,7 @@ int main(int argc, char *argv[])
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
return 0;
|
||||
CVF_ASSERT(false && "Unknown ApplicationStatus");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@@ -223,13 +223,13 @@ QList<caf::PdmOptionItemInfo> RiaMemoryCleanup::calculateValueOptions(const caf:
|
||||
std::vector<RimEclipseCase*> eclipseCases = proj->eclipseCases();
|
||||
for (RimEclipseCase* c : eclipseCases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider()));
|
||||
}
|
||||
|
||||
std::vector<RimGeoMechCase*> geoMechCases = proj->geoMechCases();
|
||||
for (RimGeoMechCase* c : geoMechCases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ CAF_PDM_SOURCE_INIT(RiaPreferences, "RiaPreferences");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaPreferences::RiaPreferences(void)
|
||||
{
|
||||
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaApplication::RINavigationPolicy>(RiaApplication::NAVIGATION_POLICY_RMS), "Navigation Mode", "", "", "");
|
||||
CAF_PDM_InitField(&navigationPolicy, "navigationPolicy", caf::AppEnum<RiaGuiApplication::RINavigationPolicy>(RiaGuiApplication::NAVIGATION_POLICY_RMS), "Navigation Mode", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "");
|
||||
scriptDirectories.uiCapability()->setUiEditorTypeName(caf::PdmUiFilePathEditor::uiEditorTypeName());
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaFontCache.h"
|
||||
|
||||
@@ -65,7 +66,7 @@ public:
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
|
||||
|
||||
public: // Pdm Fields
|
||||
caf::PdmField<caf::AppEnum< RiaApplication::RINavigationPolicy > > navigationPolicy;
|
||||
caf::PdmField<caf::AppEnum< RiaGuiApplication::RINavigationPolicy > > navigationPolicy;
|
||||
|
||||
caf::PdmField<QString> scriptDirectories;
|
||||
caf::PdmField<QString> scriptEditorExecutable;
|
||||
|
@@ -17,7 +17,6 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaArgumentParser.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaBaseDefs.h"
|
||||
#include "RiaEclipseFileNameTools.h"
|
||||
@@ -50,489 +49,77 @@
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaArgumentParser::parseArguments()
|
||||
bool RiaArgumentParser::parseArguments(cvf::ProgramOptions* progOpt)
|
||||
{
|
||||
cvf::ProgramOptions progOpt;
|
||||
progOpt.registerOption("last", "", "Open last used project.");
|
||||
progOpt.registerOption("project", "<filename>", "Open project file <filename>.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("case",
|
||||
CVF_ASSERT(progOpt);
|
||||
progOpt->registerOption("console", "", "Run as a console application without Graphics");
|
||||
progOpt->registerOption("last", "", "Open last used project.");
|
||||
progOpt->registerOption("project", "<filename>", "Open project file <filename>.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("case",
|
||||
"<case name without extension or filename>",
|
||||
"If case or grid filename, import simulation grid data. If summary file name, import summary data",
|
||||
cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption("startdir", "<folder>", "Set startup directory.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("savesnapshots",
|
||||
progOpt->registerOption("startdir", "<folder>", "Set startup directory.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("savesnapshots",
|
||||
"all|views|plots",
|
||||
"Save snapshot of all views or plots to project file location sub folder 'snapshots'. Option 'all' "
|
||||
"will include both views and plots. Application closes after snapshots have been written.",
|
||||
cvf::ProgramOptions::OPTIONAL_MULTI_VALUE);
|
||||
progOpt.registerOption(
|
||||
progOpt->registerOption(
|
||||
"size", "<width> <height>", "Set size of the main application window.", cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption(
|
||||
progOpt->registerOption(
|
||||
"replaceCase",
|
||||
"[<caseId>] <newGridFile>",
|
||||
"Replace grid in <caseId> or first case with <newgridFile>. Repeat parameter for multiple replace operations.",
|
||||
cvf::ProgramOptions::MULTI_VALUE,
|
||||
cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt.registerOption("replaceSourceCases",
|
||||
progOpt->registerOption("replaceSourceCases",
|
||||
"[<caseGroupId>] <gridListFile>",
|
||||
"Replace source cases in <caseGroupId> or first grid case group with the grid files listed in the "
|
||||
"<gridListFile> file. Repeat parameter for multiple replace operations.",
|
||||
cvf::ProgramOptions::MULTI_VALUE,
|
||||
cvf::ProgramOptions::COMBINE_REPEATED);
|
||||
progOpt.registerOption("replacePropertiesFolder",
|
||||
progOpt->registerOption("replacePropertiesFolder",
|
||||
"[<caseId>] <newPropertiesFolder>",
|
||||
"Replace the folder containing property files for an eclipse input case.",
|
||||
cvf::ProgramOptions::MULTI_VALUE);
|
||||
progOpt.registerOption("multiCaseSnapshots",
|
||||
progOpt->registerOption("multiCaseSnapshots",
|
||||
"<gridListFile>",
|
||||
"For each grid file listed in the <gridListFile> file, replace the first case in the project and save "
|
||||
"snapshot of all views.",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("commandFile", "<commandfile>", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption(
|
||||
progOpt->registerOption("commandFile", "<commandfile>", "Execute the command file.", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption(
|
||||
"commandFileProject",
|
||||
"<filename>",
|
||||
"Project to use if performing case looping for command file. Used in conjunction with 'commandFileReplaceCases'.",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("commandFileReplaceCases",
|
||||
progOpt->registerOption("commandFileReplaceCases",
|
||||
"[<caseId>] <caseListFile>",
|
||||
"Supply list of cases to replace in project, performing command file for each case.",
|
||||
cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("help", "", "Displays help text.");
|
||||
progOpt.registerOption("?", "", "Displays help text.");
|
||||
progOpt.registerOption("regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt.registerOption("unittest", "", "System command");
|
||||
progOpt.registerOption("ignoreArgs", "", "Ignore all arguments. Mostly for testing purposes");
|
||||
progOpt->registerOption("help", "", "Displays help text.");
|
||||
progOpt->registerOption("?", "", "Displays help text.");
|
||||
progOpt->registerOption("regressiontest", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("updateregressiontestbase", "<folder>", "System command", cvf::ProgramOptions::SINGLE_VALUE);
|
||||
progOpt->registerOption("unittest", "", "System command");
|
||||
progOpt->registerOption("ignoreArgs", "", "Ignore all arguments. Mostly for testing purposes");
|
||||
|
||||
progOpt.setOptionPrefix(cvf::ProgramOptions::DOUBLE_DASH);
|
||||
|
||||
QString helpText = QString("\n%1 v. %2\n").arg(RI_APPLICATION_NAME).arg(RiaApplication::getVersionStringApp(false));
|
||||
helpText += "Copyright Equinor ASA, Ceetron Solution AS, Ceetron AS\n\n";
|
||||
|
||||
const cvf::String usageText = progOpt.usageText(110, 30);
|
||||
helpText += cvfqt::Utils::toQString(usageText);
|
||||
|
||||
RiaApplication::instance()->setHelpText(helpText);
|
||||
progOpt->setOptionPrefix(cvf::ProgramOptions::DOUBLE_DASH);
|
||||
|
||||
QStringList arguments = QCoreApplication::arguments();
|
||||
|
||||
bool parseOk = progOpt.parse(cvfqt::Utils::toStringVector(arguments));
|
||||
bool parseOk = progOpt->parse(cvfqt::Utils::toStringVector(arguments));
|
||||
|
||||
// If positional parameter functionality is to be supported, the test for existence of positionalParameters must be removed
|
||||
// This is based on a pull request by @andlaus https://github.com/OPM/ResInsight/pull/162
|
||||
if (!parseOk || progOpt.hasOption("help") || progOpt.hasOption("?") || !progOpt.positionalParameters().empty())
|
||||
if (!parseOk || progOpt->hasOption("help") || progOpt->hasOption("?") || !progOpt->positionalParameters().empty())
|
||||
{
|
||||
#if defined(_MSC_VER) && defined(_WIN32)
|
||||
RiaApplication::instance()->showFormattedTextInMessageBox(helpText);
|
||||
#else
|
||||
fprintf(stdout, "%s\n", helpText.toLatin1().data());
|
||||
fflush(stdout);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
// Handling of the actual command line options
|
||||
// --------------------------------------------------------
|
||||
|
||||
if (cvf::Option o = progOpt.option("ignoreArgs"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("regressiontest"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
QString regressionTestPath = cvfqt::Utils::toQString(o.value(0));
|
||||
|
||||
// Use a logger writing to stdout instead of message panel
|
||||
// This is useful when executing regression tests on a build server, and this is the reason for creating the logger when
|
||||
// parsing the command line options
|
||||
auto stdLogger = new RiaStdOutLogger;
|
||||
stdLogger->setLevel(RI_LL_DEBUG);
|
||||
|
||||
RiaLogging::setLoggerInstance(stdLogger);
|
||||
|
||||
RiaRegressionTestRunner::instance()->executeRegressionTests(regressionTestPath, QStringList());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("updateregressiontestbase"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
QString regressionTestPath = cvfqt::Utils::toQString(o.value(0));
|
||||
RiaRegressionTestRunner::instance()->updateRegressionTest(regressionTestPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("startdir"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
RiaApplication::instance()->setStartDir(cvfqt::Utils::toQString(o.value(0)));
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("size"))
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
int width = o.safeValue(0).toInt(-1);
|
||||
int height = o.safeValue(1).toInt(-1);
|
||||
if (mainWnd && width > 0 && height > 0)
|
||||
{
|
||||
mainWnd->resize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
QString projectFileName;
|
||||
|
||||
if (progOpt.hasOption("last"))
|
||||
{
|
||||
projectFileName = RiaApplication::instance()->preferences()->lastUsedProjectFileName;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("project"))
|
||||
{
|
||||
CVF_ASSERT(o.valueCount() == 1);
|
||||
projectFileName = cvfqt::Utils::toQString(o.value(0));
|
||||
}
|
||||
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
if (cvf::Option o = progOpt.option("multiCaseSnapshots"))
|
||||
{
|
||||
QString gridListFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
std::vector<QString> gridFiles = RiaApplication::readFileListFromTextFile(gridListFile);
|
||||
RiaApplication::instance()->runMultiCaseSnapshots(projectFileName, gridFiles, "multiCaseSnapshots");
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!projectFileName.isEmpty())
|
||||
{
|
||||
cvf::ref<RiaProjectModifier> projectModifier;
|
||||
RiaApplication::ProjectLoadAction projectLoadAction = RiaApplication::PLA_NONE;
|
||||
|
||||
if (cvf::Option o = progOpt.option("replaceCase"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplaceCaseFirstOccurrence(gridFileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString gridFileName = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !gridFileName.isEmpty())
|
||||
{
|
||||
projectModifier->setReplaceCase(caseId, gridFileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("replaceSourceCases"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
// One argument is available, use replace case for first occurrence in the project
|
||||
|
||||
std::vector<QString> gridFileNames =
|
||||
RiaApplication::readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(0)));
|
||||
projectModifier->setReplaceSourceCasesFirstOccurrence(gridFileNames);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int groupId = o.safeValue(optionIdx++).toInt(-1);
|
||||
std::vector<QString> gridFileNames =
|
||||
RiaApplication::readFileListFromTextFile(cvfqt::Utils::toQString(o.safeValue(optionIdx++)));
|
||||
|
||||
if (groupId != -1 && !gridFileNames.empty())
|
||||
{
|
||||
projectModifier->setReplaceSourceCasesById(groupId, gridFileNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
projectLoadAction = RiaApplication::PLA_CALCULATE_STATISTICS;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("replacePropertiesFolder"))
|
||||
{
|
||||
if (projectModifier.isNull()) projectModifier = new RiaProjectModifier;
|
||||
|
||||
if (o.valueCount() == 1)
|
||||
{
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
projectModifier->setReplacePropertiesFolderFirstOccurrence(propertiesFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < o.valueCount())
|
||||
{
|
||||
const int caseId = o.safeValue(optionIdx++).toInt(-1);
|
||||
QString propertiesFolder = cvfqt::Utils::toQString(o.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !propertiesFolder.isEmpty())
|
||||
{
|
||||
projectModifier->setReplacePropertiesFolder(caseId, propertiesFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(projectFileName, projectLoadAction, projectModifier.p());
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("case"))
|
||||
{
|
||||
QStringList caseNames = cvfqt::Utils::toQStringList(o.values());
|
||||
for (const QString& caseName : caseNames)
|
||||
{
|
||||
openCaseFromCommandLineParameter(caseName);
|
||||
}
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("savesnapshots"))
|
||||
{
|
||||
bool snapshotViews = false;
|
||||
bool snapshotPlots = false;
|
||||
|
||||
QStringList snapshotItemTexts = cvfqt::Utils::toQStringList(o.values());
|
||||
if (snapshotItemTexts.empty())
|
||||
{
|
||||
// No options will keep backwards compatibility before we introduced snapshot of plots
|
||||
snapshotViews = true;
|
||||
}
|
||||
|
||||
for (const QString& s : snapshotItemTexts)
|
||||
{
|
||||
if (s.toLower() == "all")
|
||||
{
|
||||
snapshotViews = true;
|
||||
snapshotPlots = true;
|
||||
}
|
||||
else if (s.toLower() == "views")
|
||||
{
|
||||
snapshotViews = true;
|
||||
}
|
||||
else if (s.toLower() == "plots")
|
||||
{
|
||||
snapshotPlots = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (RiaApplication::instance()->project() != nullptr && !RiaApplication::instance()->project()->fileName().isEmpty())
|
||||
{
|
||||
if (snapshotViews)
|
||||
{
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
CVF_ASSERT(mainWnd);
|
||||
mainWnd->hideAllDockWindows();
|
||||
|
||||
// 2016-11-09 : Location of snapshot folder was previously located in 'snapshot' folder
|
||||
// relative to current working folder. Now harmonized to behave as RiuMainWindow::slotSnapshotAllViewsToFile()
|
||||
QString absolutePathToSnapshotDir =
|
||||
RiaApplication::instance()->createAbsolutePathFromProjectRelativePath("snapshots");
|
||||
RicSnapshotAllViewsToFileFeature::exportSnapshotOfAllViewsIntoFolder(absolutePathToSnapshotDir);
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
|
||||
if (snapshotPlots)
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
RiaApplication::instance()->mainPlotWindow()->hideAllDockWindows();
|
||||
|
||||
// Will be saved relative to current directory
|
||||
RicSnapshotAllPlotsToFileFeature::saveAllPlots();
|
||||
|
||||
RiaApplication::instance()->mainPlotWindow()->loadWinGeoAndDockToolBarLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returning false will exit the application
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cvf::Option o = progOpt.option("commandFile"))
|
||||
{
|
||||
QString commandFile = cvfqt::Utils::toQString(o.safeValue(0));
|
||||
|
||||
cvf::Option projectOption = progOpt.option("commandFileProject");
|
||||
cvf::Option caseOption = progOpt.option("commandFileReplaceCases");
|
||||
if (projectOption && caseOption)
|
||||
{
|
||||
projectFileName = cvfqt::Utils::toQString(projectOption.value(0));
|
||||
|
||||
std::vector<int> caseIds;
|
||||
std::vector<QString> caseListFiles;
|
||||
|
||||
if (caseOption.valueCount() == 1)
|
||||
{
|
||||
caseListFiles.push_back(cvfqt::Utils::toQString(caseOption.safeValue(0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t optionIdx = 0;
|
||||
while (optionIdx < caseOption.valueCount())
|
||||
{
|
||||
const int caseId = caseOption.safeValue(optionIdx++).toInt(-1);
|
||||
QString caseListFile = cvfqt::Utils::toQString(caseOption.safeValue(optionIdx++));
|
||||
|
||||
if (caseId != -1 && !caseListFile.isEmpty())
|
||||
{
|
||||
caseIds.push_back(caseId);
|
||||
caseListFiles.push_back(caseListFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (caseIds.empty() && !caseListFiles.empty())
|
||||
{
|
||||
QString caseListFile = caseListFiles[0];
|
||||
std::vector<QString> caseFiles = RiaApplication::readFileListFromTextFile(caseListFile);
|
||||
for (const QString& caseFile : caseFiles)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
projectModifier.setReplaceCaseFirstOccurrence(caseFile);
|
||||
RiaApplication::instance()->loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CVF_ASSERT(caseIds.size() == caseListFiles.size());
|
||||
|
||||
std::vector<std::vector<QString>> allCaseFiles;
|
||||
size_t maxFiles = 0;
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
std::vector<QString> caseFiles = RiaApplication::readFileListFromTextFile(caseListFiles[i]);
|
||||
allCaseFiles.push_back(caseFiles);
|
||||
maxFiles = std::max(caseFiles.size(), maxFiles);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < caseIds.size(); ++i)
|
||||
{
|
||||
RiaProjectModifier projectModifier;
|
||||
for (size_t j = 0; j < maxFiles; ++j)
|
||||
{
|
||||
if (allCaseFiles[i].size() > j)
|
||||
{
|
||||
projectModifier.setReplaceCase(caseIds[i], allCaseFiles[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
RiaApplication::instance()->loadProject(projectFileName, RiaApplication::PLA_NONE, &projectModifier);
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
executeCommandFile(commandFile);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaArgumentParser::executeCommandFile(const QString& commandFile)
|
||||
{
|
||||
QFile file(commandFile);
|
||||
RicfMessages messages;
|
||||
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
{
|
||||
// TODO : Error logging?
|
||||
return;
|
||||
}
|
||||
|
||||
QTextStream in(&file);
|
||||
RicfCommandFileExecutor::instance()->executeCommands(in);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaArgumentParser::openCaseFromCommandLineParameter(const QString& parameter)
|
||||
{
|
||||
if (RiaEclipseFileNameTools::isProjectFile(parameter))
|
||||
{
|
||||
return RiaApplication::instance()->loadProject(parameter);
|
||||
}
|
||||
|
||||
QStringList gridFileNames;
|
||||
QStringList summarySpecFileNames;
|
||||
|
||||
if (RiaEclipseFileNameTools::isGridFile(parameter))
|
||||
{
|
||||
QFileInfo fi(parameter);
|
||||
|
||||
gridFileNames.push_back(fi.absoluteFilePath());
|
||||
}
|
||||
else if (RiaEclipseFileNameTools::isSummarySpecFile(parameter))
|
||||
{
|
||||
QFileInfo fi(parameter);
|
||||
|
||||
summarySpecFileNames.push_back(fi.absoluteFilePath());
|
||||
}
|
||||
else
|
||||
{
|
||||
RiaEclipseFileNameTools fileNameTools(parameter);
|
||||
|
||||
{
|
||||
QString gridFileName = fileNameTools.findRelatedGridFile();
|
||||
if (!gridFileName.isEmpty())
|
||||
{
|
||||
gridFileNames.push_back(gridFileName);
|
||||
}
|
||||
}
|
||||
|
||||
QString summarySpecFileName = fileNameTools.findRelatedSummarySpecFile();
|
||||
if (!summarySpecFileName.isEmpty())
|
||||
{
|
||||
summarySpecFileNames.push_back(summarySpecFileName);
|
||||
}
|
||||
}
|
||||
|
||||
bool openCaseResult = true;
|
||||
|
||||
// Open summary cases first. Then, the open of grid file will not open an already open summary case file
|
||||
if (!summarySpecFileNames.empty())
|
||||
{
|
||||
openCaseResult &= RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(summarySpecFileNames);
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
}
|
||||
|
||||
for (const auto& f : gridFileNames)
|
||||
{
|
||||
openCaseResult &= RiaImportEclipseCaseTools::openEclipseCasesFromFile(QStringList({f}), nullptr, true);
|
||||
}
|
||||
|
||||
return openCaseResult;
|
||||
}
|
||||
|
@@ -20,6 +20,10 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace cvf
|
||||
{
|
||||
class ProgramOptions;
|
||||
}
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
@@ -28,10 +32,6 @@
|
||||
class RiaArgumentParser
|
||||
{
|
||||
public:
|
||||
static bool parseArguments();
|
||||
|
||||
private:
|
||||
static void executeCommandFile(const QString& commandFile);
|
||||
static bool openCaseFromCommandLineParameter(const QString& parameter);
|
||||
static bool parseArguments(cvf::ProgramOptions* progOpt);
|
||||
};
|
||||
|
||||
|
@@ -43,7 +43,7 @@ void RiaOptionItemFactory::appendOptionItemFromViewNameAndCaseName(Rim3dView* vi
|
||||
|
||||
QString displayName = caseName + " : " + view->name();
|
||||
|
||||
QIcon icon = view->uiCapability()->uiIcon();
|
||||
caf::QIconProvider iconProvider = view->uiCapability()->uiIconProvider();
|
||||
|
||||
optionItems->push_back(caf::PdmOptionItemInfo(displayName, view, false, icon));
|
||||
optionItems->push_back(caf::PdmOptionItemInfo(displayName, view, false, iconProvider));
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RiaRegressionTestRunner.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaGitDiff.h"
|
||||
#include "RiaImageCompareReporter.h"
|
||||
#include "RiaImageFileCompare.h"
|
||||
@@ -504,7 +504,7 @@ void RiaRegressionTestRunner::resizeMaximizedPlotWindows()
|
||||
RimProject* proj = RiaApplication::instance()->project();
|
||||
if (!proj) return;
|
||||
|
||||
RiuPlotMainWindow* plotMainWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if (!plotMainWindow) return;
|
||||
|
||||
std::vector<RimViewWindow*> viewWindows;
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "GridCrossPlotCommands/RicCreateSaturationPressurePlotsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimEclipseResultCase.h"
|
||||
@@ -79,5 +79,5 @@ void RicfCreateSaturationPressurePlots::execute()
|
||||
|
||||
RimSaturationPressurePlotCollection* collection = project->mainPlotCollection()->saturationPressurePlotCollection();
|
||||
collection->updateAllRequiredEditors();
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
}
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "RicfCommandFileExecutor.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaProjectModifier.h"
|
||||
|
||||
@@ -39,6 +39,12 @@ RicfExportMultiCaseSnapshots::RicfExportMultiCaseSnapshots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportMultiCaseSnapshots::execute()
|
||||
{
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
if (!app)
|
||||
{
|
||||
RiaLogging::error("exportMultiCaseSnapshots: Requires GUI Application");
|
||||
return;
|
||||
}
|
||||
if (m_gridListFile().isNull())
|
||||
{
|
||||
RiaLogging::error("exportMultiCaseSnapshots: Required parameter gridListFile.");
|
||||
@@ -53,5 +59,5 @@ void RicfExportMultiCaseSnapshots::execute()
|
||||
}
|
||||
|
||||
std::vector<QString> listFileNames = RiaApplication::readFileListFromTextFile(m_gridListFile());
|
||||
RiaApplication::instance()->runMultiCaseSnapshots(lastProjectPath, listFileNames, RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS));
|
||||
app->runMultiCaseSnapshots(lastProjectPath, listFileNames, RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS));
|
||||
}
|
||||
|
@@ -23,7 +23,8 @@
|
||||
#include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotAllViewsToFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@@ -57,10 +58,16 @@ RicfExportSnapshots::RicfExportSnapshots()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfExportSnapshots::execute()
|
||||
{
|
||||
if (!RiaGuiApplication::isRunning())
|
||||
{
|
||||
RiaLogging::error(QString("RicfExportSnapshot: Command cannot run without a GUI"));
|
||||
return;
|
||||
}
|
||||
|
||||
RiuMainWindow* mainWnd = RiuMainWindow::instance();
|
||||
CVF_ASSERT(mainWnd);
|
||||
mainWnd->hideAllDockWindows();
|
||||
RiaApplication::instance()->processEvents();
|
||||
RiaGuiApplication::instance()->processEvents();
|
||||
|
||||
QString absolutePathToSnapshotDir = RicfCommandFileExecutor::instance()->getExportPath(RicfCommandFileExecutor::SNAPSHOTS);
|
||||
if (absolutePathToSnapshotDir.isNull())
|
||||
@@ -77,5 +84,5 @@ void RicfExportSnapshots::execute()
|
||||
}
|
||||
|
||||
mainWnd->loadWinGeoAndDockToolBarLayout();
|
||||
RiaApplication::instance()->processEvents();
|
||||
RiaGuiApplication::instance()->processEvents();
|
||||
}
|
||||
|
@@ -24,6 +24,9 @@
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaRegressionTestRunner.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
CAF_PDM_SOURCE_INIT(RicfOpenProject, "openProject");
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -39,7 +42,14 @@ RicfOpenProject::RicfOpenProject()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicfOpenProject::execute()
|
||||
{
|
||||
bool ok = RiaApplication::instance()->loadProject(m_path);
|
||||
QString projectPath = m_path;
|
||||
QFileInfo projectPathInfo(projectPath);
|
||||
if (!projectPathInfo.exists())
|
||||
{
|
||||
QDir startDir(RiaApplication::instance()->startDir());
|
||||
projectPath = startDir.absoluteFilePath(m_path);
|
||||
}
|
||||
bool ok = RiaApplication::instance()->loadProject(projectPath);
|
||||
if (!ok)
|
||||
{
|
||||
RiaLogging::error(QString("openProject: Unable to open project at %1").arg(m_path()));
|
||||
@@ -51,5 +61,5 @@ void RicfOpenProject::execute()
|
||||
RiaRegressionTestRunner::regressionTestConfigureProject();
|
||||
}
|
||||
|
||||
RicfCommandFileExecutor::instance()->setLastProjectPath(m_path);
|
||||
RicfCommandFileExecutor::instance()->setLastProjectPath(projectPath);
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicCloseProjectFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@@ -39,9 +39,8 @@ void RicCloseProjectFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
if (!app->askUserToSaveModifiedProject()) return;
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
if (!app || !app->askUserToSaveModifiedProject()) return;
|
||||
|
||||
app->closeProject();
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicEditPreferencesFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RiuPropertyViewTabWidget.h"
|
||||
@@ -44,7 +44,7 @@ void RicEditPreferencesFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
QStringList tabNames = app->preferences()->tabNames();
|
||||
|
||||
@@ -57,6 +57,7 @@ void RicEditPreferencesFeature::onActionTriggered(bool isChecked)
|
||||
// Write preferences using QSettings and apply them to the application
|
||||
caf::PdmSettings::writeFieldsToApplicationStore(app->preferences());
|
||||
app->applyPreferences(oldPreferences.get());
|
||||
app->applyGuiPreferences(oldPreferences.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicExitApplicationFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
@@ -41,7 +41,7 @@ void RicExitApplicationFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
if (!app->askUserToSaveModifiedProject()) return;
|
||||
|
||||
// Hide all windows first to make sure they get closed properly
|
||||
|
@@ -147,7 +147,7 @@ void RicHelpCommandLineFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString text = app->commandLineParameterHelp();
|
||||
app->showFormattedTextInMessageBox(text);
|
||||
app->showInformationMessage(text);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -40,7 +40,7 @@ bool RicOpenLastUsedFileFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicOpenLastUsedFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
if (!app->askUserToSaveModifiedProject()) return;
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicOpenProjectFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
|
||||
@@ -41,7 +41,7 @@ bool RicOpenProjectFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicOpenProjectFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
if (!app->askUserToSaveModifiedProject()) return;
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "RicSaveProjectFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
|
||||
#include <QAction>
|
||||
@@ -42,11 +42,14 @@ void RicSaveProjectAsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
if (app)
|
||||
{
|
||||
app->saveProjectPromptForFileName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicSaveProjectFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@@ -39,7 +39,7 @@ void RicSaveProjectFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
app->saveProject();
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicShowPlotDataFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotCurve.h"
|
||||
@@ -211,7 +211,7 @@ void RicShowPlotDataFeature::onActionTriggered(bool isChecked)
|
||||
return;
|
||||
}
|
||||
|
||||
RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
CVF_ASSERT(plotwindow);
|
||||
|
||||
for (RimSummaryPlot* summaryPlot : selectedSummaryPlots)
|
||||
@@ -248,7 +248,7 @@ void RicShowPlotDataFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowPlotDataFeature::showTabbedTextWindow(RiuTabbedTextProvider* textProvider)
|
||||
{
|
||||
RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
CVF_ASSERT(plotwindow);
|
||||
|
||||
RiuTabbedTextDialog* textWidget = new RiuTabbedTextDialog(textProvider);
|
||||
@@ -263,7 +263,7 @@ void RicShowPlotDataFeature::showTabbedTextWindow(RiuTabbedTextProvider* textPro
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicShowPlotDataFeature::showTextWindow(const QString& title, const QString& text)
|
||||
{
|
||||
RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
CVF_ASSERT(plotwindow);
|
||||
|
||||
RiuTextDialog* textWiget = new RiuTextDialog();
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicShowPlotWindowFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include <QAction>
|
||||
|
||||
@@ -39,7 +39,7 @@ void RicShowPlotWindowFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -19,12 +19,12 @@
|
||||
|
||||
#include "RicTileWindowsFeature.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QApplication>
|
||||
#include "RiaApplication.h"
|
||||
|
||||
CAF_CMD_SOURCE_INIT(RicTileWindowsFeature, "RicTileWindowsFeature");
|
||||
|
||||
@@ -80,9 +80,9 @@ void RicTileWindowsFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTileWindowsFeature::isCommandChecked()
|
||||
{
|
||||
if (RiaApplication::instance()->mainWindow())
|
||||
if (RiaGuiApplication::instance()->mainWindow())
|
||||
{
|
||||
return RiaApplication::instance()->mainWindow()->subWindowsAreTiled();
|
||||
return RiaGuiApplication::instance()->mainWindow()->subWindowsAreTiled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -94,7 +94,7 @@ CAF_CMD_SOURCE_INIT(RicTilePlotWindowsFeature, "RicTilePlotWindowsFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTilePlotWindowsFeature::isCommandEnabled()
|
||||
{
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if (mainPlotWindow)
|
||||
{
|
||||
return mainPlotWindow->isAnyMdiSubWindowVisible();
|
||||
@@ -108,7 +108,7 @@ bool RicTilePlotWindowsFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicTilePlotWindowsFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if (mainPlotWindow)
|
||||
{
|
||||
if (!mainPlotWindow->subWindowsAreTiled())
|
||||
@@ -137,9 +137,9 @@ void RicTilePlotWindowsFeature::setupActionLook(QAction* actionToSetup)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicTilePlotWindowsFeature::isCommandChecked()
|
||||
{
|
||||
if (RiaApplication::instance()->mainPlotWindow())
|
||||
if (RiaGuiApplication::instance()->mainPlotWindow())
|
||||
{
|
||||
return RiaApplication::instance()->mainPlotWindow()->subWindowsAreTiled();
|
||||
return RiaGuiApplication::instance()->mainPlotWindow()->subWindowsAreTiled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicSnapshotAllPlotsToFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
@@ -48,7 +48,7 @@ CAF_CMD_SOURCE_INIT(RicSnapshotAllPlotsToFileFeature, "RicSnapshotAllPlotsToFile
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSnapshotAllPlotsToFileFeature::saveAllPlots()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = app->mainPlotWindow();
|
||||
if (!mainPlotWindow) return;
|
||||
@@ -119,9 +119,9 @@ bool RicSnapshotAllPlotsToFileFeature::isCommandEnabled()
|
||||
void RicSnapshotAllPlotsToFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
QWidget* currentActiveWidget = nullptr;
|
||||
if (RiaApplication::activeViewWindow())
|
||||
if (RiaGuiApplication::activeViewWindow())
|
||||
{
|
||||
currentActiveWidget = RiaApplication::activeViewWindow()->viewWidget();
|
||||
currentActiveWidget = RiaGuiApplication::activeViewWindow()->viewWidget();
|
||||
}
|
||||
|
||||
RicSnapshotAllPlotsToFileFeature::saveAllPlots();
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicSnapshotAllViewsToFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaViewRedrawScheduler.h"
|
||||
|
||||
@@ -151,9 +151,9 @@ bool RicSnapshotAllViewsToFileFeature::isCommandEnabled()
|
||||
void RicSnapshotAllViewsToFileFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
QWidget* currentActiveWidget = nullptr;
|
||||
if (RiaApplication::activeViewWindow())
|
||||
if (RiaGuiApplication::activeViewWindow())
|
||||
{
|
||||
currentActiveWidget = RiaApplication::activeViewWindow()->viewWidget();
|
||||
currentActiveWidget = RiaGuiApplication::activeViewWindow()->viewWidget();
|
||||
}
|
||||
|
||||
RicSnapshotAllViewsToFileFeature::saveAllViews();
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "RicSnapshotViewToClipboardFeature.h"
|
||||
#include "RicGridStatisticsDialog.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
@@ -82,7 +82,7 @@ void RicSnapshotViewToClipboardFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
RimViewWindow* viewWindow = RiaApplication::activeViewWindow();
|
||||
RimViewWindow* viewWindow = RiaGuiApplication::activeViewWindow();
|
||||
|
||||
if (viewWindow)
|
||||
{
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicSnapshotViewToFileFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
@@ -135,7 +135,7 @@ void RicSnapshotViewToFileFeature::onActionTriggered(bool isChecked)
|
||||
// If this is done after the file save dialog is displayed (and closed)
|
||||
// app->activeViewWindow() returns nullptr on Linux
|
||||
|
||||
RimViewWindow* viewWindow = RiaApplication::activeViewWindow();
|
||||
RimViewWindow* viewWindow = RiaGuiApplication::activeViewWindow();
|
||||
if (!viewWindow)
|
||||
{
|
||||
RiaLogging::error("No view window is available, nothing to do");
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicPlotProductionRateFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RifEclipseSummaryAddress.h"
|
||||
@@ -184,7 +184,7 @@ void RicPlotProductionRateFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
if (summaryPlotToSelect)
|
||||
{
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
if (mainPlotWindow)
|
||||
{
|
||||
mainPlotWindow->selectAsCurrentItem(summaryPlotToSelect);
|
||||
|
@@ -104,10 +104,10 @@ QList<caf::PdmOptionItemInfo> RicSelectViewUI::calculateValueOptions(const caf::
|
||||
{
|
||||
for (Rim3dView* v : m_currentCase->views())
|
||||
{
|
||||
QIcon icon = v->uiCapability()->uiIcon();
|
||||
caf::QIconProvider iconProvider = v->uiCapability()->uiIconProvider();
|
||||
QString displayName = v->name();
|
||||
|
||||
options.push_back(caf::PdmOptionItemInfo(displayName, v, false, icon));
|
||||
options.push_back(caf::PdmOptionItemInfo(displayName, v, false, iconProvider));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicShowContributingWellsFromPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RicShowContributingWellsFeatureImpl.h"
|
||||
|
||||
@@ -36,7 +36,7 @@ CAF_CMD_SOURCE_INIT(RicShowContributingWellsFromPlotFeature, "RicShowContributin
|
||||
bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot =
|
||||
dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
|
||||
dynamic_cast<RimWellAllocationPlot*>(RiaGuiApplication::instance()->activePlotWindow());
|
||||
|
||||
if (wellAllocationPlot) return true;
|
||||
|
||||
@@ -49,7 +49,7 @@ bool RicShowContributingWellsFromPlotFeature::isCommandEnabled()
|
||||
void RicShowContributingWellsFromPlotFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimWellAllocationPlot* wellAllocationPlot =
|
||||
dynamic_cast<RimWellAllocationPlot*>(RiaApplication::instance()->activePlotWindow());
|
||||
dynamic_cast<RimWellAllocationPlot*>(RiaGuiApplication::instance()->activePlotWindow());
|
||||
|
||||
if (!wellAllocationPlot) return;
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicCreateGridCrossPlotDataSetFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
@@ -49,7 +49,7 @@ void RicCreateGridCrossPlotDataSetFeature::onActionTriggered(bool isChecked)
|
||||
RimGridCrossPlotDataSet* dataSet = crossPlot->createDataSet();
|
||||
dataSet->loadDataAndUpdate(true);
|
||||
|
||||
RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(dataSet);
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#include "RicCreateGridCrossPlotFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
@@ -71,7 +71,7 @@ void RicCreateGridCrossPlotFeature::onActionTriggered(bool isChecked)
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
collection->updateAllRequiredEditors();
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(dataSet);
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "RicCreateSaturationPressurePlotsFeature.h"
|
||||
#include "RicSaturationPressureUi.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPorosityModel.h"
|
||||
|
||||
@@ -147,7 +147,7 @@ void RicCreateSaturationPressurePlotsFeature::onActionTriggered(bool isChecked)
|
||||
RicSaturationPressureUi saturationPressureUi;
|
||||
saturationPressureUi.setSelectedCase(eclipseCases[0]);
|
||||
|
||||
RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
|
||||
caf::PdmUiPropertyViewDialog propertyDialog(
|
||||
plotwindow, &saturationPressureUi, "Select Case to create Pressure Saturation plots", "");
|
||||
@@ -182,7 +182,7 @@ void RicCreateSaturationPressurePlotsFeature::onActionTriggered(bool isChecked)
|
||||
}
|
||||
|
||||
collection->updateAllRequiredEditors();
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
|
||||
if (objectToSelect)
|
||||
{
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicPasteGridCrossPlotDataSetFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RimGridCrossPlot.h"
|
||||
#include "RimGridCrossPlotDataSet.h"
|
||||
#include "RiuPlotMainWindowTools.h"
|
||||
@@ -70,7 +70,7 @@ void RicPasteGridCrossPlotDataSetFeature::onActionTriggered(bool isChecked)
|
||||
}
|
||||
|
||||
|
||||
RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
crossPlot->updateAllRequiredEditors();
|
||||
crossPlot->loadDataAndUpdate();
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicToggleMeasurementModeFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimMeasurement.h"
|
||||
@@ -110,7 +110,10 @@ bool RicToggleMeasurementModeFeature::isCommandChecked()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimMeasurement* RicToggleMeasurementModeFeature::measurement() const
|
||||
{
|
||||
return RiaApplication::instance()->project()->measurement();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
CAF_ASSERT(app && app->project());
|
||||
|
||||
return app->project()->measurement();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -118,7 +121,9 @@ RimMeasurement* RicToggleMeasurementModeFeature::measurement() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
Rim3dView* RicToggleMeasurementModeFeature::activeView() const
|
||||
{
|
||||
auto view = RiaApplication::instance()->activeReservoirView();
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
CAF_ASSERT(app);
|
||||
auto view = app->activeReservoirView();
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicCloseSummaryCaseFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
@@ -70,7 +70,7 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases(std::vector<RimSummaryCase*>
|
||||
|
||||
summaryCaseMainCollection->updateAllRequiredEditors();
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
|
||||
caf::AsyncPdmObjectVectorDeleter<RimSummaryCase> summaryCaseDeleter(cases);
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicCloseSummaryCaseInCollectionFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RicCloseSummaryCaseFeature.h"
|
||||
|
||||
@@ -94,7 +94,7 @@ void RicCloseSummaryCaseInCollectionFeature::onActionTriggered(bool isChecked)
|
||||
RicCloseSummaryCaseFeature::deleteSummaryCases(collectionSummaryCases);
|
||||
}
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicCreateTemporaryLgrFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaCellDividingTools.h"
|
||||
#include "RiaCompletionTypeCalculationScheduler.h"
|
||||
#include "RiaLogging.h"
|
||||
@@ -110,7 +110,9 @@ void RicCreateTemporaryLgrFeature::createLgrsForWellPaths(std::vector<RimWellPat
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateTemporaryLgrFeature::updateViews(RimEclipseCase* eclipseCase)
|
||||
{
|
||||
RiaApplication::clearAllSelections();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
app->clearAllSelections();
|
||||
|
||||
deleteAllCachedData(eclipseCase);
|
||||
RiaApplication::instance()->project()->mainPlotCollection()->deleteAllCachedData();
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include "RicDeleteItemExec.h"
|
||||
#include "RicDeleteItemExecData.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimAnnotationCollection.h"
|
||||
@@ -204,7 +204,7 @@ void RicDeleteItemExec::redo()
|
||||
{
|
||||
wellLogPlot->calculateAvailableDepthRange();
|
||||
wellLogPlot->updateDepthZoom();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateWellLogPlotToolBar();
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ void RicDeleteItemExec::redo()
|
||||
if (wellLogPlotTrack)
|
||||
{
|
||||
wellLogPlotTrack->calculateXZoomRangeAndUpdateQwt();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateWellLogPlotToolBar();
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ void RicDeleteItemExec::redo()
|
||||
project->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateWellLogPlotToolBar();
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ void RicDeleteItemExec::redo()
|
||||
if (summaryPlotCollection)
|
||||
{
|
||||
summaryPlotCollection->updateSummaryNameHasChanged();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
@@ -281,7 +281,7 @@ void RicDeleteItemExec::redo()
|
||||
parentObj->firstAncestorOrThisOfType(summaryCrossPlotCollection);
|
||||
if (summaryCrossPlotCollection)
|
||||
{
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "RicDeleteTemporaryLgrsFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimGridCollection.h"
|
||||
@@ -37,7 +37,7 @@ CAF_CMD_SOURCE_INIT(RicDeleteTemporaryLgrsFeature, "RicDeleteTemporaryLgrsFeatur
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicDeleteTemporaryLgrsFeature::deleteAllTemporaryLgrs(RimEclipseCase* eclipseCase)
|
||||
{
|
||||
RiaApplication::clearAllSelections();
|
||||
RiaGuiApplication::clearAllSelections();
|
||||
|
||||
if (eclipseCase)
|
||||
{
|
||||
|
@@ -40,7 +40,7 @@ CAF_CMD_SOURCE_INIT(RicImportGeneralDataFeature, "RicImportGeneralDataFeature");
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RicImportGeneralDataFeature::openEclipseFilesFromFileNames(const QStringList& fileNames)
|
||||
RicImportGeneralDataFeature::OpenCaseResults RicImportGeneralDataFeature::openEclipseFilesFromFileNames(const QStringList& fileNames)
|
||||
{
|
||||
CVF_ASSERT(!fileNames.empty());
|
||||
|
||||
@@ -66,23 +66,35 @@ bool RicImportGeneralDataFeature::openEclipseFilesFromFileNames(const QStringLis
|
||||
}
|
||||
}
|
||||
|
||||
bool allSucceeded = true;
|
||||
OpenCaseResults results;
|
||||
if (!eclipseCaseFiles.empty())
|
||||
{
|
||||
allSucceeded = allSucceeded && openEclipseCaseFromFileNames(eclipseCaseFiles);
|
||||
if (!openEclipseCaseFromFileNames(eclipseCaseFiles))
|
||||
{
|
||||
return OpenCaseResults();
|
||||
}
|
||||
results.eclipseCaseFiles = eclipseCaseFiles;
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory(defaultDirectoryLabel(ECLIPSE_EGRID_FILE), defaultDir);
|
||||
}
|
||||
if (!eclipseInputFiles.empty())
|
||||
{
|
||||
allSucceeded = allSucceeded && openInputEclipseCaseFromFileNames(eclipseInputFiles);
|
||||
if (!openInputEclipseCaseFromFileNames(eclipseInputFiles))
|
||||
{
|
||||
return OpenCaseResults();
|
||||
}
|
||||
results.eclipseInputFiles = eclipseInputFiles;
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory(defaultDirectoryLabel(ECLIPSE_INPUT_FILE), defaultDir);
|
||||
}
|
||||
if (!eclipseSummaryFiles.empty())
|
||||
{
|
||||
allSucceeded = allSucceeded && openSummaryCaseFromFileNames(eclipseSummaryFiles);
|
||||
if (!openSummaryCaseFromFileNames(eclipseSummaryFiles))
|
||||
{
|
||||
return OpenCaseResults();
|
||||
}
|
||||
results.eclipseSummaryFiles = eclipseSummaryFiles;
|
||||
RiaApplication::instance()->setLastUsedDialogDirectory(defaultDirectoryLabel(ECLIPSE_SUMMARY_FILE), defaultDir);
|
||||
}
|
||||
return allSucceeded;
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "cafCmdFeature.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
#include <vector>
|
||||
|
||||
//==================================================================================================
|
||||
@@ -32,7 +34,19 @@ class RicImportGeneralDataFeature : public caf::CmdFeature
|
||||
CAF_CMD_HEADER_INIT;
|
||||
|
||||
public:
|
||||
static bool openEclipseFilesFromFileNames(const QStringList& fileNames);
|
||||
struct OpenCaseResults
|
||||
{
|
||||
QStringList eclipseCaseFiles;
|
||||
QStringList eclipseInputFiles;
|
||||
QStringList eclipseSummaryFiles;
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return !(eclipseCaseFiles.empty() && eclipseInputFiles.empty() && eclipseSummaryFiles.empty());
|
||||
}
|
||||
};
|
||||
|
||||
static OpenCaseResults openEclipseFilesFromFileNames(const QStringList& fileNames);
|
||||
|
||||
protected:
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "SummaryPlotCommands/RicNewSummaryCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
@@ -73,7 +73,7 @@ bool RicImportSummaryCasesFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportSummaryCasesFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
QString pathCacheName = "INPUT_FILES";
|
||||
QStringList fileNames = runRecursiveSummaryCaseFileSearchDialog("Import Summary Cases", pathCacheName);
|
||||
|
||||
@@ -89,7 +89,7 @@ void RicImportSummaryCasesFeature::onActionTriggered(bool isChecked)
|
||||
addCasesToGroupIfRelevant(cases);
|
||||
|
||||
for (const auto& rimCase : cases)
|
||||
RiaApplication::instance()->addToRecentFiles(rimCase->summaryHeaderFilename());
|
||||
app->addToRecentFiles(rimCase->summaryHeaderFilename());
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow();
|
||||
if (mainPlotWindow && !cases.empty())
|
||||
@@ -123,7 +123,7 @@ void RicImportSummaryCasesFeature::setupActionLook(QAction* actionToSetup)
|
||||
bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles(const QStringList& fileNames,
|
||||
std::vector<RimSummaryCase*>* newCases)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
std::vector<RimSummaryCase*> temp;
|
||||
std::vector<RimSummaryCase*>* cases = newCases ? newCases : &temp;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicImportSummaryGroupFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RicImportSummaryCasesFeature.h"
|
||||
@@ -60,7 +60,7 @@ bool RicImportSummaryGroupFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicImportSummaryGroupFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
QString pathCacheName = "INPUT_FILES";
|
||||
QStringList fileNames = RicImportSummaryCasesFeature::runRecursiveSummaryCaseFileSearchDialog("Import Summary Case Group", pathCacheName);
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "RicReloadCaseFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimReloadCaseTools.h"
|
||||
@@ -60,7 +60,7 @@ void RicReloadCaseFeature::onActionTriggered(bool isChecked)
|
||||
std::vector<RimEclipseCase*> selectedEclipseCases;
|
||||
caf::SelectionManager::instance()->objectsByType(&selectedEclipseCases);
|
||||
|
||||
RiaApplication::clearAllSelections();
|
||||
RiaGuiApplication::clearAllSelections();
|
||||
|
||||
for (RimEclipseCase* selectedCase : selectedEclipseCases)
|
||||
{
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include "ExportCommands/RicSnapshotViewToFileFeature.h"
|
||||
#include "ExportCommands/RicSnapshotFilenameGenerator.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaFilePathTools.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaQDateTimeTools.h"
|
||||
@@ -611,7 +611,7 @@ void RicSummaryCaseRestartDialog::slotCopyFileNameToClipboard()
|
||||
{
|
||||
QAction* a = dynamic_cast<QAction*>(sender());
|
||||
|
||||
QClipboard* cb = RiaApplication::clipboard();
|
||||
QClipboard* cb = RiaGuiApplication::clipboard();
|
||||
if (cb)
|
||||
{
|
||||
QString fullFileName = a->data().toString();
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicWellLogTools.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimCase.h"
|
||||
#include "RimEclipseResultCase.h"
|
||||
@@ -205,7 +205,7 @@ RimWellLogExtractionCurve* RicWellLogTools::addExtractionCurve(RimWellLogTrack*
|
||||
plotTrack->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(curve);
|
||||
|
||||
if (showPlotWindow)
|
||||
@@ -257,7 +257,7 @@ RimWellLogRftCurve* RicWellLogTools::addRftCurve(RimWellLogTrack* plotTrack, con
|
||||
plotTrack->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(curve);
|
||||
|
||||
if (showPlotWindow)
|
||||
@@ -286,7 +286,7 @@ RimWellLogFileCurve* RicWellLogTools::addFileCurve(RimWellLogTrack* plotTrack, b
|
||||
plotTrack->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->project()->updateConnectedEditors();
|
||||
RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindowTools::selectAsCurrentItem(curve);
|
||||
|
||||
if (showPlotWindow)
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicNewGridTimeHistoryCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RigFemResultAddress.h"
|
||||
@@ -82,14 +82,16 @@ void RicNewGridTimeHistoryCurveFeature::createCurveFromSelectionItem(const RiuSe
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
{
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
const QString lastUsedSummaryPlotKey("lastUsedSummaryPlotKey");
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection();
|
||||
|
||||
RimSummaryPlot* defaultSelectedPlot = nullptr;
|
||||
{
|
||||
QString lastUsedPlotRef = RiaApplication::instance()->cacheDataObject(lastUsedSummaryPlotKey).toString();
|
||||
RimSummaryPlot* lastUsedPlot = dynamic_cast<RimSummaryPlot*>(caf::PdmReferenceHelper::objectFromReference(RiaApplication::instance()->project(), lastUsedPlotRef));
|
||||
QString lastUsedPlotRef = app->cacheDataObject(lastUsedSummaryPlotKey).toString();
|
||||
RimSummaryPlot* lastUsedPlot = dynamic_cast<RimSummaryPlot*>(caf::PdmReferenceHelper::objectFromReference(app->project(), lastUsedPlotRef));
|
||||
if (lastUsedPlot)
|
||||
{
|
||||
defaultSelectedPlot = lastUsedPlot;
|
||||
@@ -97,7 +99,7 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
|
||||
if (!defaultSelectedPlot)
|
||||
{
|
||||
defaultSelectedPlot = dynamic_cast<RimSummaryPlot*>( RiaApplication::instance()->activePlotWindow() );
|
||||
defaultSelectedPlot = dynamic_cast<RimSummaryPlot*>( app->activePlotWindow() );
|
||||
}
|
||||
|
||||
if (!defaultSelectedPlot && summaryPlotColl->summaryPlots().size() > 0)
|
||||
@@ -136,8 +138,8 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
summaryPlot = featureUi.selectedSummaryPlot();
|
||||
}
|
||||
|
||||
QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(RiaApplication::instance()->project(), summaryPlot);
|
||||
RiaApplication::instance()->setCacheDataObject(lastUsedSummaryPlotKey, refFromProjectToView);
|
||||
QString refFromProjectToView = caf::PdmReferenceHelper::referenceFromRootToObject(app->project(), summaryPlot);
|
||||
app->setCacheDataObject(lastUsedSummaryPlotKey, refFromProjectToView);
|
||||
|
||||
return summaryPlot;
|
||||
}
|
||||
@@ -147,7 +149,6 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RicNewGridTimeHistoryCurveFeature::suggestedNewPlotName()
|
||||
{
|
||||
|
||||
QString resultName;
|
||||
{
|
||||
Rim3dView* activeView = RiaApplication::instance()->activeReservoirView();
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicNewSummaryCrossPlotCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaSummaryTools.h"
|
||||
|
||||
#include "RimMainPlotCollection.h"
|
||||
@@ -76,9 +76,9 @@ void RicNewSummaryCrossPlotCurveFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicNewSummaryCurveFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RiaSummaryTools.h"
|
||||
@@ -117,7 +117,8 @@ bool RicNewSummaryCurveFeature::isCommandEnabled()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
RimProject* project = RiaApplication::instance()->project();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
RimProject* project = app->project();
|
||||
CVF_ASSERT(project);
|
||||
|
||||
RimSummaryPlot* plot = selectedSummaryPlot();
|
||||
@@ -133,9 +134,9 @@ void RicNewSummaryCurveFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
plot->updateConnectedEditors();
|
||||
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);
|
||||
app->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem(newCurve);
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = app->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicNewSummaryEnsembleCurveSetFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
|
||||
#include "RiaSummaryTools.h"
|
||||
@@ -77,7 +77,7 @@ RimEnsembleCurveSet* RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSet(Ri
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(RimSummaryCaseCollection* ensemble)
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
RimProject* proj = app->project();
|
||||
|
||||
RimSummaryPlotCollection* summaryPlotCollection = proj->mainPlotCollection->summaryPlotCollection();
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicSummaryCurveCreator.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaColorTables.h"
|
||||
#include "RiaCurveSetDefinition.h"
|
||||
#include "RiaSummaryCurveDefinition.h"
|
||||
@@ -231,7 +231,7 @@ void RicSummaryCurveCreator::fieldChangedByUi(const caf::PdmFieldHandle* changed
|
||||
caf::PdmField<bool>* field = dynamic_cast<caf::PdmField<bool>*>(m_targetPlot->uiCapability()->objectToggleField());
|
||||
field->setValueWithFieldChanged(true);
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
else if (changedField == &m_useAutoAppearanceAssignment && m_useAutoAppearanceAssignment)
|
||||
@@ -912,7 +912,7 @@ void RicSummaryCurveCreator::createNewPlot()
|
||||
m_targetPlot = newSummaryPlot;
|
||||
updateTargetPlot();
|
||||
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
mainPlotWindow->updateSummaryPlotToolBar();
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicSummaryCurveCreatorDialog.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RicSummaryCurveCreator.h"
|
||||
#include "RicSummaryCurveCreatorSplitterUi.h"
|
||||
@@ -81,7 +81,7 @@ void RicSummaryCurveCreatorDialog::updateFromDefaultCases(const std::vector<caf:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicSummaryCurveCreatorDialog::slotDialogFinished()
|
||||
{
|
||||
RiuPlotMainWindow* plotwindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if (plotwindow)
|
||||
{
|
||||
plotwindow->cleanUpTemporaryWidgets();
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicViewZoomAllFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "RimViewWindow.h"
|
||||
@@ -47,11 +47,11 @@ void RicViewZoomAllFeature::onActionTriggered(bool isChecked)
|
||||
{
|
||||
this->disableModelChangeContribution();
|
||||
|
||||
QWidget* topLevelWidget = RiaApplication::activeWindow();
|
||||
QWidget* topLevelWidget = RiaGuiApplication::activeWindow();
|
||||
|
||||
if (dynamic_cast<RiuMainWindow*>(topLevelWidget))
|
||||
{
|
||||
RimViewWindow* viewWindow = RiaApplication::instance()->activeReservoirView();
|
||||
RimViewWindow* viewWindow = RiaGuiApplication::instance()->activeReservoirView();
|
||||
if (viewWindow)
|
||||
{
|
||||
viewWindow->zoomAll();
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "RiuMainWindow.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "cafPdmUiFieldHandle.h"
|
||||
#include "cafPdmUiItem.h"
|
||||
@@ -161,7 +161,7 @@ caf::PdmUiTreeOrdering* RicToggleItemsFeatureImpl::findTreeItemFromSelectedUiIte
|
||||
QModelIndex modIndex = RiuMainWindow::instance()->projectTreeView()->findModelIndex(uiItem);
|
||||
if(!modIndex.isValid())
|
||||
{
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaApplication::instance()->mainPlotWindow();
|
||||
RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow();
|
||||
if(mainPlotWindow)
|
||||
{
|
||||
modIndex = mainPlotWindow->projectTreeView()->findModelIndex(uiItem);
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "RicDeleteWellLogPlotTrackFeature.h"
|
||||
#include "RicWellLogPlotCurveFeatureImpl.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
@@ -67,7 +67,7 @@ void RicDeleteWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
|
||||
|
||||
std::vector<RimWellLogTrack*> selection;
|
||||
caf::SelectionManager::instance()->objectsByType(&selection);
|
||||
RiuPlotMainWindow* plotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
std::set<RimWellLogPlot*> alteredWellLogPlots;
|
||||
|
||||
for (size_t i = 0; i < selection.size(); i++)
|
||||
|
@@ -25,7 +25,7 @@
|
||||
#include "RimWellLogPlotCollection.h"
|
||||
#include "RimWellLogTrack.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "cvfAssert.h"
|
||||
|
||||
@@ -40,7 +40,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot(bool showAfterCr
|
||||
CVF_ASSERT(wellLogPlotColl);
|
||||
|
||||
// Make sure the summary plot window is created
|
||||
RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
|
||||
RimWellLogPlot* plot = new RimWellLogPlot();
|
||||
plot->setAsPlotMdiWindow();
|
||||
@@ -58,7 +58,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot(bool showAfterCr
|
||||
|
||||
if (showAfterCreation)
|
||||
{
|
||||
RiaApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow();
|
||||
}
|
||||
|
||||
return plot;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "RicNewWellLogPlotTrackFeature.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
@@ -66,7 +66,7 @@ void RicNewWellLogPlotTrackFeature::onActionTriggered(bool isChecked)
|
||||
RimWellLogTrack* plotTrack = new RimWellLogTrack;
|
||||
wellLogPlot->addTrack(plotTrack);
|
||||
plotTrack->setDescription(QString("Track %1").arg(wellLogPlot->trackCount()));
|
||||
RiuPlotMainWindow* plotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuWellLogPlot* viewWidget = dynamic_cast<RiuWellLogPlot*>(wellLogPlot->viewWidget());
|
||||
RicWellLogTools::addExtractionCurve(plotTrack, nullptr, nullptr, nullptr, -1, true);
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "RicWellLogPlotTrackFeatureImpl.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiuPlotMainWindow.h"
|
||||
#include "RiuWellLogPlot.h"
|
||||
#include "RiuWellLogTrack.h"
|
||||
@@ -94,7 +94,7 @@ void RicWellLogPlotTrackFeatureImpl::moveTracksToWellLogPlot(RimWellLogPlot* dst
|
||||
{
|
||||
CVF_ASSERT(dstWellLogPlot);
|
||||
|
||||
RiuPlotMainWindow* plotWindow = RiaApplication::instance()->getOrCreateMainPlotWindow();
|
||||
RiuPlotMainWindow* plotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow();
|
||||
|
||||
std::set<RimWellLogPlot*> srcPlots;
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RicCreateWellTargetsPickEventHandler.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaOffshoreSphericalCoords.h"
|
||||
|
||||
#include "RigFemPart.h"
|
||||
@@ -70,7 +70,7 @@ RicCreateWellTargetsPickEventHandler::~RicCreateWellTargetsPickEventHandler() {}
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateWellTargetsPickEventHandler::registerAsPickEventHandler()
|
||||
{
|
||||
RiaApplication::instance()->setOverrideCursor(Qt::CrossCursor);
|
||||
RiaGuiApplication::instance()->setOverrideCursor(Qt::CrossCursor);
|
||||
Ric3dViewPickEventHandler::registerAsPickEventHandler();
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ void RicCreateWellTargetsPickEventHandler::registerAsPickEventHandler()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RicCreateWellTargetsPickEventHandler::notifyUnregistered()
|
||||
{
|
||||
RiaApplication::instance()->restoreOverrideCursor();
|
||||
RiaGuiApplication::instance()->restoreOverrideCursor();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "RivGridBoxGenerator.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaColorTools.h"
|
||||
|
||||
#include "RivPartPriority.h"
|
||||
@@ -639,7 +639,7 @@ void RivGridBoxGenerator::createLegend(EdgeType edge, cvf::Collection<cvf::Part>
|
||||
|
||||
cvf::ref<cvf::DrawableText> geo = new cvf::DrawableText;
|
||||
|
||||
cvf::Font* standardFont = RiaApplication::instance()->defaultSceneFont();
|
||||
cvf::Font* standardFont = RiaGuiApplication::instance()->defaultSceneFont();
|
||||
|
||||
geo->setFont(standardFont);
|
||||
geo->setTextColor(m_gridLegendColor);
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "RivIntersectionPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaOffshoreSphericalCoords.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
@@ -607,7 +607,7 @@ void RivIntersectionPartMgr::createFaultLabelParts(const std::vector<std::pair<Q
|
||||
if (!(eclipseView && faultInViewColl->showFaultLabel())) return;
|
||||
|
||||
cvf::Color3f faultLabelColor = faultInViewColl->faultLabelColor();
|
||||
cvf::Font* font = RiaApplication::instance()->defaultSceneFont();
|
||||
cvf::Font* font = RiaGuiApplication::instance()->defaultSceneFont();
|
||||
|
||||
std::vector<cvf::Vec3f> lineVertices;
|
||||
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "Riv3dWellLogPlanePartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
#include "Rim3dWellLogCurveCollection.h"
|
||||
@@ -258,7 +258,7 @@ void Riv3dWellLogPlanePartMgr::appendDrawSurfaceToModel(cvf::ModelBasicList*
|
||||
if (normals.notNull())
|
||||
{
|
||||
normals->setSingleColor(borderColor);
|
||||
if (RiaApplication::instance()->useShaders())
|
||||
if (RiaGuiApplication::instance()->useShaders())
|
||||
{
|
||||
normals->setUniformNames("u_transformationMatrix", "u_color");
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "RivFaultPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaPreferences.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
@@ -482,7 +482,9 @@ void RivFaultPartMgr::createLabelWithAnchorLine(const cvf::Part* part)
|
||||
// Fault label
|
||||
if (!m_rimFault->name().isEmpty())
|
||||
{
|
||||
cvf::Font* font = RiaApplication::instance()->defaultWellLabelFont();
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
cvf::Font* font = app->defaultWellLabelFont();
|
||||
|
||||
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
|
||||
drawableText->setFont(font);
|
||||
@@ -491,7 +493,7 @@ void RivFaultPartMgr::createLabelWithAnchorLine(const cvf::Part* part)
|
||||
drawableText->setDrawBackground(false);
|
||||
drawableText->setVerticalAlignment(cvf::TextDrawer::CENTER);
|
||||
|
||||
cvf::Color3f defWellLabelColor = RiaApplication::instance()->preferences()->defaultWellLabelColor();
|
||||
cvf::Color3f defWellLabelColor = app->preferences()->defaultWellLabelColor();
|
||||
{
|
||||
{
|
||||
RimFaultInViewCollection* parentObject;
|
||||
|
@@ -186,11 +186,13 @@ void RivMeasurementPartMgr::buildPolyLineParts(const cvf::Camera* camera,
|
||||
negativeXDir = true;
|
||||
}
|
||||
|
||||
auto backgroundColor = RiaApplication::instance()->preferences()->defaultViewerBackgroundColor;
|
||||
RiaGuiApplication* app = RiaGuiApplication::instance();
|
||||
|
||||
auto backgroundColor = app->preferences()->defaultViewerBackgroundColor;
|
||||
auto fontColor = cvf::Color3f::BLACK;
|
||||
QString text = m_measurement->label();
|
||||
auto labelPosition = pointsInDisplay.back();
|
||||
auto font = RiaApplication::instance()->defaultWellLabelFont();
|
||||
auto font = app->defaultWellLabelFont();
|
||||
|
||||
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
|
||||
drawableText->setFont(font);
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RivPolylineAnnotationPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaBoundingBoxTools.h"
|
||||
|
||||
#include "Rim3dView.h"
|
||||
@@ -134,7 +134,7 @@ void RivPolylineAnnotationPartMgr::buildPolylineAnnotationParts(const caf::Displ
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableVectors> vectorDrawable;
|
||||
if (RiaApplication::instance()->useShaders())
|
||||
if (RiaGuiApplication::instance()->useShaders())
|
||||
{
|
||||
// NOTE: Drawable vectors must be rendered using shaders when the rest of the application is rendered using
|
||||
// shaders Drawing vectors using fixed function when rest of the application uses shaders causes visual artifacts
|
||||
|
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "RivWellHeadPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RigActiveCellInfo.h"
|
||||
#include "RigCell.h"
|
||||
@@ -297,7 +297,7 @@ void RivWellHeadPartMgr::buildWellHeadParts(size_t frameIndex,
|
||||
|
||||
if (well->showWellLabel() && !well->name().isEmpty())
|
||||
{
|
||||
cvf::Font* font = RiaApplication::instance()->defaultWellLabelFont();
|
||||
cvf::Font* font = RiaGuiApplication::instance()->defaultWellLabelFont();
|
||||
|
||||
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
|
||||
drawableText->setFont(font);
|
||||
|
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "RivWellPathPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RigEclipseCaseData.h"
|
||||
#include "RigMainGrid.h"
|
||||
@@ -612,7 +612,7 @@ void RivWellPathPartMgr::buildWellPathParts(const caf::DisplayCoordTransform* di
|
||||
|
||||
if (wellPathCollection->showWellPathLabel() && m_rimWellPath->showWellPathLabel() && !m_rimWellPath->name().isEmpty())
|
||||
{
|
||||
cvf::Font* font = RiaApplication::instance()->defaultWellLabelFont();
|
||||
cvf::Font* font = RiaGuiApplication::instance()->defaultWellLabelFont();
|
||||
|
||||
cvf::ref<cvf::DrawableText> drawableText = new cvf::DrawableText;
|
||||
drawableText->setFont(font);
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RivWellSpheresPartMgr.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RigMainGrid.h"
|
||||
#include "RigSimWellData.h"
|
||||
@@ -137,7 +137,7 @@ cvf::ref<cvf::Part> RivWellSpheresPartMgr::createPart(std::vector<std::pair<cvf:
|
||||
}
|
||||
|
||||
cvf::ref<cvf::DrawableVectors> vectorDrawable;
|
||||
if (RiaApplication::instance()->useShaders())
|
||||
if (RiaGuiApplication::instance()->useShaders())
|
||||
{
|
||||
// NOTE: Drawable vectors must be rendered using shaders when the rest of the application is rendered using shaders
|
||||
// Drawing vectors using fixed function when rest of the application uses shaders causes visual artifacts
|
||||
@@ -169,7 +169,7 @@ cvf::ref<cvf::Part> RivWellSpheresPartMgr::createPart(std::vector<std::pair<cvf:
|
||||
part->setDrawable(vectorDrawable.p());
|
||||
|
||||
cvf::ref<cvf::Effect> eff = new cvf::Effect;
|
||||
if (RiaApplication::instance()->useShaders())
|
||||
if (RiaGuiApplication::instance()->useShaders())
|
||||
{
|
||||
if (m_rimReservoirView->viewer())
|
||||
{
|
||||
|
@@ -62,9 +62,9 @@ RimAnnotationCollection::RimAnnotationCollection()
|
||||
m_userDefinedPolylineAnnotations->uiCapability()->setUiName(RimAnnotationGroupCollection::USED_DEFINED_POLYLINE_ANNOTATION_UI_NAME);
|
||||
m_polylineFromFileAnnotations->uiCapability()->setUiName(RimAnnotationGroupCollection::POLYLINE_FROM_FILE_ANNOTATION_UI_NAME);
|
||||
|
||||
m_reachCircleAnnotations->uiCapability()->setUiIcon(QIcon(":/ReachCircle16x16.png"));
|
||||
m_userDefinedPolylineAnnotations->uiCapability()->setUiIcon(QIcon(":/PolylinesFromFile16x16.png"));
|
||||
m_polylineFromFileAnnotations->uiCapability()->setUiIcon(QIcon(":/PolylinesFromFile16x16.png"));
|
||||
m_reachCircleAnnotations->uiCapability()->setUiIcon(":/ReachCircle16x16.png");
|
||||
m_userDefinedPolylineAnnotations->uiCapability()->setUiIcon(":/PolylinesFromFile16x16.png");
|
||||
m_polylineFromFileAnnotations->uiCapability()->setUiIcon(":/PolylinesFromFile16x16.png");
|
||||
|
||||
}
|
||||
|
||||
|
@@ -51,7 +51,7 @@ RimAnnotationCollectionBase::RimAnnotationCollectionBase()
|
||||
m_textAnnotations.uiCapability()->setUiHidden(true);
|
||||
m_textAnnotations = new RimAnnotationGroupCollection();
|
||||
m_textAnnotations->uiCapability()->setUiName(RimAnnotationGroupCollection::TEXT_ANNOTATION_UI_NAME);
|
||||
m_textAnnotations->uiCapability()->setUiIcon(QIcon(":/TextAnnotation16x16.png"));
|
||||
m_textAnnotations->uiCapability()->setUiIcon(":/TextAnnotation16x16.png");
|
||||
}
|
||||
|
||||
|
||||
|
@@ -105,10 +105,10 @@ RimAnnotationInViewCollection::RimAnnotationInViewCollection()
|
||||
m_globalUserDefinedPolylineAnnotations->uiCapability()->setUiName("Global User Defined Polylines Annotations");
|
||||
m_globalPolylineFromFileAnnotations->uiCapability()->setUiName("Global Polylines From File Annotations");
|
||||
|
||||
m_globalTextAnnotations->uiCapability()->setUiIcon(QIcon(":/TextAnnotation16x16.png"));
|
||||
m_globalReachCircleAnnotations->uiCapability()->setUiIcon(QIcon(":/ReachCircle16x16.png"));
|
||||
m_globalUserDefinedPolylineAnnotations->uiCapability()->setUiIcon(QIcon(":/PolylinesFromFile16x16.png"));
|
||||
m_globalPolylineFromFileAnnotations->uiCapability()->setUiIcon(QIcon(":/PolylinesFromFile16x16.png"));
|
||||
m_globalTextAnnotations->uiCapability()->setUiIcon(":/TextAnnotation16x16.png");
|
||||
m_globalReachCircleAnnotations->uiCapability()->setUiIcon(":/ReachCircle16x16.png");
|
||||
m_globalUserDefinedPolylineAnnotations->uiCapability()->setUiIcon(":/PolylinesFromFile16x16.png");
|
||||
m_globalPolylineFromFileAnnotations->uiCapability()->setUiIcon(":/PolylinesFromFile16x16.png");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -296,6 +296,10 @@ void RimAnnotationInViewCollection::defineUiOrdering(QString uiConfigName, caf::
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimAnnotationInViewCollection::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue)
|
||||
{
|
||||
if (changedField == &m_isActive)
|
||||
{
|
||||
updateUiIconFromToggleField();
|
||||
}
|
||||
scheduleRedrawOfRelevantViews();
|
||||
}
|
||||
|
||||
|
@@ -256,15 +256,15 @@ void RimValveTemplate::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrderi
|
||||
this->setName(fullLabel());
|
||||
if (m_type() == RiaDefines::ICV)
|
||||
{
|
||||
this->setUiIcon(QIcon(":/ICVValve16x16.png"));
|
||||
this->setUiIcon(":/ICVValve16x16.png");
|
||||
}
|
||||
else if (m_type() == RiaDefines::ICD)
|
||||
{
|
||||
this->setUiIcon(QIcon(":/ICDValve16x16.png"));
|
||||
this->setUiIcon(":/ICDValve16x16.png");
|
||||
}
|
||||
else if (m_type() == RiaDefines::AICD)
|
||||
{
|
||||
this->setUiIcon(QIcon(":/AICDValve16x16.png"));
|
||||
this->setUiIcon(":/AICDValve16x16.png");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -184,13 +184,13 @@ void RimWellPathValve::applyValveLabelAndIcon()
|
||||
{
|
||||
if (componentType() == RiaDefines::ICV)
|
||||
{
|
||||
this->setUiIcon(QIcon(":/ICVValve16x16.png"));
|
||||
this->setUiIcon(":/ICVValve16x16.png");
|
||||
QString fullName = QString("%1: %2").arg(componentLabel()).arg(m_measuredDepth());
|
||||
this->setName(fullName);
|
||||
}
|
||||
else if (componentType() == RiaDefines::ICD)
|
||||
{
|
||||
this->setUiIcon(QIcon(":/ICDValve16x16.png"));
|
||||
this->setUiIcon(":/ICDValve16x16.png");
|
||||
QString fullName = QString("%1 %2: %3 - %4")
|
||||
.arg(m_multipleValveLocations->valveLocations().size())
|
||||
.arg(componentLabel())
|
||||
@@ -200,7 +200,7 @@ void RimWellPathValve::applyValveLabelAndIcon()
|
||||
}
|
||||
else if (componentType() == RiaDefines::AICD)
|
||||
{
|
||||
this->setUiIcon(QIcon(":/AICDValve16x16.png"));
|
||||
this->setUiIcon(":/AICDValve16x16.png");
|
||||
QString fullName = QString("%1 %2: %3 - %4")
|
||||
.arg(m_multipleValveLocations->valveLocations().size())
|
||||
.arg(componentLabel())
|
||||
|
@@ -188,7 +188,7 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
|
||||
{
|
||||
if (c->defaultFlowDiagSolution())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
|
||||
{
|
||||
for (RimEclipseView* view : m_case()->reservoirViews())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(view->name(), view, false, view->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(view->name(), view, false, view->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ QList<caf::PdmOptionItemInfo> RimFlowCharacteristicsPlot::calculateValueOptions(
|
||||
options.push_back(caf::PdmOptionItemInfo("None", nullptr));
|
||||
for (RimFlowDiagSolution* flowSol : flowSols)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -98,7 +98,7 @@ RimWellAllocationPlot::RimWellAllocationPlot()
|
||||
m_accumulatedWellFlowPlot->setDepthUnit(RiaDefines::UNIT_NONE);
|
||||
m_accumulatedWellFlowPlot->setDepthType(RimWellLogPlot::CONNECTION_NUMBER);
|
||||
m_accumulatedWellFlowPlot->setTrackLegendsVisible(false);
|
||||
m_accumulatedWellFlowPlot->uiCapability()->setUiIcon(QIcon(":/WellFlowPlot16x16.png"));
|
||||
m_accumulatedWellFlowPlot->uiCapability()->setUiIcon(":/WellFlowPlot16x16.png");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "");
|
||||
m_totalWellAllocationPlot.uiCapability()->setUiHidden(true);
|
||||
@@ -594,7 +594,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
|
||||
{
|
||||
std::set<QString> sortedWellNames = this->findSortedWellNames();
|
||||
|
||||
QIcon simWellIcon(":/Well.png");
|
||||
caf::QIconProvider simWellIcon(":/Well.png");
|
||||
for ( const QString& wname: sortedWellNames )
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(wname, wname, false, simWellIcon));
|
||||
@@ -630,7 +630,7 @@ QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const
|
||||
|
||||
for (RimEclipseResultCase* c : cases)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -927,7 +927,7 @@ QList<caf::PdmOptionItemInfo> RimGridCrossPlotDataSet::calculateValueOptions(con
|
||||
for (RimEclipseView* view : eclipseCase->reservoirViews.childObjects())
|
||||
{
|
||||
CVF_ASSERT(view && "Really always should have a valid view pointer in ReservoirViews");
|
||||
options.push_back(caf::PdmOptionItemInfo(view->name(), view, false, view->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(view->name(), view, false, view->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "RiuMeasurementEventFilter.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RimMeasurement.h"
|
||||
|
||||
@@ -39,7 +39,7 @@ RiuMeasurementEventFilter::RiuMeasurementEventFilter(RimMeasurement* parent)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMeasurementEventFilter::registerFilter()
|
||||
{
|
||||
RiaApplication::instance()->installEventFilter(this);
|
||||
RiaGuiApplication::instance()->installEventFilter(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -47,7 +47,7 @@ void RiuMeasurementEventFilter::registerFilter()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMeasurementEventFilter::unregisterFilter()
|
||||
{
|
||||
RiaApplication::instance()->removeEventFilter(this);
|
||||
RiaGuiApplication::instance()->removeEventFilter(this);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -116,7 +116,6 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig()
|
||||
|
||||
m_isVisCellStatUpToDate = false;
|
||||
|
||||
m_gridStatisticsDialog = std::unique_ptr<RicGridStatisticsDialog>(new RicGridStatisticsDialog(nullptr));
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -228,14 +227,27 @@ QString Rim3dOverlayInfoConfig::resultInfoText(const HistogramData& histData)
|
||||
return "";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RicGridStatisticsDialog* Rim3dOverlayInfoConfig::getOrCreateGridStatisticsDialog()
|
||||
{
|
||||
if (!m_gridStatisticsDialog)
|
||||
{
|
||||
m_gridStatisticsDialog.reset(new RicGridStatisticsDialog(nullptr));
|
||||
}
|
||||
CVF_ASSERT(m_gridStatisticsDialog);
|
||||
return m_gridStatisticsDialog.get();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QImage Rim3dOverlayInfoConfig::statisticsDialogScreenShotImage()
|
||||
{
|
||||
if (m_gridStatisticsDialog->isVisible())
|
||||
if (getOrCreateGridStatisticsDialog()->isVisible())
|
||||
{
|
||||
return m_gridStatisticsDialog->screenShotImage();
|
||||
return getOrCreateGridStatisticsDialog()->screenShotImage();
|
||||
}
|
||||
return QImage();
|
||||
}
|
||||
@@ -862,16 +874,17 @@ void Rim3dOverlayInfoConfig::showStatisticsInfoDialog(bool raise)
|
||||
{
|
||||
if (m_viewDef)
|
||||
{
|
||||
RicGridStatisticsDialog* dialog = getOrCreateGridStatisticsDialog();
|
||||
// Show dialog before setting data due to text edit auto height setting
|
||||
m_gridStatisticsDialog->resize(600, 800);
|
||||
m_gridStatisticsDialog->show();
|
||||
dialog->resize(600, 800);
|
||||
dialog->show();
|
||||
|
||||
m_gridStatisticsDialog->setLabel("Grid statistics");
|
||||
m_gridStatisticsDialog->updateFromRimView(m_viewDef);
|
||||
dialog->setLabel("Grid statistics");
|
||||
dialog->updateFromRimView(m_viewDef);
|
||||
|
||||
if (raise)
|
||||
{
|
||||
m_gridStatisticsDialog->raise();
|
||||
dialog->raise();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -916,7 +929,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
updateEclipse3DInfo(reservoirView);
|
||||
|
||||
// Update statistics dialog
|
||||
m_gridStatisticsDialog->updateFromRimView(reservoirView);
|
||||
getOrCreateGridStatisticsDialog()->updateFromRimView(reservoirView);
|
||||
}
|
||||
|
||||
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(m_viewDef.p());
|
||||
@@ -927,7 +940,7 @@ void Rim3dOverlayInfoConfig::update3DInfo()
|
||||
updateGeoMech3DInfo(geoMechView);
|
||||
|
||||
// Update statistics dialog
|
||||
m_gridStatisticsDialog->updateFromRimView(geoMechView);
|
||||
getOrCreateGridStatisticsDialog()->updateFromRimView(geoMechView);
|
||||
}
|
||||
|
||||
update3DInfoIn2dViews();
|
||||
|
@@ -80,6 +80,7 @@ public:
|
||||
QString caseInfoText();
|
||||
QString resultInfoText(const HistogramData& histData);
|
||||
|
||||
RicGridStatisticsDialog* getOrCreateGridStatisticsDialog();
|
||||
void showStatisticsInfoDialog(bool raise = true);
|
||||
QImage statisticsDialogScreenShotImage();
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "Rim3dView.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
#include "RiaFieldHandleTools.h"
|
||||
#include "RiaPreferences.h"
|
||||
#include "RiaViewRedrawScheduler.h"
|
||||
@@ -181,7 +181,7 @@ QString Rim3dView::name() const
|
||||
QWidget* Rim3dView::createViewWidget(QWidget* mainWindowParent)
|
||||
{
|
||||
QGLFormat glFormat;
|
||||
glFormat.setDirectRendering(RiaApplication::instance()->useShaders());
|
||||
glFormat.setDirectRendering(RiaGuiApplication::instance()->useShaders());
|
||||
|
||||
m_viewer = new RiuViewer(glFormat, mainWindowParent);
|
||||
m_viewer->setOwnerReservoirView(this);
|
||||
@@ -207,7 +207,7 @@ void Rim3dView::updateViewWidgetAfterCreation()
|
||||
this->resetLegendsInViewer();
|
||||
|
||||
m_viewer->updateNavigationPolicy();
|
||||
m_viewer->enablePerfInfoHud(RiaApplication::instance()->showPerformanceInfo());
|
||||
m_viewer->enablePerfInfoHud(RiaGuiApplication::instance()->showPerformanceInfo());
|
||||
|
||||
m_viewer->mainCamera()->setViewMatrix(m_cameraPosition);
|
||||
m_viewer->setPointOfInterest(m_cameraPointOfInterest());
|
||||
@@ -409,8 +409,11 @@ void Rim3dView::createDisplayModelAndRedraw()
|
||||
}
|
||||
}
|
||||
|
||||
if (RiuMainWindow::instance())
|
||||
{
|
||||
RiuMainWindow::instance()->refreshAnimationActions();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
|
@@ -153,7 +153,7 @@ QList<caf::PdmOptionItemInfo> RimCase::calculateValueOptions(const caf::PdmField
|
||||
{
|
||||
for(RimFormationNames* fnames : proj->activeOilField()->formationNamesCollection()->formationNamesList())
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(fnames->fileNameWoPath(), fnames, false, fnames->uiCapability()->uiIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(fnames->fileNameWoPath(), fnames, false, fnames->uiCapability()->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,8 @@
|
||||
|
||||
#include "RimCellFilter.h"
|
||||
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
namespace caf
|
||||
@@ -69,9 +71,13 @@ caf::PdmFieldHandle* RimCellFilter::userDescriptionField()
|
||||
void RimCellFilter::updateIconState()
|
||||
{
|
||||
// Reset dynamic icon
|
||||
this->setUiIcon(QIcon());
|
||||
this->setUiIcon(caf::QIconProvider());
|
||||
// Get static one
|
||||
QIcon icon = this->uiIcon();
|
||||
caf::QIconProvider iconProvider = this->uiIconProvider();
|
||||
|
||||
if (iconProvider.isNull()) return;
|
||||
|
||||
QIcon icon = iconProvider.icon();
|
||||
|
||||
// Get a pixmap, and modify it
|
||||
|
||||
@@ -93,14 +99,9 @@ void RimCellFilter::updateIconState()
|
||||
painter.drawPixmap(0,0, sign);
|
||||
}
|
||||
|
||||
if (!isActive || isActive.uiCapability()->isUiReadOnly())
|
||||
{
|
||||
QIcon temp(icPixmap);
|
||||
icPixmap = temp.pixmap(16, 16, QIcon::Disabled);
|
||||
}
|
||||
|
||||
QIcon newIcon(icPixmap);
|
||||
this->setUiIcon(newIcon);
|
||||
iconProvider.setPixmap(icPixmap);
|
||||
iconProvider.setActive(isActive && !isActive.uiCapability()->isUiReadOnly());
|
||||
this->setUiIcon(iconProvider);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "RiaDefines.h"
|
||||
#include "RiaFieldHandleTools.h"
|
||||
#include "RiaGuiApplication.h"
|
||||
|
||||
#include "RigCaseCellResultsData.h"
|
||||
#include "RigEclipseCaseData.h"
|
||||
@@ -90,7 +91,11 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter()
|
||||
CAF_PDM_InitField(&m_useCategorySelection, "CategorySelection", false, "Category Selection", "", "", "");
|
||||
m_upperBound.uiCapability()->setUiEditorTypeName(caf::PdmUiDoubleSliderEditor::uiEditorTypeName());
|
||||
|
||||
// HEADLESS HACK
|
||||
if (RiaGuiApplication::isRunning())
|
||||
{
|
||||
updateIconState();
|
||||
}
|
||||
|
||||
m_minimumResultValue = cvf::UNDEFINED_DOUBLE;
|
||||
m_maximumResultValue = cvf::UNDEFINED_DOUBLE;
|
||||
|
@@ -684,7 +684,7 @@ QList<caf::PdmOptionItemInfo> RimEclipseResultDefinition::calculateValueOptions(
|
||||
QString("%1 (#%2)").arg(otherCase->caseUserDescription()).arg(otherCase->caseId()),
|
||||
otherCase,
|
||||
false,
|
||||
otherCase->uiIcon()));
|
||||
otherCase->uiIconProvider()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -814,7 +814,7 @@ QList<caf::PdmOptionItemInfo> RimGeoMechCase::calculateValueOptions(const caf::P
|
||||
{
|
||||
for (size_t i = 0; i < m_elementPropertyFileNames.v().size(); i++)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(m_elementPropertyFileNames.v().at(i).path(), (int)i, true, QIcon()));
|
||||
options.push_back(caf::PdmOptionItemInfo(m_elementPropertyFileNames.v().at(i).path(), (int)i, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -260,18 +260,18 @@ RimGridCollection::RimGridCollection()
|
||||
m_mainGrid = new RimGridInfo();
|
||||
m_mainGrid->setUiName("Main Grid");
|
||||
m_mainGrid->uiCapability()->setUiTreeHidden(true);
|
||||
m_mainGrid->setUiIcon(QIcon(":/MainGrid16x16.png"));
|
||||
m_mainGrid->setUiIcon(":/MainGrid16x16.png");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_persistentLgrs, "PersistentLgrs", "Persistent LGRs", "", "", "");
|
||||
m_persistentLgrs = new RimGridInfoCollection();
|
||||
m_persistentLgrs->setUiName(persistentGridUiName());
|
||||
m_persistentLgrs->setUiIcon(QIcon(":/LGR16x16.png"));
|
||||
m_persistentLgrs->setUiIcon(":/LGR16x16.png");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_temporaryLgrs, "TemporaryLgrs", "Temporary LGRs", "", "", "");
|
||||
m_temporaryLgrs.xmlCapability()->disableIO();
|
||||
m_temporaryLgrs = new RimGridInfoCollection();
|
||||
m_temporaryLgrs->setUiName(temporaryGridUiName());
|
||||
m_temporaryLgrs->setUiIcon(QIcon(":/TempLGR16x16.png"));
|
||||
m_temporaryLgrs->setUiIcon(":/TempLGR16x16.png");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -390,7 +390,7 @@ void RimGridCollection::syncFromMainEclipseGrid()
|
||||
auto gridInfo = new RimGridInfo();
|
||||
gridInfo->setName(gridName);
|
||||
gridInfo->setEclipseGridIndex((int)gridIndex);
|
||||
gridInfo->setUiIcon(QIcon(":/TempLGR16x16.png"));
|
||||
gridInfo->setUiIcon(":/TempLGR16x16.png");
|
||||
m_temporaryLgrs->addGridInfo(gridInfo);
|
||||
}
|
||||
}
|
||||
@@ -405,7 +405,7 @@ void RimGridCollection::syncFromMainEclipseGrid()
|
||||
auto gridInfo = new RimGridInfo();
|
||||
gridInfo->setName(gridName);
|
||||
gridInfo->setEclipseGridIndex((int)gridIndex);
|
||||
gridInfo->setUiIcon(QIcon(":/LGR16x16.png"));
|
||||
gridInfo->setUiIcon(":/LGR16x16.png");
|
||||
m_persistentLgrs->addGridInfo(gridInfo);
|
||||
}
|
||||
}
|
||||
|
@@ -325,8 +325,7 @@ bool RimGridView::applyFontSize(RiaDefines::FontSettingType fontSettingType,
|
||||
|
||||
if (applyFontSizes)
|
||||
{
|
||||
anyChange =
|
||||
annotations->applyFontSizeToAllTextAnnotations(oldFontSizeEnum, newFontSizeEnum, forceChange) || anyChange;
|
||||
anyChange = annotations->applyFontSizeToAllTextAnnotations(oldFontSizeEnum, newFontSizeEnum, forceChange) || anyChange;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -64,11 +64,11 @@ RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup()
|
||||
|
||||
caseCollection = new RimCaseCollection;
|
||||
caseCollection->uiCapability()->setUiName("Source Cases");
|
||||
caseCollection->uiCapability()->setUiIcon(QIcon(":/Cases16x16.png"));
|
||||
caseCollection->uiCapability()->setUiIcon(":/Cases16x16.png");
|
||||
|
||||
statisticsCaseCollection = new RimCaseCollection;
|
||||
statisticsCaseCollection->uiCapability()->setUiName("Derived Statistics");
|
||||
statisticsCaseCollection->uiCapability()->setUiIcon(QIcon(":/Histograms16x16.png"));
|
||||
statisticsCaseCollection->uiCapability()->setUiIcon(":/Histograms16x16.png");
|
||||
|
||||
|
||||
m_mainGrid = nullptr;
|
||||
|
@@ -316,7 +316,7 @@ QList<caf::PdmOptionItemInfo> RimIntersection::calculateValueOptions(const caf::
|
||||
{
|
||||
caf::PdmChildArrayField<RimSimWellInView*>& simWells = coll->wells;
|
||||
|
||||
QIcon simWellIcon(":/Well.png");
|
||||
caf::QIconProvider simWellIcon(":/Well.png");
|
||||
for (RimSimWellInView* eclWell : simWells)
|
||||
{
|
||||
options.push_back(caf::PdmOptionItemInfo(eclWell->name(), eclWell, false, simWellIcon));
|
||||
|
@@ -543,21 +543,21 @@ void RimIntersectionBox::updateVisibility()
|
||||
if (m_singlePlaneState == PLANE_STATE_X)
|
||||
{
|
||||
m_maxXCoord.uiCapability()->setUiReadOnly(true);
|
||||
this->setUiIcon(QIcon(QString(":/IntersectionXPlane16x16.png")));
|
||||
this->setUiIcon(QString(":/IntersectionXPlane16x16.png"));
|
||||
}
|
||||
else if (m_singlePlaneState == PLANE_STATE_Y)
|
||||
{
|
||||
m_maxYCoord.uiCapability()->setUiReadOnly(true);
|
||||
this->setUiIcon(QIcon(QString(":/IntersectionYPlane16x16.png")));
|
||||
this->setUiIcon(QString(":/IntersectionYPlane16x16.png"));
|
||||
}
|
||||
else if (m_singlePlaneState == PLANE_STATE_Z)
|
||||
{
|
||||
m_maxDepth.uiCapability()->setUiReadOnly(true);
|
||||
this->setUiIcon(QIcon(QString(":/IntersectionZPlane16x16.png")));
|
||||
this->setUiIcon(QString(":/IntersectionZPlane16x16.png"));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->setUiIcon(QIcon(QString(":/IntersectionBox16x16.png")));
|
||||
this->setUiIcon(QString(":/IntersectionBox16x16.png"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -279,6 +279,8 @@ void RimIntersectionCollection::fieldChangedByUi(const caf::PdmFieldHandle* chan
|
||||
{
|
||||
if (changedField == &isActive)
|
||||
{
|
||||
updateUiIconFromToggleField();
|
||||
|
||||
Rim3dView* rimView = nullptr;
|
||||
firstAncestorOrThisOfType(rimView);
|
||||
if (rimView)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user