mirror of
https://github.com/OPM/ResInsight.git
synced 2026-08-26 21:27:15 -05:00
#2365 Replace PdmField<QString> with PdmField<caf::FilePath> for file path fields
Convert 11 file/directory path fields from QString to caf::FilePath across ProjectDataModel classes for type safety and consistent path handling. Fields converted: RimCalcScript::absoluteFileName, RimScriptCollection::directory, RimBinaryExportSettings::fileName, RimExportInputSettings::fileName, RimFractureExportSettings::fileName, RimReservoirCellResultsStorage::m_resultCacheFileName, RimProcess::m_workDir, RimWellIASettings::m_baseDir, RimPlotTemplateFileItem::m_absoluteFileName, RimWellMeasurement::m_filePath, RimFileWellPath::m_filePath.
This commit is contained in:
@@ -116,7 +116,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
|
||||
const double undefinedValue = 0.0;
|
||||
|
||||
QString errorMsg;
|
||||
bool isOk = RicEclipseCellResultToFileImpl::writePropertyToTextFile( exportSettings.fileName,
|
||||
bool isOk = RicEclipseCellResultToFileImpl::writePropertyToTextFile( exportSettings.fileName().path(),
|
||||
eclipseCase->eclipseCaseData(),
|
||||
0,
|
||||
inputProperty->resultName,
|
||||
@@ -126,7 +126,7 @@ void RicSaveEclipseInputPropertyFeature::onActionTriggered( bool isChecked )
|
||||
&errorMsg );
|
||||
if ( isOk )
|
||||
{
|
||||
inputProperty->fileName = exportSettings.fileName();
|
||||
inputProperty->fileName = exportSettings.fileName().path();
|
||||
inputProperty->eclipseKeyword = exportSettings.eclipseKeyword;
|
||||
inputProperty->resolvedState = RimEclipseInputProperty::RESOLVED;
|
||||
|
||||
|
||||
+2
-2
@@ -101,7 +101,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
|
||||
|
||||
QString errMsg;
|
||||
bool isOk =
|
||||
RicEclipseCellResultToFileImpl::writeBinaryResultToTextFile( exportSettings.fileName,
|
||||
RicEclipseCellResultToFileImpl::writeBinaryResultToTextFile( exportSettings.fileName().path(),
|
||||
m_cellColors->reservoirView()->eclipseCase()->eclipseCaseData(),
|
||||
timeStep,
|
||||
m_cellColors,
|
||||
@@ -113,7 +113,7 @@ void RicSaveEclipseResultAsInputPropertyExec::redo()
|
||||
if ( !isOk )
|
||||
{
|
||||
QString fullError =
|
||||
QString( "Failed to exported current result to %1. Error was: %2" ).arg( exportSettings.fileName ).arg( errMsg );
|
||||
QString( "Failed to exported current result to %1. Error was: %2" ).arg( exportSettings.fileName().path() ).arg( errMsg );
|
||||
RiaLogging::error( fullError );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ bool RicDeleteScriptPathFeature::isCommandEnabled() const
|
||||
std::vector<RimScriptCollection*> selection = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
if ( selection.size() == 1 )
|
||||
{
|
||||
if ( selection.front()->directory().isEmpty() ) return false;
|
||||
if ( selection.front()->directory().path().isEmpty() ) return false;
|
||||
}
|
||||
return !selection.empty();
|
||||
}
|
||||
@@ -57,7 +57,7 @@ void RicDeleteScriptPathFeature::onActionTriggered( bool isChecked )
|
||||
RimScriptCollection* scriptCollection = !calcScriptCollections.empty() ? calcScriptCollections[0] : nullptr;
|
||||
if ( scriptCollection )
|
||||
{
|
||||
QString toBeRemoved = scriptCollection->directory;
|
||||
QString toBeRemoved = scriptCollection->directory().path();
|
||||
|
||||
QString originalFilePathString = RiaPreferences::current()->scriptDirectories();
|
||||
QStringList allFilePaths = originalFilePathString.split( ";" );
|
||||
|
||||
@@ -54,7 +54,7 @@ void RicEditScriptFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
RimCalcScript* calcScript = selection[0];
|
||||
|
||||
RicOpenInTextEditorFeature::openFileInTextEditor( calcScript->absoluteFileName, this );
|
||||
RicOpenInTextEditorFeature::openFileInTextEditor( calcScript->absoluteFileName().path(), this );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ void RicExecuteLastUsedScriptFeature::onActionTriggered( bool isChecked )
|
||||
std::vector<RimCalcScript*> scripts = rootScriptCollection->descendantsIncludingThisOfType<RimCalcScript>();
|
||||
for ( auto c : scripts )
|
||||
{
|
||||
if ( c->absoluteFileName() == lastUsedScript )
|
||||
if ( c->absoluteFileName().path() == lastUsedScript )
|
||||
{
|
||||
RicExecuteScriptFeature::executeScript( c );
|
||||
return;
|
||||
|
||||
@@ -94,7 +94,7 @@ void RicExecuteScriptFeature::executeScript( RimCalcScript* calcScript )
|
||||
QString octavePath = app->octavePath();
|
||||
if ( !octavePath.isEmpty() )
|
||||
{
|
||||
QStringList arguments = RimCalcScript::createCommandLineArguments( calcScript->absoluteFileName() );
|
||||
QStringList arguments = RimCalcScript::createCommandLineArguments( calcScript->absoluteFileName().path() );
|
||||
RiaApplication::instance()->launchProcess( octavePath, arguments, app->octaveProcessEnvironment() );
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,7 @@ void RicExecuteScriptFeature::executeScript( RimCalcScript* calcScript )
|
||||
QString pythonPath = app->pythonPath();
|
||||
if ( !pythonPath.isEmpty() )
|
||||
{
|
||||
QStringList arguments = RimCalcScript::createCommandLineArguments( calcScript->absoluteFileName() );
|
||||
QStringList arguments = RimCalcScript::createCommandLineArguments( calcScript->absoluteFileName().path() );
|
||||
QProcessEnvironment penv = app->pythonProcessEnvironment();
|
||||
|
||||
RiuProcessMonitor* processMonitor = RiuMainWindow::instance()->processMonitor();
|
||||
@@ -136,10 +136,10 @@ void RicExecuteScriptFeature::executeScript( RimCalcScript* calcScript )
|
||||
}
|
||||
}
|
||||
|
||||
if ( !calcScript->absoluteFileName().isEmpty() )
|
||||
if ( !calcScript->absoluteFileName().path().isEmpty() )
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue( RicExecuteLastUsedScriptFeature::lastUsedScriptPathKey(), calcScript->absoluteFileName() );
|
||||
settings.setValue( RicExecuteLastUsedScriptFeature::lastUsedScriptPathKey(), calcScript->absoluteFileName().path() );
|
||||
|
||||
auto cmdFeature = caf::CmdFeatureManager::instance()->getCommandFeature( "RicExecuteLastUsedScriptFeature" );
|
||||
cmdFeature->action(); // Retrieve the action to update the looks
|
||||
|
||||
@@ -48,7 +48,7 @@ bool RicNewOctaveScriptFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
if ( calcScriptCollections.empty() ) return false;
|
||||
return !calcScriptCollections.front()->directory().isEmpty();
|
||||
return !calcScriptCollections.front()->directory().path().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -66,12 +66,12 @@ void RicNewOctaveScriptFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( calcScript )
|
||||
{
|
||||
QFileInfo existingScriptFileInfo( calcScript->absoluteFileName() );
|
||||
QFileInfo existingScriptFileInfo( calcScript->absoluteFileName().path() );
|
||||
fullPathNewScript = existingScriptFileInfo.absolutePath();
|
||||
}
|
||||
else if ( scriptColl )
|
||||
{
|
||||
fullPathNewScript = scriptColl->directory();
|
||||
fullPathNewScript = scriptColl->directory().path();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ bool RicNewPythonScriptFeature::isCommandEnabled() const
|
||||
{
|
||||
std::vector<RimScriptCollection*> calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections();
|
||||
if ( calcScriptCollections.empty() ) return false;
|
||||
return !calcScriptCollections.front()->directory().isEmpty();
|
||||
return !calcScriptCollections.front()->directory().path().isEmpty();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -67,13 +67,13 @@ void RicNewPythonScriptFeature::onActionTriggered( bool isChecked )
|
||||
|
||||
if ( calcScript )
|
||||
{
|
||||
QFileInfo existingScriptFileInfo( calcScript->absoluteFileName() );
|
||||
QFileInfo existingScriptFileInfo( calcScript->absoluteFileName().path() );
|
||||
fullPathNewScript = existingScriptFileInfo.absolutePath();
|
||||
scriptColl = calcScript->firstAncestorOrThisOfTypeAsserted<RimScriptCollection>();
|
||||
}
|
||||
else if ( scriptColl )
|
||||
{
|
||||
fullPathNewScript = scriptColl->directory();
|
||||
fullPathNewScript = scriptColl->directory().path();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmPtrField.h"
|
||||
@@ -36,7 +37,7 @@ class RimFractureExportSettings : public caf::PdmObject
|
||||
public:
|
||||
RimFractureExportSettings();
|
||||
|
||||
caf::PdmField<QString> fileName;
|
||||
caf::PdmField<caf::FilePath> fileName;
|
||||
caf::PdmPtrField<RimEclipseCase*> caseToApply;
|
||||
|
||||
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override;
|
||||
|
||||
@@ -36,7 +36,7 @@ RimPlotTemplateFileItem::RimPlotTemplateFileItem()
|
||||
{
|
||||
CAF_PDM_InitObject( "PlotTemplateFileItem", ":/plot-template-standard.svg", "Plot Template", "" );
|
||||
|
||||
CAF_PDM_InitField( &m_absoluteFileName, "AbsolutePath", QString(), "Location" );
|
||||
CAF_PDM_InitField( &m_absoluteFileName, "AbsolutePath", caf::FilePath(), "Location" );
|
||||
m_absoluteFileName.uiCapability()->setUiReadOnly( true );
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ void RimPlotTemplateFileItem::setFilePath( const QString& filePath )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimPlotTemplateFileItem::absoluteFilePath() const
|
||||
{
|
||||
return m_absoluteFileName();
|
||||
return m_absoluteFileName().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -73,7 +73,7 @@ QString RimPlotTemplateFileItem::absoluteFilePath() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RimPlotTemplateFileItem::isEnsembleTemplate() const
|
||||
{
|
||||
return m_absoluteFileName().toLower().endsWith( ".erpt" );
|
||||
return m_absoluteFileName().path().toLower().endsWith( ".erpt" );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
@@ -43,5 +44,5 @@ public:
|
||||
void updateIconState();
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_absoluteFileName;
|
||||
caf::PdmField<caf::FilePath> m_absoluteFileName;
|
||||
};
|
||||
|
||||
@@ -52,7 +52,7 @@ RimProcess::RimProcess( bool logStdOutErr /*true*/, RimProcessMonitor* monitor )
|
||||
CAF_PDM_InitFieldNoDefault( &m_command, "Command", "Command" );
|
||||
m_command.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitField( &m_workDir, "WorkDir", QString(), "Working Directory" );
|
||||
CAF_PDM_InitField( &m_workDir, "WorkDir", caf::FilePath(), "Working Directory" );
|
||||
m_command.uiCapability()->setUiReadOnly( true );
|
||||
|
||||
CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description" );
|
||||
@@ -191,9 +191,9 @@ bool RimProcess::start( bool enableStdOut, bool enableStdErr )
|
||||
env.insert( key, val );
|
||||
}
|
||||
m_qProcess->setProcessEnvironment( env );
|
||||
if ( !m_workDir().isEmpty() )
|
||||
if ( !m_workDir().path().isEmpty() )
|
||||
{
|
||||
m_qProcess->setWorkingDirectory( m_workDir );
|
||||
m_qProcess->setWorkingDirectory( m_workDir().path() );
|
||||
}
|
||||
|
||||
m_qProcess->start( m_command, m_arguments );
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma once
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
@@ -73,11 +74,11 @@ private:
|
||||
|
||||
bool isWindowsBatchFile() const;
|
||||
|
||||
caf::PdmField<QString> m_command;
|
||||
QStringList m_arguments;
|
||||
caf::PdmField<QString> m_description;
|
||||
caf::PdmField<int> m_id;
|
||||
caf::PdmField<QString> m_workDir;
|
||||
caf::PdmField<QString> m_command;
|
||||
QStringList m_arguments;
|
||||
caf::PdmField<QString> m_description;
|
||||
caf::PdmField<int> m_id;
|
||||
caf::PdmField<caf::FilePath> m_workDir;
|
||||
|
||||
std::vector<std::pair<QString, QString>> m_environmentVariables;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
@@ -32,10 +33,10 @@ class RimBinaryExportSettings : public caf::PdmObject
|
||||
public:
|
||||
RimBinaryExportSettings();
|
||||
|
||||
caf::PdmField<QString> fileName;
|
||||
caf::PdmField<QString> eclipseKeyword;
|
||||
caf::PdmField<double> undefinedValue;
|
||||
caf::PdmField<bool> writeEchoInGrdeclFiles;
|
||||
caf::PdmField<caf::FilePath> fileName;
|
||||
caf::PdmField<QString> eclipseKeyword;
|
||||
caf::PdmField<double> undefinedValue;
|
||||
caf::PdmField<bool> writeEchoInGrdeclFiles;
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
@@ -36,7 +36,7 @@ RimCalcScript::RimCalcScript()
|
||||
{
|
||||
CAF_PDM_InitObject( "CalcScript", ":/OctaveScriptFile16x16.png", "Calc Script", "" );
|
||||
|
||||
CAF_PDM_InitField( &absoluteFileName, "AbsolutePath", QString(), "Location" );
|
||||
CAF_PDM_InitField( &absoluteFileName, "AbsolutePath", caf::FilePath(), "Location" );
|
||||
absoluteFileName.uiCapability()->setUiReadOnly( true );
|
||||
absoluteFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() );
|
||||
}
|
||||
@@ -70,7 +70,7 @@ RimCalcScript::ScriptType RimCalcScript::scriptType( const QString& absoluteFile
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RimCalcScript::ScriptType RimCalcScript::scriptType() const
|
||||
{
|
||||
return scriptType( absoluteFileName() );
|
||||
return scriptType( absoluteFileName().path() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
@@ -45,7 +46,7 @@ public:
|
||||
|
||||
static QStringList createCommandLineArguments( const QString& absoluteFileNameScript );
|
||||
|
||||
caf::PdmField<QString> absoluteFileName;
|
||||
caf::PdmField<caf::FilePath> absoluteFileName;
|
||||
|
||||
protected:
|
||||
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
|
||||
|
||||
@@ -1373,16 +1373,16 @@ void RimContextCommandBuilder::createExecuteScriptForCasesFeatureMenu( caf::CmdF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimContextCommandBuilder::appendScriptItems( caf::CmdFeatureMenuBuilder& menuBuilder, RimScriptCollection* scriptCollection )
|
||||
{
|
||||
QDir dir( scriptCollection->directory );
|
||||
QDir dir( scriptCollection->directory().path() );
|
||||
menuBuilder.subMenuStart( dir.dirName() );
|
||||
|
||||
for ( size_t i = 0; i < scriptCollection->calcScripts.size(); i++ )
|
||||
{
|
||||
RimCalcScript* calcScript = scriptCollection->calcScripts[i];
|
||||
QFileInfo fi( calcScript->absoluteFileName() );
|
||||
QFileInfo fi( calcScript->absoluteFileName().path() );
|
||||
|
||||
QString menuText = fi.baseName();
|
||||
menuBuilder.addCmdFeatureWithUserData( "RicExecuteScriptForCasesFeature", menuText, QVariant( calcScript->absoluteFileName() ) );
|
||||
menuBuilder.addCmdFeatureWithUserData( "RicExecuteScriptForCasesFeature", menuText, QVariant( calcScript->absoluteFileName().path() ) );
|
||||
}
|
||||
|
||||
for ( size_t i = 0; i < scriptCollection->subDirectories.size(); i++ )
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
@@ -32,9 +33,9 @@ class RimExportInputSettings : public caf::PdmObject
|
||||
public:
|
||||
RimExportInputSettings();
|
||||
|
||||
caf::PdmField<QString> fileName;
|
||||
caf::PdmField<QString> eclipseKeyword;
|
||||
caf::PdmField<bool> writeEchoInGrdeclFiles;
|
||||
caf::PdmField<caf::FilePath> fileName;
|
||||
caf::PdmField<QString> eclipseKeyword;
|
||||
caf::PdmField<bool> writeEchoInGrdeclFiles;
|
||||
|
||||
protected:
|
||||
void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override;
|
||||
|
||||
@@ -53,7 +53,7 @@ RimReservoirCellResultsStorage::RimReservoirCellResultsStorage()
|
||||
{
|
||||
CAF_PDM_InitObject( "Cacher" );
|
||||
|
||||
CAF_PDM_InitField( &m_resultCacheFileName, "ResultCacheFileName", QString(), "UiDummyname" );
|
||||
CAF_PDM_InitField( &m_resultCacheFileName, "ResultCacheFileName", caf::FilePath(), "UiDummyname" );
|
||||
m_resultCacheFileName.uiCapability()->setUiHidden( true );
|
||||
CAF_PDM_InitFieldNoDefault( &m_resultCacheMetaData, "ResultCacheEntries", "UiDummyname" );
|
||||
}
|
||||
@@ -176,7 +176,7 @@ void RimReservoirCellResultsStorage::setupBeforeSave()
|
||||
QString RimReservoirCellResultsStorage::getValidCacheFileName()
|
||||
{
|
||||
QString cacheFileName;
|
||||
if ( m_resultCacheFileName().isEmpty() )
|
||||
if ( m_resultCacheFileName().path().isEmpty() )
|
||||
{
|
||||
QString newCacheDirPath = getCacheDirectoryPath();
|
||||
QUuid guid = QUuid::createUuid();
|
||||
@@ -186,7 +186,7 @@ QString RimReservoirCellResultsStorage::getValidCacheFileName()
|
||||
{
|
||||
// Make the path correct related to the possibly new project filename
|
||||
QString newCacheDirPath = getCacheDirectoryPath();
|
||||
QFileInfo oldCacheFile( m_resultCacheFileName() );
|
||||
QFileInfo oldCacheFile( m_resultCacheFileName().path() );
|
||||
|
||||
cacheFileName = newCacheDirPath + "/" + oldCacheFile.fileName();
|
||||
}
|
||||
@@ -215,7 +215,7 @@ void RimReservoirCellResultsStorage::setCellResults( RigCaseCellResultsData* cel
|
||||
// Now that we have got the results container, we can finally
|
||||
// Read data from the internal storage and populate it
|
||||
|
||||
if ( m_resultCacheFileName().isEmpty() ) return;
|
||||
if ( m_resultCacheFileName().path().isEmpty() ) return;
|
||||
|
||||
// Get the name of the cache name relative to the current project file position
|
||||
QString newValidCacheFileName = getValidCacheFileName();
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "RiaDefines.h"
|
||||
|
||||
#include "cafAppEnum.h"
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@@ -52,7 +53,7 @@ private:
|
||||
QString getValidCacheFileName();
|
||||
QString getCacheDirectoryPath();
|
||||
// Fields
|
||||
caf::PdmField<QString> m_resultCacheFileName;
|
||||
caf::PdmField<caf::FilePath> m_resultCacheFileName;
|
||||
caf::PdmChildArrayField<RimReservoirCellResultsStorageEntryInfo*> m_resultCacheMetaData;
|
||||
|
||||
RigCaseCellResultsData* m_cellResults;
|
||||
|
||||
@@ -56,7 +56,7 @@ void RimScriptCollection::readContentFromDisc( int folderLevelsLeft )
|
||||
folderLevelsLeft--;
|
||||
if ( folderLevelsLeft < 0 ) return;
|
||||
|
||||
if ( directory().isEmpty() )
|
||||
if ( directory().path().isEmpty() )
|
||||
{
|
||||
for ( size_t i = 0; i < subDirectories.size(); ++i )
|
||||
{
|
||||
@@ -65,7 +65,7 @@ void RimScriptCollection::readContentFromDisc( int folderLevelsLeft )
|
||||
return;
|
||||
}
|
||||
|
||||
QDir myDir( directory() );
|
||||
QDir myDir( directory().path() );
|
||||
if ( !myDir.isReadable() )
|
||||
{
|
||||
return;
|
||||
@@ -75,7 +75,7 @@ void RimScriptCollection::readContentFromDisc( int folderLevelsLeft )
|
||||
{
|
||||
QStringList nameFilters;
|
||||
nameFilters << "*.m" << "*.py";
|
||||
QStringList fileList = caf::Utils::getFilesInDirectory( directory, nameFilters, true );
|
||||
QStringList fileList = caf::Utils::getFilesInDirectory( directory().path(), nameFilters, true );
|
||||
|
||||
int i;
|
||||
for ( i = 0; i < fileList.size(); i++ )
|
||||
@@ -97,7 +97,7 @@ void RimScriptCollection::readContentFromDisc( int folderLevelsLeft )
|
||||
|
||||
if ( folderLevelsLeft > 0 )
|
||||
{
|
||||
QDir dir( directory );
|
||||
QDir dir( directory().path() );
|
||||
QFileInfoList fileInfoList = dir.entryInfoList( QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Readable );
|
||||
|
||||
QListIterator<QFileInfo> it( fileInfoList );
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmObject.h"
|
||||
@@ -43,7 +44,7 @@ public:
|
||||
RimScriptCollection();
|
||||
|
||||
public:
|
||||
caf::PdmField<QString> directory;
|
||||
caf::PdmField<caf::FilePath> directory;
|
||||
caf::PdmChildArrayField<RimCalcScript*> calcScripts;
|
||||
|
||||
caf::PdmChildArrayField<RimScriptCollection*> subDirectories;
|
||||
|
||||
@@ -165,7 +165,7 @@ void RimWellMeasurement::setRemark( const QString& remark )
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellMeasurement::filePath() const
|
||||
{
|
||||
return m_filePath;
|
||||
return m_filePath().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmField.h"
|
||||
|
||||
#include "cvfColor3.h"
|
||||
@@ -66,12 +67,12 @@ private:
|
||||
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
|
||||
|
||||
private:
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<double> m_MD;
|
||||
caf::PdmField<QDate> m_date;
|
||||
caf::PdmField<double> m_value;
|
||||
caf::PdmField<QString> m_kind;
|
||||
caf::PdmField<int> m_quality;
|
||||
caf::PdmField<QString> m_remark;
|
||||
caf::PdmField<QString> m_filePath;
|
||||
caf::PdmField<QString> m_wellName;
|
||||
caf::PdmField<double> m_MD;
|
||||
caf::PdmField<QDate> m_date;
|
||||
caf::PdmField<double> m_value;
|
||||
caf::PdmField<QString> m_kind;
|
||||
caf::PdmField<int> m_quality;
|
||||
caf::PdmField<QString> m_remark;
|
||||
caf::PdmField<caf::FilePath> m_filePath;
|
||||
};
|
||||
|
||||
@@ -65,7 +65,7 @@ QString RimFileWellPath::filePath() const
|
||||
{
|
||||
if ( isStoredInCache() || m_filePath().path().isEmpty() )
|
||||
{
|
||||
return m_filePathInCache();
|
||||
return m_filePathInCache().path();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -208,7 +208,7 @@ QString RimFileWellPath::getCacheDirectoryPath()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimFileWellPath::getCacheFileName()
|
||||
{
|
||||
if ( m_filePathInCache().isEmpty() )
|
||||
if ( m_filePathInCache().path().isEmpty() )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
@@ -218,7 +218,7 @@ QString RimFileWellPath::getCacheFileName()
|
||||
// Make the path correct related to the possibly new project filename
|
||||
|
||||
QString newCacheDirPath = getCacheDirectoryPath();
|
||||
QFileInfo oldCacheFile( m_filePathInCache() );
|
||||
QFileInfo oldCacheFile( m_filePathInCache().path() );
|
||||
|
||||
cacheFileName = newCacheDirPath + "/" + oldCacheFile.fileName();
|
||||
|
||||
@@ -238,7 +238,7 @@ void RimFileWellPath::setupBeforeSave()
|
||||
return;
|
||||
}
|
||||
|
||||
if ( m_filePathInCache().isEmpty() )
|
||||
if ( m_filePathInCache().path().isEmpty() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -248,12 +248,12 @@ void RimFileWellPath::setupBeforeSave()
|
||||
QString newCacheFileName = getCacheFileName();
|
||||
|
||||
// Use QFileInfo to get same string representation to avoid issues with mix of forward and backward slashes
|
||||
QFileInfo prevFileInfo( m_filePathInCache() );
|
||||
QFileInfo prevFileInfo( m_filePathInCache().path() );
|
||||
QFileInfo currentFileInfo( newCacheFileName );
|
||||
|
||||
if ( prevFileInfo.absoluteFilePath().compare( currentFileInfo.absoluteFilePath() ) != 0 )
|
||||
{
|
||||
QFile::copy( m_filePathInCache(), newCacheFileName );
|
||||
QFile::copy( m_filePathInCache().path(), newCacheFileName );
|
||||
|
||||
m_filePathInCache = newCacheFileName;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ private:
|
||||
void ensureWellPathStartAtSeaLevel( RigWellPath* wellPath );
|
||||
|
||||
caf::PdmField<caf::FilePath> m_filePath;
|
||||
caf::PdmField<QString> m_filePathInCache; // Used for SSIHUB imported well paths
|
||||
caf::PdmField<caf::FilePath> m_filePathInCache; // Used for SSIHUB imported well paths
|
||||
caf::PdmField<int> m_wellPathIndexInFile; // -1 means none.
|
||||
|
||||
caf::PdmField<QString> id;
|
||||
|
||||
@@ -307,7 +307,7 @@ QDateTime RimWellIASettings::geostaticDate() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellIASettings::outputBaseDirectory() const
|
||||
{
|
||||
return m_baseDir();
|
||||
return m_baseDir().path();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -315,7 +315,7 @@ QString RimWellIASettings::outputBaseDirectory() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellIASettings::outputOdbFilename() const
|
||||
{
|
||||
return m_baseDir() + "/" + name() + ".odb";
|
||||
return m_baseDir().path() + "/" + name() + ".odb";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -323,7 +323,7 @@ QString RimWellIASettings::outputOdbFilename() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellIASettings::outputDrillingOdbFilename() const
|
||||
{
|
||||
return m_baseDir() + "/" + name() + "_drilling.odb";
|
||||
return m_baseDir().path() + "/" + name() + "_drilling.odb";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -331,7 +331,7 @@ QString RimWellIASettings::outputDrillingOdbFilename() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellIASettings::jsonInputFilename() const
|
||||
{
|
||||
return m_baseDir() + "/model_input.json";
|
||||
return m_baseDir().path() + "/model_input.json";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -339,14 +339,14 @@ QString RimWellIASettings::jsonInputFilename() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RimWellIASettings::csvInputFilename() const
|
||||
{
|
||||
return m_baseDir() + "/model_input.csv";
|
||||
return m_baseDir().path() + "/model_input.csv";
|
||||
}
|
||||
|
||||
QStringList RimWellIASettings::commandParameters() const
|
||||
{
|
||||
QStringList retlist;
|
||||
|
||||
retlist << m_baseDir();
|
||||
retlist << m_baseDir().path();
|
||||
retlist << jsonInputFilename();
|
||||
retlist << csvInputFilename();
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "RimCheckableNamedObject.h"
|
||||
#include "RimWellIAModelBox.h"
|
||||
|
||||
#include "cafFilePath.h"
|
||||
#include "cafPdmChildArrayField.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cafPdmFieldCvfVec3d.h"
|
||||
@@ -117,7 +118,7 @@ private:
|
||||
caf::PdmProxyValueField<QString> m_nameProxy;
|
||||
|
||||
caf::PdmPtrField<RimGeoMechCase*> m_geomechCase;
|
||||
caf::PdmField<QString> m_baseDir;
|
||||
caf::PdmField<caf::FilePath> m_baseDir;
|
||||
|
||||
caf::PdmField<bool> m_showBox;
|
||||
caf::PdmField<bool> m_boxValid;
|
||||
|
||||
Reference in New Issue
Block a user