mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Remove obsolete code related to Qt5
* Remove bundling of openssl1.1 * Remove obsolete compile flags * Remove use of obsolete RimCommandObject * Use QColor::isValidColorName QColor::isValidColor is deprecated in Qt 6.6, QColor::isValidColorName was introduced in 6.4 * Make sure debug DLLs are copied when required * Remove Qt5 from AppFwk * Remove obsolete copy of Qt DLLs
This commit is contained in:
@@ -48,7 +48,6 @@
|
||||
|
||||
#include "Rim2dIntersectionViewCollection.h"
|
||||
#include "RimCellFilterCollection.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimCommandRouter.h"
|
||||
#include "RimCompletionTemplateCollection.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
@@ -789,18 +788,6 @@ bool RiaApplication::loadProject( const QString& projectFileName, ProjectLoadAct
|
||||
// Default behavior for scripts is to use current active view for data read/write
|
||||
onProjectOpened();
|
||||
|
||||
// Loop over command objects and execute them
|
||||
for ( size_t i = 0; i < m_project->commandObjects.size(); i++ )
|
||||
{
|
||||
m_commandQueue.push_back( m_project->commandObjects[i] );
|
||||
}
|
||||
|
||||
// Lock the command queue
|
||||
m_commandQueueLock.lock();
|
||||
|
||||
// Execute command objects, and release the mutex when the queue is empty
|
||||
executeCommandObjects();
|
||||
|
||||
// Recalculate the results from grid property calculations.
|
||||
// Has to be done late since the results are filtered by view cell visibility
|
||||
for ( auto gridCalculation : m_project->gridCalculationCollection()->sortedGridCalculations() )
|
||||
@@ -883,7 +870,6 @@ void RiaApplication::closeProject()
|
||||
onProjectBeingClosed();
|
||||
|
||||
m_project->close();
|
||||
m_commandQueue.clear();
|
||||
|
||||
RiaWellNameComparer::clearCache();
|
||||
|
||||
@@ -1383,81 +1369,6 @@ void RiaApplication::executeCommandFile( const QString& commandFile )
|
||||
RicfCommandFileExecutor::instance()->executeCommands( in );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::addCommandObject( RimCommandObject* commandObject )
|
||||
{
|
||||
m_commandQueue.push_back( commandObject );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::executeCommandObjects()
|
||||
{
|
||||
{
|
||||
auto currentCommandQueue = m_commandQueue;
|
||||
for ( auto command : currentCommandQueue )
|
||||
{
|
||||
if ( !command->isAsyncronous() )
|
||||
{
|
||||
command->redo();
|
||||
m_commandQueue.remove( command );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_commandQueue.empty() )
|
||||
{
|
||||
auto it = m_commandQueue.begin();
|
||||
if ( it->notNull() )
|
||||
{
|
||||
RimCommandObject* first = *it;
|
||||
first->redo();
|
||||
}
|
||||
m_commandQueue.pop_front();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unlock the command queue lock when the command queue is empty
|
||||
// Required to lock the mutex before unlocking to avoid undefined behavior
|
||||
m_commandQueueLock.tryLock();
|
||||
m_commandQueueLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaApplication::waitUntilCommandObjectsHasBeenProcessed()
|
||||
{
|
||||
auto start = std::chrono::system_clock::now();
|
||||
const double timeoutThreshold = 5.0;
|
||||
|
||||
// Wait until all command objects have completed
|
||||
bool mutexLockedSuccessfully = m_commandQueueLock.tryLock();
|
||||
|
||||
while ( !mutexLockedSuccessfully )
|
||||
{
|
||||
invokeProcessEvents();
|
||||
|
||||
mutexLockedSuccessfully = m_commandQueueLock.tryLock();
|
||||
|
||||
std::chrono::duration<double> elapsed_seconds = std::chrono::system_clock::now() - start;
|
||||
if ( timeoutThreshold < elapsed_seconds.count() )
|
||||
{
|
||||
// This can happen if the octave plugins fails to execute during regression testing.
|
||||
|
||||
RiaLogging::warning(
|
||||
QString( "Timeout waiting for command objects to complete, timeout set to %1 seconds." ).arg( timeoutThreshold ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_commandQueueLock.unlock();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -49,7 +49,6 @@ class RiaSocketServer;
|
||||
|
||||
class RigEclipseCaseData;
|
||||
|
||||
class RimCommandObject;
|
||||
class RimCommandRouter;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
@@ -180,9 +179,6 @@ public:
|
||||
QVariant cacheDataObject( const QString& key ) const;
|
||||
|
||||
void executeCommandFile( const QString& commandFile );
|
||||
void addCommandObject( RimCommandObject* commandObject );
|
||||
void executeCommandObjects();
|
||||
void waitUntilCommandObjectsHasBeenProcessed();
|
||||
|
||||
const QString startDir() const;
|
||||
void setStartDir( const QString& startDir );
|
||||
@@ -253,9 +249,6 @@ protected:
|
||||
QString m_commandLineHelpText;
|
||||
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
|
||||
|
||||
std::list<caf::PdmPointer<RimCommandObject>> m_commandQueue;
|
||||
QMutex m_commandQueueLock;
|
||||
|
||||
bool m_runningWorkerProcess;
|
||||
|
||||
private:
|
||||
|
||||
@@ -50,7 +50,6 @@
|
||||
#include "RimAnnotationCollection.h"
|
||||
#include "RimAnnotationInViewCollection.h"
|
||||
#include "RimAnnotationTextAppearance.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimEclipseCaseCollection.h"
|
||||
#include "RimEclipseView.h"
|
||||
#include "RimFlowPlotCollection.h"
|
||||
@@ -1574,9 +1573,6 @@ void RiaGuiApplication::slotWorkerProcessFinished( int exitCode, QProcess::ExitS
|
||||
}
|
||||
m_workerProcess = nullptr;
|
||||
|
||||
// Always make sure the command objects are executed before any return statement
|
||||
executeCommandObjects();
|
||||
|
||||
// Either the work process crashed or was aborted by the user
|
||||
if ( exitStatus == QProcess::CrashExit )
|
||||
{
|
||||
|
||||
@@ -43,7 +43,6 @@ class RiaSocketServer;
|
||||
|
||||
class RigEclipseCaseData;
|
||||
|
||||
class RimCommandObject;
|
||||
class RimEclipseCase;
|
||||
class RimEclipseView;
|
||||
class RimGridView;
|
||||
|
||||
@@ -240,9 +240,6 @@ void RiaRegressionTestRunner::runRegressionTest()
|
||||
|
||||
app->loadProject( testCaseFolder.filePath( projectFileName ), RiaApplication::ProjectLoadAction::PLA_NONE, projectModifier.p() );
|
||||
|
||||
// Wait until all command objects have completed
|
||||
app->waitUntilCommandObjectsHasBeenProcessed();
|
||||
|
||||
QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName );
|
||||
if ( regressionTestConfig.exportSnapshots3dViews )
|
||||
{
|
||||
|
||||
@@ -277,13 +277,6 @@ if(MSVC)
|
||||
|
||||
message(STATUS "CMAKE_CXX_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
|
||||
# The following warning is generated over 800 times from a qwt header only
|
||||
# using VS2015 Disabling temporarily warning C4505 'function' : unreferenced
|
||||
# local function has been removed
|
||||
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38)
|
||||
# https://github.com/OPM/ResInsight/issues/10844
|
||||
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996")
|
||||
|
||||
@@ -123,13 +123,6 @@ if(MSVC)
|
||||
|
||||
set(BUILD_FLAGS_FOR_MSVC "/W3 /wd4190 /wd4100 /wd4127")
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14)
|
||||
# The following warning is generated over 800 times from a qwt header only
|
||||
# using VS2015 Disabling temporarily warning C4505 'function' : unreferenced
|
||||
# local function has been removed
|
||||
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4505")
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 19.38)
|
||||
# https://github.com/OPM/ResInsight/issues/10844
|
||||
set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996")
|
||||
|
||||
@@ -88,7 +88,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
|
||||
// extract last word which may contain formation color
|
||||
QString colorWord = RiaTextStringTools::splitSkipEmptyParts( numberString ).last();
|
||||
|
||||
if ( QColor::isValidColor( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line
|
||||
if ( QColor::isValidColorName( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line
|
||||
|
||||
// extract words containing formation number(s)
|
||||
QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) );
|
||||
@@ -110,7 +110,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
|
||||
startK = tmp < endK ? tmp : endK;
|
||||
endK = tmp > endK ? tmp : endK;
|
||||
|
||||
if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line
|
||||
if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line
|
||||
{
|
||||
cvf::Color3f formationColor;
|
||||
|
||||
@@ -133,7 +133,7 @@ cvf::ref<RigFormationNames> RifColorLegendData::readLyrFormationNameFile( const
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( QColor::isValidColor( colorWord ) ) // formation color present at end of line
|
||||
if ( QColor::isValidColorName( colorWord ) ) // formation color present at end of line
|
||||
{
|
||||
cvf::Color3f formationColor;
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ set(SOURCE_GROUP_HEADER_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMimeData.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCommandObject.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTools.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.h
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.h
|
||||
@@ -168,7 +167,6 @@ set(SOURCE_GROUP_SOURCE_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimReservoirCellResultsStorage.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimEclipseStatisticsCaseEvaluator.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimMimeData.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimCommandObject.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimTools.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFormationNames.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RimFormationNamesCollection.cpp
|
||||
|
||||
@@ -1,318 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// 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 "RimCommandObject.h"
|
||||
|
||||
#include "RiaApplication.h"
|
||||
#include "RimCalcScript.h"
|
||||
#include "RimEclipseStatisticsCase.h"
|
||||
#include "RimProject.h"
|
||||
|
||||
#include "cafPdmObjectGroup.h"
|
||||
#include "cafPdmUiPushButtonEditor.h"
|
||||
#include "cafPdmUiTextEditor.h"
|
||||
#include "cafPdmValueField.h"
|
||||
|
||||
#include <QFile>
|
||||
|
||||
CAF_PDM_SOURCE_INIT( RimCommandObject, "RimCommandObject" );
|
||||
CAF_PDM_SOURCE_INIT( RimCommandExecuteScript, "RimCommandExecuteScript" );
|
||||
CAF_PDM_SOURCE_INIT( RimCommandIssueFieldChanged, "RimCommandIssueFieldChanged" );
|
||||
|
||||
//------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCommandObject::RimCommandObject()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCommandObject::~RimCommandObject()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCommandExecuteScript::RimCommandExecuteScript()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &name, "Name", "Name" );
|
||||
|
||||
CAF_PDM_InitField( &scriptText, "ScriptText", QString(), "Script Text" );
|
||||
scriptText.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() );
|
||||
|
||||
CAF_PDM_InitField( &isEnabled, "IsEnabled", true, "Enabled " );
|
||||
|
||||
CAF_PDM_InitField( &execute, "Execute", true, "Execute" );
|
||||
caf::PdmUiPushButtonEditor::configureEditorLabelHidden( &execute );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCommandExecuteScript::~RimCommandExecuteScript()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCommandExecuteScript::redo()
|
||||
{
|
||||
if ( !isEnabled ) return;
|
||||
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
QString octavePath = app->octavePath();
|
||||
if ( !octavePath.isEmpty() )
|
||||
{
|
||||
QStringList arguments = app->octaveArguments();
|
||||
|
||||
arguments.append( "--eval" );
|
||||
arguments << scriptText();
|
||||
|
||||
RiaApplication::instance()->launchProcess( octavePath, arguments, app->octaveProcessEnvironment() );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCommandExecuteScript::undo()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCommandExecuteScript::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute )
|
||||
{
|
||||
caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast<caf::PdmUiTextEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
{
|
||||
myAttr->showSaveButton = true;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCommandExecuteScript::userDescriptionField()
|
||||
{
|
||||
return &name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCommandExecuteScript::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( &execute == changedField )
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
app->addCommandObject( this );
|
||||
app->executeCommandObjects();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimCommandExecuteScript::isAsyncronous()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCommandFactory::createCommandObjects( const caf::PdmObjectGroup& selectedObjects, std::vector<RimCommandObject*>* commandObjects )
|
||||
{
|
||||
for ( size_t i = 0; i < selectedObjects.objects.size(); i++ )
|
||||
{
|
||||
caf::PdmObjectHandle* pdmObject = selectedObjects.objects[i];
|
||||
|
||||
if ( dynamic_cast<RimCalcScript*>( pdmObject ) )
|
||||
{
|
||||
RimCalcScript* calcScript = dynamic_cast<RimCalcScript*>( pdmObject );
|
||||
|
||||
QFile file( calcScript->absoluteFileName );
|
||||
if ( file.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||
{
|
||||
QTextStream in( &file );
|
||||
QByteArray byteArray = file.readAll();
|
||||
QString scriptText( byteArray );
|
||||
|
||||
RimCommandExecuteScript* command = new RimCommandExecuteScript;
|
||||
command->scriptText = scriptText;
|
||||
|
||||
commandObjects->push_back( command );
|
||||
}
|
||||
}
|
||||
else if ( dynamic_cast<RimEclipseStatisticsCase*>( pdmObject ) )
|
||||
{
|
||||
RimEclipseStatisticsCase* statisticsCase = dynamic_cast<RimEclipseStatisticsCase*>( pdmObject );
|
||||
|
||||
RimCommandIssueFieldChanged* command = new RimCommandIssueFieldChanged;
|
||||
command->objectName = statisticsCase->uiName();
|
||||
command->fieldName = statisticsCase->m_calculateEditCommand.keyword();
|
||||
command->fieldValueToApply = "true";
|
||||
|
||||
commandObjects->push_back( command );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCommandIssueFieldChanged::RimCommandIssueFieldChanged()
|
||||
{
|
||||
CAF_PDM_InitFieldNoDefault( &commandName, "CommandName", "CommandName" );
|
||||
|
||||
CAF_PDM_InitField( &objectName, "ObjectName", QString(), "ObjectName" );
|
||||
CAF_PDM_InitField( &fieldName, "FieldName", QString(), "FieldName" );
|
||||
CAF_PDM_InitField( &fieldValueToApply, "FieldValueToApply", QString(), "FieldValueToApply" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCommandIssueFieldChanged::~RimCommandIssueFieldChanged()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCommandIssueFieldChanged::redo()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
PdmObject* project = app->project();
|
||||
|
||||
caf::PdmObjectHandle* pdmObject = findObjectByName( project, objectName );
|
||||
|
||||
if ( pdmObject )
|
||||
{
|
||||
caf::PdmFieldHandle* fieldHandle = findFieldByKeyword( pdmObject, fieldName );
|
||||
|
||||
if ( fieldHandle && fieldHandle->uiCapability() )
|
||||
{
|
||||
caf::PdmValueField* valueField = dynamic_cast<caf::PdmValueField*>( fieldHandle );
|
||||
CVF_ASSERT( valueField );
|
||||
|
||||
QVariant oldValue = valueField->toQVariant();
|
||||
QVariant newValue( fieldValueToApply );
|
||||
|
||||
valueField->setFromQVariant( newValue );
|
||||
|
||||
caf::PdmUiFieldHandle* uiFieldHandle = fieldHandle->uiCapability();
|
||||
uiFieldHandle->notifyFieldChanged( oldValue, newValue );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCommandIssueFieldChanged::undo()
|
||||
{
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCommandIssueFieldChanged::userDescriptionField()
|
||||
{
|
||||
return &commandName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimCommandIssueFieldChanged::childObjects( caf::PdmObject* pdmObject, std::vector<caf::PdmObjectHandle*>& children )
|
||||
{
|
||||
if ( !pdmObject ) return;
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> fields = pdmObject->fields();
|
||||
|
||||
size_t fIdx;
|
||||
for ( fIdx = 0; fIdx < fields.size(); ++fIdx )
|
||||
{
|
||||
if ( fields[fIdx] )
|
||||
{
|
||||
auto other = fields[fIdx]->children();
|
||||
children.insert( children.end(), other.begin(), other.end() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmObjectHandle* RimCommandIssueFieldChanged::findObjectByName( caf::PdmObjectHandle* pdmObject, const QString& name )
|
||||
{
|
||||
std::vector<caf::PdmFieldHandle*> fields = pdmObject->fields();
|
||||
|
||||
caf::PdmUiObjectHandle* uiObjectHandle = uiObj( pdmObject );
|
||||
|
||||
if ( uiObjectHandle && uiObjectHandle->uiName() == name )
|
||||
{
|
||||
return pdmObject;
|
||||
}
|
||||
|
||||
for ( size_t fIdx = 0; fIdx < fields.size(); fIdx++ )
|
||||
{
|
||||
if ( fields[fIdx] )
|
||||
{
|
||||
std::vector<caf::PdmObjectHandle*> children = fields[fIdx]->children();
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < children.size(); cIdx++ )
|
||||
{
|
||||
PdmObjectHandle* candidateObj = findObjectByName( children[cIdx], name );
|
||||
if ( candidateObj )
|
||||
{
|
||||
return candidateObj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimCommandIssueFieldChanged::findFieldByKeyword( caf::PdmObjectHandle* pdmObject, const QString& keywordName )
|
||||
{
|
||||
std::vector<caf::PdmFieldHandle*> fields = pdmObject->fields();
|
||||
|
||||
for ( size_t fIdx = 0; fIdx < fields.size(); fIdx++ )
|
||||
{
|
||||
if ( fields[fIdx] && fields[fIdx]->keyword() == keywordName )
|
||||
{
|
||||
return fields[fIdx];
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011- Statoil ASA
|
||||
// Copyright (C) 2013- Ceetron Solutions AS
|
||||
// Copyright (C) 2011-2012 Ceetron AS
|
||||
//
|
||||
// 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 "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmObjectGroup.h"
|
||||
|
||||
#include "cvfObject.h"
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimCommandObject : public caf::PdmObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimCommandObject();
|
||||
~RimCommandObject() override;
|
||||
|
||||
virtual bool isAsyncronous() { return false; };
|
||||
|
||||
virtual void redo(){};
|
||||
virtual void undo(){};
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimCommandExecuteScript : public RimCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimCommandExecuteScript();
|
||||
~RimCommandExecuteScript() override;
|
||||
|
||||
caf::PdmField<QString> name;
|
||||
caf::PdmField<bool> isEnabled;
|
||||
caf::PdmField<bool> execute;
|
||||
caf::PdmField<QString> scriptText;
|
||||
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override;
|
||||
|
||||
bool isAsyncronous() override;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimCommandIssueFieldChanged : public RimCommandObject
|
||||
{
|
||||
CAF_PDM_HEADER_INIT;
|
||||
|
||||
public:
|
||||
RimCommandIssueFieldChanged();
|
||||
~RimCommandIssueFieldChanged() override;
|
||||
|
||||
caf::PdmField<QString> commandName;
|
||||
caf::PdmField<QString> objectName;
|
||||
caf::PdmField<QString> fieldName;
|
||||
caf::PdmField<QString> fieldValueToApply;
|
||||
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
|
||||
caf::PdmFieldHandle* userDescriptionField() override;
|
||||
|
||||
private:
|
||||
void childObjects( caf::PdmObject* pdmObject, std::vector<caf::PdmObjectHandle*>& children );
|
||||
caf::PdmObjectHandle* findObjectByName( caf::PdmObjectHandle* root, const QString& name );
|
||||
caf::PdmFieldHandle* findFieldByKeyword( caf::PdmObjectHandle* pdmObject, const QString& fieldName );
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
class RimCommandFactory
|
||||
{
|
||||
public:
|
||||
static void createCommandObjects( const caf::PdmObjectGroup& selectedObjects, std::vector<RimCommandObject*>* commandObjects );
|
||||
};
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "RimCase.h"
|
||||
#include "RimCaseCollection.h"
|
||||
#include "RimColorLegendCollection.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimCompletionTemplateCollection.h"
|
||||
#include "RimContextCommandBuilder.h"
|
||||
#include "RimCorrelationPlotCollection.h"
|
||||
@@ -172,8 +171,6 @@ RimProject::RimProject()
|
||||
CAF_PDM_InitFieldNoDefault( &gridCalculationCollection, "GridCalculationCollection", "Grid Calculation Collection" );
|
||||
gridCalculationCollection = new RimGridCalculationCollection;
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewStates, "TreeViewStates", "" );
|
||||
@@ -267,8 +264,6 @@ void RimProject::close()
|
||||
casesObsolete.deleteChildren();
|
||||
caseGroupsObsolete.deleteChildren();
|
||||
|
||||
commandObjects.deleteChildren();
|
||||
|
||||
multiSnapshotDefinitions.deleteChildren();
|
||||
|
||||
m_dialogData->clearProjectSpecificData();
|
||||
|
||||
@@ -43,8 +43,6 @@ class RimPolylinesAnnotation;
|
||||
class RimSummaryCalculationCollection;
|
||||
class RimSummaryCalculation;
|
||||
class RimCase;
|
||||
class RimCommandObject;
|
||||
class RimCommandObject;
|
||||
class RimDialogData;
|
||||
class RimEclipseCase;
|
||||
class RimGeoMechCase;
|
||||
@@ -101,7 +99,6 @@ public:
|
||||
caf::PdmChildField<RimViewLinkerCollection*> viewLinkerCollection;
|
||||
caf::PdmChildField<RimSummaryCalculationCollection*> calculationCollection;
|
||||
caf::PdmChildField<RimGridCalculationCollection*> gridCalculationCollection;
|
||||
caf::PdmChildArrayField<RimCommandObject*> commandObjects;
|
||||
|
||||
RimMainPlotCollection* mainPlotCollection() const;
|
||||
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "Rim2dIntersectionView.h"
|
||||
#include "Rim3dView.h"
|
||||
#include "RimCellEdgeColors.h"
|
||||
#include "RimCommandObject.h"
|
||||
#include "RimEclipseCase.h"
|
||||
#include "RimEclipseCellColors.h"
|
||||
#include "RimEclipseContourMapView.h"
|
||||
@@ -358,7 +357,6 @@ void RiuMainWindow::createActions()
|
||||
|
||||
m_snapshotAllViewsToFile = new QAction( QIcon( ":/SnapShotSaveViews.svg" ), "Snapshot All Views To File", this );
|
||||
|
||||
m_createCommandObject = new QAction( "Create Command Object", this );
|
||||
m_showRegressionTestDialog = new QAction( "Regression Test Dialog", this );
|
||||
m_executePaintEventPerformanceTest = new QAction( "&Paint Event Performance Test", this );
|
||||
|
||||
@@ -370,7 +368,6 @@ void RiuMainWindow::createActions()
|
||||
|
||||
connect( m_snapshotAllViewsToFile, SIGNAL( triggered() ), SLOT( slotSnapshotAllViewsToFile() ) );
|
||||
|
||||
connect( m_createCommandObject, SIGNAL( triggered() ), SLOT( slotCreateCommandObject() ) );
|
||||
connect( m_showRegressionTestDialog, SIGNAL( triggered() ), SLOT( slotShowRegressionTestDialog() ) );
|
||||
connect( m_executePaintEventPerformanceTest, SIGNAL( triggered() ), SLOT( slotExecutePaintEventPerformanceTest() ) );
|
||||
|
||||
@@ -532,8 +529,6 @@ void RiuMainWindow::createMenus()
|
||||
testMenu->addAction( m_mockModelCustomizedAction );
|
||||
testMenu->addAction( m_mockInputModelAction );
|
||||
testMenu->addSeparator();
|
||||
testMenu->addAction( m_createCommandObject );
|
||||
testMenu->addSeparator();
|
||||
testMenu->addAction( m_showRegressionTestDialog );
|
||||
testMenu->addAction( m_executePaintEventPerformanceTest );
|
||||
testMenu->addAction( cmdFeatureMgr->action( "RicRunCommandFileFeature" ) );
|
||||
@@ -1928,44 +1923,6 @@ void RiuMainWindow::selectedCases( std::vector<RimCase*>& cases )
|
||||
caf::SelectionManager::instance()->objectsByType( &cases );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiuMainWindow::slotCreateCommandObject()
|
||||
{
|
||||
RiaApplication* app = RiaApplication::instance();
|
||||
if ( !app->project() ) return;
|
||||
|
||||
caf::PdmUiTreeView* projectTree = dynamic_cast<caf::PdmUiTreeView*>( sender() );
|
||||
if ( !projectTree ) return;
|
||||
|
||||
std::vector<caf::PdmUiItem*> selectedUiItems;
|
||||
projectTree->selectedUiItems( selectedUiItems );
|
||||
|
||||
caf::PdmObjectGroup selectedObjects;
|
||||
for ( auto* selectedUiItem : selectedUiItems )
|
||||
{
|
||||
caf::PdmUiObjectHandle* uiObj = dynamic_cast<caf::PdmUiObjectHandle*>( selectedUiItem );
|
||||
if ( uiObj )
|
||||
{
|
||||
selectedObjects.addObject( uiObj->objectHandle() );
|
||||
}
|
||||
}
|
||||
|
||||
if ( !selectedObjects.objects.empty() )
|
||||
{
|
||||
std::vector<RimCommandObject*> commandObjects;
|
||||
RimCommandFactory::createCommandObjects( selectedObjects, &commandObjects );
|
||||
|
||||
for ( auto* commandObject : commandObjects )
|
||||
{
|
||||
app->project()->commandObjects.push_back( commandObject );
|
||||
}
|
||||
|
||||
app->project()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -173,7 +173,6 @@ private:
|
||||
|
||||
QAction* m_snapshotAllViewsToFile;
|
||||
|
||||
QAction* m_createCommandObject;
|
||||
QAction* m_showRegressionTestDialog;
|
||||
QAction* m_executePaintEventPerformanceTest;
|
||||
|
||||
@@ -235,8 +234,6 @@ private slots:
|
||||
// Debug slots
|
||||
void slotSnapshotAllViewsToFile();
|
||||
|
||||
void slotCreateCommandObject();
|
||||
|
||||
void slotShowRegressionTestDialog();
|
||||
void slotExecutePaintEventPerformanceTest();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user