mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Update text for curve names and plot titles when source data changes
* Update titles after dropping vectors into plot * Do not replace _Name variables * Make sure signals are wired when opening a project file * Add auto name field and set default on * Remove includes from header files
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "RimSummaryCaseCollection.h"
|
||||
|
||||
#include "RiaEnsembleNameTools.h"
|
||||
#include "RiaFieldHandleTools.h"
|
||||
#include "RiaLogging.h"
|
||||
#include "RiaStatisticsTools.h"
|
||||
@@ -115,6 +116,7 @@ RimSummaryCaseCollection::RimSummaryCaseCollection()
|
||||
m_cases.uiCapability()->setUiTreeHidden( true );
|
||||
|
||||
CAF_PDM_InitScriptableField( &m_name, "SummaryCollectionName", QString( "Group" ), "Name" );
|
||||
CAF_PDM_InitScriptableField( &m_autoName, "CreateAutoName", true, "Auto Name" );
|
||||
|
||||
CAF_PDM_InitScriptableFieldNoDefault( &m_nameAndItemCount, "NameCount", "Name" );
|
||||
m_nameAndItemCount.registerGetMethod( this, &RimSummaryCaseCollection::nameAndItemCount );
|
||||
@@ -246,6 +248,28 @@ QString RimSummaryCaseCollection::name() const
|
||||
return m_name;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseCollection::ensureNameIsUpdated()
|
||||
{
|
||||
if ( m_autoName )
|
||||
{
|
||||
QStringList fileNames;
|
||||
for ( const auto& summaryCase : m_cases )
|
||||
{
|
||||
fileNames.push_back( summaryCase->summaryHeaderFilename() );
|
||||
}
|
||||
|
||||
RiaEnsembleNameTools::EnsembleGroupingMode groupingMode =
|
||||
RiaEnsembleNameTools::EnsembleGroupingMode::FMU_FOLDER_STRUCTURE;
|
||||
|
||||
QString ensembleName = RiaEnsembleNameTools::findSuitableEnsembleName( fileNames, groupingMode );
|
||||
m_name = ensembleName;
|
||||
caseNameChanged.send();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1036,6 +1060,11 @@ void RimSummaryCaseCollection::initAfterRead()
|
||||
}
|
||||
|
||||
updateIcon();
|
||||
|
||||
for ( const auto& summaryCase : m_cases )
|
||||
{
|
||||
summaryCase->nameChanged.connect( this, &RimSummaryCaseCollection::onCaseNameChanged );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1049,6 +1078,14 @@ void RimSummaryCaseCollection::fieldChangedByUi( const caf::PdmFieldHandle* chan
|
||||
{
|
||||
updateIcon();
|
||||
}
|
||||
if ( changedField == &m_autoName )
|
||||
{
|
||||
ensureNameIsUpdated();
|
||||
}
|
||||
if ( changedField == &m_name )
|
||||
{
|
||||
caseNameChanged.send();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1064,7 +1101,9 @@ void RimSummaryCaseCollection::onCaseNameChanged( const SignalEmitter* emitter )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimSummaryCaseCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
uiOrdering.add( &m_autoName );
|
||||
uiOrdering.add( &m_name );
|
||||
m_name.uiCapability()->setUiReadOnly( m_autoName() );
|
||||
if ( m_isEnsemble() )
|
||||
{
|
||||
uiOrdering.add( &m_ensembleId );
|
||||
|
||||
Reference in New Issue
Block a user