From 453562082dc6b572847bec40e2cba4c6395df7c5 Mon Sep 17 00:00:00 2001 From: JJ <69144954+jonjenssen@users.noreply.github.com> Date: Mon, 3 Nov 2025 18:41:55 +0100 Subject: [PATCH] Summary case refresh update. (#13123) Use improved opm-common reader with less throws. Add reload selected cases button Add timer for auto-reload of cases Add include in auto update option for cases and ensembles Do not enable auto reload option for cases in an ensemble --- ApplicationExeCode/Resources/ResInsight.qrc | 1 + ApplicationExeCode/Resources/TimedRefresh.png | Bin 0 -> 6436 bytes .../Commands/RicReloadSummaryCaseFeature.cpp | 63 +++++++++++++----- .../Commands/RicReloadSummaryCaseFeature.h | 4 ++ .../Ensemble/RimSummaryFileSetEnsemble.cpp | 1 + .../Summary/RimSummaryCase.cpp | 27 +++++++- .../ProjectDataModel/Summary/RimSummaryCase.h | 3 + .../Summary/RimSummaryEnsemble.cpp | 31 +++++++++ .../Summary/RimSummaryEnsemble.h | 4 ++ .../Tools/RimAutomationSettings.cpp | 17 +++++ .../Tools/RimAutomationSettings.h | 3 + .../UserInterface/RiuPlotMainWindow.cpp | 60 +++++++++++++++++ .../UserInterface/RiuPlotMainWindow.h | 7 ++ ThirdParty/custom-opm-common/opm-common | 2 +- 14 files changed, 202 insertions(+), 21 deletions(-) create mode 100644 ApplicationExeCode/Resources/TimedRefresh.png diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index c939613301..8100efc223 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -300,6 +300,7 @@ pinned.svg pinned-remove.svg Select.svg + TimedRefresh.png NavigationProperty.svg user-defined-view.svg stop.svg diff --git a/ApplicationExeCode/Resources/TimedRefresh.png b/ApplicationExeCode/Resources/TimedRefresh.png new file mode 100644 index 0000000000000000000000000000000000000000..5dac4b57e702f85fe003ac1dd1b223d09542f093 GIT binary patch literal 6436 zcmZ{JXH-*B({4xt1OkF|q)SsIbm>)Tp^4Hv2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DQx5sBlEJ@qT5&y)dfP&P63`7SgpN2tPUw?oI5{ zq<%$}s!GMVJ;T+aD|f2>l8X1<4mDHwXx>N?c0bvdix#?)Gr~y1rR1nSa%FR+%Ib## z=k2gdmIbzD${^=N4%2swSCX#uc4(LK<_M@06tlHfPa>#n|6=^Y$JiIZsCQ58n~Yse@kL?pCLBv9xzT zx1@=npS~{*v&y#G%0GJ#A$CgG)Qq_>k|kdn)5&2xaZLUaAWX(8`lsE8!neHcZ?kft zXKlcM3*}Li20apnU5?G6;>>qrHBKUxx?07!^=GLSxhFw^1smKReaYf+S-9AmW_3AU zSK zC93Hu4q{&pSj$RH(-m&5{jqQKW{XwQpEj)K!cNjo_QXBpmFqyuQ}i%I7gnKs@@F=} z?YWZ#D|nXhx&ki@`ePb+06Ij~q+!_h#U$)zTk+@5A>PkaE_CU$(lE0$@98*#Aw3qj zODWC@z0-G|eA+G;Ms+^1u+tClmKKg+Kdah1j`3&Jn1%%FYcFh=c8u6!D{5;Do*ty( z?%~l&?be&e)-u<;`w zn2L(5RWAhGo$?)LQ(a}*o)u)J8U@C?hCedf8xdZo$SBR%XyGHD(Y1!0HF21pGF$e2 z#G@8{X$n;MQ*?ht;QgOC&;Wa1y9r1M(sZ5Q#XM>E5gT{3j;nfR<@hR|F_e4#LcNin zri=9~>dh#9I~xPIBT#x~EWxfl*#9O1(V(6gIn#ZL6Wip_6^FiKEt_>B67nKW-dJEG z21ZB*@{AobjectsByType(); - if ( !ensembles.empty() ) - { - for ( RimSummaryEnsemble* ensemble : ensembles ) - { - ensemble->reloadCases(); - } - - return; - } - - std::vector caseSelection = selectedSummaryCases(); - for ( RimSummaryCase* summaryCase : caseSelection ) - { - RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( summaryCase ); - - RiaLogging::info( QString( "Reloaded data for %1" ).arg( summaryCase->summaryHeaderFilename() ) ); - } + reloadSelectedCasesAndUpdate(); } //-------------------------------------------------------------------------------------------------- @@ -77,6 +61,7 @@ void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked ) void RicReloadSummaryCaseFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "Reload" ); + actionToSetup->setToolTip( "Reload selected summary and/or ensemble cases" ); actionToSetup->setIcon( QIcon( ":/Refresh.svg" ) ); } @@ -103,3 +88,45 @@ std::vector RicReloadSummaryCaseFeature::selectedSummaryCases() return caseSelection; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicReloadSummaryCaseFeature::reloadTaggedSummaryCasesAndUpdate() +{ + auto proj = RimProject::current(); + for ( auto summaryCase : proj->allSummaryCases() ) + { + if ( summaryCase->includeInAutoReload() ) RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( summaryCase ); + } + + for ( RimSummaryEnsemble* ensemble : proj->summaryEnsembles() ) + { + if ( ensemble->includeInAutoReload() ) ensemble->reloadCases(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicReloadSummaryCaseFeature::reloadSelectedCasesAndUpdate() +{ + auto ensembles = caf::SelectionManager::instance()->objectsByType(); + if ( !ensembles.empty() ) + { + for ( RimSummaryEnsemble* ensemble : ensembles ) + { + ensemble->reloadCases(); + } + + return; + } + + std::vector caseSelection = selectedSummaryCases(); + for ( RimSummaryCase* summaryCase : caseSelection ) + { + RiaSummaryTools::reloadSummaryCaseAndUpdateConnectedPlots( summaryCase ); + + RiaLogging::info( QString( "Reloaded data for %1" ).arg( summaryCase->summaryHeaderFilename() ) ); + } +} \ No newline at end of file diff --git a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.h b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.h index d756c8462e..61e6c76b16 100644 --- a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.h +++ b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.h @@ -28,6 +28,10 @@ class RicReloadSummaryCaseFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; +public: + static void reloadTaggedSummaryCasesAndUpdate(); + static void reloadSelectedCasesAndUpdate(); + protected: bool isCommandEnabled() const override; void onActionTriggered( bool isChecked ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/Ensemble/RimSummaryFileSetEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/Summary/Ensemble/RimSummaryFileSetEnsemble.cpp index c9d39b70ee..23e93949e9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/Ensemble/RimSummaryFileSetEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/Ensemble/RimSummaryFileSetEnsemble.cpp @@ -213,6 +213,7 @@ void RimSummaryFileSetEnsemble::defineUiOrdering( QString uiConfigName, caf::Pdm auto group = uiOrdering.addNewGroup( "Ensemble Definition" ); m_ensembleFileSet()->uiOrdering( uiConfigName, *group ); } + uiOrdering.add( &m_includeInAutoReload ); auto developersGroup = uiOrdering.addNewGroup( " -- Developers --" ); developersGroup->setCollapsedByDefault(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index 4e2c332e4a..8e6ba3d874 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -49,6 +49,9 @@ RimSummaryCase::RimSummaryCase() CAF_PDM_InitScriptableField( &m_showSubNodesInTree, "ShowSubNodesInTree", true, "Show Summary Data Sub-Tree" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showSubNodesInTree ); + CAF_PDM_InitScriptableField( &m_includeInAutoReload, "IncludeInAutoReload", false, "Include in Automatic Case Reloads" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_includeInAutoReload ); + CAF_PDM_InitScriptableField( &m_useAutoShortName_OBSOLETE, "AutoShortyName", false, "Use Auto Display Name" ); m_useAutoShortName_OBSOLETE.xmlCapability()->setIOWritable( false ); m_useAutoShortName_OBSOLETE.uiCapability()->setUiHidden( true ); @@ -299,6 +302,12 @@ void RimSummaryCase::defineObjectEditorAttribute( QString uiConfigName, caf::Pdm treeItemAttribute->tags.push_back( std::move( tag ) ); } + if ( m_includeInAutoReload() ) + { + auto tag = caf::PdmUiTreeViewItemAttribute::createTag(); + tag->icon = caf::IconProvider( ":/TimedRefresh.png" ); + treeItemAttribute->tags.push_back( std::move( tag ) ); + } } } @@ -311,8 +320,14 @@ void RimSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering.add( &m_displayNameOption ); uiOrdering.add( &m_summaryHeaderFilename ); uiOrdering.add( &m_caseId ); - - if ( ensemble() ) uiOrdering.add( &m_showSubNodesInTree ); + if ( ensemble() ) + { + uiOrdering.add( &m_showSubNodesInTree ); + } + else + { + uiOrdering.add( &m_includeInAutoReload ); + } uiOrdering.skipRemainingFields( true ); } @@ -425,6 +440,14 @@ void RimSummaryCase::updateAutoShortName() updateTreeItemName(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryCase::includeInAutoReload() const +{ + return m_includeInAutoReload; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h index 748a5754d7..dc579500c5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h @@ -91,6 +91,8 @@ public: void copyFrom( const RimSummaryCase& rhs ); bool operator<( const RimSummaryCase& rhs ) const; + bool includeInAutoReload() const; + protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; @@ -116,6 +118,7 @@ protected: caf::PdmField m_summaryHeaderFilename; caf::PdmField m_showSubNodesInTree; + caf::PdmField m_includeInAutoReload; caf::PdmChildField m_dataVectorFolders; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp index ad6ec4f7b3..44f87a030a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.cpp @@ -42,8 +42,10 @@ #include "cafCmdFeatureMenuBuilder.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmObjectScriptingCapability.h" +#include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiLineEditor.h" #include "cafPdmUiTextEditor.h" +#include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeOrdering.h" #include @@ -74,6 +76,9 @@ RimSummaryEnsemble::RimSummaryEnsemble() CAF_PDM_InitFieldNoDefault( &m_groupingMode, "GroupingMode", "Grouping Mode" ); + CAF_PDM_InitScriptableField( &m_includeInAutoReload, "IncludeInAutoReload", false, "Include in Automatic Case Reloads" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_includeInAutoReload ); + CAF_PDM_InitScriptableFieldNoDefault( &m_nameAndItemCount, "NameCount", "Name" ); m_nameAndItemCount.registerGetMethod( this, &RimSummaryEnsemble::nameAndItemCount ); RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_nameAndItemCount ); @@ -985,6 +990,8 @@ void RimSummaryEnsemble::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder uiOrdering.add( &m_ensembleDescription ); + uiOrdering.add( &m_includeInAutoReload ); + uiOrdering.skipRemainingFields( true ); } @@ -1029,6 +1036,22 @@ void RimSummaryEnsemble::defineEditorAttribute( const caf::PdmFieldHandle* field } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryEnsemble::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +{ + if ( auto* treeItemAttribute = dynamic_cast( attribute ) ) + { + if ( m_includeInAutoReload() ) + { + auto tag = caf::PdmUiTreeViewItemAttribute::createTag(); + tag->icon = caf::IconProvider( ":/TimedRefresh.png" ); + treeItemAttribute->tags.push_back( std::move( tag ) ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1233,3 +1256,11 @@ void RimSummaryEnsemble::clearChildNodes() { m_dataVectorFolders->deleteChildren(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryEnsemble::includeInAutoReload() const +{ + return m_includeInAutoReload(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.h index 2dccb5b070..2a84c41a9a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryEnsemble.h @@ -122,6 +122,8 @@ public: virtual void cleanupBeforeDelete(); + bool includeInAutoReload() const; + protected: virtual void onLoadDataAndUpdate(); @@ -139,6 +141,7 @@ private: caf::PdmFieldHandle* userDescriptionField() override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; QString nameAndItemCount() const; void updateIcon(); @@ -154,6 +157,7 @@ private: protected: caf::PdmChildArrayField m_cases; caf::PdmField m_name; + caf::PdmField m_includeInAutoReload; private: caf::PdmField m_nameTemplateString; diff --git a/ApplicationLibCode/ProjectDataModel/Tools/RimAutomationSettings.cpp b/ApplicationLibCode/ProjectDataModel/Tools/RimAutomationSettings.cpp index 1032c760f3..ffaa319553 100644 --- a/ApplicationLibCode/ProjectDataModel/Tools/RimAutomationSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Tools/RimAutomationSettings.cpp @@ -42,6 +42,12 @@ RimAutomationSettings::RimAutomationSettings() "Cell Selection Destination", "", "Add curves to the selected Summary Plot when clicking on cells in a 3D view." ); + + CAF_PDM_InitField( &m_caseReloadIntervalSeconds, + "CaseReloadIntervalSeconds", + 15, + "Case Reload Interval (seconds)", + "Interval in seconds for automatic reload of cases when enabled." ); } //-------------------------------------------------------------------------------------------------- @@ -79,6 +85,9 @@ void RimAutomationSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOr group->add( &m_cellSelectionDestination ); m_cellSelectionDestination.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + + auto refreshGrp = uiOrdering.addNewGroup( "Plot Update" ); + refreshGrp->add( &m_caseReloadIntervalSeconds ); } //-------------------------------------------------------------------------------------------------- @@ -112,3 +121,11 @@ QList RimAutomationSettings::calculateValueOptions( cons return options; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimAutomationSettings::caseReloadIntervalMs() const +{ + return m_caseReloadIntervalSeconds() * 1000; +} diff --git a/ApplicationLibCode/ProjectDataModel/Tools/RimAutomationSettings.h b/ApplicationLibCode/ProjectDataModel/Tools/RimAutomationSettings.h index 10c50e3779..4ec889b1a0 100644 --- a/ApplicationLibCode/ProjectDataModel/Tools/RimAutomationSettings.h +++ b/ApplicationLibCode/ProjectDataModel/Tools/RimAutomationSettings.h @@ -40,10 +40,13 @@ public: void setDestinationPlot( RimPlotWindow* plotWindow ); + int caseReloadIntervalMs() const; + private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: caf::PdmPtrField m_cellSelectionDestination; + caf::PdmField m_caseReloadIntervalSeconds; }; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index cc7e66a4f8..1d682d3e6a 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -44,7 +44,9 @@ #include "RimWellLogCurveCommonDataSource.h" #include "RimWellLogPlot.h" #include "RimWellRftPlot.h" +#include "Tools/RimAutomationSettings.h" +#include "RicReloadSummaryCaseFeature.h" #include "SummaryPlotCommands/RicSummaryCurveCalculatorDialog.h" #include "SummaryPlotCommands/RicSummaryPlotEditorDialog.h" @@ -79,6 +81,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +94,9 @@ RiuPlotMainWindow::RiuPlotMainWindow() : m_activePlotViewWindow( nullptr ) , m_selection3DLinkEnabled( false ) , m_toggleSelectionLinkAction( nullptr ) + , m_toggleAutoUpdateAction( nullptr ) + , m_autoUpdateEnabled( false ) + , m_autoUpdateTimerId( -1 ) { m_mdiArea = new RiuMdiArea( this ); connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); @@ -112,6 +118,17 @@ RiuPlotMainWindow::RiuPlotMainWindow() m_toggleSelectionLinkAction->setChecked( m_selection3DLinkEnabled ); connect( m_toggleSelectionLinkAction, SIGNAL( triggered() ), SLOT( slotToggleSelectionLink() ) ); + m_toggleAutoUpdateAction = new QAction( QIcon( ":/TimedRefresh.png" ), tr( "Auto-update plots." ), this ); + m_toggleAutoUpdateAction->setToolTip( "Reload cases at interval specified in Automation Settings." ); + m_toggleAutoUpdateAction->setCheckable( true ); + m_toggleAutoUpdateAction->setChecked( m_autoUpdateEnabled ); + connect( m_toggleAutoUpdateAction, SIGNAL( triggered() ), SLOT( slotToggleAutoUpdate() ) ); + + m_reloadSelectedCasesAction = new QAction( QIcon( ":/Refresh.svg" ), tr( "Reload Selected Cases" ), this ); + m_reloadSelectedCasesAction->setToolTip( "Reload selected summary and/or ensemble cases." ); + m_reloadSelectedCasesAction->setCheckable( false ); + connect( m_reloadSelectedCasesAction, SIGNAL( triggered() ), SLOT( slotReloadSelectedCases() ) ); + createMenus(); createToolBars(); createDockPanels(); @@ -430,6 +447,8 @@ void RiuPlotMainWindow::createToolBars() if ( toolbarName == "View" ) { toolbar->addAction( m_toggleSelectionLinkAction ); + toolbar->addAction( m_reloadSelectedCasesAction ); + toolbar->addAction( m_toggleAutoUpdateAction ); } } @@ -1113,3 +1132,44 @@ void RiuPlotMainWindow::slotToggleSelectionLink() { m_selection3DLinkEnabled = !m_selection3DLinkEnabled; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::slotToggleAutoUpdate() +{ + m_autoUpdateEnabled = !m_autoUpdateEnabled; + + if ( ( m_autoUpdateEnabled ) && ( m_autoUpdateTimerId == -1 ) ) + { + auto intervalMs = RimProject::current()->automationSettings()->caseReloadIntervalMs(); + m_autoUpdateTimerId = startTimer( intervalMs ); + } + else + { + if ( m_autoUpdateTimerId != -1 ) + { + killTimer( m_autoUpdateTimerId ); + m_autoUpdateTimerId = -1; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::slotReloadSelectedCases() +{ + RicReloadSummaryCaseFeature::reloadSelectedCasesAndUpdate(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::timerEvent( QTimerEvent* event ) +{ + if ( event->timerId() == m_autoUpdateTimerId ) + { + RicReloadSummaryCaseFeature::reloadTaggedSummaryCasesAndUpdate(); + } +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 139b25ad23..89d4d4d387 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -99,6 +99,7 @@ protected: void keyPressEvent( QKeyEvent* ) override; void dragEnterEvent( QDragEnterEvent* event ) override; void dropEvent( QDropEvent* event ) override; + void timerEvent( QTimerEvent* event ) override; QStringList defaultDockStateNames() override; QStringList windowsMenuFeatureNames() override; @@ -118,6 +119,8 @@ private: private slots: void slotToggleSelectionLink(); + void slotToggleAutoUpdate(); + void slotReloadSelectedCases(); friend class RiuMdiSubWindow; @@ -146,4 +149,8 @@ private: QAction* m_toggleSelectionLinkAction; bool m_selection3DLinkEnabled; + QAction* m_toggleAutoUpdateAction; + bool m_autoUpdateEnabled; + int m_autoUpdateTimerId; + QAction* m_reloadSelectedCasesAction; }; diff --git a/ThirdParty/custom-opm-common/opm-common b/ThirdParty/custom-opm-common/opm-common index d1c7e87951..4fb60d2852 160000 --- a/ThirdParty/custom-opm-common/opm-common +++ b/ThirdParty/custom-opm-common/opm-common @@ -1 +1 @@ -Subproject commit d1c7e8795133c6c49fc295a64279b23dbd6756f5 +Subproject commit 4fb60d2852da6853a4d823b61f9179df79af31d4