From bb875a5a2118c79b18330289d0a9fd13f7ab430f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Mon, 23 Oct 2023 15:58:00 +0200
Subject: [PATCH] merge fct

---
 GUI/Model/Sample/SampleValidator.cpp | 21 ++++++++-------------
 GUI/Model/Sample/SampleValidator.h   |  2 --
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/GUI/Model/Sample/SampleValidator.cpp b/GUI/Model/Sample/SampleValidator.cpp
index cf9842e817d..0a4dca1510e 100644
--- a/GUI/Model/Sample/SampleValidator.cpp
+++ b/GUI/Model/Sample/SampleValidator.cpp
@@ -21,18 +21,6 @@
 #include "GUI/Model/Sample/ParticleLayoutItem.h"
 #include "GUI/Model/Sample/SampleItem.h"
 
-void SampleValidator::validateItem(const ItemWithParticles* item)
-{
-    if (const auto* p = dynamic_cast<const CoreAndShellItem*>(item)) {
-        if (!p->coreItem())
-            addMessage("Sim/shell particle doesn't have core defined.");
-        if (!p->shellItem())
-            addMessage("Sim/shell particle doesn't have shell defined.");
-    } else if (const auto* p = dynamic_cast<const CompoundItem*>(item))
-        if (p->itemsWithParticles().isEmpty())
-            addMessage("Particle composition doesn't have any particles.");
-}
-
 void SampleValidator::addMessage(const QString& m)
 {
     m_messages += QString("* ") + m + "\n";
@@ -55,7 +43,14 @@ bool SampleValidator::isValidSample(const SampleItem* sample)
             if (layout->itemsWithParticles().isEmpty())
                 addMessage("Particle layout doesn't contain any particles.");
             for (const auto* particle : layout->containedItemsWithParticles()) {
-                validateItem(particle);
+		if (const auto* p = dynamic_cast<const CoreAndShellItem*>(particle)) {
+		    if (!p->coreItem())
+			addMessage("Sim/shell particle doesn't have core defined.");
+		    if (!p->shellItem())
+			addMessage("Sim/shell particle doesn't have shell defined.");
+		} else if (const auto* p = dynamic_cast<const CompoundItem*>(particle))
+		    if (p->itemsWithParticles().isEmpty())
+			addMessage("Particle composition doesn't have any particles.");
             }
         }
     }
diff --git a/GUI/Model/Sample/SampleValidator.h b/GUI/Model/Sample/SampleValidator.h
index a70b32ac262..69bc85fb5e7 100644
--- a/GUI/Model/Sample/SampleValidator.h
+++ b/GUI/Model/Sample/SampleValidator.h
@@ -29,8 +29,6 @@ public:
     QString getValidationMessage() const { return m_messages; }
 
 private:
-    void validateItem(const ItemWithParticles* item);
-
     //! Adds this message to the report.
     void addMessage(const QString& m);
 
-- 
GitLab