diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsAngleNode.cxx b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsAngleNode.cxx index 38363d3fc61..3c125ccee70 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsAngleNode.cxx +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsAngleNode.cxx @@ -16,6 +16,7 @@ ==============================================================================*/ // MRML includes +#include "vtkMRMLI18N.h" #include "vtkMRMLMarkupsDisplayNode.h" #include "vtkMRMLMarkupsAngleNode.h" #include "vtkMRMLMeasurementAngle.h" @@ -41,6 +42,12 @@ vtkMRMLMarkupsAngleNode::vtkMRMLMarkupsAngleNode() this->MaximumNumberOfControlPoints = 3; this->RequiredNumberOfControlPoints = 3; + // Set markup type GUI display name + this->TypeDisplayName = vtkMRMLTr("vtkMRMLMarkupsAngleNode", "Angle"); + + // Set markup short name + this->DefaultNodeNamePrefix = vtkMRMLTr("vtkMRMLMarkupsAngleNode", "A"); + // Setup measurements calculated for this markup type vtkNew angleMeasurement; angleMeasurement->SetName("angle"); diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsAngleNode.h b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsAngleNode.h index cf5b6cbd473..7fb985b6bac 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsAngleNode.h +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsAngleNode.h @@ -67,12 +67,6 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsAngleNode : public vt /// Get markup type internal name const char* GetMarkupType() override {return "Angle";}; - // Get markup type GUI display name - const char* GetTypeDisplayName() override {return "Angle";}; - - /// Get markup short name - const char* GetDefaultNodeNamePrefix() override {return "A";}; - /// Read node attributes from XML file void ReadXMLAttributes( const char** atts) override; diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsClosedCurveNode.cxx b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsClosedCurveNode.cxx index 800aa499045..79fce575200 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsClosedCurveNode.cxx +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsClosedCurveNode.cxx @@ -20,6 +20,7 @@ // MRML includes #include "vtkCurveGenerator.h" #include "vtkCurveMeasurementsCalculator.h" +#include "vtkMRMLI18N.h" #include "vtkMRMLMeasurementArea.h" #include "vtkMRMLMessageCollection.h" @@ -52,6 +53,12 @@ vtkMRMLMarkupsClosedCurveNode::vtkMRMLMarkupsClosedCurveNode() this->CurveGenerator->SetCurveIsClosed(true); this->CurveMeasurementsCalculator->SetCurveIsClosed(true); + // Set markup type GUI display name + this->TypeDisplayName = vtkMRMLTr("vtkMRMLMarkupsClosedCurveNode", "Closed Curve"); + + // Set markup short name + this->DefaultNodeNamePrefix = vtkMRMLTr("vtkMRMLMarkupsClosedCurveNode", "CC"); + // Setup measurements calculated for this markup type vtkNew areaMeasurement; areaMeasurement->SetEnabled(false); diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsClosedCurveNode.h b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsClosedCurveNode.h index de55b078d3c..454b41d132d 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsClosedCurveNode.h +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsClosedCurveNode.h @@ -53,12 +53,6 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsClosedCurveNode : pub /// Get markup type internal name const char* GetMarkupType() override {return "ClosedCurve";}; - // Get markup type GUI display name - const char* GetTypeDisplayName() override {return "Closed Curve";}; - - /// Get markup short name - const char* GetDefaultNodeNamePrefix() override {return "CC";}; - /// Copy node content (excludes basic data, such as name and node references). /// \sa vtkMRMLNode::CopyContent vtkMRMLCopyContentDefaultMacro(vtkMRMLMarkupsClosedCurveNode); diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsCurveNode.cxx b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsCurveNode.cxx index e1e7678512e..03ce7811a5c 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsCurveNode.cxx +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsCurveNode.cxx @@ -18,6 +18,7 @@ #include "vtkMRMLMarkupsCurveNode.h" // MRML includes +#include "vtkMRMLI18N.h" #include "vtkCurveGenerator.h" #include "vtkCurveMeasurementsCalculator.h" #include "vtkEventBroker.h" @@ -73,6 +74,12 @@ vtkMRMLMarkupsCurveNode::vtkMRMLMarkupsCurveNode() // in place mode after placing a curve point. this->RequiredNumberOfControlPoints = 1e6; + // Set markup type GUI display name + this->TypeDisplayName = vtkMRMLTr("vtkMRMLMarkupsCurveNode", "Curve"); + + // Set markup short name + this->DefaultNodeNamePrefix = vtkMRMLTr("vtkMRMLMarkupsCurveNode", "OC"); + this->CleanFilter = vtkSmartPointer::New(); this->TriangleFilter = vtkSmartPointer::New(); diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsCurveNode.h b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsCurveNode.h index 37862e559af..f99349681f0 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsCurveNode.h +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsCurveNode.h @@ -108,12 +108,6 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsCurveNode : public vt /// Get markup type internal name const char* GetMarkupType() override {return "Curve";}; - // Get markup type GUI display name - const char* GetTypeDisplayName() override {return "Curve";}; - - /// Get markup short name - const char* GetDefaultNodeNamePrefix() override {return "OC";}; - /// Read node attributes from XML file void ReadXMLAttributes( const char** atts) override; diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.cxx b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.cxx index 86bfc0524a1..a1fee28b872 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.cxx +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.cxx @@ -16,6 +16,7 @@ ==============================================================================*/ // MRML includes +#include "vtkMRMLI18N.h" #include "vtkMRMLMarkupsFiducialDisplayNode.h" #include "vtkMRMLMarkupsFiducialNode.h" #include "vtkMRMLMarkupsFiducialStorageNode.h" @@ -34,7 +35,14 @@ vtkMRMLNodeNewMacro(vtkMRMLMarkupsFiducialNode); //---------------------------------------------------------------------------- -vtkMRMLMarkupsFiducialNode::vtkMRMLMarkupsFiducialNode() = default; +vtkMRMLMarkupsFiducialNode::vtkMRMLMarkupsFiducialNode() +{ + // Set markup type GUI display name + this->TypeDisplayName = vtkMRMLTr("vtkMRMLMarkupsFiducialNode", "Point List"); + + // Set markup short name + this->DefaultNodeNamePrefix = vtkMRMLTr("vtkMRMLMarkupsFiducialNode", "F"); +} //---------------------------------------------------------------------------- vtkMRMLMarkupsFiducialNode::~vtkMRMLMarkupsFiducialNode() = default; diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.h b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.h index 37ffaa647c7..27bc7c111e8 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.h +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsFiducialNode.h @@ -58,12 +58,6 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsFiducialNode : public /// Get markup type internal name const char* GetMarkupType() override {return "Fiducial";}; - // Get markup type GUI display name - const char* GetTypeDisplayName() override {return "Point List";}; - - /// Get markup short name - const char* GetDefaultNodeNamePrefix() override {return "F";}; - /// Read node attributes from XML file void ReadXMLAttributes( const char** atts) override; diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsLineNode.cxx b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsLineNode.cxx index 605bc0ad680..46cc7c45bf8 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsLineNode.cxx +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsLineNode.cxx @@ -16,6 +16,7 @@ ==============================================================================*/ // MRML includes +#include "vtkMRMLI18N.h" #include "vtkMRMLMarkupsDisplayNode.h" #include "vtkMRMLMarkupsLineNode.h" #include "vtkMRMLMeasurementLength.h" @@ -42,6 +43,12 @@ vtkMRMLMarkupsLineNode::vtkMRMLMarkupsLineNode() this->MaximumNumberOfControlPoints = 2; this->RequiredNumberOfControlPoints = 2; + // Set markup type GUI display name + this->TypeDisplayName = vtkMRMLTr("vtkMRMLMarkupsLineNode", "Line"); + + // Set markup short name + this->DefaultNodeNamePrefix = vtkMRMLTr("vtkMRMLMarkupsLineNode", "L"); + // Setup measurements calculated for this markup type vtkNew lengthMeasurement; lengthMeasurement->SetName("length"); diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsLineNode.h b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsLineNode.h index 8942252977f..28dfb9c717f 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsLineNode.h +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsLineNode.h @@ -55,12 +55,6 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsLineNode : public vtk /// Get markup type internal name const char* GetMarkupType() override {return "Line";}; - // Get markup type GUI display name - const char* GetTypeDisplayName() override {return "Line";}; - - /// Get markup short name - const char* GetDefaultNodeNamePrefix() override {return "L";}; - /// Read node attributes from XML file void ReadXMLAttributes( const char** atts) override; diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.cxx b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.cxx index 61553c40475..13dad898e0d 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.cxx +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.cxx @@ -18,6 +18,7 @@ #include "vtkMRMLMarkupsNode.h" // MRML includes +#include "vtkMRMLI18N.h" #include "vtkCurveGenerator.h" #include #include "vtkMRMLMarkupsDisplayNode.h" @@ -532,6 +533,26 @@ void vtkMRMLMarkupsNode::SetLocked(int locked) this->InvokeCustomModifiedEvent(vtkMRMLMarkupsNode::LockModifiedEvent); } +//---------------------------------------------------------------------------- +const char* vtkMRMLMarkupsNode::GetDefaultNodeNamePrefix() +{ + if(this->DefaultNodeNamePrefix.empty()) + { + this->DefaultNodeNamePrefix = vtkMRMLTr("vtkMRMLMarkupsNode", "M"); + } + return this->DefaultNodeNamePrefix.c_str(); +} + +//---------------------------------------------------------------------------- +const char* vtkMRMLMarkupsNode::GetTypeDisplayName() +{ + if(this->TypeDisplayName.empty()) + { + this->TypeDisplayName = vtkMRMLTr("vtkMRMLMarkupsNode", "Markup"); + } + return this->TypeDisplayName.c_str(); +} + //--------------------------------------------------------------------------- vtkMRMLMarkupsDisplayNode *vtkMRMLMarkupsNode::GetMarkupsDisplayNode() { diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.h b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.h index b496e39a396..2376a56c204 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.h +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsNode.h @@ -149,7 +149,10 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsNode : public vtkMRML virtual const char* GetMarkupType() {return "Markup";}; /// Get markup short name - virtual const char* GetDefaultNodeNamePrefix() {return "M";}; + virtual const char* GetDefaultNodeNamePrefix(); + + /// Get markup type GUI display name + virtual const char* GetTypeDisplayName() override; /// Read node attributes from XML file void ReadXMLAttributes(const char** atts) override; @@ -1029,6 +1032,14 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsNode : public vtkMRML std::string PropertiesLabelText; + /// Store markup type GUI display name + /// \note It's displayed to the user and is therefore translated to the application language + std::string TypeDisplayName; + + /// Store markup short name + /// \note It's displayed to the user and is therefore translated to the application language + std::string DefaultNodeNamePrefix; + /// Transform that moves the xyz unit vectors and origin of the interaction handles to local coordinates vtkSmartPointer InteractionHandleToWorldMatrix; diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsPlaneNode.cxx b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsPlaneNode.cxx index a512d46531f..897630de24f 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsPlaneNode.cxx +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsPlaneNode.cxx @@ -19,6 +19,7 @@ ==============================================================================*/ // MRML includes +#include "vtkMRMLI18N.h" #include "vtkMRMLMarkupsPlaneDisplayNode.h" #include "vtkMRMLMarkupsPlaneNode.h" #include "vtkMRMLMeasurementArea.h" @@ -49,6 +50,12 @@ vtkMRMLMarkupsPlaneNode::vtkMRMLMarkupsPlaneNode() this->RequiredNumberOfControlPoints = 1; this->MaximumNumberOfControlPoints = 1; + // Set markup type GUI display name + this->TypeDisplayName = vtkMRMLTr("vtkMRMLMarkupsPlaneNode", "Plane"); + + // Set markup short name + this->DefaultNodeNamePrefix = vtkMRMLTr("vtkMRMLMarkupsPlaneNode", "P"); + this->ObjectToBaseMatrix = vtkSmartPointer::New(); this->BaseToNodeMatrix = vtkSmartPointer::New(); diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsPlaneNode.h b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsPlaneNode.h index a8f542e3744..68b799f2a6a 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsPlaneNode.h +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsPlaneNode.h @@ -90,12 +90,6 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsPlaneNode : public vt /// Get markup type internal name const char* GetMarkupType() override {return "Plane";}; - // Get markup type GUI display name - const char* GetTypeDisplayName() override {return "Plane";}; - - /// Get markup short name - const char* GetDefaultNodeNamePrefix() override {return "P";}; - /// Read node attributes from XML file void ReadXMLAttributes( const char** atts) override; diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsROINode.cxx b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsROINode.cxx index ad76cc9bbd3..72202f13b2b 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsROINode.cxx +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsROINode.cxx @@ -21,6 +21,7 @@ #include "vtkMRMLMarkupsROINode.h" // MRML includes +#include #include #include #include "vtkMRMLMeasurementVolume.h" @@ -58,6 +59,12 @@ vtkMRMLMarkupsROINode::vtkMRMLMarkupsROINode() { this->PropertiesLabelText = ""; + // Set markup type GUI display name + this->TypeDisplayName = vtkMRMLTr("vtkMRMLMarkupsROINode", "ROI"); + + // Set markup short name + this->DefaultNodeNamePrefix = vtkMRMLTr("vtkMRMLMarkupsROINode", "R"); + this->RequiredNumberOfControlPoints = NUMBER_OF_BOX_CONTROL_POINTS; this->MaximumNumberOfControlPoints = -1; this->IsUpdatingControlPointsFromROI = false; diff --git a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsROINode.h b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsROINode.h index f8fcebb474b..49722ee6c58 100644 --- a/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsROINode.h +++ b/Modules/Loadable/Markups/MRML/vtkMRMLMarkupsROINode.h @@ -76,12 +76,6 @@ class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsROINode : public vtkM /// Get markup type internal name const char* GetMarkupType() override {return "ROI";}; - // Get markup type GUI display name - const char* GetTypeDisplayName() override {return "ROI";}; - - /// Get markup short name - const char* GetDefaultNodeNamePrefix() override {return "R";}; - /// Copy node content (excludes basic data, such as name and node references). /// \sa vtkMRMLNode::CopyContent vtkMRMLCopyContentMacro(vtkMRMLMarkupsROINode); diff --git a/Modules/Loadable/Markups/SubjectHierarchyPlugins/qSlicerSubjectHierarchyMarkupsPlugin.cxx b/Modules/Loadable/Markups/SubjectHierarchyPlugins/qSlicerSubjectHierarchyMarkupsPlugin.cxx index 4e0a6a819e6..edf444dda1a 100644 --- a/Modules/Loadable/Markups/SubjectHierarchyPlugins/qSlicerSubjectHierarchyMarkupsPlugin.cxx +++ b/Modules/Loadable/Markups/SubjectHierarchyPlugins/qSlicerSubjectHierarchyMarkupsPlugin.cxx @@ -293,7 +293,7 @@ void qSlicerSubjectHierarchyMarkupsPluginPrivate::jumpToPoint(int controlPointIn return; } - vtkSlicerMarkupsLogic* markupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(appLogic->GetModuleLogic("Markups")); + vtkSlicerMarkupsLogic* markupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(appLogic->GetModuleLogic(/*no tr*/"Markups")); if (!markupsLogic) { qCritical() << Q_FUNC_INFO << ": could not get the Markups module logic."; @@ -348,7 +348,7 @@ double qSlicerSubjectHierarchyMarkupsPlugin::canAddNodeToSubjectHierarchy( return 0.0; } - vtkSlicerMarkupsLogic* markupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(appLogic->GetModuleLogic("Markups")); + vtkSlicerMarkupsLogic* markupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(appLogic->GetModuleLogic(/*no tr*/"Markups")); if (!markupsLogic) { qCritical() << Q_FUNC_INFO << ": could not get the Markups module logic."; @@ -402,7 +402,7 @@ double qSlicerSubjectHierarchyMarkupsPlugin::canOwnSubjectHierarchyItem(vtkIdTyp return 0.0; } - vtkSlicerMarkupsLogic* markupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(appLogic->GetModuleLogic("Markups")); + vtkSlicerMarkupsLogic* markupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(appLogic->GetModuleLogic(/*no tr*/"Markups")); if (!markupsLogic) { qCritical() << Q_FUNC_INFO << ": could not get the Markups module logic."; @@ -800,7 +800,7 @@ void qSlicerSubjectHierarchyMarkupsPlugin::renamePoint() QString oldName(markupsNode->GetNthControlPointLabel(componentIndex).c_str()); bool ok = false; - QString newName = QInputDialog::getText(nullptr, QString("Rename ") + oldName, "New name:", QLineEdit::Normal, oldName, &ok); + QString newName = QInputDialog::getText(nullptr, tr("Rename %1").arg(oldName), tr("New name:"), QLineEdit::Normal, oldName, &ok); if (!ok) { return; @@ -831,7 +831,7 @@ void qSlicerSubjectHierarchyMarkupsPlugin::refocusCamera() // Get point index int componentIndex = d->ViewContextMenuEventData["ComponentIndex"].toInt(); - vtkSlicerMarkupsLogic* markupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(appLogic->GetModuleLogic("Markups")); + vtkSlicerMarkupsLogic* markupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(appLogic->GetModuleLogic(/*no tr*/"Markups")); if (!markupsLogic) { qCritical() << Q_FUNC_INFO << ": could not get the Markups module logic."; @@ -994,7 +994,7 @@ void qSlicerSubjectHierarchyMarkupsPlugin::editNodeTerminology() return; } vtkSlicerTerminologiesModuleLogic* terminologiesLogic = vtkSlicerTerminologiesModuleLogic::SafeDownCast( - qSlicerCoreApplication::application()->moduleLogic("Terminologies")); + qSlicerCoreApplication::application()->moduleLogic(/*no tr*/"Terminologies")); if (!terminologiesLogic) { qCritical() << Q_FUNC_INFO << ": Failed to get Terminologies module logic"; diff --git a/Modules/Loadable/Markups/Widgets/qMRMLMarkupsCurveSettingsWidget.cxx b/Modules/Loadable/Markups/Widgets/qMRMLMarkupsCurveSettingsWidget.cxx index 2c1b3a454b0..4b12d6b7634 100644 --- a/Modules/Loadable/Markups/Widgets/qMRMLMarkupsCurveSettingsWidget.cxx +++ b/Modules/Loadable/Markups/Widgets/qMRMLMarkupsCurveSettingsWidget.cxx @@ -45,8 +45,8 @@ class qMRMLMarkupsCurveSettingsWidgetPrivate public: qMRMLMarkupsCurveSettingsWidgetPrivate(qMRMLMarkupsCurveSettingsWidget &widget); - static const char* getCurveTypeAsHumanReadableString(int curveType); - static const char* getCostFunctionAsHumanReadableString(int costFunction); + static QString curveTypeAsDisplayableString(int curveType); + static QString costFunctionAsDisplayableString(int costFunction); void setupUi(QWidget* widget); @@ -78,13 +78,17 @@ void qMRMLMarkupsCurveSettingsWidgetPrivate::setupUi(qMRMLMarkupsCurveSettingsWi this->curveTypeComboBox->clear(); for (int curveType = 0; curveType < vtkCurveGenerator::CURVE_TYPE_LAST; ++curveType) { - this->curveTypeComboBox->addItem(qMRMLMarkupsCurveSettingsWidgetPrivate::getCurveTypeAsHumanReadableString(curveType), curveType); + this->curveTypeComboBox->addItem( + qMRMLMarkupsCurveSettingsWidgetPrivate::curveTypeAsDisplayableString(curveType), curveType + ); } this->costFunctionComboBox->clear(); for (int costFunction = 0; costFunction < vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_LAST; ++costFunction) { - this->costFunctionComboBox->addItem(qMRMLMarkupsCurveSettingsWidgetPrivate::getCostFunctionAsHumanReadableString(costFunction), costFunction); + this->costFunctionComboBox->addItem( + qMRMLMarkupsCurveSettingsWidgetPrivate::costFunctionAsDisplayableString(costFunction), costFunction + ); } this->editScalarFunctionDelay = new QTimer(q); @@ -112,58 +116,58 @@ void qMRMLMarkupsCurveSettingsWidgetPrivate::setupUi(qMRMLMarkupsCurveSettingsWi } //------------------------------------------------------------------------------ -const char* qMRMLMarkupsCurveSettingsWidgetPrivate::getCurveTypeAsHumanReadableString(int curveType) +QString qMRMLMarkupsCurveSettingsWidgetPrivate::curveTypeAsDisplayableString(int curveType) { switch (curveType) { case vtkCurveGenerator::CURVE_TYPE_LINEAR_SPLINE: { - return "Linear"; + return qMRMLMarkupsCurveSettingsWidget::tr("Linear"); } case vtkCurveGenerator::CURVE_TYPE_CARDINAL_SPLINE: { - return "Spline"; + return qMRMLMarkupsCurveSettingsWidget::tr("Spline"); } case vtkCurveGenerator::CURVE_TYPE_KOCHANEK_SPLINE: { - return "Kochanek spline"; + return qMRMLMarkupsCurveSettingsWidget::tr("Kochanek spline"); } case vtkCurveGenerator::CURVE_TYPE_POLYNOMIAL: { - return "Polynomial"; + return qMRMLMarkupsCurveSettingsWidget::tr("Polynomial"); } case vtkCurveGenerator::CURVE_TYPE_SHORTEST_DISTANCE_ON_SURFACE: { - return "Shortest distance on surface"; + return qMRMLMarkupsCurveSettingsWidget::tr("Shortest distance on surface"); } default: { vtkGenericWarningMacro("Unknown curve type: " << curveType); - return "Unknown"; + return qMRMLMarkupsCurveSettingsWidget::tr("Unknown"); } } } //------------------------------------------------------------------------------ -const char* qMRMLMarkupsCurveSettingsWidgetPrivate::getCostFunctionAsHumanReadableString(int costFunction) +QString qMRMLMarkupsCurveSettingsWidgetPrivate::costFunctionAsDisplayableString(int costFunction) { switch (costFunction) { case vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_DISTANCE: { - return "Distance"; + return qMRMLMarkupsCurveSettingsWidget::tr("Distance"); } case vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_ADDITIVE: { - return "Additive"; + return qMRMLMarkupsCurveSettingsWidget::tr("Additive"); } case vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_MULTIPLICATIVE: { - return "Multiplicative"; + return qMRMLMarkupsCurveSettingsWidget::tr("Multiplicative"); } case vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_INVERSE_SQUARED: { - return "Inverse squared"; + return qMRMLMarkupsCurveSettingsWidget::tr("Inverse squared"); } default: { @@ -251,23 +255,22 @@ void qMRMLMarkupsCurveSettingsWidget::updateWidgetFromMRML() d->scalarFunctionLineEdit->setVisible(true); } - QString prefixString; + // prefixString is "distance" when : + // costFunction is vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_DISTANCE, + // costFunction doesn't match any of the evaluated cases below + QString prefixString = tr("distance"); QString suffixString; switch (costFunction) { case vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_ADDITIVE: - prefixString = "distance + "; + prefixString += " + "; break; case vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_MULTIPLICATIVE: - prefixString = "distance * "; + prefixString += " * "; break; case vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_INVERSE_SQUARED: - prefixString = "distance / ("; - suffixString = " ^ 2"; - break; - default: - case vtkSlicerDijkstraGraphGeodesicPath::COST_FUNCTION_TYPE_DISTANCE: - prefixString = "distance"; + prefixString += " / ("; + suffixString = " ^ 2)"; break; } d->scalarFunctionPrefixLabel->setText(prefixString); diff --git a/Modules/Loadable/Markups/Widgets/qMRMLMarkupsPlaneWidget.cxx b/Modules/Loadable/Markups/Widgets/qMRMLMarkupsPlaneWidget.cxx index 926cc265276..5d14d850ac5 100644 --- a/Modules/Loadable/Markups/Widgets/qMRMLMarkupsPlaneWidget.cxx +++ b/Modules/Loadable/Markups/Widgets/qMRMLMarkupsPlaneWidget.cxx @@ -38,7 +38,7 @@ class qMRMLMarkupsPlaneWidgetPrivate: qMRMLMarkupsPlaneWidgetPrivate(qMRMLMarkupsPlaneWidget& object); void setupUi(qMRMLMarkupsPlaneWidget* widget); - const char* getPlaneTypeName(int planeType); + QString planeTypeName(int planeType); protected: qMRMLMarkupsPlaneWidget* const q_ptr; @@ -63,7 +63,7 @@ void qMRMLMarkupsPlaneWidgetPrivate::setupUi(qMRMLMarkupsPlaneWidget* widget) this->planeTypeComboBox->clear(); for (int planeType = 0; planeType < vtkMRMLMarkupsPlaneNode::PlaneType_Last; ++planeType) { - this->planeTypeComboBox->addItem(this->getPlaneTypeName(planeType), planeType); + this->planeTypeComboBox->addItem(this->planeTypeName(planeType), planeType); } this->planeSizeModeComboBox->clear(); @@ -100,16 +100,16 @@ void qMRMLMarkupsPlaneWidgetPrivate::setupUi(qMRMLMarkupsPlaneWidget* widget) } // -------------------------------------------------------------------------- -const char* qMRMLMarkupsPlaneWidgetPrivate::getPlaneTypeName(int planeType) +QString qMRMLMarkupsPlaneWidgetPrivate::planeTypeName(int planeType) { switch (planeType) { case vtkMRMLMarkupsPlaneNode::PlaneType3Points: - return "Three points"; + return qMRMLMarkupsPlaneWidget::tr("Three points"); case vtkMRMLMarkupsPlaneNode::PlaneTypePointNormal: - return "Point normal"; + return qMRMLMarkupsPlaneWidget::tr("Point normal"); case vtkMRMLMarkupsPlaneNode::PlaneTypePlaneFit: - return "Plane fit"; + return qMRMLMarkupsPlaneWidget::tr("Plane fit"); default: break; } diff --git a/Modules/Loadable/Markups/Widgets/qMRMLMarkupsToolBar.cxx b/Modules/Loadable/Markups/Widgets/qMRMLMarkupsToolBar.cxx index d4eedc0f56e..10b4a3aab7e 100644 --- a/Modules/Loadable/Markups/Widgets/qMRMLMarkupsToolBar.cxx +++ b/Modules/Loadable/Markups/Widgets/qMRMLMarkupsToolBar.cxx @@ -116,7 +116,8 @@ void qMRMLMarkupsToolBarPrivate::addSetModuleButton(vtkSlicerMarkupsLogic* marku QPushButton* moduleButton = new QPushButton(); moduleButton->setObjectName(QString(moduleName + " module shortcut")); - moduleButton->setToolTip("Open the " + moduleName + " module"); + //: %1 is the module name + moduleButton->setToolTip(tr("Open the %1 module").arg(moduleName)); QString iconName = ":/Icons/" + moduleName + ".png"; moduleButton->setIcon(QIcon(iconName)); QSignalMapper* mapper = new QSignalMapper(moduleButton); @@ -433,7 +434,7 @@ void qMRMLMarkupsToolBar::initializeToolBarLayout() Q_D(qMRMLMarkupsToolBar); vtkSlicerMarkupsLogic* markupsLogic = - vtkSlicerMarkupsLogic::SafeDownCast(d->MRMLAppLogic->GetModuleLogic("Markups")); + vtkSlicerMarkupsLogic::SafeDownCast(d->MRMLAppLogic->GetModuleLogic(/*no tr*/"Markups")); if (!markupsLogic) { qWarning() << Q_FUNC_INFO << " failed: invalid markups logic"; @@ -450,7 +451,7 @@ void qMRMLMarkupsToolBar::initializeToolBarLayout() // Module shortcuts this->addSeparator(); - d->addSetModuleButton(markupsLogic, "Markups"); + d->addSetModuleButton(markupsLogic, /*no tr*/"Markups"); // Add event observers for registration/unregistration of markups this->qvtkConnect(markupsLogic, vtkSlicerMarkupsLogic::MarkupRegistered, @@ -468,7 +469,7 @@ void qMRMLMarkupsToolBar::updateToolBarLayout() Q_D(qMRMLMarkupsToolBar); vtkSlicerMarkupsLogic* markupsLogic = - vtkSlicerMarkupsLogic::SafeDownCast(d->MRMLAppLogic->GetModuleLogic("Markups")); + vtkSlicerMarkupsLogic::SafeDownCast(d->MRMLAppLogic->GetModuleLogic(/*no tr*/"Markups")); if (!markupsLogic) { qWarning() << Q_FUNC_INFO << " failed: invalid markups logic"; @@ -511,7 +512,7 @@ void qMRMLMarkupsToolBar::updateToolBarLayout() for (int index = this->layout()->count()-1; index >=0 ; index--) { QString buttonName = this->layout()->itemAt(index)->widget()->objectName(); - if (!buttonName.startsWith("Create") || !buttonName.endsWith("PushButton")) + if (!buttonName.startsWith(/*no tr*/"Create") || !buttonName.endsWith(/*no tr*/"PushButton")) { // Not a markup create button, leave it as is continue; @@ -544,7 +545,7 @@ void qMRMLMarkupsToolBar::onAddNewMarkupsNodeByClass(const QString& className) // Add new markups node to the scene vtkMRMLMarkupsNode* markupsNode = nullptr; vtkSlicerMarkupsLogic* markupsLogic = - vtkSlicerMarkupsLogic::SafeDownCast(d->MRMLAppLogic->GetModuleLogic("Markups")); + vtkSlicerMarkupsLogic::SafeDownCast(d->MRMLAppLogic->GetModuleLogic(/*no tr*/"Markups")); if (markupsLogic) { markupsNode = markupsLogic->AddNewMarkupsNode(className.toStdString()); diff --git a/Modules/Loadable/Markups/Widgets/qSlicerMarkupsPlaceWidget.cxx b/Modules/Loadable/Markups/Widgets/qSlicerMarkupsPlaceWidget.cxx index e1402cec617..565aebf4a7f 100644 --- a/Modules/Loadable/Markups/Widgets/qSlicerMarkupsPlaceWidget.cxx +++ b/Modules/Loadable/Markups/Widgets/qSlicerMarkupsPlaceWidget.cxx @@ -120,7 +120,7 @@ void qSlicerMarkupsPlaceWidget::setup() { Q_D(qSlicerMarkupsPlaceWidget); - d->MarkupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(this->moduleLogic("Markups")); + d->MarkupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(this->moduleLogic(/*no tr*/"Markups")); if (!d->MarkupsLogic) { qCritical() << Q_FUNC_INFO << ": Markups module is not found, some markup manipulation features will not be available"; diff --git a/Modules/Loadable/Markups/Widgets/qSlicerSimpleMarkupsWidget.cxx b/Modules/Loadable/Markups/Widgets/qSlicerSimpleMarkupsWidget.cxx index 40e6d30acb2..a36ab3f6a08 100644 --- a/Modules/Loadable/Markups/Widgets/qSlicerSimpleMarkupsWidget.cxx +++ b/Modules/Loadable/Markups/Widgets/qSlicerSimpleMarkupsWidget.cxx @@ -110,7 +110,7 @@ void qSlicerSimpleMarkupsWidget::setup() { Q_D(qSlicerSimpleMarkupsWidget); - d->MarkupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(this->moduleLogic("Markups")); + d->MarkupsLogic = vtkSlicerMarkupsLogic::SafeDownCast(this->moduleLogic(/*no tr*/"Markups")); if (!d->MarkupsLogic) { qCritical() << Q_FUNC_INFO << ": Markups module is not found, some markup manipulation features will not be available"; diff --git a/Modules/Loadable/Markups/qSlicerMarkupsModule.cxx b/Modules/Loadable/Markups/qSlicerMarkupsModule.cxx index 36dd27b5bb0..14589d7cef6 100644 --- a/Modules/Loadable/Markups/qSlicerMarkupsModule.cxx +++ b/Modules/Loadable/Markups/qSlicerMarkupsModule.cxx @@ -560,7 +560,7 @@ bool qSlicerMarkupsModule::showMarkups(vtkMRMLMarkupsNode* markupsNode) qSlicerCoreApplication* app = qSlicerCoreApplication::application(); if (!app || !app->moduleManager() - || !dynamic_cast(app->moduleManager()->module("Markups"))) + || !dynamic_cast(app->moduleManager()->module(/*no tr*/"Markups"))) { qCritical("Markups module is not available"); return false;