mirror of
https://github.com/OPM/ResInsight.git
synced 2026-09-03 20:53:13 -05:00
#4657 Summary Templates : Application objects
Add file path to preferences Show templates in project tree Add pointer to template to RimSummaryPlot
This commit is contained in:
@@ -1118,6 +1118,7 @@ void RiaApplication::applyPreferences()
|
||||
if ( this->project() )
|
||||
{
|
||||
this->project()->setScriptDirectories( m_preferences->scriptDirectories() );
|
||||
this->project()->setPlotTemplateFolders( m_preferences->plotTemplateFolders() );
|
||||
this->project()->updateConnectedEditors();
|
||||
}
|
||||
caf::PdmSettings::writeFieldsToApplicationStore( m_preferences );
|
||||
@@ -1415,6 +1416,7 @@ void RiaApplication::initialize()
|
||||
// Start with a project
|
||||
m_project = new RimProject;
|
||||
m_project->setScriptDirectories( m_preferences->scriptDirectories() );
|
||||
m_project->setPlotTemplateFolders( m_preferences->plotTemplateFolders() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -301,6 +301,17 @@ RiaPreferences::RiaPreferences( void )
|
||||
CAF_PDM_InitFieldNoDefault( &m_timeFormat, "timeFormat", "Time Format", "", "", "" );
|
||||
m_timeFormat.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() );
|
||||
m_timeFormat = RiaQDateTimeTools::supportedTimeFormats().front();
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolders, "plotTemplateFolders", "Plot Template Folder(s)", "", "", "" );
|
||||
m_plotTemplateFolders.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
CAF_PDM_InitField( &m_searchPlotTemplateFoldersRecursively,
|
||||
"SearchPlotTemplateFoldersRecursively",
|
||||
true,
|
||||
"Search Plot Templates Recursively",
|
||||
"",
|
||||
"",
|
||||
"" );
|
||||
m_searchPlotTemplateFoldersRecursively.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -320,7 +331,7 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
{
|
||||
m_readerSettings->defineEditorAttribute( field, uiConfigName, attribute );
|
||||
|
||||
if ( field == &scriptDirectories )
|
||||
if ( field == &scriptDirectories || field == &m_plotTemplateFolders )
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
@@ -334,7 +345,8 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field,
|
||||
field == &m_appendClassNameToUiText || field == &m_appendFieldKeywordToToolTipText ||
|
||||
field == &m_showTestToolbar || field == &m_includeFractureDebugInfoFile ||
|
||||
field == &showLasCurveWithoutTvdWarning || field == &holoLensDisableCertificateVerification ||
|
||||
field == &m_showProjectChangedDialog || field == &showLegendBackground )
|
||||
field == &m_showProjectChangedDialog || field == &m_searchPlotTemplateFoldersRecursively ||
|
||||
field == &showLegendBackground )
|
||||
{
|
||||
caf::PdmUiCheckBoxEditorAttribute* myAttr = dynamic_cast<caf::PdmUiCheckBoxEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
@@ -422,6 +434,10 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
|
||||
uiOrdering.add( &defaultSummaryHistoryCurveStyle );
|
||||
uiOrdering.add( &m_dateFormat );
|
||||
uiOrdering.add( &m_timeFormat );
|
||||
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Plot Templates" );
|
||||
group->add( &m_plotTemplateFolders );
|
||||
group->add( &m_searchPlotTemplateFoldersRecursively );
|
||||
}
|
||||
else if ( uiConfigName == RiaPreferences::tabNameScripting() )
|
||||
{
|
||||
@@ -673,6 +689,33 @@ const QString& RiaPreferences::timeFormat() const
|
||||
return m_timeFormat();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaPreferences::searchPlotTemplateFoldersRecursively() const
|
||||
{
|
||||
return m_searchPlotTemplateFoldersRecursively();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QStringList RiaPreferences::plotTemplateFolders() const
|
||||
{
|
||||
QStringList filteredFolders;
|
||||
QStringList pathList = m_plotTemplateFolders().split( ';' );
|
||||
for ( const auto& path : pathList )
|
||||
{
|
||||
QDir dir( path );
|
||||
if ( !path.isEmpty() && dir.exists() && dir.isReadable() )
|
||||
{
|
||||
filteredFolders.push_back( path );
|
||||
}
|
||||
}
|
||||
|
||||
return filteredFolders;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -79,6 +79,9 @@ public:
|
||||
const QString& dateFormat() const;
|
||||
const QString& timeFormat() const;
|
||||
|
||||
bool searchPlotTemplateFoldersRecursively() const;
|
||||
QStringList plotTemplateFolders() const;
|
||||
|
||||
std::map<RiaDefines::FontSettingType, RiaFontCache::FontSize> defaultFontSizes() const;
|
||||
|
||||
public: // Pdm Fields
|
||||
@@ -162,5 +165,9 @@ private:
|
||||
caf::PdmField<QString> m_holoLensExportFolder;
|
||||
caf::PdmField<QString> m_dateFormat;
|
||||
caf::PdmField<QString> m_timeFormat;
|
||||
QStringList m_tabNames;
|
||||
|
||||
caf::PdmField<QString> m_plotTemplateFolders;
|
||||
caf::PdmField<bool> m_searchPlotTemplateFoldersRecursively;
|
||||
|
||||
QStringList m_tabNames;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user