mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#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
This commit is contained in:
parent
7c7be7a846
commit
d440e260c0
@ -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<QString> 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<caf::PdmUiLineEditorAttribute*>( attribute );
|
||||
auto* lineEditorAttr = dynamic_cast<caf::PdmUiLineEditorAttribute*>( attribute );
|
||||
|
||||
if ( field == &exportParametersFilename || field == &exportGridFilename || field == &exportFaultsFilename )
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||
auto* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( 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<caf::PdmUiListEditorAttribute*>( attribute );
|
||||
auto* myAttr = dynamic_cast<caf::PdmUiListEditorAttribute*>( 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<caf::PdmOptionItemInfo>
|
||||
resultData );
|
||||
|
||||
std::set<QString> mainKeywords = this->mainKeywords();
|
||||
for ( caf::PdmOptionItemInfo option : allOptions )
|
||||
for ( const caf::PdmOptionItemInfo& option : allOptions )
|
||||
{
|
||||
if ( mainKeywords.count( option.optionUiText() ) )
|
||||
{
|
||||
@ -458,7 +459,7 @@ QList<caf::PdmOptionItemInfo>
|
||||
}
|
||||
}
|
||||
}
|
||||
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<QString> validKeywords;
|
||||
for ( QString keyword : selectedKeywords() )
|
||||
for ( const QString& keyword : selectedKeywords() )
|
||||
{
|
||||
if ( resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, keyword ) ) )
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ class RicExportEclipseSectorModelUi : public caf::PdmObject
|
||||
EXPORT_TO_SINGLE_SEPARATE_FILE,
|
||||
EXPORT_TO_SEPARATE_FILE_PER_RESULT
|
||||
};
|
||||
typedef caf::AppEnum<ResultExportOptions> ResultExportOptionsEnum;
|
||||
using ResultExportOptionsEnum = caf::AppEnum<ResultExportOptions>;
|
||||
|
||||
enum GridBoxSelection
|
||||
{
|
||||
@ -56,7 +56,7 @@ class RicExportEclipseSectorModelUi : public caf::PdmObject
|
||||
FULL_GRID_BOX,
|
||||
MANUAL_SELECTION
|
||||
};
|
||||
typedef caf::AppEnum<GridBoxSelection> GridBoxSelectionEnum;
|
||||
using GridBoxSelectionEnum = caf::AppEnum<GridBoxSelection>;
|
||||
|
||||
public:
|
||||
RicExportEclipseSectorModelUi();
|
||||
|
@ -73,12 +73,11 @@ void RicSaveEclipseInputVisibleCellsUi::defineEditorAttribute( const caf::PdmFie
|
||||
{
|
||||
if ( field == &exportFilename )
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||
auto* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( 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 (*.*)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -43,11 +43,11 @@ void RimBinaryExportSettings::defineEditorAttribute( const caf::PdmFieldHandle*
|
||||
{
|
||||
if ( field == &fileName )
|
||||
{
|
||||
caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||
auto* myAttr = dynamic_cast<caf::PdmUiFilePathEditorAttribute*>( attribute );
|
||||
if ( myAttr )
|
||||
{
|
||||
myAttr->m_selectSaveFileName = true;
|
||||
myAttr->m_fileSelectionFilter = "Text files (*.txt);;All files (*.*)";
|
||||
myAttr->m_fileSelectionFilter = "GRDECL files (*.grdecl *.GRDECL);;All files (*.*)";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user