From 45a57c4880d2a6ac97b60860f406f6571b86041f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 1 Mar 2024 07:38:52 +0100 Subject: [PATCH] Rename and improve log message --- .../ProjectDataModel/Polygons/RimPolygon.cpp | 2 +- .../Polygons/RimPolygonFile.cpp | 23 ++++++++----------- .../Polygons/RimPolygonInView.cpp | 2 +- .../cafPdmUiTreeAttributes.cpp | 2 +- .../cafUserInterface/cafPdmUiTreeAttributes.h | 2 +- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp index e368660039..06908f4535 100644 --- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp +++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygon.cpp @@ -262,6 +262,6 @@ void RimPolygon::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEd if ( m_isReadOnly ) { - caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( attribute, ":/padlock.svg" ); + caf::PdmUiTreeViewItemAttribute::appendTagToTreeViewItemAttribute( attribute, ":/padlock.svg" ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp index 6c84a85875..2b3aeb4519 100644 --- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonFile.cpp @@ -77,15 +77,15 @@ void RimPolygonFile::loadData() m_polygons.deleteChildren(); m_polygons.setValue( polygonsFromFile ); + } - if ( polygonsFromFile.empty() ) - { - RiaLogging::warning( "No polygons found in file: " + m_fileName().path() ); - } - else - { - RiaLogging::warning( QString( "Imported %1 polygons from file: " ).arg( polygonsFromFile.size() ) + m_fileName().path() ); - } + if ( polygonsFromFile.empty() ) + { + RiaLogging::warning( "No polygons found in file: " + m_fileName().path() ); + } + else + { + RiaLogging::info( QString( "Imported %1 polygons from file: " ).arg( polygonsFromFile.size() ) + m_fileName().path() ); } } @@ -197,11 +197,8 @@ void RimPolygonFile::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) //-------------------------------------------------------------------------------------------------- void RimPolygonFile::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) { - if ( auto* treeItemAttribute = dynamic_cast( attribute ) ) + if ( m_polygons.empty() ) { - if ( m_polygons.empty() ) - { - caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( attribute, ":/warning.svg" ); - } + caf::PdmUiTreeViewItemAttribute::appendTagToTreeViewItemAttribute( attribute, ":/warning.svg" ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp index c922610847..570f530590 100644 --- a/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Polygons/RimPolygonInView.cpp @@ -350,7 +350,7 @@ void RimPolygonInView::defineObjectEditorAttribute( QString uiConfigName, caf::P if ( m_polygon->isReadOnly() ) { - caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( attribute, ":/padlock.svg" ); + caf::PdmUiTreeViewItemAttribute::appendTagToTreeViewItemAttribute( attribute, ":/padlock.svg" ); } } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp index 37c81bfd42..56fc50f440 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.cpp @@ -72,7 +72,7 @@ std::unique_ptr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void caf::PdmUiTreeViewItemAttribute::createTagIfTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute, +void caf::PdmUiTreeViewItemAttribute::appendTagToTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute, const QString& iconResourceString ) { if ( auto* treeItemAttribute = dynamic_cast( attribute ) ) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h index 457157e566..b5e6442be1 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h @@ -77,7 +77,7 @@ class PdmUiTreeViewItemAttribute : public PdmUiEditorAttribute static std::unique_ptr createTag(); static std::unique_ptr createTag( const QColor& color, const QColor& backgroundColor, const QString& text ); - static void createTagIfTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute, const QString& iconString ); + static void appendTagToTreeViewItemAttribute( caf::PdmUiEditorAttribute* attribute, const QString& iconString ); std::vector> tags; };