From 340ccb8ed63a8ceb529827a47283d68dee460935 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Wed, 28 Dec 2022 09:43:36 +0100 Subject: [PATCH] Sketcher: SketchObject using the new notification system ======================================================== - CriticalMessage old signal is reconverted to new notification system. This enables to remove the obsolete old system. - An example of how common errors can be provided with translation support is added, so that App notifications appear translated in the NotificationArea. --- src/Mod/Sketcher/App/SketchObject.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 82a4de87e2..3a8f335831 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -90,7 +90,6 @@ FC_LOG_LEVEL_INIT("Sketch",true,true) PROPERTY_SOURCE(Sketcher::SketchObject, Part::Part2DObject) - SketchObject::SketchObject() { ADD_PROPERTY_TYPE(Geometry, (nullptr) ,"Sketch",(App::PropertyType)(App::Prop_None),"Sketch geometry"); @@ -300,11 +299,11 @@ int SketchObject::solve(bool updateGeoAfterSolving/*=true*/) } if(lastHasMalformedConstraints) { - Base::Console().Error("Sketch %s has malformed constraints!\n",this->getNameInDocument()); + Base::Console().Error(this->getFullLabel(), QT_TRANSLATE_NOOP("Notifications","The Sketch has malformed constraints!") "\n"); } if(lastHasPartialRedundancies) { - Base::Console().Warning("Sketch %s has partially redundant constraints!\n",this->getNameInDocument()); + Base::Console().Warning(this->getFullLabel(), QT_TRANSLATE_NOOP("Notifications","The Sketch has partially redundant constraints!") "\n"); } lastSolveTime=solvedSketch.getSolveTime(); @@ -8313,10 +8312,7 @@ void SketchObject::migrateSketch() Constraints.setValues(std::move(newconstraints)); - Base::Console().Warning("In Sketch %s, parabolas were migrated. Migrated files won't open in previous versions of FreeCAD!!\n",this->Label.getStrValue().c_str()); - - this->getDocument()->signalUserMessage(*this, QStringLiteral(QT_TRANSLATE_NOOP("CriticalMessages","Sketch:")) + QStringLiteral(" ") + QString::fromStdString(this->Label.getStrValue()) + - QStringLiteral(".\n\n") + QString::fromLatin1(QT_TRANSLATE_NOOP("CriticalMessages","Parabolas were migrated. Migrated files won't open in previous versions of FreeCAD!!")), App::Document::NotificationType::Critical); + Base::Console().Critical(this->getFullName(),QT_TRANSLATE_NOOP("Notifications","Parabolas were migrated. Migrated files won't open in previous versions of FreeCAD!!\n")); } } }