From a9509c0212765447ffc517cf0da28b5eeb2b4240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 5 Oct 2016 15:41:10 +0200 Subject: [PATCH] #903 Fixed formation names file name presentation in UI. Use filename wo/path --- ApplicationCode/ProjectDataModel/RimCase.cpp | 2 +- .../ProjectDataModel/RimFormationNames.cpp | 15 +++++++++++++-- .../ProjectDataModel/RimFormationNames.h | 1 + 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimCase.cpp b/ApplicationCode/ProjectDataModel/RimCase.cpp index e6a9a1ea05..b3f464da23 100644 --- a/ApplicationCode/ProjectDataModel/RimCase.cpp +++ b/ApplicationCode/ProjectDataModel/RimCase.cpp @@ -78,7 +78,7 @@ QList RimCase::calculateValueOptions(const caf::PdmField { for(RimFormationNames* fnames : proj->activeOilField()->formationNamesCollection()->formationNamesList()) { - optionList.push_back(caf::PdmOptionItemInfo(fnames->uiCapability()->uiName(), + optionList.push_back(caf::PdmOptionItemInfo(fnames->fileNameWoPath(), QVariant::fromValue(caf::PdmPointer(fnames)), false, fnames->uiCapability()->uiIcon())); diff --git a/ApplicationCode/ProjectDataModel/RimFormationNames.cpp b/ApplicationCode/ProjectDataModel/RimFormationNames.cpp index 4580b86dd8..fc0b654689 100644 --- a/ApplicationCode/ProjectDataModel/RimFormationNames.cpp +++ b/ApplicationCode/ProjectDataModel/RimFormationNames.cpp @@ -25,7 +25,9 @@ #include "RimView.h" #include "cafPdmUiFilePathEditor.h" -#include "QFile" + +#include +#include CAF_PDM_SOURCE_INIT(RimFormationNames, "FormationNames"); @@ -76,7 +78,7 @@ void RimFormationNames::initAfterRead() //-------------------------------------------------------------------------------------------------- void RimFormationNames::updateUiTreeName() { - this->uiCapability()->setUiName(m_formationNamesFileName()); + this->uiCapability()->setUiName(fileNameWoPath()); } //-------------------------------------------------------------------------------------------------- @@ -97,6 +99,15 @@ const QString& RimFormationNames::fileName() return m_formationNamesFileName(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFormationNames::fileNameWoPath() +{ + QFileInfo fnameFileInfo(m_formationNamesFileName()); + return fnameFileInfo.fileName(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimFormationNames.h b/ApplicationCode/ProjectDataModel/RimFormationNames.h index 8503e9c8d2..2e6a71320c 100644 --- a/ApplicationCode/ProjectDataModel/RimFormationNames.h +++ b/ApplicationCode/ProjectDataModel/RimFormationNames.h @@ -33,6 +33,7 @@ public: void setFileName(const QString& fileName); const QString& fileName(); + QString fileNameWoPath(); RigFormationNames* formationNamesData() { return m_formationNamesData.p();} void updateConnectedViews();