mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5147 RimFormationNames::m_formationNamesFileName -> FilePath
This commit is contained in:
parent
b1942e0844
commit
37b32c4e8a
@ -42,7 +42,7 @@ RimFormationNames::RimFormationNames()
|
|||||||
{
|
{
|
||||||
CAF_PDM_InitObject( "Formation Names", ":/Formations16x16.png", "", "" );
|
CAF_PDM_InitObject( "Formation Names", ":/Formations16x16.png", "", "" );
|
||||||
|
|
||||||
CAF_PDM_InitField( &m_formationNamesFileName, "FormationNamesFileName", QString( "" ), "File Name", "", "", "" );
|
CAF_PDM_InitFieldNoDefault( &m_formationNamesFileName, "FormationNamesFileName", "File Name", "", "", "" );
|
||||||
|
|
||||||
m_formationNamesFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
m_formationNamesFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||||
}
|
}
|
||||||
@ -92,9 +92,9 @@ void RimFormationNames::setFileName( const QString& fileName )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
///
|
///
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
const QString& RimFormationNames::fileName()
|
QString RimFormationNames::fileName()
|
||||||
{
|
{
|
||||||
return m_formationNamesFileName();
|
return m_formationNamesFileName().path();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -102,7 +102,7 @@ const QString& RimFormationNames::fileName()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
QString RimFormationNames::fileNameWoPath()
|
QString RimFormationNames::fileNameWoPath()
|
||||||
{
|
{
|
||||||
QFileInfo fnameFileInfo( m_formationNamesFileName() );
|
QFileInfo fnameFileInfo( m_formationNamesFileName().path() );
|
||||||
return fnameFileInfo.fileName();
|
return fnameFileInfo.fileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,18 +142,19 @@ void RimFormationNames::updateConnectedViews()
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimFormationNames::readFormationNamesFile( QString* errorMessage )
|
void RimFormationNames::readFormationNamesFile( QString* errorMessage )
|
||||||
{
|
{
|
||||||
QFile dataFile( m_formationNamesFileName() );
|
QFile dataFile( m_formationNamesFileName().path() );
|
||||||
|
|
||||||
if ( !dataFile.open( QFile::ReadOnly ) )
|
if ( !dataFile.open( QFile::ReadOnly ) )
|
||||||
{
|
{
|
||||||
if ( errorMessage ) ( *errorMessage ) += "Could not open the File: " + ( m_formationNamesFileName() ) + "\n";
|
if ( errorMessage )
|
||||||
|
( *errorMessage ) += "Could not open the File: " + ( m_formationNamesFileName().path() ) + "\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_formationNamesData = new RigFormationNames;
|
m_formationNamesData = new RigFormationNames;
|
||||||
QTextStream stream( &dataFile );
|
QTextStream stream( &dataFile );
|
||||||
|
|
||||||
QFileInfo fileInfo( m_formationNamesFileName() );
|
QFileInfo fileInfo( m_formationNamesFileName().path() );
|
||||||
|
|
||||||
if ( fileInfo.fileName() == RimFormationNames::layerZoneTableFileName() )
|
if ( fileInfo.fileName() == RimFormationNames::layerZoneTableFileName() )
|
||||||
{
|
{
|
||||||
@ -170,8 +171,8 @@ void RimFormationNames::readFormationNamesFile( QString* errorMessage )
|
|||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
void RimFormationNames::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
void RimFormationNames::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath )
|
||||||
{
|
{
|
||||||
m_formationNamesFileName =
|
// m_formationNamesFileName =
|
||||||
RimTools::relocateFile( m_formationNamesFileName(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
// RimTools::relocateFile( m_formationNamesFileName(), newProjectPath, oldProjectPath, nullptr, nullptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
@ -297,8 +298,9 @@ void RimFormationNames::readFmuFormationNameFile( QTextStream& stream, QString*
|
|||||||
|
|
||||||
if ( lineStream.status() != QTextStream::Ok )
|
if ( lineStream.status() != QTextStream::Ok )
|
||||||
{
|
{
|
||||||
*errorMessage =
|
*errorMessage = QString( "Failed to parse line %1 of '%2'" )
|
||||||
QString( "Failed to parse line %1 of '%2'" ).arg( lineNumber ).arg( m_formationNamesFileName() );
|
.arg( lineNumber )
|
||||||
|
.arg( m_formationNamesFileName().path() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
~RimFormationNames() override;
|
~RimFormationNames() override;
|
||||||
|
|
||||||
void setFileName( const QString& fileName );
|
void setFileName( const QString& fileName );
|
||||||
const QString& fileName();
|
QString fileName();
|
||||||
QString fileNameWoPath();
|
QString fileNameWoPath();
|
||||||
|
|
||||||
RigFormationNames* formationNamesData()
|
RigFormationNames* formationNamesData()
|
||||||
@ -63,7 +63,7 @@ private:
|
|||||||
void readFmuFormationNameFile( QTextStream& stream, QString* errorMessage );
|
void readFmuFormationNameFile( QTextStream& stream, QString* errorMessage );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
caf::PdmField<QString> m_formationNamesFileName;
|
caf::PdmField<caf::FilePath> m_formationNamesFileName;
|
||||||
|
|
||||||
cvf::ref<RigFormationNames> m_formationNamesData;
|
cvf::ref<RigFormationNames> m_formationNamesData;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user