2012-05-18 09:45:23 +02:00
/////////////////////////////////////////////////////////////////////////////////
//
2019-04-02 13:28:31 +02:00
// Copyright (C) 2019- Equinor ASA
// Copyright (C) 2011-2018 Statoil ASA
2014-09-23 15:04:57 +02:00
// Copyright (C) 2013- Ceetron Solutions AS
// Copyright (C) 2011-2012 Ceetron AS
2012-05-18 09:45:23 +02:00
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
2013-03-22 16:24:42 +01:00
#include "RiaPreferences.h"
2013-05-06 10:55:00 +02:00
2019-04-02 13:28:31 +02:00
#include "RiaColorTables.h"
2015-07-31 18:58:23 +02:00
#include "RifReaderSettings.h"
2013-05-06 10:55:00 +02:00
#include "cafPdmFieldCvfColor.h"
2019-04-14 15:40:37 +02:00
#include "cafPdmUiComboBoxEditor.h"
2014-07-22 12:10:51 +02:00
#include "cafPdmUiCheckBoxEditor.h"
2015-07-31 18:58:23 +02:00
#include "cafPdmUiFieldHandle.h"
#include "cafPdmUiFilePathEditor.h"
2012-05-18 09:45:23 +02:00
2019-07-30 14:04:51 +02:00
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QStandardPaths>
#endif
2018-03-20 14:57:11 +01:00
namespace caf
2018-03-19 13:35:56 +01:00
{
2018-03-20 14:57:11 +01:00
template <>
void RiaPreferences :: SummaryRestartFilesImportModeType :: setUp ()
{
2018-04-13 15:44:28 +02:00
addItem ( RiaPreferences :: IMPORT , "IMPORT" , "Unified" );
addItem ( RiaPreferences :: SEPARATE_CASES , "SEPARATE_CASES" , "Separate Cases" );
2018-04-25 11:21:30 +02:00
addItem ( RiaPreferences :: NOT_IMPORT , "NOT_IMPORT" , "Skip" );
2018-04-09 13:21:48 +02:00
setDefault ( RiaPreferences :: IMPORT );
2018-03-20 14:57:11 +01:00
}
2019-08-16 15:41:58 +02:00
template <>
void RiaPreferences :: SummaryHistoryCurveStyleModeType :: setUp ()
{
addItem ( RiaPreferences :: SYMBOLS , "SYMBOLS" , "Symbols" );
addItem ( RiaPreferences :: LINES , "LINES" , "Lines" );
addItem ( RiaPreferences :: SYMBOLS_AND_LINES , "SYMBOLS_AND_LINES" , "Symbols and Lines" );
setDefault ( RiaPreferences :: SYMBOLS );
}
}
2018-03-19 13:35:56 +01:00
2013-03-22 16:24:42 +01:00
CAF_PDM_SOURCE_INIT ( RiaPreferences , "RiaPreferences" );
2012-05-18 09:45:23 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2013-03-22 15:50:44 +01:00
RiaPreferences :: RiaPreferences ( void )
2012-05-18 09:45:23 +02:00
{
2019-05-06 10:36:05 +02:00
CAF_PDM_InitField ( & navigationPolicy , "navigationPolicy" , caf :: AppEnum < RiaGuiApplication :: RINavigationPolicy > ( RiaGuiApplication :: NAVIGATION_POLICY_RMS ), "Navigation Mode" , "" , "" , "" );
2012-05-18 09:45:23 +02:00
2019-07-30 11:29:20 +02:00
CAF_PDM_InitField ( & enableGrpcServer , "enableGrpcServer" , true , "Enable Python Script Server" , "" , "Remote Procedure Call Scripting Engine" , "" );
CAF_PDM_InitField ( & defaultGrpcPortNumber , "defaultGrpcPort" , 50051 , "Default Python Script Server Port" , "" , "" , "" );
2019-05-20 13:21:02 +02:00
2013-04-24 07:35:31 +02:00
CAF_PDM_InitFieldNoDefault ( & scriptDirectories , "scriptDirectory" , "Shared Script Folder(s)" , "" , "" , "" );
2015-08-05 13:27:36 +02:00
scriptDirectories . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiFilePathEditor :: uiEditorTypeName ());
2012-06-26 16:10:41 +02:00
2019-07-30 14:04:51 +02:00
QString defaultTextEditor ;
#ifdef WIN32
defaultTextEditor = QString ( "notepad.exe" );
#else
defaultTextEditor = QString ( "kate" );
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
defaultTextEditor = QStandardPaths :: findExecutable ( "kate" );
if ( defaultTextEditor . isEmpty ())
{
defaultTextEditor = QStandardPaths :: findExecutable ( "gedit" );
}
#endif
#endif
2019-07-31 11:40:36 +02:00
CAF_PDM_InitField ( & scriptEditorExecutable , "scriptEditorExecutable" , defaultTextEditor , "Script Editor" , "" , "" , "" );
2015-08-05 13:27:36 +02:00
scriptEditorExecutable . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiFilePathEditor :: uiEditorTypeName ());
2012-06-26 16:10:41 +02:00
2017-04-27 13:16:44 +02:00
CAF_PDM_InitField ( & octaveExecutable , "octaveExecutable" , QString ( "octave" ), "Octave Executable Location" , "" , "" , "" );
2015-08-05 13:27:36 +02:00
octaveExecutable . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiFilePathEditor :: uiEditorTypeName ());
octaveExecutable . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: TOP );
2014-07-22 12:10:51 +02:00
2017-04-27 13:16:44 +02:00
CAF_PDM_InitField ( & octaveShowHeaderInfoWhenExecutingScripts , "octaveShowHeaderInfoWhenExecutingScripts" , false , "Show Text Header When Executing Scripts" , "" , "" , "" );
2015-08-05 13:27:36 +02:00
octaveShowHeaderInfoWhenExecutingScripts . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2012-05-18 09:45:23 +02:00
2019-07-26 14:54:54 +02:00
CAF_PDM_InitField ( & pythonExecutable , "pythonExecutable" , QString ( "python" ), "Python Executable Location" , "" , "" , "" );
pythonExecutable . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiFilePathEditor :: uiEditorTypeName ());
pythonExecutable . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: TOP );
2017-04-27 13:16:44 +02:00
CAF_PDM_InitField ( & ssihubAddress , "ssihubAddress" , QString ( "http://" ), "SSIHUB Address" , "" , "" , "" );
2015-09-22 08:39:53 +02:00
ssihubAddress . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: TOP );
2013-05-29 12:59:08 +02:00
2019-04-10 12:49:20 +02:00
CAF_PDM_InitFieldNoDefault ( & defaultMeshModeType , "defaultMeshModeType" , "Show Grid Lines" , "" , "" , "" );
2019-04-02 13:28:31 +02:00
CAF_PDM_InitField ( & defaultGridLineColors , "defaultGridLineColors" , RiaColorTables :: defaultGridLineColor (), "Mesh Color" , "" , "" , "" );
CAF_PDM_InitField ( & defaultFaultGridLineColors , "defaultFaultGridLineColors" , RiaColorTables :: defaultFaultLineColor (), "Mesh Color Along Faults" , "" , "" , "" );
CAF_PDM_InitField ( & defaultWellLabelColor , "defaultWellLableColor" , RiaColorTables :: defaultWellLabelColor (), "Well Label Color" , "" , "The default well label color in new views" , "" );
2013-04-12 13:15:41 +02:00
2019-04-02 13:28:31 +02:00
CAF_PDM_InitField ( & defaultViewerBackgroundColor , "defaultViewerBackgroundColor" , RiaColorTables :: defaultViewerBackgroundColor (), "Viewer Background" , "" , "The viewer background color for new views" , "" );
2013-04-15 13:13:41 +02:00
2019-04-10 12:49:20 +02:00
CAF_PDM_InitField ( & defaultScaleFactorZ , "defaultScaleFactorZ" , 5 , "Default Z Scale Factor" , "" , "" , "" );
2019-04-30 12:36:53 +02:00
caf :: AppEnum < RiaFontCache :: FontSize > fontSize = RiaFontCache :: FONT_SIZE_8 ;
2019-07-30 12:51:18 +02:00
caf :: AppEnum < RiaFontCache :: FontSize > plotFontSize = RiaFontCache :: FONT_SIZE_10 ;
2019-04-30 12:36:53 +02:00
CAF_PDM_InitField ( & defaultSceneFontSize , "fontSizeInScene" , fontSize , "Viewer Font Size" , "" , "" , "" );
CAF_PDM_InitField ( & defaultAnnotationFontSize , "defaultAnnotationFontSize" , fontSize , "Annotation Font Size" , "" , "" , "" );
CAF_PDM_InitField ( & defaultWellLabelFontSize , "wellLabelFontSize" , fontSize , "Well Label Font Size" , "" , "" , "" );
2019-07-30 12:51:18 +02:00
CAF_PDM_InitField ( & defaultPlotFontSize , "defaultPlotFontSize" , plotFontSize , "Plot Font Size" , "" , "" , "" );
2016-08-09 13:09:08 +02:00
2017-04-27 13:16:44 +02:00
CAF_PDM_InitField ( & showLasCurveWithoutTvdWarning , "showLasCurveWithoutTvdWarning" , true , "Show LAS Curve Without TVD Warning" , "" , "" , "" );
2015-10-30 11:42:11 +01:00
showLasCurveWithoutTvdWarning . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2012-10-12 15:05:42 +02:00
2012-05-18 09:45:23 +02:00
CAF_PDM_InitField ( & useShaders , "useShaders" , true , "Use Shaders" , "" , "" , "" );
2015-09-22 08:39:53 +02:00
useShaders . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2012-10-23 08:27:49 +02:00
CAF_PDM_InitField ( & showHud , "showHud" , false , "Show 3D Information" , "" , "" , "" );
2015-09-22 08:39:53 +02:00
showHud . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2018-09-19 14:43:06 +02:00
CAF_PDM_InitField ( & m_appendClassNameToUiText , "appendClassNameToUiText" , false , "Show Class Names" , "" , "" , "" );
m_appendClassNameToUiText . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
CAF_PDM_InitField ( & m_appendFieldKeywordToToolTipText , "appendFieldKeywordToToolTipText" , false , "Show Field Keyword in ToolTip" , "" , "" , "" );
m_appendFieldKeywordToToolTipText . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
CAF_PDM_InitField ( & m_showTestToolbar , "showTestToolbar" , false , "Enable Test Toolbar" , "" , "" , "" );
m_showTestToolbar . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
CAF_PDM_InitField ( & m_includeFractureDebugInfoFile , "includeFractureDebugInfoFile" , false , "Include Fracture Debug Info for Completion Export" , "" , "" , "" );
m_includeFractureDebugInfoFile . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2012-05-18 09:45:23 +02:00
2019-04-10 12:49:20 +02:00
CAF_PDM_InitField ( & showLegendBackground , "showLegendBackground" , true , "Show Box around Legends" , "" , "" , "" );
showLegendBackground . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2018-03-08 16:15:45 +01:00
2012-05-18 09:45:23 +02:00
CAF_PDM_InitFieldNoDefault ( & lastUsedProjectFileName , "lastUsedProjectFileName" , "Last Used Project File" , "" , "" , "" );
2015-08-05 13:27:36 +02:00
lastUsedProjectFileName . uiCapability () -> setUiHidden ( true );
2012-08-31 19:12:47 +02:00
2017-04-27 13:16:44 +02:00
CAF_PDM_InitField ( & autocomputeDepthRelatedProperties , "autocomputeDepth" , true , "Compute DEPTH Related Properties" , "" , "DEPTH, DX, DY, DZ, TOP, BOTTOM" , "" );
2015-08-05 13:27:36 +02:00
autocomputeDepthRelatedProperties . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2014-10-24 11:38:47 +02:00
2017-04-27 13:16:44 +02:00
CAF_PDM_InitField ( & loadAndShowSoil , "loadAndShowSoil" , true , "Load and Show SOIL" , "" , "" , "" );
2015-08-05 13:27:36 +02:00
loadAndShowSoil . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2014-07-30 09:13:47 +02:00
2018-04-09 13:21:48 +02:00
CAF_PDM_InitFieldNoDefault ( & summaryRestartFilesShowImportDialog , "summaryRestartFilesShowImportDialog" , "Show Import Dialog" , "" , "" , "" );
2018-04-13 15:44:28 +02:00
CAF_PDM_InitField ( & summaryImportMode , "summaryImportMode" , SummaryRestartFilesImportModeType ( RiaPreferences :: IMPORT ), "Default Summary Import Option" , "" , "" , "" );
CAF_PDM_InitField ( & gridImportMode , "gridImportMode" , SummaryRestartFilesImportModeType ( RiaPreferences :: NOT_IMPORT ), "Default Grid Import Option" , "" , "" , "" );
2019-06-21 09:11:10 +02:00
CAF_PDM_InitField ( & summaryEnsembleImportMode , "summaryEnsembleImportMode" , SummaryRestartFilesImportModeType ( RiaPreferences :: IMPORT ), "Default Ensemble Summary Import Option" , "" , "" , "" );
2018-03-19 13:35:56 +01:00
2019-08-16 15:41:58 +02:00
CAF_PDM_InitField ( & defaultSummaryHistoryCurveStyle , "defaultSummaryHistoryCurveStyle" , SummaryHistoryCurveStyleModeType ( RiaPreferences :: SYMBOLS ), "Default Curve Style for History Vectors" , "" , "" , "" );
2019-08-09 09:54:55 +02:00
CAF_PDM_InitField ( & defaultSummaryCurvesTextFilter , "defaultSummaryCurvesTextFilter" , QString ( "FOPT" ), "Default Summary Curves" , "" , "Semicolon separated list of filters used to create curves in new summary plots" , "" );
2018-10-25 09:25:53 +02:00
CAF_PDM_InitFieldNoDefault ( & m_holoLensExportFolder , "holoLensExportFolder" , "HoloLens Export Folder" , "" , "" , "" );
m_holoLensExportFolder . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: TOP );
m_holoLensExportFolder . uiCapability () -> setUiEditorTypeName ( caf :: PdmUiFilePathEditor :: uiEditorTypeName ());
2019-01-15 10:01:01 +01:00
CAF_PDM_InitField ( & holoLensDisableCertificateVerification , "holoLensDisableCertificateVerification" , false , "Disable SSL Certificate Verification (HoloLens)" , "" , "" , "" );
holoLensDisableCertificateVerification . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2019-06-23 18:32:05 +02:00
CAF_PDM_InitField ( & csvTextExportFieldSeparator , "csvTextExportFieldSeparator" , QString ( "," ), "CSV Text Export Field Separator" , "" , "" , "" );
2019-02-15 09:07:13 +01:00
CAF_PDM_InitField ( & m_showProjectChangedDialog , "showProjectChangedDialog" , true , "Show 'Project has changed' dialog" , "" , "" , "" );
m_showProjectChangedDialog . uiCapability () -> setUiLabelPosition ( caf :: PdmUiItemInfo :: HIDDEN );
2017-08-29 08:27:42 +02:00
CAF_PDM_InitFieldNoDefault ( & m_readerSettings , "readerSettings" , "Reader Settings" , "" , "" , "" );
m_readerSettings = new RifReaderSettings ;
2012-05-18 09:45:23 +02:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2013-03-22 15:50:44 +01:00
RiaPreferences ::~ RiaPreferences ( void )
2012-05-18 09:45:23 +02:00
{
2017-08-29 08:27:42 +02:00
delete m_readerSettings ;
2012-05-18 09:45:23 +02:00
}
2012-06-26 16:10:41 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2013-03-22 15:50:44 +01:00
void RiaPreferences :: defineEditorAttribute ( const caf :: PdmFieldHandle * field , QString uiConfigName , caf :: PdmUiEditorAttribute * attribute )
2012-06-26 16:10:41 +02:00
{
2017-08-29 08:27:42 +02:00
m_readerSettings -> defineEditorAttribute ( field , uiConfigName , attribute );
2014-07-30 09:13:47 +02:00
2013-04-24 07:35:31 +02:00
if ( field == & scriptDirectories )
2012-06-26 16:10:41 +02:00
{
2017-04-25 10:31:37 +02:00
caf :: PdmUiFilePathEditorAttribute * myAttr = dynamic_cast < caf :: PdmUiFilePathEditorAttribute *> ( attribute );
2012-06-26 16:10:41 +02:00
if ( myAttr )
{
myAttr -> m_selectDirectory = true ;
2013-04-24 07:35:31 +02:00
myAttr -> m_appendUiSelectedFolderToText = true ;
2012-06-26 16:10:41 +02:00
}
}
2014-07-30 09:13:47 +02:00
else if ( field == & octaveShowHeaderInfoWhenExecutingScripts ||
2014-10-24 11:38:47 +02:00
field == & autocomputeDepthRelatedProperties ||
2015-09-22 08:39:53 +02:00
field == & loadAndShowSoil ||
field == & useShaders ||
field == & showHud ||
2018-09-19 14:43:06 +02:00
field == & m_appendClassNameToUiText ||
field == & m_appendFieldKeywordToToolTipText ||
field == & m_showTestToolbar ||
field == & m_includeFractureDebugInfoFile ||
2019-01-15 10:01:01 +01:00
field == & showLasCurveWithoutTvdWarning ||
2019-02-15 09:07:13 +01:00
field == & holoLensDisableCertificateVerification ||
field == & m_showProjectChangedDialog ||
2019-04-10 12:49:20 +02:00
field == & showLegendBackground )
2014-07-22 12:10:51 +02:00
{
2017-04-25 10:31:37 +02:00
caf :: PdmUiCheckBoxEditorAttribute * myAttr = dynamic_cast < caf :: PdmUiCheckBoxEditorAttribute *> ( attribute );
2014-07-22 12:10:51 +02:00
if ( myAttr )
{
myAttr -> m_useNativeCheckBoxLabel = true ;
}
}
2018-10-25 09:25:53 +02:00
else if ( field == & m_holoLensExportFolder )
{
caf :: PdmUiFilePathEditorAttribute * myAttr = dynamic_cast < caf :: PdmUiFilePathEditorAttribute *> ( attribute );
if ( myAttr )
{
myAttr -> m_selectDirectory = true ;
}
}
2019-04-14 15:40:37 +02:00
if ( field == & defaultSceneFontSize || field == & defaultWellLabelFontSize ||
field == & defaultAnnotationFontSize || field == & defaultPlotFontSize )
{
caf :: PdmUiComboBoxEditorAttribute * myAttr = dynamic_cast < caf :: PdmUiComboBoxEditorAttribute *> ( attribute );
myAttr -> minimumContentsLength = 2 ;
}
2012-06-26 16:10:41 +02:00
}
2012-10-12 15:05:42 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
2013-04-08 12:16:38 +02:00
void RiaPreferences :: defineUiOrdering ( QString uiConfigName , caf :: PdmUiOrdering & uiOrdering )
2012-10-12 15:05:42 +02:00
{
2019-08-16 15:10:32 +02:00
if ( uiConfigName == RiaPreferences :: tabNameGeneral ())
2016-08-09 13:09:08 +02:00
{
2019-04-10 12:49:20 +02:00
caf :: PdmUiGroup * colorGroup = uiOrdering . addNewGroup ( "Default Colors" );
colorGroup -> add ( & defaultViewerBackgroundColor );
2019-04-14 15:40:37 +02:00
colorGroup -> add ( & defaultGridLineColors , false );
2019-04-10 12:49:20 +02:00
colorGroup -> add ( & defaultFaultGridLineColors );
2019-04-14 15:40:37 +02:00
colorGroup -> add ( & defaultWellLabelColor , false );
2019-04-10 12:49:20 +02:00
caf :: PdmUiGroup * fontGroup = uiOrdering . addNewGroup ( "Default Font Sizes" );
2019-04-10 16:13:40 +02:00
fontGroup -> add ( & defaultSceneFontSize );
2019-04-10 12:49:20 +02:00
fontGroup -> add ( & defaultAnnotationFontSize , false );
fontGroup -> add ( & defaultWellLabelFontSize );
fontGroup -> add ( & defaultPlotFontSize , false );
2019-04-14 15:40:37 +02:00
2019-04-10 12:49:20 +02:00
caf :: PdmUiGroup * viewsGroup = uiOrdering . addNewGroup ( "3d Views" );
viewsGroup -> add ( & defaultMeshModeType );
2016-08-09 13:21:59 +02:00
viewsGroup -> add ( & navigationPolicy );
2019-04-10 12:49:20 +02:00
viewsGroup -> add ( & defaultScaleFactorZ );
viewsGroup -> add ( & showLegendBackground );
2016-08-09 13:21:59 +02:00
viewsGroup -> add ( & useShaders );
viewsGroup -> add ( & showHud );
2019-04-10 12:49:20 +02:00
2017-04-27 13:16:44 +02:00
caf :: PdmUiGroup * otherGroup = uiOrdering . addNewGroup ( "Other" );
otherGroup -> add ( & ssihubAddress );
otherGroup -> add ( & showLasCurveWithoutTvdWarning );
2019-01-15 10:01:01 +01:00
otherGroup -> add ( & holoLensDisableCertificateVerification );
2017-04-27 13:16:44 +02:00
}
2019-08-16 15:10:32 +02:00
else if ( uiConfigName == RiaPreferences :: tabNameEclipse ())
2017-04-27 13:16:44 +02:00
{
caf :: PdmUiGroup * newCaseBehaviourGroup = uiOrdering . addNewGroup ( "Behavior When Loading Data" );
2016-08-09 13:21:59 +02:00
newCaseBehaviourGroup -> add ( & autocomputeDepthRelatedProperties );
newCaseBehaviourGroup -> add ( & loadAndShowSoil );
2014-07-30 09:13:47 +02:00
2017-08-29 08:27:42 +02:00
m_readerSettings -> defineUiOrdering ( uiConfigName , * newCaseBehaviourGroup );
2019-04-14 15:40:37 +02:00
2018-05-15 15:08:02 +02:00
caf :: PdmUiGroup * restartBehaviourGroup = uiOrdering . addNewGroup ( "Origin Files" );
2018-04-09 13:21:48 +02:00
restartBehaviourGroup -> add ( & summaryRestartFilesShowImportDialog );
2019-06-21 09:11:10 +02:00
{
caf :: PdmUiGroup * group = restartBehaviourGroup -> addNewGroup ( "Origin Summary Files" );
group -> add ( & summaryImportMode );
}
{
caf :: PdmUiGroup * group = restartBehaviourGroup -> addNewGroup ( "Origin Grid Files" );
group -> add ( & gridImportMode );
}
{
caf :: PdmUiGroup * group = restartBehaviourGroup -> addNewGroup ( "Origin Ensemble Summary Files" );
group -> add ( & summaryEnsembleImportMode );
}
2019-08-16 15:41:58 +02:00
}
else if ( uiConfigName == RiaPreferences :: tabNameEclipseSummary ())
{
uiOrdering . add ( & defaultSummaryCurvesTextFilter );
uiOrdering . add ( & defaultSummaryHistoryCurveStyle );
2016-08-09 13:09:08 +02:00
}
2019-08-16 15:10:32 +02:00
else if ( uiConfigName == RiaPreferences :: tabNameScripting ())
2014-07-30 09:13:47 +02:00
{
2016-08-09 13:21:59 +02:00
caf :: PdmUiGroup * octaveGroup = uiOrdering . addNewGroup ( "Octave" );
octaveGroup -> add ( & octaveExecutable );
octaveGroup -> add ( & octaveShowHeaderInfoWhenExecutingScripts );
2019-07-30 11:29:20 +02:00
#ifdef ENABLE_GRPC
2019-07-26 14:54:54 +02:00
caf :: PdmUiGroup * pythonGroup = uiOrdering . addNewGroup ( "Python" );
2019-07-30 11:29:20 +02:00
pythonGroup -> add ( & enableGrpcServer );
pythonGroup -> add ( & defaultGrpcPortNumber );
2019-07-26 14:54:54 +02:00
pythonGroup -> add ( & pythonExecutable );
2019-07-30 11:29:20 +02:00
#endif
2016-08-09 13:21:59 +02:00
caf :: PdmUiGroup * scriptGroup = uiOrdering . addNewGroup ( "Script files" );
scriptGroup -> add ( & scriptDirectories );
scriptGroup -> add ( & scriptEditorExecutable );
2014-07-30 09:13:47 +02:00
}
2019-08-16 15:10:32 +02:00
else if ( uiConfigName == RiaPreferences :: tabNameExport ())
2019-06-23 18:32:05 +02:00
{
uiOrdering . add ( & csvTextExportFieldSeparator );
}
2019-08-16 15:10:32 +02:00
else if ( RiaApplication :: enableDevelopmentFeatures () && uiConfigName == RiaPreferences :: tabNameSystem ())
2017-09-21 12:05:45 +02:00
{
2018-09-19 14:43:06 +02:00
uiOrdering . add ( & m_appendClassNameToUiText );
uiOrdering . add ( & m_appendFieldKeywordToToolTipText );
2019-02-15 09:07:13 +01:00
uiOrdering . add ( & m_showProjectChangedDialog );
2018-09-19 14:43:06 +02:00
uiOrdering . add ( & m_showTestToolbar );
uiOrdering . add ( & m_includeFractureDebugInfoFile );
2018-10-25 09:25:53 +02:00
uiOrdering . add ( & m_holoLensExportFolder );
2017-09-21 12:05:45 +02:00
}
2016-08-09 13:09:08 +02:00
2017-03-21 13:47:53 +01:00
uiOrdering . skipRemainingFields ( true );
2016-08-09 13:09:08 +02:00
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QList < caf :: PdmOptionItemInfo > RiaPreferences :: calculateValueOptions ( const caf :: PdmFieldHandle * fieldNeedingOptions , bool * useOptionsOnly )
{
QList < caf :: PdmOptionItemInfo > options ;
* useOptionsOnly = true ;
2019-02-04 14:23:16 +01:00
if ( fieldNeedingOptions == & gridImportMode )
2018-04-13 15:44:28 +02:00
{
// Manual option handling in order to one only a subset of the enum values
SummaryRestartFilesImportModeType skip ( RiaPreferences :: NOT_IMPORT );
SummaryRestartFilesImportModeType separate ( RiaPreferences :: SEPARATE_CASES );
options . push_back ( caf :: PdmOptionItemInfo ( skip . uiText (), RiaPreferences :: NOT_IMPORT ));
options . push_back ( caf :: PdmOptionItemInfo ( separate . uiText (), RiaPreferences :: SEPARATE_CASES ));
}
2019-06-21 09:11:10 +02:00
else if ( fieldNeedingOptions == & summaryEnsembleImportMode )
{
// Manual option handling in order to one only a subset of the enum values
SummaryRestartFilesImportModeType skip ( RiaPreferences :: NOT_IMPORT );
SummaryRestartFilesImportModeType allowImport ( RiaPreferences :: IMPORT );
options . push_back ( caf :: PdmOptionItemInfo ( skip . uiText (), RiaPreferences :: NOT_IMPORT ));
options . push_back ( caf :: PdmOptionItemInfo ( allowImport . uiText (), RiaPreferences :: IMPORT ));
}
2016-08-09 13:09:08 +02:00
return options ;
2012-10-12 15:05:42 +02:00
}
2019-05-13 13:47:03 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiaPreferences :: initAfterRead ()
{
// If the stored font size is larger than the maximum enum value, the stored font size is actually point size
int defaultSceneFontEnumValue = static_cast < int > ( defaultSceneFontSize . v ());
if ( defaultSceneFontEnumValue > ( int ) RiaFontCache :: MAX_FONT_SIZE )
{
defaultSceneFontSize = RiaFontCache :: fontSizeEnumFromPointSize ( defaultSceneFontEnumValue );
}
}
2019-08-16 15:10:32 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences :: tabNameGeneral ()
{
return "General" ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences :: tabNameEclipse ()
{
return "Eclipse" ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences :: tabNameEclipseSummary ()
{
return "Summary" ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences :: tabNameScripting ()
{
return "Scripting" ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences :: tabNameExport ()
{
return "Export" ;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences :: tabNameSystem ()
{
return "System" ;
}
2016-08-09 13:09:08 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QStringList RiaPreferences :: tabNames ()
{
2019-08-16 15:10:32 +02:00
QStringList names ;
names << tabNameGeneral ();
names << tabNameEclipse ();
names << tabNameEclipseSummary ();
names << tabNameScripting ();
names << tabNameExport ();
if ( RiaApplication :: enableDevelopmentFeatures ())
{
names << tabNameSystem ();
}
return names ;
2016-08-09 13:09:08 +02:00
}
2017-08-29 08:27:42 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
const RifReaderSettings * RiaPreferences :: readerSettings () const
{
return m_readerSettings ;
}
2018-09-19 14:43:06 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences :: appendClassNameToUiText () const
{
return RiaApplication :: enableDevelopmentFeatures () && m_appendClassNameToUiText ();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences :: appendFieldKeywordToToolTipText () const
{
return RiaApplication :: enableDevelopmentFeatures () && m_appendFieldKeywordToToolTipText ();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences :: showTestToolbar () const
{
return RiaApplication :: enableDevelopmentFeatures () && m_showTestToolbar ();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences :: includeFractureDebugInfoFile () const
{
return RiaApplication :: enableDevelopmentFeatures () && m_includeFractureDebugInfoFile ();
}
2019-02-15 09:07:13 +01:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RiaPreferences :: showProjectChangedDialog () const
{
if ( ! RiaApplication :: enableDevelopmentFeatures ())
{
return true ;
}
return m_showProjectChangedDialog ();
}
2018-10-25 09:25:53 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RiaPreferences :: holoLensExportFolder () const
{
return m_holoLensExportFolder ();
}
2019-04-10 16:13:40 +02:00
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std :: map < RiaDefines :: FontSettingType , RiaFontCache :: FontSize > RiaPreferences :: defaultFontSizes () const
{
std :: map < RiaDefines :: FontSettingType , RiaFontCache :: FontSize > fontSizes ;
fontSizes [ RiaDefines :: SCENE_FONT ] = defaultSceneFontSize ();
fontSizes [ RiaDefines :: ANNOTATION_FONT ] = defaultAnnotationFontSize ();
fontSizes [ RiaDefines :: WELL_LABEL_FONT ] = defaultWellLabelFontSize ();
fontSizes [ RiaDefines :: PLOT_FONT ] = defaultPlotFontSize ();
return fontSizes ;
}