Refactoring. Fixed wrong using method tr().

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-07-18 19:29:34 +03:00
parent 47f12c80f8
commit 18e0f6750a
7 changed files with 40 additions and 40 deletions

View File

@ -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<VArc> arc = data->GeometricObject<VArc>(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<VArc> arc = data->GeometricObject<VArc>(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<VAbstractCubicBezier> spl = data->GeometricObject<VAbstractCubicBezier>(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<VAbstractCubicBezierPath> splPath =
data->GeometricObject<VAbstractCubicBezierPath>(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)));

View File

@ -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)

View File

@ -714,7 +714,7 @@ void MainWindowsNoGUI::PdfToPs(const QStringList &params) 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();
}

View File

@ -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"

View File

@ -78,8 +78,8 @@ void VisToolCurveIntersectAxis::RefreshGeometry()
DrawPoint(point, p, mainColor);
Visualization::toolTip = QString(tr("<b>Intersection curve and axis</b>: angle = %1°; <b>Shift</b> - "
"sticking angle, <b>Enter</b> - finish creation"))
Visualization::toolTip = tr("<b>Intersection curve and axis</b>: angle = %1°; <b>Shift</b> - "
"sticking angle, <b>Enter</b> - finish creation")
.arg(this->line().angle());
}
}

View File

@ -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("<b>Point at distance and angle</b>: angle = %1°, length = %2%3; "
"<b>Shift</b> - sticking angle, <b>Enter</b> - finish creation"))
Visualization::toolTip = tr("<b>Point at distance and angle</b>: angle = %1°, length = %2%3; "
"<b>Shift</b> - sticking angle, <b>Enter</b> - finish creation")
.arg(this->line().angle())
.arg(qApp->TrVars()->FormulaToUser(QString::number(qApp->fromPixel(this->line().length())),
qApp->Settings()->GetOsSeparator()))

View File

@ -93,8 +93,8 @@ void VisToolLineIntersectAxis::RefreshGeometry()
DrawPoint(point, p, mainColor);
ShowIntersection(axis_line, base_line);
Visualization::toolTip = QString(tr("<b>Intersection line and axis</b>: angle = %1°; <b>Shift</b> - "
"sticking angle, <b>Enter</b> - finish creation"))
Visualization::toolTip = tr("<b>Intersection line and axis</b>: angle = %1°; <b>Shift</b> - "
"sticking angle, <b>Enter</b> - finish creation")
.arg(this->line().angle());
}
}