New placeholders.

This commit is contained in:
Roman Telezhynskyi 2022-02-14 14:11:27 +02:00
parent 77138b0364
commit 080e84ff48
6 changed files with 89 additions and 13 deletions

View File

@ -439,28 +439,36 @@ auto PrepareGradationPlaceholders(const VContainer *data) -> QMap<QString, QStri
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
placeholders.insert(pl_height, heightValue); placeholders.insert(pl_height, heightValue);
placeholders.insert(pl_dimensionX, heightValue);
QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize());
placeholders.insert(pl_size, sizeValue); placeholders.insert(pl_size, sizeValue);
placeholders.insert(pl_dimensionY, sizeValue);
QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip());
placeholders.insert(pl_hip, hipValue); placeholders.insert(pl_hip, hipValue);
placeholders.insert(pl_dimensionZ, hipValue);
QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist());
placeholders.insert(pl_waist, waistValue); placeholders.insert(pl_waist, waistValue);
placeholders.insert(pl_dimensionW, waistValue);
{ {
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel(); QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
placeholders.insert(pl_heightLabel, not label.isEmpty() ? label : heightValue); placeholders.insert(pl_heightLabel, not label.isEmpty() ? label : heightValue);
placeholders.insert(pl_dimensionXLabel, not label.isEmpty() ? label : heightValue);
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel(); label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
placeholders.insert(pl_sizeLabel, not label.isEmpty() ? label : sizeValue); placeholders.insert(pl_sizeLabel, not label.isEmpty() ? label : sizeValue);
placeholders.insert(pl_dimensionYLabel, not label.isEmpty() ? label : heightValue);
label = VAbstractValApplication::VApp()->GetDimensionHipLabel(); label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
placeholders.insert(pl_hipLabel, not label.isEmpty() ? label : hipValue); placeholders.insert(pl_hipLabel, not label.isEmpty() ? label : hipValue);
placeholders.insert(pl_dimensionZLabel, not label.isEmpty() ? label : heightValue);
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel(); label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
placeholders.insert(pl_waistLabel, not label.isEmpty() ? label : waistValue); placeholders.insert(pl_waistLabel, not label.isEmpty() ? label : waistValue);
placeholders.insert(pl_dimensionWLabel, not label.isEmpty() ? label : heightValue);
} }
{ {
@ -485,8 +493,9 @@ auto ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString lin
{ {
if (line.contains(per+placeholder+per) && placeholders.value(placeholder) == QChar('0')) if (line.contains(per+placeholder+per) && placeholders.value(placeholder) == QChar('0'))
{ {
VAbstractApplication::VApp()->IsPedantic() ? throw VException(errorMsg) : VAbstractApplication::VApp()->IsPedantic()
qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg; ? throw VException(errorMsg)
: qWarning() << VAbstractValApplication::warningMessageSignature + errorMsg;
} }
}; };
@ -495,6 +504,11 @@ auto ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString lin
TestDimension(pl_hip, QObject::tr("No data for the hip dimension.")); TestDimension(pl_hip, QObject::tr("No data for the hip dimension."));
TestDimension(pl_waist, QObject::tr("No data for the waist dimension.")); TestDimension(pl_waist, QObject::tr("No data for the waist dimension."));
TestDimension(pl_dimensionX, QObject::tr("No data for the X dimension."));
TestDimension(pl_dimensionY, QObject::tr("No data for the Y dimension."));
TestDimension(pl_dimensionZ, QObject::tr("No data for the Z dimension."));
TestDimension(pl_dimensionW, QObject::tr("No data for the W dimension."));
auto i = placeholders.constBegin(); auto i = placeholders.constBegin();
while (i != placeholders.constEnd()) while (i != placeholders.constEnd())
{ {

View File

@ -217,15 +217,19 @@ auto PreparePlaceholders(const VAbstractPattern *doc, const VContainer *data) ->
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
placeholders.insert(pl_height, heightValue); placeholders.insert(pl_height, heightValue);
placeholders.insert(pl_dimensionX, heightValue);
QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize());
placeholders.insert(pl_size, sizeValue); placeholders.insert(pl_size, sizeValue);
placeholders.insert(pl_dimensionY, sizeValue);
QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip());
placeholders.insert(pl_hip, hipValue); placeholders.insert(pl_hip, hipValue);
placeholders.insert(pl_dimensionZ, hipValue);
QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist());
placeholders.insert(pl_waist, waistValue); placeholders.insert(pl_waist, waistValue);
placeholders.insert(pl_dimensionW, waistValue);
{ {
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel(); QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
@ -349,6 +353,11 @@ auto ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString lin
TestDimension(pl_hip, QObject::tr("No data for the hip dimension.")); TestDimension(pl_hip, QObject::tr("No data for the hip dimension."));
TestDimension(pl_waist, QObject::tr("No data for the waist dimension.")); TestDimension(pl_waist, QObject::tr("No data for the waist dimension."));
TestDimension(pl_dimensionX, QObject::tr("No data for the X dimension."));
TestDimension(pl_dimensionY, QObject::tr("No data for the Y dimension."));
TestDimension(pl_dimensionZ, QObject::tr("No data for the Z dimension."));
TestDimension(pl_dimensionW, QObject::tr("No data for the W dimension."));
auto i = placeholders.constBegin(); auto i = placeholders.constBegin();
while (i != placeholders.constEnd()) while (i != placeholders.constEnd())
{ {

View File

@ -134,14 +134,26 @@ const QStringList builInFunctions
warning_F warning_F
}; };
const QString pl_size = QStringLiteral("size"); const QString pl_size = QStringLiteral("size");
const QString pl_height = QStringLiteral("height"); const QString pl_height = QStringLiteral("height");
const QString pl_hip = QStringLiteral("hip"); const QString pl_hip = QStringLiteral("hip");
const QString pl_waist = QStringLiteral("waist"); const QString pl_waist = QStringLiteral("waist");
const QString pl_sizeLabel = QStringLiteral("sizeLabel");
const QString pl_heightLabel = QStringLiteral("heightLabel"); const QString pl_sizeLabel = QStringLiteral("sizeLabel");
const QString pl_hipLabel = QStringLiteral("hipLabel"); const QString pl_heightLabel = QStringLiteral("heightLabel");
const QString pl_waistLabel = QStringLiteral("waistLabel"); const QString pl_hipLabel = QStringLiteral("hipLabel");
const QString pl_waistLabel = QStringLiteral("waistLabel");
const QString pl_dimensionX = QStringLiteral("dimensionX");
const QString pl_dimensionY = QStringLiteral("dimensionY");
const QString pl_dimensionW = QStringLiteral("dimensionW");
const QString pl_dimensionZ = QStringLiteral("dimensionZ");
const QString pl_dimensionXLabel = QStringLiteral("dimensionXLabel");
const QString pl_dimensionYLabel = QStringLiteral("dimensionYLabel");
const QString pl_dimensionWLabel = QStringLiteral("dimensionWLabel");
const QString pl_dimensionZLabel = QStringLiteral("dimensionZLabel");
const QString pl_date = QStringLiteral("date"); const QString pl_date = QStringLiteral("date");
const QString pl_time = QStringLiteral("time"); const QString pl_time = QStringLiteral("time");
const QString pl_birthDate = QStringLiteral("birthDate"); const QString pl_birthDate = QStringLiteral("birthDate");

View File

@ -409,14 +409,26 @@ extern const QString warning_F;
extern const QStringList builInFunctions; extern const QStringList builInFunctions;
// Placeholders // Placeholders
extern const QString pl_size;
extern const QString pl_height; extern const QString pl_height;
extern const QString pl_hip; extern const QString pl_size;
extern const QString pl_waist; extern const QString pl_waist;
extern const QString pl_sizeLabel; extern const QString pl_hip;
extern const QString pl_heightLabel; extern const QString pl_heightLabel;
extern const QString pl_sizeLabel;
extern const QString pl_hipLabel; extern const QString pl_hipLabel;
extern const QString pl_waistLabel; extern const QString pl_waistLabel;
extern const QString pl_dimensionX;
extern const QString pl_dimensionY;
extern const QString pl_dimensionW;
extern const QString pl_dimensionZ;
extern const QString pl_dimensionXLabel;
extern const QString pl_dimensionYLabel;
extern const QString pl_dimensionWLabel;
extern const QString pl_dimensionZLabel;
extern const QString pl_date; extern const QString pl_date;
extern const QString pl_time; extern const QString pl_time;
extern const QString pl_birthDate; extern const QString pl_birthDate;

View File

@ -537,32 +537,44 @@ void DialogEditLabel::InitPlaceholders()
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
m_placeholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue)); m_placeholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue));
m_placeholders.insert(pl_dimensionX, qMakePair(tr("Dimension X", "dimension"), heightValue));
QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize());
m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"), sizeValue)); m_placeholders.insert(pl_size, qMakePair(tr("Size", "dimension"), sizeValue));
m_placeholders.insert(pl_dimensionY, qMakePair(tr("Dimension Y", "dimension"), sizeValue));
QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip());
m_placeholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), hipValue)); m_placeholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), hipValue));
m_placeholders.insert(pl_dimensionZ, qMakePair(tr("Dimension Z", "dimension"), hipValue));
QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist());
m_placeholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), waistValue)); m_placeholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), waistValue));
m_placeholders.insert(pl_dimensionW, qMakePair(tr("Dimension W", "dimension"), waistValue));
{ {
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel(); QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
m_placeholders.insert(pl_heightLabel, qMakePair(tr("Height label", "dimension"), m_placeholders.insert(pl_heightLabel, qMakePair(tr("Height label", "dimension"),
not label.isEmpty() ? label : heightValue)); not label.isEmpty() ? label : heightValue));
m_placeholders.insert(pl_dimensionX, qMakePair(tr("Dimension X label", "dimension"),
not label.isEmpty() ? label : heightValue));
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel(); label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
m_placeholders.insert(pl_sizeLabel, qMakePair(tr("Size label", "dimension"), m_placeholders.insert(pl_sizeLabel, qMakePair(tr("Size label", "dimension"),
not label.isEmpty() ? label : sizeValue)); not label.isEmpty() ? label : sizeValue));
m_placeholders.insert(pl_dimensionY, qMakePair(tr("Dimension Y label", "dimension"),
not label.isEmpty() ? label : sizeValue));
label = VAbstractValApplication::VApp()->GetDimensionHipLabel(); label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
m_placeholders.insert(pl_hipLabel, qMakePair(tr("Hip label", "dimension"), m_placeholders.insert(pl_hipLabel, qMakePair(tr("Hip label", "dimension"),
not label.isEmpty() ? label : hipValue)); not label.isEmpty() ? label : hipValue));
m_placeholders.insert(pl_dimensionZ, qMakePair(tr("Dimension Z label", "dimension"),
not label.isEmpty() ? label : hipValue));
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel(); label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
m_placeholders.insert(pl_waistLabel, qMakePair(tr("Waist label", "dimension"), m_placeholders.insert(pl_waistLabel, qMakePair(tr("Waist label", "dimension"),
not label.isEmpty() ? label : waistValue)); not label.isEmpty() ? label : waistValue));
m_placeholders.insert(pl_dimensionW, qMakePair(tr("Dimension W label", "dimension"),
not label.isEmpty() ? label : waistValue));
} }
@ -666,6 +678,11 @@ QString DialogEditLabel::ReplacePlaceholders(QString line) const
TestDimension(pl_hip, tr("No data for the hip dimension.")); TestDimension(pl_hip, tr("No data for the hip dimension."));
TestDimension(pl_waist, tr("No data for the waist dimension.")); TestDimension(pl_waist, tr("No data for the waist dimension."));
TestDimension(pl_dimensionX, tr("No data for the X dimension."));
TestDimension(pl_dimensionY, tr("No data for the Y dimension."));
TestDimension(pl_dimensionZ, tr("No data for the Z dimension."));
TestDimension(pl_dimensionW, tr("No data for the W dimension."));
auto i = m_placeholders.constBegin(); auto i = m_placeholders.constBegin();
while (i != m_placeholders.constEnd()) while (i != m_placeholders.constEnd())
{ {

View File

@ -3904,32 +3904,44 @@ void DialogSeamAllowance::InitGradationPlaceholders()
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight()); QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
m_gradationPlaceholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue)); m_gradationPlaceholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue));
m_gradationPlaceholders.insert(pl_dimensionX, qMakePair(tr("Dimension X", "dimension"), heightValue));
QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize()); QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize());
m_gradationPlaceholders.insert(pl_size, qMakePair(tr("Size", "dimension"), sizeValue)); m_gradationPlaceholders.insert(pl_size, qMakePair(tr("Size", "dimension"), sizeValue));
m_gradationPlaceholders.insert(pl_dimensionY, qMakePair(tr("Dimension Y", "dimension"), sizeValue));
QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip()); QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip());
m_gradationPlaceholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), hipValue)); m_gradationPlaceholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), hipValue));
m_gradationPlaceholders.insert(pl_dimensionZ, qMakePair(tr("Dimension Z", "dimension"), hipValue));
QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist()); QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist());
m_gradationPlaceholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), waistValue)); m_gradationPlaceholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), waistValue));
m_gradationPlaceholders.insert(pl_dimensionW, qMakePair(tr("Dimension W", "dimension"), waistValue));
{ {
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel(); QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
m_gradationPlaceholders.insert(pl_heightLabel, qMakePair(tr("Height label", "dimension"), m_gradationPlaceholders.insert(pl_heightLabel, qMakePair(tr("Height label", "dimension"),
not label.isEmpty() ? label : heightValue)); not label.isEmpty() ? label : heightValue));
m_gradationPlaceholders.insert(pl_dimensionXLabel, qMakePair(tr("Dimension X label", "dimension"),
not label.isEmpty() ? label : heightValue));
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel(); label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
m_gradationPlaceholders.insert(pl_sizeLabel, qMakePair(tr("Size label", "dimension"), m_gradationPlaceholders.insert(pl_sizeLabel, qMakePair(tr("Size label", "dimension"),
not label.isEmpty() ? label : sizeValue)); not label.isEmpty() ? label : sizeValue));
m_gradationPlaceholders.insert(pl_dimensionYLabel, qMakePair(tr("Dimension Y label", "dimension"),
not label.isEmpty() ? label : sizeValue));
label = VAbstractValApplication::VApp()->GetDimensionHipLabel(); label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
m_gradationPlaceholders.insert(pl_hipLabel, qMakePair(tr("Hip label", "dimension"), m_gradationPlaceholders.insert(pl_hipLabel, qMakePair(tr("Hip label", "dimension"),
not label.isEmpty() ? label : hipValue)); not label.isEmpty() ? label : hipValue));
m_gradationPlaceholders.insert(pl_dimensionZLabel, qMakePair(tr("Dimension Z label", "dimension"),
not label.isEmpty() ? label : hipValue));
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel(); label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
m_gradationPlaceholders.insert(pl_waistLabel, qMakePair(tr("Waist label", "dimension"), m_gradationPlaceholders.insert(pl_waistLabel, qMakePair(tr("Waist label", "dimension"),
not label.isEmpty() ? label : waistValue)); not label.isEmpty() ? label : waistValue));
m_gradationPlaceholders.insert(pl_dimensionWLabel, qMakePair(tr("Dimension W label", "dimension"),
not label.isEmpty() ? label : waistValue));
} }
{ {