From d440e260c029ec9e8a45298eac300d436a59aeea Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 14 Oct 2021 14:36:06 +0200 Subject: [PATCH] #6525 Export parameter : Add .GRDECL as default file name extension Support both upper and lower case of *.GRDECL in file filter when specifying save file name --- .../RicExportEclipseSectorModelUi.cpp | 21 ++++++++++--------- .../RicExportEclipseSectorModelUi.h | 4 ++-- .../RicSaveEclipseInputVisibleCellsUi.cpp | 7 +++---- ...icSaveEclipseResultAsInputPropertyExec.cpp | 3 ++- .../RimBinaryExportSettings.cpp | 4 ++-- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp index 087c71fde2..96ad9179e3 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp @@ -165,7 +165,7 @@ void RicExportEclipseSectorModelUi::setCaseData( RigEclipseCaseData* caseData /* if ( selectedKeywords.v().empty() ) { - for ( QString keyword : mainKeywords() ) + for ( const QString& keyword : mainKeywords() ) { if ( caseData && caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) @@ -178,7 +178,7 @@ void RicExportEclipseSectorModelUi::setCaseData( RigEclipseCaseData* caseData /* else { std::vector validSelectedKeywords; - for ( QString keyword : selectedKeywords() ) + for ( const QString& keyword : selectedKeywords() ) { if ( caseData && caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) @@ -239,19 +239,20 @@ void RicExportEclipseSectorModelUi::defineEditorAttribute( const caf::PdmFieldHa const RigMainGrid* mainGrid = m_caseData->mainGrid(); cvf::Vec3i gridDimensions( int( mainGrid->cellCountI() ), int( mainGrid->cellCountJ() ), int( mainGrid->cellCountK() ) ); - caf::PdmUiLineEditorAttribute* lineEditorAttr = dynamic_cast( attribute ); + auto* lineEditorAttr = dynamic_cast( attribute ); if ( field == &exportParametersFilename || field == &exportGridFilename || field == &exportFaultsFilename ) { - caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { - myAttr->m_selectSaveFileName = true; + myAttr->m_selectSaveFileName = true; + myAttr->m_fileSelectionFilter = "GRDECL files (*.grdecl *.GRDECL);;All files (*.*)"; } } else if ( field == &selectedKeywords ) { - caf::PdmUiListEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { myAttr->m_heightHint = 280; @@ -261,7 +262,7 @@ void RicExportEclipseSectorModelUi::defineEditorAttribute( const caf::PdmFieldHa { if ( lineEditorAttr ) { - QIntValidator* validator = new QIntValidator( 1, 10, nullptr ); + auto* validator = new QIntValidator( 1, 10, nullptr ); lineEditorAttr->validator = validator; } } @@ -447,7 +448,7 @@ QList resultData ); std::set mainKeywords = this->mainKeywords(); - for ( caf::PdmOptionItemInfo option : allOptions ) + for ( const caf::PdmOptionItemInfo& option : allOptions ) { if ( mainKeywords.count( option.optionUiText() ) ) { @@ -458,7 +459,7 @@ QList } } } - for ( caf::PdmOptionItemInfo option : allOptions ) + for ( const caf::PdmOptionItemInfo& option : allOptions ) { if ( !mainKeywords.count( option.optionUiText() ) && option.optionUiText() != "None" ) { @@ -609,7 +610,7 @@ void RicExportEclipseSectorModelUi::removeInvalidKeywords() RigCaseCellResultsData* resultData = m_caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); std::vector validKeywords; - for ( QString keyword : selectedKeywords() ) + for ( const QString& keyword : selectedKeywords() ) { if ( resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, keyword ) ) ) { diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.h b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.h index f5b47c7d70..49c077fea8 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.h @@ -47,7 +47,7 @@ class RicExportEclipseSectorModelUi : public caf::PdmObject EXPORT_TO_SINGLE_SEPARATE_FILE, EXPORT_TO_SEPARATE_FILE_PER_RESULT }; - typedef caf::AppEnum ResultExportOptionsEnum; + using ResultExportOptionsEnum = caf::AppEnum; enum GridBoxSelection { @@ -56,7 +56,7 @@ class RicExportEclipseSectorModelUi : public caf::PdmObject FULL_GRID_BOX, MANUAL_SELECTION }; - typedef caf::AppEnum GridBoxSelectionEnum; + using GridBoxSelectionEnum = caf::AppEnum; public: RicExportEclipseSectorModelUi(); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsUi.cpp index 4583a07a3a..ece728d1d8 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsUi.cpp @@ -73,12 +73,11 @@ void RicSaveEclipseInputVisibleCellsUi::defineEditorAttribute( const caf::PdmFie { if ( field == &exportFilename ) { - caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { - myAttr->m_selectSaveFileName = true; - // Set GRDECL file filter as default - myAttr->m_fileSelectionFilter = "GRDECL files (*.grdecl);;All files (*.*)"; + myAttr->m_selectSaveFileName = true; + myAttr->m_fileSelectionFilter = "GRDECL files (*.grdecl *.GRDECL);;All files (*.*)"; } } } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyExec.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyExec.cpp index 0e442cf9eb..7f5682a749 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyExec.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyExec.cpp @@ -84,7 +84,8 @@ void RicSaveEclipseResultAsInputPropertyExec::redo() } QString outputFileName = projectFolder + "/" + - caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiShortName() ); + caf::Utils::makeValidFileBasename( m_cellColors->resultVariableUiShortName() ) + + ".GRDECL"; exportSettings.fileName = outputFileName; } diff --git a/ApplicationLibCode/ProjectDataModel/RimBinaryExportSettings.cpp b/ApplicationLibCode/ProjectDataModel/RimBinaryExportSettings.cpp index 9b2a830198..6c84bf4f5f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimBinaryExportSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimBinaryExportSettings.cpp @@ -43,11 +43,11 @@ void RimBinaryExportSettings::defineEditorAttribute( const caf::PdmFieldHandle* { if ( field == &fileName ) { - caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { myAttr->m_selectSaveFileName = true; - myAttr->m_fileSelectionFilter = "Text files (*.txt);;All files (*.*)"; + myAttr->m_fileSelectionFilter = "GRDECL files (*.grdecl *.GRDECL);;All files (*.*)"; } } }