Gradation label.
This commit is contained in:
parent
0944ea968a
commit
29325add49
|
@ -504,38 +504,6 @@ void VPMainWindow::InitProperties()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPMainWindow::InitPropertyTabCurrentPiece()
|
||||
{
|
||||
connect(ui->lineEditCurrentPieceName, &QLineEdit::textEdited, this, [this](const QString &text)
|
||||
{
|
||||
QList<VPPiecePtr> selectedPieces = SelectedPieces();
|
||||
if (selectedPieces.size() == 1)
|
||||
{
|
||||
VPPiecePtr selectedPiece = selectedPieces.first();
|
||||
if (not selectedPiece.isNull())
|
||||
{
|
||||
selectedPiece->SetName(text);
|
||||
LayoutWasSaved(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->plainTextEditCurrentPieceUUID, &QPlainTextEdit::textChanged, this, [this]()
|
||||
{
|
||||
QList<VPPiecePtr> selectedPieces = SelectedPieces();
|
||||
if (selectedPieces.size() == 1)
|
||||
{
|
||||
VPPiecePtr selectedPiece = selectedPieces.first();
|
||||
if (not selectedPiece.isNull())
|
||||
{
|
||||
const QUuid temp = QUuid(ui->plainTextEditCurrentPieceUUID->toPlainText());
|
||||
if (not temp.isNull())
|
||||
{
|
||||
selectedPiece->SetUUID(temp);
|
||||
}
|
||||
LayoutWasSaved(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
connect(ui->checkBoxCurrentPieceShowSeamline, &QCheckBox::toggled, this, [this](bool checked)
|
||||
{
|
||||
QList<VPPiecePtr> selectedPieces = SelectedPieces();
|
||||
|
@ -956,6 +924,7 @@ void VPMainWindow::SetPropertyTabCurrentPieceData()
|
|||
// set the value to the current piece
|
||||
SetLineEditValue(ui->lineEditCurrentPieceName, selectedPiece->GetName());
|
||||
SetPlainTextEditValue(ui->plainTextEditCurrentPieceUUID, selectedPiece->GetUUID().toString());
|
||||
SetLineEditValue(ui->lineEditCurrentPieceGradationId, selectedPiece->GetGradationId());
|
||||
|
||||
// SetCheckBoxValue(ui->checkBoxCurrentPieceShowSeamline, selectedPiece->GetShowSeamLine());
|
||||
SetCheckBoxValue(ui->checkBoxCurrentPieceMirrorPiece, selectedPiece->IsMirror());
|
||||
|
|
|
@ -189,7 +189,7 @@
|
|||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
|
@ -331,6 +331,20 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Gradation id:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEditCurrentPieceGradationId">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1874,8 +1888,8 @@
|
|||
</resources>
|
||||
<connections/>
|
||||
<buttongroups>
|
||||
<buttongroup name="buttonGroupSheetOrientation"/>
|
||||
<buttongroup name="buttonGroupRotationDirection"/>
|
||||
<buttongroup name="buttonGroupTileOrientation"/>
|
||||
<buttongroup name="buttonGroupSheetOrientation"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
|
|
@ -876,6 +876,7 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
|||
initData.id = GetParametrId(domElement);
|
||||
initData.detail.SetName(GetParametrString(domElement, AttrName, tr("Detail")));
|
||||
initData.detail.SetUUID(GetParametrEmptyString(domElement, AttrUUID));
|
||||
initData.detail.SetGradationLabel(GetParametrEmptyString(domElement, AttrGradationLabel));
|
||||
initData.detail.SetMx(VAbstractValApplication::VApp()
|
||||
->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"))));
|
||||
initData.detail.SetMy(VAbstractValApplication::VApp()
|
||||
|
|
|
@ -48,6 +48,7 @@ const QString AttrMx = QStringLiteral("mx");
|
|||
const QString AttrMy = QStringLiteral("my");
|
||||
const QString AttrName = QStringLiteral("name");
|
||||
const QString AttrUUID = QStringLiteral("uuid");
|
||||
const QString AttrGradationLabel = QStringLiteral("gradationLabel");
|
||||
const QString AttrMx1 = QStringLiteral("mx1");
|
||||
const QString AttrMy1 = QStringLiteral("my1");
|
||||
const QString AttrName1 = QStringLiteral("name1");
|
||||
|
|
|
@ -66,6 +66,7 @@ extern const QString AttrMx;
|
|||
extern const QString AttrMy;
|
||||
extern const QString AttrName;
|
||||
extern const QString AttrUUID;
|
||||
extern const QString AttrGradationLabel;
|
||||
extern const QString AttrMx1;
|
||||
extern const QString AttrMy1;
|
||||
extern const QString AttrName1;
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
<file>schema/pattern/v0.8.9.xsd</file>
|
||||
<file>schema/pattern/v0.8.10.xsd</file>
|
||||
<file>schema/pattern/v0.8.11.xsd</file>
|
||||
<file>schema/pattern/v0.8.12.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.3.0.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.4.0.xsd</file>
|
||||
<file>schema/multisize_measurements/v0.4.1.xsd</file>
|
||||
|
|
1134
src/libs/ifc/schema/pattern/v0.8.12.xsd
Normal file
1134
src/libs/ifc/schema/pattern/v0.8.12.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -60,8 +60,8 @@ class QDomElement;
|
|||
*/
|
||||
|
||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.11");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.11.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.12");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.12.xsd");
|
||||
|
||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
|
@ -244,7 +244,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
|||
std::make_pair(FORMAT_VERSION(0, 8, 8), QStringLiteral("://schema/pattern/v0.8.8.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 9), QStringLiteral("://schema/pattern/v0.8.9.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 10), QStringLiteral("://schema/pattern/v0.8.10.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 11), CurrentSchema)
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 11), QStringLiteral("://schema/pattern/v0.8.11.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 12), CurrentSchema)
|
||||
};
|
||||
|
||||
if (schemas.contains(ver))
|
||||
|
@ -509,6 +510,10 @@ void VPatternConverter::ApplyPatches()
|
|||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 11)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 8, 11)):
|
||||
ToV0_8_12();
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 12)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 8, 12)):
|
||||
break;
|
||||
default:
|
||||
InvalidVersion(m_ver);
|
||||
|
@ -526,7 +531,7 @@ void VPatternConverter::DowngradeToCurrentMaxVersion()
|
|||
bool VPatternConverter::IsReadOnly() const
|
||||
{
|
||||
// Check if attribute readOnly was not changed in file format
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 11),
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 12),
|
||||
"Check attribute readOnly.");
|
||||
|
||||
// Possibly in future attribute readOnly will change position etc.
|
||||
|
@ -1208,6 +1213,16 @@ void VPatternConverter::ToV0_8_11()
|
|||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ToV0_8_12()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.8.12
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 12),
|
||||
"Time to refactor the code.");
|
||||
SetVersion(QStringLiteral("0.8.12"));
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnitToV0_2_0()
|
||||
{
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
static const QString PatternMaxVerStr;
|
||||
static const QString CurrentSchema;
|
||||
static Q_DECL_CONSTEXPR const int PatternMinVer = FORMAT_VERSION(0, 1, 4);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 11);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 12);
|
||||
|
||||
protected:
|
||||
virtual int MinVer() const override;
|
||||
|
@ -134,6 +134,7 @@ private:
|
|||
void ToV0_8_9();
|
||||
void ToV0_8_10();
|
||||
void ToV0_8_11();
|
||||
void ToV0_8_12();
|
||||
|
||||
void TagUnitToV0_2_0();
|
||||
void TagIncrementToV0_2_0();
|
||||
|
|
|
@ -1631,7 +1631,7 @@ void VAbstractPiece::SetUUID(const QString &uuid)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPiece::GetUniqueID() const
|
||||
auto VAbstractPiece::GetUniqueID() const -> QString
|
||||
{
|
||||
return d->m_uuid.toString();
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ public:
|
|||
* @brief GetUniqueID returns unique piece id. Combines UUID and gradation label.
|
||||
* @return unique piece id.
|
||||
*/
|
||||
QString GetUniqueID() const;
|
||||
virtual QString GetUniqueID() const;
|
||||
|
||||
static QVector<QPointF> Equidistant(QVector<VSAPoint> points, qreal width, const QString &name);
|
||||
static qreal SumTrapezoids(const QVector<QPointF> &points);
|
||||
|
|
|
@ -429,6 +429,87 @@ QVector<VLayoutPassmark> ConvertPassmarks(const VPiece &piece, const VContainer
|
|||
|
||||
return layoutPassmarks;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto PrepareGradationPlaceholders(const VContainer *data) -> QMap<QString, QString>
|
||||
{
|
||||
SCASSERT(data != nullptr)
|
||||
|
||||
QMap<QString, QString> placeholders;
|
||||
|
||||
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
|
||||
placeholders.insert(pl_height, heightValue);
|
||||
|
||||
QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize());
|
||||
placeholders.insert(pl_size, sizeValue);
|
||||
|
||||
QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip());
|
||||
placeholders.insert(pl_hip, hipValue);
|
||||
|
||||
QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist());
|
||||
placeholders.insert(pl_waist, waistValue);
|
||||
|
||||
{
|
||||
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
|
||||
placeholders.insert(pl_heightLabel, not label.isEmpty() ? label : heightValue);
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
|
||||
placeholders.insert(pl_sizeLabel, not label.isEmpty() ? label : sizeValue);
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
|
||||
placeholders.insert(pl_hipLabel, not label.isEmpty() ? label : hipValue);
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
|
||||
placeholders.insert(pl_waistLabel, not label.isEmpty() ? label : waistValue);
|
||||
}
|
||||
|
||||
{
|
||||
const QMap<QString, QSharedPointer<VMeasurement> > measurements = data->DataMeasurements();
|
||||
auto i = measurements.constBegin();
|
||||
while (i != measurements.constEnd())
|
||||
{
|
||||
placeholders.insert(pl_measurement + i.key(), QString::number(*i.value()->GetValue()));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
return placeholders;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto ReplacePlaceholders(const QMap<QString, QString> &placeholders, QString line) -> QString
|
||||
{
|
||||
QChar per('%');
|
||||
|
||||
auto TestDimension = [per, placeholders, line](const QString &placeholder, const QString &errorMsg)
|
||||
{
|
||||
if (line.contains(per+placeholder+per) && placeholders.value(placeholder) == QChar('0'))
|
||||
{
|
||||
VAbstractApplication::VApp()->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())
|
||||
{
|
||||
line.replace(per+i.key()+per, i.value());
|
||||
++i;
|
||||
}
|
||||
return line;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto PrepareGradationId(const QString &label, const VContainer *pattern) -> QString
|
||||
{
|
||||
const QMap<QString, QString> placeholders = PrepareGradationPlaceholders(pattern);
|
||||
return ReplacePlaceholders(placeholders, label);
|
||||
}
|
||||
}
|
||||
|
||||
// Friend functions
|
||||
|
@ -506,6 +587,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
|||
|
||||
det.SetName(piece.GetName());
|
||||
det.SetUUID(piece.GetUUID());
|
||||
det.SetGradationId(PrepareGradationId(piece.GetGradationLabel(), pattern));
|
||||
|
||||
det.SetSAWidth(VAbstractValApplication::VApp()->toPixel(piece.GetSAWidth()));
|
||||
det.SetForbidFlipping(piece.IsForbidFlipping());
|
||||
|
@ -558,6 +640,19 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
|||
return det;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VLayoutPiece::GetUniqueID() const -> QString
|
||||
{
|
||||
QString id = VAbstractPiece::GetUniqueID();
|
||||
|
||||
if (not d->m_gradationId.isEmpty())
|
||||
{
|
||||
id = id + '_' + d->m_gradationId;
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <class T>
|
||||
auto VLayoutPiece::Map(QVector<T> points) const -> QVector<T>
|
||||
|
@ -1573,6 +1668,18 @@ void VLayoutPiece::SetMirror(bool value)
|
|||
d->mirror = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VLayoutPiece::SetGradationId(const QString &id)
|
||||
{
|
||||
d->m_gradationId = id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VLayoutPiece::GetGradationId() const -> QString
|
||||
{
|
||||
return d->m_gradationId;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QLineF VLayoutPiece::Edge(const QVector<QPointF> &path, int i) const
|
||||
{
|
||||
|
|
|
@ -73,6 +73,8 @@ public:
|
|||
|
||||
static VLayoutPiece Create(const VPiece &piece, vidtype id, const VContainer *pattern);
|
||||
|
||||
virtual auto GetUniqueID() const -> QString override;
|
||||
|
||||
QVector<QPointF> GetMappedContourPoints() const;
|
||||
QVector<QPointF> GetContourPoints() const;
|
||||
void SetCountourPoints(const QVector<QPointF> &points, bool hideMainPath = false);
|
||||
|
@ -132,6 +134,9 @@ public:
|
|||
bool IsMirror() const;
|
||||
void SetMirror(bool value);
|
||||
|
||||
void SetGradationId(const QString &id);
|
||||
auto GetGradationId() const -> QString;
|
||||
|
||||
void Translate(const QPointF &p);
|
||||
void Translate(qreal dx, qreal dy);
|
||||
void Scale(qreal sx, qreal sy);
|
||||
|
|
|
@ -77,7 +77,8 @@ public:
|
|||
m_placeLabels(detail.m_placeLabels),
|
||||
m_square(detail.m_square),
|
||||
m_quantity(detail.m_quantity),
|
||||
m_id(detail.m_id)
|
||||
m_id(detail.m_id),
|
||||
m_gradationId(detail.m_gradationId)
|
||||
{}
|
||||
|
||||
~VLayoutPieceData() Q_DECL_EQ_DEFAULT;
|
||||
|
@ -137,6 +138,8 @@ public:
|
|||
/** @brief m_id keep id of original piece. */
|
||||
vidtype m_id;
|
||||
|
||||
QString m_gradationId{};
|
||||
|
||||
private:
|
||||
Q_DISABLE_ASSIGN(VLayoutPieceData)
|
||||
|
||||
|
@ -175,6 +178,7 @@ inline QDataStream &operator<<(QDataStream &dataStream, const VLayoutPieceData &
|
|||
// Added in classVersion = 3
|
||||
dataStream << piece.m_tmDetail;
|
||||
dataStream << piece.m_tmPattern;
|
||||
dataStream << piece.m_gradationId;
|
||||
|
||||
return dataStream;
|
||||
}
|
||||
|
@ -232,6 +236,7 @@ inline QDataStream &operator>>(QDataStream &dataStream, VLayoutPieceData &piece)
|
|||
{
|
||||
dataStream >> piece.m_tmDetail;
|
||||
dataStream >> piece.m_tmPattern;
|
||||
dataStream >> piece.m_gradationId;
|
||||
}
|
||||
|
||||
return dataStream;
|
||||
|
|
|
@ -748,6 +748,18 @@ QVector<QPointF> VPiece::SeamAllowancePointsWithRotation(const VContainer *data,
|
|||
return Equidistant(pointsEkv, width, GetName());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::SetGradationLabel(const QString &label)
|
||||
{
|
||||
d->m_gradationLabel = label;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VPiece::GetGradationLabel() const
|
||||
{
|
||||
return d->m_gradationLabel;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVector<VPieceNode> VPiece::GetUnitedPath(const VContainer *data) const
|
||||
{
|
||||
|
|
|
@ -134,6 +134,9 @@ public:
|
|||
|
||||
QVector<QPointF> SeamAllowancePointsWithRotation(const VContainer *data, int makeFirst) const;
|
||||
|
||||
void SetGradationLabel(const QString &label);
|
||||
auto GetGradationLabel() const -> QString;
|
||||
|
||||
static void DumpPiece(const VPiece &piece, const VContainer *data);
|
||||
private:
|
||||
QSharedDataPointer<VPieceData> d;
|
||||
|
|
|
@ -73,7 +73,8 @@ public:
|
|||
m_ppData(detail.m_ppData),
|
||||
m_piPatternInfo(detail.m_piPatternInfo),
|
||||
m_glGrainline(detail.m_glGrainline),
|
||||
m_formulaWidth(detail.m_formulaWidth)
|
||||
m_formulaWidth(detail.m_formulaWidth),
|
||||
m_gradationLabel(detail.m_gradationLabel)
|
||||
{}
|
||||
|
||||
~VPieceData();
|
||||
|
@ -100,6 +101,8 @@ public:
|
|||
|
||||
QString m_formulaWidth;
|
||||
|
||||
QString m_gradationLabel{};
|
||||
|
||||
private:
|
||||
Q_DISABLE_ASSIGN(VPieceData)
|
||||
};
|
||||
|
|
|
@ -168,7 +168,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId,
|
|||
m_templateLines(),
|
||||
m_undoStack(),
|
||||
m_newPlaceLabels(),
|
||||
m_newPaths()
|
||||
m_newPaths(),
|
||||
m_placeholdersMenu(new QMenu(this))
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
|
@ -350,6 +351,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
uiTabPaths->checkBoxBuiltIn->setChecked(piece.IsSeamAllowanceBuiltIn());
|
||||
uiTabPaths->lineEditName->setText(piece.GetName());
|
||||
uiTabPaths->lineEditUUID->setText(piece.GetUUID().toString());
|
||||
uiTabPaths->lineEditGradationLabel->setText(piece.GetGradationLabel());
|
||||
uiTabPaths->spinBoxPriority->setValue(static_cast<int>(piece.GetPriority()));
|
||||
|
||||
uiTabPaths->plainTextEditFormulaWidth->setPlainText(
|
||||
|
@ -2581,6 +2583,7 @@ VPiece DialogSeamAllowance::CreatePiece() const
|
|||
piece.SetHideMainPath(uiTabPaths->checkBoxHideMainPath->isChecked());
|
||||
piece.SetName(uiTabPaths->lineEditName->text());
|
||||
piece.SetUUID(uiTabPaths->lineEditUUID->text());
|
||||
piece.SetGradationLabel(uiTabPaths->lineEditGradationLabel->text());
|
||||
piece.SetPriority(static_cast<uint>(uiTabPaths->spinBoxPriority->value()));
|
||||
piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth);
|
||||
piece.GetPatternPieceData().SetLetter(uiTabLabels->lineEditLetter->text());
|
||||
|
@ -3025,6 +3028,12 @@ void DialogSeamAllowance::InitPieceTab()
|
|||
[this](){MoveListRowDown(uiTabPaths->listWidgetMainPath);});
|
||||
|
||||
connect(uiTabPaths->lineEditUUID, &QLineEdit::textChanged, this, &DialogSeamAllowance::DetailUUIDChanged);
|
||||
|
||||
InitGradationPlaceholders();
|
||||
InitGradationPlaceholdersMenu();
|
||||
|
||||
m_placeholdersMenu->setStyleSheet(QStringLiteral("QMenu { menu-scrollable: 1; }"));
|
||||
uiTabPaths->pushButtonGradationPlaceholder->setMenu(m_placeholdersMenu);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -3863,6 +3872,71 @@ void DialogSeamAllowance::SavePatternMaterialData()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitGradationPlaceholdersMenu()
|
||||
{
|
||||
QChar per('%');
|
||||
auto i = m_gradationPlaceholders.constBegin();
|
||||
while (i != m_gradationPlaceholders.constEnd())
|
||||
{
|
||||
auto value = i.value();
|
||||
QAction *action = m_placeholdersMenu->addAction(value.first);
|
||||
action->setData(per + i.key() + per);
|
||||
connect(action, &QAction::triggered, this, &DialogSeamAllowance::InsertGradationPlaceholder);
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitGradationPlaceholders()
|
||||
{
|
||||
// Pattern tags
|
||||
QLocale locale(VAbstractApplication::VApp()->Settings()->GetLocale());
|
||||
|
||||
QString heightValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHeight());
|
||||
m_gradationPlaceholders.insert(pl_height, qMakePair(tr("Height", "dimension"), heightValue));
|
||||
|
||||
QString sizeValue = QString::number(VAbstractValApplication::VApp()->GetDimensionSize());
|
||||
m_gradationPlaceholders.insert(pl_size, qMakePair(tr("Size", "dimension"), sizeValue));
|
||||
|
||||
QString hipValue = QString::number(VAbstractValApplication::VApp()->GetDimensionHip());
|
||||
m_gradationPlaceholders.insert(pl_hip, qMakePair(tr("Hip", "dimension"), hipValue));
|
||||
|
||||
QString waistValue = QString::number(VAbstractValApplication::VApp()->GetDimensionWaist());
|
||||
m_gradationPlaceholders.insert(pl_waist, qMakePair(tr("Waist", "dimension"), waistValue));
|
||||
|
||||
{
|
||||
QString label = VAbstractValApplication::VApp()->GetDimensionHeightLabel();
|
||||
m_gradationPlaceholders.insert(pl_heightLabel, qMakePair(tr("Height label", "dimension"),
|
||||
not label.isEmpty() ? label : heightValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionSizeLabel();
|
||||
m_gradationPlaceholders.insert(pl_sizeLabel, qMakePair(tr("Size label", "dimension"),
|
||||
not label.isEmpty() ? label : sizeValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionHipLabel();
|
||||
m_gradationPlaceholders.insert(pl_hipLabel, qMakePair(tr("Hip label", "dimension"),
|
||||
not label.isEmpty() ? label : hipValue));
|
||||
|
||||
label = VAbstractValApplication::VApp()->GetDimensionWaistLabel();
|
||||
m_gradationPlaceholders.insert(pl_waistLabel, qMakePair(tr("Waist label", "dimension"),
|
||||
not label.isEmpty() ? label : waistValue));
|
||||
}
|
||||
|
||||
{
|
||||
const QMap<QString, QSharedPointer<VMeasurement> > measurements = data->DataMeasurements();
|
||||
auto i = measurements.constBegin();
|
||||
while (i != measurements.constEnd())
|
||||
{
|
||||
QString description = i.value()->GetGuiText().isEmpty() ? i.key() : i.value()->GetGuiText();
|
||||
m_gradationPlaceholders.insert(pl_measurement + i.key(),
|
||||
qMakePair(tr("Measurement: %1").arg(description),
|
||||
QString::number(*i.value()->GetValue())));
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::SetMoveControls()
|
||||
{
|
||||
|
@ -3955,3 +4029,14 @@ void DialogSeamAllowance::ManagePatternMaterials()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InsertGradationPlaceholder()
|
||||
{
|
||||
QAction *action = qobject_cast<QAction *>(sender());
|
||||
if (action)
|
||||
{
|
||||
uiTabPaths->lineEditGradationLabel->insert(action->data().toString());
|
||||
uiTabPaths->lineEditGradationLabel->setFocus();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,6 +164,8 @@ private slots:
|
|||
void EditPatternLabel();
|
||||
void ManagePatternMaterials();
|
||||
|
||||
void InsertGradationPlaceholder();
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogSeamAllowance)
|
||||
|
||||
|
@ -242,6 +244,10 @@ private:
|
|||
|
||||
QString m_defLabelValue{};
|
||||
|
||||
QMenu *m_placeholdersMenu;
|
||||
|
||||
QMap<QString, QPair<QString, QString>> m_gradationPlaceholders{};
|
||||
|
||||
VPiece CreatePiece() const;
|
||||
|
||||
void NewMainPathItem(const VPieceNode &node);
|
||||
|
@ -311,6 +317,9 @@ private:
|
|||
void SavePatternLabelData();
|
||||
void SavePatternTemplateData();
|
||||
void SavePatternMaterialData();
|
||||
|
||||
void InitGradationPlaceholdersMenu();
|
||||
void InitGradationPlaceholders();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -28,15 +28,15 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>402</width>
|
||||
<height>604</height>
|
||||
<width>394</width>
|
||||
<height>612</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabMainPath">
|
||||
<attribute name="title">
|
||||
|
@ -197,10 +197,13 @@
|
|||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelEditUUID">
|
||||
<item row="0" column="1">
|
||||
<widget class="VLineEdit" name="lineEditName">
|
||||
<property name="text">
|
||||
<string notr="true">UUID:</string>
|
||||
<string>Detail</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Name can't be empty</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -225,16 +228,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="VLineEdit" name="lineEditName">
|
||||
<property name="text">
|
||||
<string>Detail</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>Name can't be empty</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEditUUID">
|
||||
<property name="toolTip">
|
||||
|
@ -248,6 +241,41 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelEditUUID">
|
||||
<property name="text">
|
||||
<string notr="true">UUID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Gradation label:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditGradationLabel">
|
||||
<property name="placeholderText">
|
||||
<string>%size%_%height%</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonGradationPlaceholder">
|
||||
<property name="text">
|
||||
<string>Insert…</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -332,6 +332,8 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl
|
|||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
doc->SetAttribute(domElement, AttrName, piece.GetName());
|
||||
doc->SetAttribute(domElement, AttrUUID, piece.GetUUID().toString());
|
||||
doc->SetAttributeOrRemoveIf<QString>(domElement, AttrGradationLabel, piece.GetGradationLabel(),
|
||||
[](const QString &label){return label.isEmpty();});
|
||||
doc->SetAttribute(domElement, AttrVersion, QString().setNum(pieceVersion));
|
||||
doc->SetAttribute(domElement, AttrMx, VAbstractValApplication::VApp()->fromPixel(piece.GetMx()));
|
||||
doc->SetAttribute(domElement, AttrMy, VAbstractValApplication::VApp()->fromPixel(piece.GetMy()));
|
||||
|
|
Loading…
Reference in New Issue
Block a user