#5147 RimEclipseInputProperty::fileName -> caf::FilePath

This commit is contained in:
Jacob Støren
2019-12-10 16:58:07 +01:00
parent 11807029a5
commit 059288ef97
7 changed files with 26 additions and 22 deletions

View File

@@ -125,7 +125,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
&errorMsg );
if ( isOk )
{
inputProperty->fileName = exportSettings.fileName;
inputProperty->fileName = exportSettings.fileName();
inputProperty->eclipseKeyword = exportSettings.eclipseKeyword;
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;

View File

@@ -302,7 +302,7 @@ cvf::ref<RifReaderInterface> RimEclipseInputCase::createMockModel( QString model
RimEclipseInputProperty* inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = "PORO";
inputProperty->eclipseKeyword = "PORO";
inputProperty->fileName = "PORO.prop";
inputProperty->fileName = QString( "PORO.prop" );
m_inputPropertyCollection->inputProperties.push_back( inputProperty );
}
@@ -343,19 +343,19 @@ QString RimEclipseInputCase::locationOnDisc() const
//--------------------------------------------------------------------------------------------------
void RimEclipseInputCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
{
bool foundFile = false;
std::vector<QString> searchedPaths;
// bool foundFile = false;
// std::vector<QString> searchedPaths;
// m_gridFileName = RimTools::relocateFile( m_gridFileName().path(), newProjectPath, oldProjectPath, &foundFile, &searchedPaths );
for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
{
inputProperty->fileName = RimTools::relocateFile( inputProperty->fileName,
newProjectPath,
oldProjectPath,
&foundFile,
&searchedPaths );
}
// for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
//{
// inputProperty->fileName = RimTools::relocateFile( inputProperty->fileName,
// newProjectPath,
// oldProjectPath,
// &foundFile,
// &searchedPaths );
//}
}
//--------------------------------------------------------------------------------------------------
@@ -367,7 +367,8 @@ void RimEclipseInputCase::updateAdditionalFileFolder( const QString& newFolder )
for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
{
if ( inputProperty->fileName == m_gridFileName().path() ) continue;
QFileInfo oldFilePath( inputProperty->fileName );
QFileInfo oldFilePath( inputProperty->fileName().path() );
QFileInfo newFilePath( newDir, oldFilePath.fileName() );
inputProperty->fileName = newFilePath.absoluteFilePath();
}
@@ -382,7 +383,9 @@ std::vector<QString> RimEclipseInputCase::additionalFiles() const
for ( const RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() )
{
if ( inputProperty->fileName == m_gridFileName().path() ) continue;
additionalFiles.push_back( inputProperty->fileName );
additionalFiles.push_back( inputProperty->fileName().path() );
}
return additionalFiles;
}

View File

@@ -58,7 +58,7 @@ RimEclipseInputProperty::RimEclipseInputProperty()
CAF_PDM_InitField( &resultName, "ResultName", QString(), "Result Name", "", "", "" );
CAF_PDM_InitField( &eclipseKeyword, "EclipseKeyword", QString(), "Eclipse Keyword", "", "", "" );
CAF_PDM_InitField( &fileName, "FileName", QString(), "Filename", "", "", "" );
CAF_PDM_InitFieldNoDefault( &fileName, "FileName", "Filename", "", "", "" );
CAF_PDM_InitField( &resolvedState, "ResolvedState", (ResolveStateEnum)UNKNOWN, "Data State", "", "", "" );
resolvedState.uiCapability()->setUiReadOnly( true );

View File

@@ -49,9 +49,10 @@ public:
typedef caf::AppEnum<ResolveState> ResolveStateEnum;
// Fields:
caf::PdmField<QString> resultName;
caf::PdmField<QString> eclipseKeyword;
caf::PdmField<QString> fileName; // ReadOnly Serves as key to syncronize read eclipse prop data and this inputProp object.
caf::PdmField<QString> resultName;
caf::PdmField<QString> eclipseKeyword;
caf::PdmField<caf::FilePath> fileName; // ReadOnly Serves as key to syncronize
// read eclipse prop data and this inputProp object.
caf::PdmField<ResolveStateEnum> resolvedState; // ReadOnly and not writable
// PdmObject Overrides

View File

@@ -56,7 +56,7 @@ std::vector<RimEclipseInputProperty*> RimEclipseInputPropertyCollection::findInp
{
if ( !inputProperties[i] ) continue;
QFileInfo propFile( inputProperties[i]->fileName() );
QFileInfo propFile( inputProperties[i]->fileName().path() );
if ( fileInfo == propFile ) result.push_back( inputProperties[i] );
}

View File

@@ -568,7 +568,7 @@ public:
inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = m_currentPropertyName;
inputProperty->eclipseKeyword = "";
inputProperty->fileName = "";
inputProperty->fileName = QString( "" );
inputRes->inputPropertyCollection()->inputProperties.push_back( inputProperty );
inputRes->inputPropertyCollection()->updateConnectedEditors();
}

View File

@@ -689,7 +689,7 @@ public:
inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = m_currentPropertyName;
inputProperty->eclipseKeyword = "";
inputProperty->fileName = "";
inputProperty->fileName = QString( "" );
inputRes->inputPropertyCollection()->inputProperties.push_back( inputProperty );
inputRes->inputPropertyCollection()->updateConnectedEditors();
}
@@ -1080,7 +1080,7 @@ public:
inputProperty = new RimEclipseInputProperty;
inputProperty->resultName = m_currentPropertyName;
inputProperty->eclipseKeyword = "";
inputProperty->fileName = "";
inputProperty->fileName = QString( "" );
inputRes->inputPropertyCollection()->inputProperties.push_back( inputProperty );
inputRes->inputPropertyCollection()->updateConnectedEditors();
}