New warning. Warn about empty measurements dimension value when preparing placeholders.
This commit is contained in:
parent
f40c06b6fc
commit
0ab76dd6b9
|
@ -3,6 +3,7 @@
|
|||
- Update translations.
|
||||
- Fix a regression in tool Segment a spline path.
|
||||
- Fix invalid visualization for tool Point of intersection circles.
|
||||
- New warning. Warn about empty measurements dimension value when preparing placeholders.
|
||||
|
||||
# Version 0.7.41 Dec 4, 2020
|
||||
- Bug fixes.
|
||||
|
|
|
@ -284,6 +284,21 @@ void InitPiecePlaceholders(QMap<QString, QString> &placeholders, const QString &
|
|||
QString ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString line)
|
||||
{
|
||||
QChar per('%');
|
||||
|
||||
auto TestDimension = [per, placeholders, line](const QString &placeholder, const QString &errorMsg)
|
||||
{
|
||||
if (line.contains(per+placeholder+per) && placeholders.value(placeholder) == QChar('0'))
|
||||
{
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
};
|
||||
|
||||
TestDimension(pl_height, QObject::tr("No data for the height dimension."));
|
||||
TestDimension(pl_size, QObject::tr("No data for the size dimension."));
|
||||
TestDimension(pl_hip, QObject::tr("No data for the hip dimension."));
|
||||
TestDimension(pl_waist, QObject::tr("No data for the waist dimension."));
|
||||
|
||||
auto i = placeholders.constBegin();
|
||||
while (i != placeholders.constEnd())
|
||||
{
|
||||
|
|
|
@ -586,10 +586,26 @@ void DialogEditLabel::InitPlaceholders()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString DialogEditLabel::ReplacePlaceholders(QString line) const
|
||||
{
|
||||
QChar per('%');
|
||||
|
||||
auto TestDimension = [per, this, line](const QString &placeholder, const QString &errorMsg)
|
||||
{
|
||||
if (line.contains(per+placeholder+per) && m_placeholders.value(placeholder).second == QChar('0'))
|
||||
{
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) :
|
||||
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
|
||||
}
|
||||
};
|
||||
|
||||
TestDimension(pl_height, tr("No data for the height dimension."));
|
||||
TestDimension(pl_size, tr("No data for the size dimension."));
|
||||
TestDimension(pl_hip, tr("No data for the hip dimension."));
|
||||
TestDimension(pl_waist, tr("No data for the waist dimension."));
|
||||
|
||||
auto i = m_placeholders.constBegin();
|
||||
while (i != m_placeholders.constEnd())
|
||||
{
|
||||
line.replace(QChar('%')+i.key()+QChar('%'), i.value().second);
|
||||
line.replace(per+i.key()+per, i.value().second);
|
||||
++i;
|
||||
}
|
||||
return line;
|
||||
|
|
Loading…
Reference in New Issue
Block a user