From 18e0f6750ad0951709a634e3fb9a49c9b19be86b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 18 Jul 2016 19:29:34 +0300 Subject: [PATCH] Refactoring. Fixed wrong using method tr(). --HG-- branch : develop --- src/app/valentina/dialogs/dialoghistory.cpp | 48 +++++++++---------- src/app/valentina/mainwindow.cpp | 8 ++-- src/app/valentina/mainwindowsnogui.cpp | 2 +- src/libs/vpatterndb/vformula.cpp | 10 ++-- .../line/vistoolcurveintersectaxis.cpp | 4 +- .../visualization/line/vistoolendline.cpp | 4 +- .../line/vistoollineintersectaxis.cpp | 4 +- 7 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/app/valentina/dialogs/dialoghistory.cpp b/src/app/valentina/dialogs/dialoghistory.cpp index 46170015f..097235731 100644 --- a/src/app/valentina/dialogs/dialoghistory.cpp +++ b/src/app/valentina/dialogs/dialoghistory.cpp @@ -232,35 +232,35 @@ QString DialogHistory::Record(const VToolRecord &tool) Q_UNREACHABLE(); //-V501 break; case Tool::BasePoint: - return QString(tr("%1 - Base point")).arg(PointName(tool.getId())); + return tr("%1 - Base point").arg(PointName(tool.getId())); case Tool::EndLine: - return QString(tr("%1_%2 - Line from point %1 to point %2")) + return tr("%1_%2 - Line from point %1 to point %2") .arg(PointName(AttrUInt(domElem, AttrBasePoint))) .arg(PointName(tool.getId())); case Tool::Line: - return QString(tr("%1_%2 - Line from point %1 to point %2")) + return tr("%1_%2 - Line from point %1 to point %2") .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, AttrSecondPoint))); case Tool::AlongLine: - return QString(tr("%3 - Point along line %1_%2")) + return tr("%3 - Point along line %1_%2") .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, AttrSecondPoint))) .arg(PointName(tool.getId())); case Tool::ShoulderPoint: - return QString(tr("%1 - Point of shoulder")).arg(PointName(tool.getId())); + return tr("%1 - Point of shoulder").arg(PointName(tool.getId())); case Tool::Normal: - return QString(tr("%3 - normal to line %1_%2")) + return tr("%3 - normal to line %1_%2") .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, AttrSecondPoint))) .arg(PointName(tool.getId())); case Tool::Bisector: - return QString(tr("%4 - bisector of angle %1_%2_%3")) + return tr("%4 - bisector of angle %1_%2_%3") .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, AttrSecondPoint))) .arg(PointName(AttrUInt(domElem, AttrThirdPoint))) .arg(PointName(tool.getId())); case Tool::LineIntersect: - return QString(tr("%5 - intersection of lines %1_%2 and %3_%4")) + return tr("%5 - intersection of lines %1_%2 and %3_%4") .arg(PointName(AttrUInt(domElem, AttrP1Line1))) .arg(PointName(AttrUInt(domElem, AttrP2Line1))) .arg(PointName(AttrUInt(domElem, AttrP1Line2))) @@ -288,7 +288,7 @@ QString DialogHistory::Record(const VToolRecord &tool) { const QSharedPointer arc = data->GeometricObject(tool.getId()); SCASSERT(arc != nullptr); - return QString(tr("%1 with length %2")) + return tr("%1 with length %2") .arg(arc->NameForHistory(tr("Arc"))) .arg(arc->GetLength()); } @@ -305,24 +305,24 @@ QString DialogHistory::Record(const VToolRecord &tool) return splPath->NameForHistory(tr("Cubic bezier curve path")); } case Tool::PointOfContact: - return QString(tr("%4 - point of contact of arc with the center in point %1 and line %2_%3")) + return tr("%4 - point of contact of arc with the center in point %1 and line %2_%3") .arg(PointName(AttrUInt(domElem, AttrCenter))) .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, AttrSecondPoint))) .arg(PointName(tool.getId())); case Tool::Height: - return QString(tr("Point of perpendicular from point %1 to line %2_%3")) + return tr("Point of perpendicular from point %1 to line %2_%3") .arg(PointName(AttrUInt(domElem, AttrBasePoint))) .arg(PointName(AttrUInt(domElem, AttrP1Line))) .arg(PointName(AttrUInt(domElem, AttrP2Line))); case Tool::Triangle: - return QString(tr("Triangle: axis %1_%2, points %3 and %4")) + return tr("Triangle: axis %1_%2, points %3 and %4") .arg(PointName(AttrUInt(domElem, AttrAxisP1))) .arg(PointName(AttrUInt(domElem, AttrAxisP2))) .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, AttrSecondPoint))); case Tool::PointOfIntersection: - return QString(tr("%1 - point of intersection %2 and %3")) + return tr("%1 - point of intersection %2 and %3") .arg(PointName(tool.getId())) .arg(PointName(AttrUInt(domElem, AttrFirstPoint))) .arg(PointName(AttrUInt(domElem, AttrSecondPoint))); @@ -330,7 +330,7 @@ QString DialogHistory::Record(const VToolRecord &tool) { const QSharedPointer arc = data->GeometricObject(AttrUInt(domElem, AttrArc)); SCASSERT(arc != nullptr); - return QString(tr("%1 - cut %2")) + return tr("%1 - cut %2") .arg(PointName(tool.getId())) .arg(arc->NameForHistory(tr("arc"))); } @@ -339,7 +339,7 @@ QString DialogHistory::Record(const VToolRecord &tool) const quint32 splineId = AttrUInt(domElem, VToolCutSpline::AttrSpline); const QSharedPointer spl = data->GeometricObject(splineId); SCASSERT(spl != nullptr); - return QString(tr("%1 - cut %2")) + return tr("%1 - cut %2") .arg(PointName(tool.getId())) .arg(spl->NameForHistory(tr("curve"))); } @@ -349,32 +349,32 @@ QString DialogHistory::Record(const VToolRecord &tool) const QSharedPointer splPath = data->GeometricObject(splinePathId); SCASSERT(splPath != nullptr); - return QString(tr("%1 - cut %2")) + return tr("%1 - cut %2") .arg(PointName(tool.getId())) .arg(splPath->NameForHistory(tr("curve path"))); } case Tool::LineIntersectAxis: - return QString(tr("%1 - point of intersection line %2_%3 and axis through point %4")) + return tr("%1 - point of intersection line %2_%3 and axis through point %4") .arg(PointName(tool.getId())) .arg(PointName(AttrUInt(domElem, AttrP1Line))) .arg(PointName(AttrUInt(domElem, AttrP2Line))) .arg(PointName(AttrUInt(domElem, AttrBasePoint))); case Tool::CurveIntersectAxis: - return QString(tr("%1 - point of intersection curve and axis through point %2")) + return tr("%1 - point of intersection curve and axis through point %2") .arg(PointName(tool.getId())) .arg(PointName(AttrUInt(domElem, AttrBasePoint))); case Tool::PointOfIntersectionArcs: - return QString(tr("%1 - point of arcs intersection")).arg(PointName(tool.getId())); + return tr("%1 - point of arcs intersection").arg(PointName(tool.getId())); case Tool::PointOfIntersectionCircles: - return QString(tr("%1 - point of circles intersection")).arg(PointName(tool.getId())); + return tr("%1 - point of circles intersection").arg(PointName(tool.getId())); case Tool::PointOfIntersectionCurves: - return QString(tr("%1 - point of curves intersection")).arg(PointName(tool.getId())); + return tr("%1 - point of curves intersection").arg(PointName(tool.getId())); case Tool::PointFromCircleAndTangent: - return QString(tr("%1 - point from circle and tangent")).arg(PointName(tool.getId())); + return tr("%1 - point from circle and tangent").arg(PointName(tool.getId())); case Tool::PointFromArcAndTangent: - return QString(tr("%1 - point from arc and tangent")).arg(PointName(tool.getId())); + return tr("%1 - point from arc and tangent").arg(PointName(tool.getId())); case Tool::TrueDarts: - return QString(tr("Correction the dart %1_%2_%3")) + return tr("Correction the dart %1_%2_%3") .arg(PointName(AttrUInt(domElem, AttrDartP1))) .arg(PointName(AttrUInt(domElem, AttrDartP2))) .arg(PointName(AttrUInt(domElem, AttrDartP2))); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index ee9a8afa8..fd3985e67 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -2755,7 +2755,7 @@ void MainWindow::New() if (comboBoxDraws->count() == 0) { qCDebug(vMainWindow, "New PP."); - QString patternPieceName = QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1); + QString patternPieceName = tr("Pattern piece %1").arg(comboBoxDraws->count()+1); qCDebug(vMainWindow, "Generated PP name: %s", qUtf8Printable(patternPieceName)); qCDebug(vMainWindow, "First PP"); @@ -3499,7 +3499,7 @@ void MainWindow::CreateActions() connect(ui->actionNewDraw, &QAction::triggered, [this]() { qCDebug(vMainWindow, "New PP."); - QString patternPieceName = QString(tr("Pattern piece %1")).arg(comboBoxDraws->count()+1); + QString patternPieceName = tr("Pattern piece %1").arg(comboBoxDraws->count()+1); qCDebug(vMainWindow, "Generated PP name: %s", qUtf8Printable(patternPieceName)); qCDebug(vMainWindow, "PP count %d", comboBoxDraws->count()); @@ -3988,8 +3988,8 @@ void MainWindow::ReopenFilesAfterCrash(QStringList &args) if (restoreFiles.size() > 0) { QMessageBox::StandardButton reply; - QString mes=QString(tr("Valentina didn't shut down correctly. " - "Do you want reopen files (%1) you had open?")).arg(restoreFiles.size()); + const QString mes = tr("Valentina didn't shut down correctly. Do you want reopen files (%1) you had open?") + .arg(restoreFiles.size()); reply = QMessageBox::question(this, tr("Reopen files."), mes, QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); if (reply == QMessageBox::Yes) diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index b3e6b9e72..adbba5f1e 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -714,7 +714,7 @@ void MainWindowsNoGUI::PdfToPs(const QStringList ¶ms) const QFile f(params.last()); if (f.exists() == false) { - QString msg = QString(tr("Creating file '%1' failed! %2")).arg(params.last()).arg(proc.errorString()); + const QString msg = tr("Creating file '%1' failed! %2").arg(params.last()).arg(proc.errorString()); QMessageBox msgBox(QMessageBox::Critical, tr("Critical error!"), msg, QMessageBox::Ok | QMessageBox::Default); msgBox.exec(); } diff --git a/src/libs/vpatterndb/vformula.cpp b/src/libs/vpatterndb/vformula.cpp index 703146d8b..58a660578 100644 --- a/src/libs/vpatterndb/vformula.cpp +++ b/src/libs/vpatterndb/vformula.cpp @@ -39,14 +39,14 @@ //VFormula //--------------------------------------------------------------------------------------------------------------------- VFormula::VFormula() - :formula(QString()), value(QString(tr("Error"))), checkZero(true), data(nullptr), toolId(NULL_ID), + :formula(QString()), value(tr("Error")), checkZero(true), data(nullptr), toolId(NULL_ID), postfix(QString()), _error(true), dValue(0) {} //--------------------------------------------------------------------------------------------------------------------- VFormula::VFormula(const QString &formula, const VContainer *container) : formula(qApp->TrVars()->FormulaToUser(formula, qApp->Settings()->GetOsSeparator())), - value(QString(tr("Error"))), + value(tr("Error")), checkZero(true), data(container), toolId(NULL_ID), @@ -226,7 +226,7 @@ void VFormula::Eval() } if (formula.isEmpty()) { - value = QString(tr("Error")); + value = tr("Error"); _error = true; dValue = 0; } @@ -240,7 +240,7 @@ void VFormula::Eval() if (qIsInf(result) || qIsNaN(result)) { - value = QString(tr("Error")); + value = tr("Error"); _error = true; dValue = 0; } @@ -263,7 +263,7 @@ void VFormula::Eval() } catch (qmu::QmuParserError &e) { - value = QString(tr("Error")); + value = tr("Error"); _error = true; dValue = 0; qDebug() << "\nMath parser error:\n" diff --git a/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp b/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp index 1f10d0ad6..356886fb4 100644 --- a/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp +++ b/src/libs/vtools/visualization/line/vistoolcurveintersectaxis.cpp @@ -78,8 +78,8 @@ void VisToolCurveIntersectAxis::RefreshGeometry() DrawPoint(point, p, mainColor); - Visualization::toolTip = QString(tr("Intersection curve and axis: angle = %1°; Shift - " - "sticking angle, Enter - finish creation")) + Visualization::toolTip = tr("Intersection curve and axis: angle = %1°; Shift - " + "sticking angle, Enter - finish creation") .arg(this->line().angle()); } } diff --git a/src/libs/vtools/visualization/line/vistoolendline.cpp b/src/libs/vtools/visualization/line/vistoolendline.cpp index 0365ab7cc..ca9d7e373 100644 --- a/src/libs/vtools/visualization/line/vistoolendline.cpp +++ b/src/libs/vtools/visualization/line/vistoolendline.cpp @@ -70,8 +70,8 @@ void VisToolEndLine::RefreshGeometry() } DrawLine(this, line, mainColor, lineStyle); static const QString prefix = VDomDocument::UnitsToStr(qApp->patternUnit(), true); - Visualization::toolTip = QString(tr("Point at distance and angle: angle = %1°, length = %2%3; " - "Shift - sticking angle, Enter - finish creation")) + Visualization::toolTip = tr("Point at distance and angle: angle = %1°, length = %2%3; " + "Shift - sticking angle, Enter - finish creation") .arg(this->line().angle()) .arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(this->line().length())), qApp->Settings()->GetOsSeparator())) diff --git a/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp b/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp index 8481818c4..b2b7becfa 100644 --- a/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp +++ b/src/libs/vtools/visualization/line/vistoollineintersectaxis.cpp @@ -93,8 +93,8 @@ void VisToolLineIntersectAxis::RefreshGeometry() DrawPoint(point, p, mainColor); ShowIntersection(axis_line, base_line); - Visualization::toolTip = QString(tr("Intersection line and axis: angle = %1°; Shift - " - "sticking angle, Enter - finish creation")) + Visualization::toolTip = tr("Intersection line and axis: angle = %1°; Shift - " + "sticking angle, Enter - finish creation") .arg(this->line().angle()); } }