From 1669fbd3b2b8301f22b2fd148016af50bff129ee Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 12 Jan 2023 20:12:16 +0200 Subject: [PATCH] Fix Lupdate warnings. --- src/app/puzzle/layout/vppiece.h | 1 + src/libs/ifc/xml/vabstractconverter.h | 1 + src/libs/ifc/xml/vabstractpattern.cpp | 4 ++- src/libs/ifc/xml/vlayoutconverter.h | 1 + src/libs/vformat/vdimensions.cpp | 29 ++++++++++++------- src/libs/vlayout/vabstractpiece.cpp | 4 ++- .../toolsinglepoint/toolcut/vtoolcutarc.cpp | 14 +++++---- .../toolcut/vtoolcutspline.cpp | 10 ++++--- .../toolcut/vtoolcutsplinepath.cpp | 10 ++++--- .../image/hideallbackgroundimages.h | 1 + .../undocommands/image/hidebackgroundimage.h | 1 + .../image/holdallbackgroundimages.h | 1 + .../undocommands/image/holdbackgroundimage.h | 1 + .../image/opaquebackgroundimage.h | 1 + .../image/renamebackgroundimage.h | 1 + .../undocommands/image/resetbackgroundimage.h | 1 + .../image/rotatebackgroundimage.h | 1 + .../image/zvaluemovebackgroundimage.h | 1 + src/libs/vwidgets/qtcolorpicker.cpp | 2 +- 19 files changed, 58 insertions(+), 27 deletions(-) diff --git a/src/app/puzzle/layout/vppiece.h b/src/app/puzzle/layout/vppiece.h index 19ae71c66..75ef5600a 100644 --- a/src/app/puzzle/layout/vppiece.h +++ b/src/app/puzzle/layout/vppiece.h @@ -45,6 +45,7 @@ class VPSheet; class VPPiece : public VLayoutPiece { + Q_DECLARE_TR_FUNCTIONS(VPPiece) // NOLINT public: VPPiece() = default; explicit VPPiece(const VLayoutPiece &layoutPiece); diff --git a/src/libs/ifc/xml/vabstractconverter.h b/src/libs/ifc/xml/vabstractconverter.h index 0f42e5b4e..36ae8d69d 100644 --- a/src/libs/ifc/xml/vabstractconverter.h +++ b/src/libs/ifc/xml/vabstractconverter.h @@ -44,6 +44,7 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-methods") class VAbstractConverter :public VDomDocument { + Q_OBJECT // NOLINT public: explicit VAbstractConverter(const QString &fileName); virtual ~VAbstractConverter() = default; diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index 1e2710584..fc49cfed6 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -2554,7 +2554,9 @@ auto VAbstractPattern::GetGroups(const QString &patternPieceName) -> QMap bool if (not valid) { - m_error = tr("Invalid min/max range"); + m_error = QCoreApplication::translate("VAbstartMeasurementDimension", "Invalid min/max range"); } return valid; @@ -223,7 +223,7 @@ auto VAbstartMeasurementDimension::IsStepValid() -> bool bool valid = ValidSteps().indexOf(m_step) != -1; if (not valid) { - m_error = tr("Invalid step"); + m_error = QCoreApplication::translate("VAbstartMeasurementDimension", "Invalid step"); } return valid; @@ -235,7 +235,7 @@ auto VAbstartMeasurementDimension::IsBaseValid() -> bool bool valid = ValidBases().indexOf(m_baseValue) != -1; if (not valid) { - m_error = tr("Base value invalid"); + m_error = QCoreApplication::translate("VAbstartMeasurementDimension", "Base value invalid"); } return valid; @@ -253,13 +253,13 @@ auto VAbstartMeasurementDimension::DimensionName(MeasurementDimension type) -> Q switch(type) { case MeasurementDimension::X: - return tr("Height", "dimension"); + return QCoreApplication::translate("VAbstartMeasurementDimension", "Height", "dimension"); case MeasurementDimension::Y: - return tr("Size", "dimension"); + return QCoreApplication::translate("VAbstartMeasurementDimension", "Size", "dimension"); case MeasurementDimension::W: - return tr("Waist", "dimension"); + return QCoreApplication::translate("VAbstartMeasurementDimension", "Waist", "dimension"); case MeasurementDimension::Z: - return tr("Hip", "dimension"); + return QCoreApplication::translate("VAbstartMeasurementDimension", "Hip", "dimension"); default: return {}; } @@ -278,19 +278,28 @@ auto VAbstartMeasurementDimension::DimensionToolTip(const MeasurementDimension_p case MeasurementDimension::Y: if (dimension->CustomName().isEmpty() && dimension->IsBodyMeasurement()) { - return fc ? tr("Chest full circumference", "dimension") : tr("Chest half circumference", "dimension"); + return fc ? QCoreApplication::translate("VAbstartMeasurementDimension", "Chest full circumference", + "dimension") + : QCoreApplication::translate("VAbstartMeasurementDimension", "Chest half circumference", + "dimension"); } return {}; case MeasurementDimension::W: if (dimension->CustomName().isEmpty() && dimension->IsBodyMeasurement()) { - return fc ? tr("Waist full circumference", "dimension") : tr("Waist half circumference", "dimension"); + return fc ? QCoreApplication::translate("VAbstartMeasurementDimension", "Waist full circumference", + "dimension") + : QCoreApplication::translate("VAbstartMeasurementDimension", "Waist half circumference", + "dimension"); } return {}; case MeasurementDimension::Z: if (dimension->CustomName().isEmpty() && dimension->IsBodyMeasurement()) { - return fc ? tr("Hip full circumference", "dimension") : tr("Hip half circumference", "dimension"); + return fc ? QCoreApplication::translate("VAbstartMeasurementDimension", "Hip full circumference", + "dimension") + : QCoreApplication::translate("VAbstartMeasurementDimension", "Hip half circumference", + "dimension"); } return {}; case MeasurementDimension::X: diff --git a/src/libs/vlayout/vabstractpiece.cpp b/src/libs/vlayout/vabstractpiece.cpp index 1e33f98c1..671051032 100644 --- a/src/libs/vlayout/vabstractpiece.cpp +++ b/src/libs/vlayout/vabstractpiece.cpp @@ -1069,7 +1069,9 @@ auto VAbstractPiece::Equidistant(QVector points, qreal width, const QS points = CorrectEquidistantPoints(points); if ( points.size() < 3 ) { - const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name); + const QString errorMsg = + QCoreApplication::translate("VAbstractPiece", "Piece '%1'. Not enough points to build seam allowance.") + .arg(name); VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; return {}; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index 52bba943b..c64eebf6c 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -291,11 +291,11 @@ QString VToolCutArc::MakeToolTip() const ->FormulaToUser(formula, VAbstractApplication::VApp()->Settings()->GetOsSeparator()); const qreal length = Visualization::FindValFromUser(expression, VAbstractTool::data.DataVariables()); - const QString arcStr = tr("Arc"); - const QString lengthStr = tr("length"); - const QString startAngleStr = tr("start angle"); - const QString endAngleStr = tr("end angle"); - const QString radiusStr = tr("radius"); + const QString arcStr = QCoreApplication::translate("VToolCutArc", "Arc"); + const QString lengthStr = QCoreApplication::translate("VToolCutArc", "length"); + const QString startAngleStr = QCoreApplication::translate("VToolCutArc", "start angle"); + const QString endAngleStr = QCoreApplication::translate("VToolCutArc", "end angle"); + const QString radiusStr = QCoreApplication::translate("VToolCutArc", "radius"); const QSharedPointer point = VAbstractTool::data.GeometricObject(m_id); @@ -326,7 +326,9 @@ QString VToolCutArc::MakeToolTip() const .arg(arc.GetStartAngle()) .arg(arcStr + arcNumber + QChar(QChar::Space) + endAngleStr) .arg(arc.GetEndAngle()) - .arg(arcStr + arcNumber + QChar(QChar::Space) + tr("label"), arc.ObjectName()); + .arg(arcStr + arcNumber + + QChar(QChar::Space) + QCoreApplication::translate("VToolCutArc", "label"), + arc.ObjectName()); return toolTip; }; diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index 78bb9c347..37a6d543f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -302,8 +302,8 @@ auto VToolCutSpline::MakeToolTip() const -> QString VSpline spline2 = VSpline(VPointF(point), spl2p2, spl2p3, spl->GetP4()); spline2.SetAliasSuffix(m_aliasSuffix2); - const QString curveStr = tr("Curve"); - const QString lengthStr = tr("length"); + const QString curveStr = QCoreApplication::translate("VToolCutSpline", "Curve"); + const QString lengthStr = QCoreApplication::translate("VToolCutSpline", "length"); const QString toolTip = QString("" "" @@ -316,8 +316,10 @@ auto VToolCutSpline::MakeToolTip() const -> QString .arg(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true), curveStr + QStringLiteral("2 ") + lengthStr) .arg(VAbstractValApplication::VApp()->fromPixel(spline2.GetLength())) - .arg(curveStr + QStringLiteral(" 1") + tr("label"), spline1.ObjectName(), - curveStr + QStringLiteral(" 2") + tr("label"), spline2.ObjectName()); + .arg(curveStr + QStringLiteral(" 1") + QCoreApplication::translate("VToolCutSpline", "label"), + spline1.ObjectName(), + curveStr + QStringLiteral(" 2") + QCoreApplication::translate("VToolCutSpline", "label"), + spline2.ObjectName()); return toolTip; } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 0b8730303..db2c2929d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -393,8 +393,8 @@ QString VToolCutSplinePath::MakeToolTip() const splPath1->SetAliasSuffix(m_aliasSuffix1); splPath2->SetAliasSuffix(m_aliasSuffix2); - const QString curveStr = tr("Curve"); - const QString lengthStr = tr("length"); + const QString curveStr = QCoreApplication::translate("VToolCutSplinePath", "Curve"); + const QString lengthStr = QCoreApplication::translate("VToolCutSplinePath", "length"); const QString toolTip = QString("
%6: %7
" "" @@ -407,8 +407,10 @@ QString VToolCutSplinePath::MakeToolTip() const .arg(UnitsToStr(VAbstractValApplication::VApp()->patternUnits(), true), curveStr + QLatin1String("2 ") + lengthStr) .arg(VAbstractValApplication::VApp()->fromPixel(splPath2->GetLength())) - .arg(curveStr + QLatin1String(" 1") + tr("label"), splPath1->ObjectName(), - curveStr + QLatin1String(" 2") + tr("label"), splPath2->ObjectName()); + .arg(curveStr + QLatin1String(" 1") + QCoreApplication::translate("VToolCutSplinePath", "label"), + splPath1->ObjectName(), + curveStr + QLatin1String(" 2") + QCoreApplication::translate("VToolCutSplinePath", "label"), + splPath2->ObjectName()); delete splPath1; delete splPath2; diff --git a/src/libs/vtools/undocommands/image/hideallbackgroundimages.h b/src/libs/vtools/undocommands/image/hideallbackgroundimages.h index 37bd59953..ec02153ae 100644 --- a/src/libs/vtools/undocommands/image/hideallbackgroundimages.h +++ b/src/libs/vtools/undocommands/image/hideallbackgroundimages.h @@ -37,6 +37,7 @@ class HideAllBackgroundImages : public VUndoCommand { + Q_OBJECT // NOLINT public: HideAllBackgroundImages(bool hide, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ~HideAllBackgroundImages() override =default; diff --git a/src/libs/vtools/undocommands/image/hidebackgroundimage.h b/src/libs/vtools/undocommands/image/hidebackgroundimage.h index ec244d916..d9ebd27a3 100644 --- a/src/libs/vtools/undocommands/image/hidebackgroundimage.h +++ b/src/libs/vtools/undocommands/image/hidebackgroundimage.h @@ -37,6 +37,7 @@ class HideBackgroundImage : public VUndoCommand { + Q_OBJECT // NOLINT public: HideBackgroundImage(QUuid id, bool hide, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ~HideBackgroundImage() override =default; diff --git a/src/libs/vtools/undocommands/image/holdallbackgroundimages.h b/src/libs/vtools/undocommands/image/holdallbackgroundimages.h index 515ddc5c3..93a455cf9 100644 --- a/src/libs/vtools/undocommands/image/holdallbackgroundimages.h +++ b/src/libs/vtools/undocommands/image/holdallbackgroundimages.h @@ -36,6 +36,7 @@ class HoldAllBackgroundImages : public VUndoCommand { + Q_OBJECT // NOLINT public: HoldAllBackgroundImages(bool hold, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ~HoldAllBackgroundImages() override =default; diff --git a/src/libs/vtools/undocommands/image/holdbackgroundimage.h b/src/libs/vtools/undocommands/image/holdbackgroundimage.h index e64e10fbd..7a60f3228 100644 --- a/src/libs/vtools/undocommands/image/holdbackgroundimage.h +++ b/src/libs/vtools/undocommands/image/holdbackgroundimage.h @@ -37,6 +37,7 @@ class HoldBackgroundImage : public VUndoCommand { + Q_OBJECT // NOLINT public: HoldBackgroundImage(QUuid id, bool hold, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ~HoldBackgroundImage() override =default; diff --git a/src/libs/vtools/undocommands/image/opaquebackgroundimage.h b/src/libs/vtools/undocommands/image/opaquebackgroundimage.h index 3132dfa20..f483bbabb 100644 --- a/src/libs/vtools/undocommands/image/opaquebackgroundimage.h +++ b/src/libs/vtools/undocommands/image/opaquebackgroundimage.h @@ -36,6 +36,7 @@ class OpaqueBackgroundImage : public VUndoCommand { + Q_OBJECT // NOLINT public: OpaqueBackgroundImage(QUuid id, qreal opacity, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ~OpaqueBackgroundImage() override =default; diff --git a/src/libs/vtools/undocommands/image/renamebackgroundimage.h b/src/libs/vtools/undocommands/image/renamebackgroundimage.h index 0d8b3f371..74b2b053b 100644 --- a/src/libs/vtools/undocommands/image/renamebackgroundimage.h +++ b/src/libs/vtools/undocommands/image/renamebackgroundimage.h @@ -37,6 +37,7 @@ class RenameBackgroundImage : public VUndoCommand { + Q_OBJECT // NOLINT public: RenameBackgroundImage(QUuid id, const QString &name, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ~RenameBackgroundImage() override =default; diff --git a/src/libs/vtools/undocommands/image/resetbackgroundimage.h b/src/libs/vtools/undocommands/image/resetbackgroundimage.h index ba1348ad1..027cad5a9 100644 --- a/src/libs/vtools/undocommands/image/resetbackgroundimage.h +++ b/src/libs/vtools/undocommands/image/resetbackgroundimage.h @@ -39,6 +39,7 @@ class ResetBackgroundImage : public VUndoCommand { + Q_OBJECT // NOLINT public: ResetBackgroundImage(QUuid id, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ~ResetBackgroundImage() override = default; diff --git a/src/libs/vtools/undocommands/image/rotatebackgroundimage.h b/src/libs/vtools/undocommands/image/rotatebackgroundimage.h index d518580a8..2188c49bd 100644 --- a/src/libs/vtools/undocommands/image/rotatebackgroundimage.h +++ b/src/libs/vtools/undocommands/image/rotatebackgroundimage.h @@ -40,6 +40,7 @@ class RotateBackgroundImage : public VUndoCommand { + Q_OBJECT // NOLINT public: RotateBackgroundImage(QUuid id, const QTransform &matrix, VAbstractPattern *doc, bool allowMerge = false, QUndoCommand *parent = nullptr); diff --git a/src/libs/vtools/undocommands/image/zvaluemovebackgroundimage.h b/src/libs/vtools/undocommands/image/zvaluemovebackgroundimage.h index e80e182a7..e685bb330 100644 --- a/src/libs/vtools/undocommands/image/zvaluemovebackgroundimage.h +++ b/src/libs/vtools/undocommands/image/zvaluemovebackgroundimage.h @@ -44,6 +44,7 @@ enum class ZValueMoveType class ZValueMoveBackgroundImage : public VUndoCommand { + Q_OBJECT // NOLINT public: ZValueMoveBackgroundImage(QUuid id, ZValueMoveType move, VAbstractPattern *doc, QUndoCommand *parent = nullptr); ~ZValueMoveBackgroundImage() override =default; diff --git a/src/libs/vwidgets/qtcolorpicker.cpp b/src/libs/vwidgets/qtcolorpicker.cpp index c4d143ae0..be52abcd6 100644 --- a/src/libs/vwidgets/qtcolorpicker.cpp +++ b/src/libs/vwidgets/qtcolorpicker.cpp @@ -682,7 +682,7 @@ auto ColorPickerPopup::CustomItems() const ->QVector for (auto *item : items) { - if (item!= nullptr && item->text() == tr("Custom")) + if (item!= nullptr && item->text() == QCoreApplication::translate("ColorPickerPopup", "Custom")) { customItems.append(item); }
%6: %7