mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-26 15:10:22 -05:00
#14081 Move experimental feature selection to its own Preferences tab
Promote the experimental feature checkboxes out of the development-only System tab into a dedicated, always-visible Experimental tab so end users can opt into experimental features without enabling development features. The m_enabledFeatures field stays owned by RiaPreferencesSystem, so its keyword, value options and legacy-keyword migration are unchanged.
This commit is contained in:
1 parent
054dbdb255
commit
c1ea8261aa
4 files changed
+68
-5
No files matched your search
@@ -531,6 +531,10 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
openTelemetryGroup->setCollapsedByDefault();
|
||||
m_openTelemetryPreferences()->uiOrdering( uiConfigName, *openTelemetryGroup );
|
||||
}
|
||||
else if ( uiConfigName == RiaPreferences::tabNameExperimental() )
|
||||
{
|
||||
m_systemPreferences()->appendExperimentalFeaturesItems( uiOrdering );
|
||||
}
|
||||
else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() )
|
||||
{
|
||||
m_systemPreferences()->uiOrdering( uiConfigName, uiOrdering );
|
||||
@@ -674,6 +678,14 @@ QString RiaPreferences::tabNameImportExport()
|
||||
return "Import/Export";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaPreferences::tabNameExperimental()
|
||||
{
|
||||
return "Experimental";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -707,6 +719,7 @@ QStringList RiaPreferences::tabNames()
|
||||
names << tabNameGeomech();
|
||||
#endif
|
||||
names << tabNameImportExport();
|
||||
names << tabNameExperimental();
|
||||
|
||||
if ( RiaApplication::enableDevelopmentFeatures() )
|
||||
{
|
||||
|
||||
@@ -176,6 +176,7 @@ private:
|
||||
static QString tabNameSystem();
|
||||
static QString tabNameImportExport();
|
||||
static QString tabNameOpmFlow();
|
||||
static QString tabNameExperimental();
|
||||
|
||||
static double defaultMarginSize( QPageSize::PageSizeId pageSizeId );
|
||||
|
||||
|
||||
@@ -341,11 +341,6 @@ void RiaPreferencesSystem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd
|
||||
group->add( &m_mimimumAngularCellCount );
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Experimental Features" );
|
||||
group->add( &m_enabledFeatures );
|
||||
}
|
||||
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Developer Settings" );
|
||||
group->add( &m_keywordsForLogging );
|
||||
@@ -353,6 +348,20 @@ void RiaPreferencesSystem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd
|
||||
}
|
||||
|
||||
uiOrdering.add( &m_maximumNumberOfThreads );
|
||||
|
||||
// The experimental feature fields are shown on the dedicated Experimental tab, so do not let
|
||||
// them auto-append to the System tab.
|
||||
uiOrdering.skipRemainingFields( true );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferencesSystem::appendExperimentalFeaturesItems( caf::PdmUiOrdering& uiOrdering )
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Experimental Features" );
|
||||
group->add( &m_enabledFeatures );
|
||||
group->add( &m_selectedFeatureDescription );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -410,4 +419,42 @@ void RiaPreferencesSystem::defineEditorAttribute( const caf::PdmFieldHandle* fie
|
||||
myAttr->m_selectDirectory = true;
|
||||
}
|
||||
}
|
||||
else if ( field == &m_enabledFeatures )
|
||||
{
|
||||
// Report the highlighted (clicked) feature so its description can be shown below the list.
|
||||
if ( auto* myAttr = dynamic_cast<caf::PdmUiTreeSelectionEditorAttribute*>( attribute ) )
|
||||
{
|
||||
myAttr->currentIndexFieldHandle = &m_currentFeatureKeyword;
|
||||
}
|
||||
}
|
||||
else if ( field == &m_selectedFeatureDescription )
|
||||
{
|
||||
if ( auto* myAttr = dynamic_cast<caf::PdmUiTextEditorAttribute*>( attribute ) )
|
||||
{
|
||||
myAttr->wrapMode = caf::PdmUiTextEditorAttribute::WordWrap;
|
||||
myAttr->heightHint = 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaPreferencesSystem::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue )
|
||||
{
|
||||
if ( changedField == &m_currentFeatureKeyword )
|
||||
{
|
||||
QString description;
|
||||
for ( const auto& feature : RiaExperimentalFeatures::availableFeatures() )
|
||||
{
|
||||
if ( feature.keyword == m_currentFeatureKeyword() )
|
||||
{
|
||||
description = feature.description;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_selectedFeatureDescription = description;
|
||||
m_selectedFeatureDescription.uiCapability()->updateConnectedEditors();
|
||||
}
|
||||
}
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
bool isLoggingActivatedForKeyword( const QString& keyword ) const;
|
||||
bool isFeatureEnabled( const QString& keyword ) const;
|
||||
|
||||
void appendExperimentalFeaturesItems( caf::PdmUiOrdering& uiOrdering );
|
||||
|
||||
protected:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
Reference in new issue
Block a user