UUID field for piece.
This commit is contained in:
parent
b2fd02b510
commit
30a27ee85a
|
@ -829,6 +829,7 @@ void VPattern::ParseDetailElement(QDomElement &domElement, const Document &parse
|
|||
VToolSeamAllowanceInitData initData;
|
||||
initData.id = GetParametrId(domElement);
|
||||
initData.detail.SetName(GetParametrString(domElement, AttrName, tr("Detail")));
|
||||
initData.detail.SetUUID(GetParametrEmptyString(domElement, AttrUUID));
|
||||
initData.detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("0.0"))));
|
||||
initData.detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("0.0"))));
|
||||
initData.detail.SetSeamAllowance(GetParametrBool(domElement, VToolSeamAllowance::AttrSeamAllowance, falseStr));
|
||||
|
|
|
@ -47,6 +47,7 @@ const QString AttrType = QStringLiteral("type");
|
|||
const QString AttrMx = QStringLiteral("mx");
|
||||
const QString AttrMy = QStringLiteral("my");
|
||||
const QString AttrName = QStringLiteral("name");
|
||||
const QString AttrUUID = QStringLiteral("uuid");
|
||||
const QString AttrMx1 = QStringLiteral("mx1");
|
||||
const QString AttrMy1 = QStringLiteral("my1");
|
||||
const QString AttrName1 = QStringLiteral("name1");
|
||||
|
|
|
@ -65,6 +65,7 @@ extern const QString AttrType;
|
|||
extern const QString AttrMx;
|
||||
extern const QString AttrMy;
|
||||
extern const QString AttrName;
|
||||
extern const QString AttrUUID;
|
||||
extern const QString AttrMx1;
|
||||
extern const QString AttrMy1;
|
||||
extern const QString AttrName1;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
<file>schema/pattern/v0.8.5.xsd</file>
|
||||
<file>schema/pattern/v0.8.6.xsd</file>
|
||||
<file>schema/pattern/v0.8.7.xsd</file>
|
||||
<file>schema/pattern/v0.8.8.xsd</file>
|
||||
<file>schema/standard_measurements/v0.3.0.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.0.xsd</file>
|
||||
<file>schema/standard_measurements/v0.4.1.xsd</file>
|
||||
|
|
1260
src/libs/ifc/schema/pattern/v0.8.8.xsd
Normal file
1260
src/libs/ifc/schema/pattern/v0.8.8.xsd
Normal file
File diff suppressed because it is too large
Load Diff
|
@ -41,6 +41,7 @@
|
|||
#include <QStringDataPtr>
|
||||
#include <algorithm>
|
||||
#include <QGlobalStatic>
|
||||
#include <QUuid>
|
||||
|
||||
#include "../exception/vexception.h"
|
||||
#include "../exception/vexceptionemptyparameter.h"
|
||||
|
@ -59,8 +60,8 @@ class QDomElement;
|
|||
*/
|
||||
|
||||
const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.4");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.7");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.7.xsd");
|
||||
const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.8.8");
|
||||
const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.8.8.xsd");
|
||||
|
||||
//VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
//VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!!
|
||||
|
@ -135,6 +136,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, strMy, (QLatin1String("my")))
|
|||
//Q_GLOBAL_STATIC_WITH_ARGS(const QString, strForbidFlipping, (QLatin1String("forbidFlipping")))
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const QString, strInLayout, (QLatin1String("inLayout")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strSeamAllowance, (QLatin1String("seamAllowance")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strUUID, (QLatin1String("uuid")))
|
||||
//Q_GLOBAL_STATIC_WITH_ARGS(const QString, strNodeType, (QLatin1String("nodeType")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strDet, (QLatin1String("det")))
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, strTypeObject, (QLatin1String("typeObject")))
|
||||
|
@ -237,7 +239,8 @@ QString VPatternConverter::XSDSchema(int ver) const
|
|||
std::make_pair(FORMAT_VERSION(0, 8, 4), QStringLiteral("://schema/pattern/v0.8.4.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 5), QStringLiteral("://schema/pattern/v0.8.5.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 6), QStringLiteral("://schema/pattern/v0.8.6.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 7), CurrentSchema)
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 7), QStringLiteral("://schema/pattern/v0.8.7.xsd")),
|
||||
std::make_pair(FORMAT_VERSION(0, 8, 8), CurrentSchema)
|
||||
};
|
||||
|
||||
if (schemas.contains(ver))
|
||||
|
@ -486,6 +489,10 @@ void VPatternConverter::ApplyPatches()
|
|||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 7)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 8, 7)):
|
||||
ToV0_8_8();
|
||||
ValidateXML(XSDSchema(FORMAT_VERSION(0, 8, 8)));
|
||||
Q_FALLTHROUGH();
|
||||
case (FORMAT_VERSION(0, 8, 8)):
|
||||
break;
|
||||
default:
|
||||
InvalidVersion(m_ver);
|
||||
|
@ -503,7 +510,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, 7),
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMaxVer == FORMAT_VERSION(0, 8, 8),
|
||||
"Check attribute readOnly.");
|
||||
|
||||
// Possibly in future attribute readOnly will change position etc.
|
||||
|
@ -1143,6 +1150,17 @@ void VPatternConverter::ToV0_8_7()
|
|||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::ToV0_8_8()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.8.8
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 8),
|
||||
"Time to refactor the code.");
|
||||
SetVersion(QStringLiteral("0.8.8"));
|
||||
AddPieceUUIDV0_8_8();
|
||||
Save();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnitToV0_2_0()
|
||||
{
|
||||
|
@ -2662,6 +2680,25 @@ void VPatternConverter::AddTagPreviewCalculationsV0_6_2()
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::AddPieceUUIDV0_8_8()
|
||||
{
|
||||
// TODO. Delete if minimal supported version is 0.8.8
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FORMAT_VERSION(0, 8, 8),
|
||||
"Time to refactor the code.");
|
||||
|
||||
const QDomNodeList list = elementsByTagName(*strDetail);
|
||||
for (int i=0; i < list.size(); ++i)
|
||||
{
|
||||
QDomElement dom = list.at(i).toElement();
|
||||
|
||||
if (not dom.isNull())
|
||||
{
|
||||
dom.setAttribute(*strUUID, QUuid::createUuid().toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPatternConverter::TagUnionDetailsToV0_4_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, 7);
|
||||
static Q_DECL_CONSTEXPR const int PatternMaxVer = FORMAT_VERSION(0, 8, 8);
|
||||
|
||||
protected:
|
||||
virtual int MinVer() const override;
|
||||
|
@ -130,6 +130,7 @@ private:
|
|||
void ToV0_8_5();
|
||||
void ToV0_8_6();
|
||||
void ToV0_8_7();
|
||||
void ToV0_8_8();
|
||||
|
||||
void TagUnitToV0_2_0();
|
||||
void TagIncrementToV0_2_0();
|
||||
|
@ -182,6 +183,8 @@ private:
|
|||
void RemoveUniqueTagV0_6_0(const QString &tag);
|
||||
|
||||
void AddTagPreviewCalculationsV0_6_2();
|
||||
|
||||
void AddPieceUUIDV0_8_8();
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
#include <QJsonDocument>
|
||||
|
||||
const quint32 VAbstractPieceData::streamHeader = 0x05CDD73A; // CRC-32Q string "VAbstractPieceData"
|
||||
const quint16 VAbstractPieceData::classVersion = 2;
|
||||
const quint16 VAbstractPieceData::classVersion = 3;
|
||||
|
||||
const qreal maxL = 3.5;
|
||||
|
||||
|
@ -1652,6 +1652,25 @@ void VAbstractPiece::SetPriority(uint value)
|
|||
d->m_priority = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QUuid VAbstractPiece::GetUUID() const
|
||||
{
|
||||
return d->m_uuid;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPiece::SetUUID(const QUuid &uuid)
|
||||
{
|
||||
d->m_uuid = uuid;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPiece::SetUUID(const QString &uuid)
|
||||
{
|
||||
const QUuid temp = QUuid(uuid);
|
||||
d->m_uuid = temp.isNull() ? QUuid::createUuid() : temp;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VSAPoint::GetSABefore(qreal width) const
|
||||
{
|
||||
|
|
|
@ -91,6 +91,10 @@ public:
|
|||
uint GetPriority() const;
|
||||
void SetPriority(uint value);
|
||||
|
||||
QUuid GetUUID() const;
|
||||
void SetUUID(const QUuid &uuid);
|
||||
void SetUUID(const QString &uuid);
|
||||
|
||||
static QVector<QPointF> Equidistant(QVector<VSAPoint> points, qreal width, const QString &name);
|
||||
static qreal SumTrapezoids(const QVector<QPointF> &points);
|
||||
static QVector<QPointF> CheckLoops(const QVector<QPointF> &points);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <QSharedData>
|
||||
#include <QString>
|
||||
#include <QCoreApplication>
|
||||
#include <QUuid>
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
|
@ -62,7 +63,8 @@ public:
|
|||
m_width(piece.m_width),
|
||||
m_mx(piece.m_mx),
|
||||
m_my(piece.m_my),
|
||||
m_priority(piece.m_priority)
|
||||
m_priority(piece.m_priority),
|
||||
m_uuid(piece.m_uuid)
|
||||
{}
|
||||
|
||||
~VAbstractPieceData() Q_DECL_EQ_DEFAULT;
|
||||
|
@ -81,6 +83,7 @@ public:
|
|||
qreal m_mx{0};
|
||||
qreal m_my{0};
|
||||
uint m_priority{0};
|
||||
QUuid m_uuid{QUuid::createUuid()};
|
||||
|
||||
private:
|
||||
Q_DISABLE_ASSIGN(VAbstractPieceData)
|
||||
|
@ -111,6 +114,9 @@ inline QDataStream &operator<<(QDataStream &dataStream, const VAbstractPieceData
|
|||
// Added in classVersion = 2
|
||||
dataStream << piece.m_priority;
|
||||
|
||||
// Added in classVersion = 3
|
||||
dataStream << piece.m_uuid;
|
||||
|
||||
return dataStream;
|
||||
}
|
||||
|
||||
|
@ -155,6 +161,11 @@ inline QDataStream &operator>>(QDataStream &dataStream, VAbstractPieceData &piec
|
|||
dataStream >> piece.m_priority;
|
||||
}
|
||||
|
||||
if (actualClassVersion >= 3)
|
||||
{
|
||||
dataStream >> piece.m_uuid;
|
||||
}
|
||||
|
||||
return dataStream;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include <QTransform>
|
||||
#include <Qt>
|
||||
#include <QtDebug>
|
||||
#include <QUuid>
|
||||
|
||||
#include "../vpatterndb/floatItemData/vpatternlabeldata.h"
|
||||
#include "../vpatterndb/floatItemData/vpiecelabeldata.h"
|
||||
|
@ -452,6 +453,7 @@ VLayoutPiece VLayoutPiece::Create(const VPiece &piece, vidtype id, const VContai
|
|||
det.SetMy(piece.GetMy());
|
||||
|
||||
det.SetName(piece.GetName());
|
||||
det.SetUUID(piece.GetUUID());
|
||||
|
||||
det.SetSAWidth(qApp->toPixel(piece.GetSAWidth()));
|
||||
det.SetForbidFlipping(piece.IsForbidFlipping());
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
|
||||
#include <QMenu>
|
||||
#include <QTimer>
|
||||
#include <QUuid>
|
||||
#include <QtNumeric>
|
||||
|
||||
enum TabOrder {Paths=0, Pins=1, Labels=2, Grainline=3, Passmarks=4, PlaceLabels=5, Count=6};
|
||||
|
@ -117,6 +118,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId,
|
|||
flagFormulaAfter(true),
|
||||
flagMainPathIsValid(true),
|
||||
flagName(true), //We have default name of piece.
|
||||
flagUUID(true),
|
||||
flagFormula(true),
|
||||
m_bAddMode(true),
|
||||
m_dialog(),
|
||||
|
@ -149,6 +151,7 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, quint32 toolId,
|
|||
EnableApply(applyAllowed);
|
||||
|
||||
InitMainPathTab();
|
||||
InitPieceTab();
|
||||
InitSeamAllowanceTab();
|
||||
InitInternalPathsTab();
|
||||
InitPatternPieceDataTab();
|
||||
|
@ -318,6 +321,7 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
|
|||
uiTabPaths->checkBoxSeams->setChecked(piece.IsSeamAllowance());
|
||||
uiTabPaths->checkBoxBuiltIn->setChecked(piece.IsSeamAllowanceBuiltIn());
|
||||
uiTabPaths->lineEditName->setText(piece.GetName());
|
||||
uiTabPaths->lineEditUUID->setText(piece.GetUUID().toString());
|
||||
uiTabPaths->spinBoxPriority->setValue(static_cast<int>(piece.GetPriority()));
|
||||
|
||||
uiTabPaths->plainTextEditFormulaWidth->setPlainText(
|
||||
|
@ -493,7 +497,7 @@ void DialogSeamAllowance::CheckState()
|
|||
|
||||
if (flagFormula && flagFormulaBefore && flagFormulaAfter)
|
||||
{
|
||||
if (flagMainPathIsValid && flagName)
|
||||
if (flagMainPathIsValid && flagName && flagUUID)
|
||||
{
|
||||
m_ftb->SetTabText(TabOrder::Paths, tr("Paths"));
|
||||
}
|
||||
|
@ -508,9 +512,9 @@ void DialogSeamAllowance::CheckState()
|
|||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabSeamAllowance), icon);
|
||||
}
|
||||
|
||||
if (flagMainPathIsValid && flagName)
|
||||
if (flagMainPathIsValid)
|
||||
{
|
||||
if (flagFormula && flagFormulaBefore && flagFormulaAfter)
|
||||
if (flagFormula && flagFormulaBefore && flagFormulaAfter && flagName && flagUUID)
|
||||
{
|
||||
m_ftb->SetTabText(TabOrder::Paths, tr("Paths"));
|
||||
}
|
||||
|
@ -532,6 +536,22 @@ void DialogSeamAllowance::CheckState()
|
|||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabMainPath), icon);
|
||||
}
|
||||
|
||||
if (flagName && flagUUID)
|
||||
{
|
||||
if (flagFormula && flagFormulaBefore && flagFormulaAfter && flagMainPathIsValid)
|
||||
{
|
||||
m_ftb->SetTabText(TabOrder::Paths, tr("Paths"));
|
||||
}
|
||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabPiece), QIcon());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ftb->SetTabText(TabOrder::Paths, tr("Paths") + '*');
|
||||
const QIcon icon = QIcon::fromTheme("dialog-warning",
|
||||
QIcon(":/icons/win.icon.theme/16x16/status/dialog-warning.png"));
|
||||
uiTabPaths->tabWidget->setTabIcon(uiTabPaths->tabWidget->indexOf(uiTabPaths->tabPiece), icon);
|
||||
}
|
||||
|
||||
uiTabPaths->comboBoxNodes->setEnabled(flagFormulaBefore && flagFormulaAfter);
|
||||
|
||||
if (uiTabPassmarks->comboBoxPassmarks->count() == 0)
|
||||
|
@ -620,6 +640,30 @@ void DialogSeamAllowance::NameDetailChanged()
|
|||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::DetailUUIDChanged()
|
||||
{
|
||||
QLineEdit* edit = qobject_cast<QLineEdit*>(sender());
|
||||
if (edit)
|
||||
{
|
||||
QRegularExpression re("^$|^{[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-"
|
||||
"[0-9a-fA-F]{12}}$");
|
||||
QRegularExpressionMatch match = re.match(edit->text());
|
||||
|
||||
if (match.hasMatch())
|
||||
{
|
||||
flagUUID = true;
|
||||
ChangeColor(uiTabPaths->labelEditUUID, OkColor(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
flagUUID = false;
|
||||
ChangeColor(uiTabPaths->labelEditUUID, errorColor);
|
||||
}
|
||||
}
|
||||
CheckState();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::ShowMainPathContextMenu(const QPoint &pos)
|
||||
{
|
||||
|
@ -2454,6 +2498,7 @@ VPiece DialogSeamAllowance::CreatePiece() const
|
|||
piece.SetSeamAllowanceBuiltIn(uiTabPaths->checkBoxBuiltIn->isChecked());
|
||||
piece.SetHideMainPath(uiTabPaths->checkBoxHideMainPath->isChecked());
|
||||
piece.SetName(uiTabPaths->lineEditName->text());
|
||||
piece.SetUUID(uiTabPaths->lineEditUUID->text());
|
||||
piece.SetPriority(static_cast<uint>(uiTabPaths->spinBoxPriority->value()));
|
||||
piece.SetFormulaSAWidth(GetFormulaFromUser(uiTabPaths->plainTextEditFormulaWidth), m_saWidth);
|
||||
piece.GetPatternPieceData().SetLetter(uiTabLabels->lineEditLetter->text());
|
||||
|
@ -2831,6 +2876,29 @@ void DialogSeamAllowance::InitFancyTabBar()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitMainPathTab()
|
||||
{
|
||||
uiTabPaths->checkBoxHideMainPath->setChecked(qApp->Settings()->IsHideMainPath());
|
||||
|
||||
uiTabPaths->listWidgetMainPath->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(uiTabPaths->listWidgetMainPath, &QListWidget::customContextMenuRequested, this,
|
||||
&DialogSeamAllowance::ShowMainPathContextMenu);
|
||||
connect(uiTabPaths->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this,
|
||||
&DialogSeamAllowance::ListChanged);
|
||||
connect(uiTabPaths->listWidgetMainPath, &QListWidget::itemSelectionChanged, this,
|
||||
&DialogSeamAllowance::SetMoveControls);
|
||||
|
||||
connect(uiTabPaths->toolButtonTop, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowTop(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonUp, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowUp(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonDown, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowDown(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonBottom, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowBottom(uiTabPaths->listWidgetMainPath);});
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void DialogSeamAllowance::InitPieceTab()
|
||||
{
|
||||
connect(uiTabPaths->lineEditName, &QLineEdit::textChanged, this, &DialogSeamAllowance::NameDetailChanged);
|
||||
|
||||
|
@ -2855,24 +2923,8 @@ void DialogSeamAllowance::InitMainPathTab()
|
|||
|
||||
uiTabPaths->checkBoxForbidFlipping->setChecked(qApp->Settings()->GetForbidWorkpieceFlipping());
|
||||
uiTabPaths->checkBoxForceFlipping->setChecked(qApp->Settings()->GetForceWorkpieceFlipping());
|
||||
uiTabPaths->checkBoxHideMainPath->setChecked(qApp->Settings()->IsHideMainPath());
|
||||
|
||||
uiTabPaths->listWidgetMainPath->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(uiTabPaths->listWidgetMainPath, &QListWidget::customContextMenuRequested, this,
|
||||
&DialogSeamAllowance::ShowMainPathContextMenu);
|
||||
connect(uiTabPaths->listWidgetMainPath->model(), &QAbstractItemModel::rowsMoved, this,
|
||||
&DialogSeamAllowance::ListChanged);
|
||||
connect(uiTabPaths->listWidgetMainPath, &QListWidget::itemSelectionChanged, this,
|
||||
&DialogSeamAllowance::SetMoveControls);
|
||||
|
||||
connect(uiTabPaths->toolButtonTop, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowTop(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonUp, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowUp(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonDown, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowDown(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->toolButtonBottom, &QToolButton::clicked, this,
|
||||
[this](){MoveListRowBottom(uiTabPaths->listWidgetMainPath);});
|
||||
connect(uiTabPaths->lineEditUUID, &QLineEdit::textChanged, this, &DialogSeamAllowance::DetailUUIDChanged);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -85,6 +85,7 @@ protected:
|
|||
|
||||
private slots:
|
||||
void NameDetailChanged();
|
||||
void DetailUUIDChanged();
|
||||
void ShowMainPathContextMenu(const QPoint &pos);
|
||||
void ShowCustomSAContextMenu(const QPoint &pos);
|
||||
void ShowInternalPathsContextMenu(const QPoint &pos);
|
||||
|
@ -192,6 +193,7 @@ private:
|
|||
bool flagFormulaPassmarkLength{true};
|
||||
bool flagMainPathIsValid;
|
||||
bool flagName;
|
||||
bool flagUUID;
|
||||
bool flagFormula;
|
||||
bool m_bAddMode;
|
||||
|
||||
|
@ -247,6 +249,7 @@ private:
|
|||
|
||||
void InitFancyTabBar();
|
||||
void InitMainPathTab();
|
||||
void InitPieceTab();
|
||||
void InitSeamAllowanceTab();
|
||||
void InitNodesList();
|
||||
void InitPassmarksList();
|
||||
|
@ -292,7 +295,7 @@ private:
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
inline bool DialogSeamAllowance::IsValid() const
|
||||
{
|
||||
return flagName && flagMainPathIsValid && flagFormula && flagFormulaBefore && flagFormulaAfter
|
||||
return flagName && flagUUID && flagMainPathIsValid && flagFormula && flagFormulaBefore && flagFormulaAfter
|
||||
&& (flagGFormulas || flagGPin) && flagDLAngle && (flagDLFormulas || flagDPin) && flagPLAngle
|
||||
&& (flagPLFormulas || flagPPin) && flagFormulaPassmarkLength;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>426</width>
|
||||
<height>637</height>
|
||||
<width>422</width>
|
||||
<height>624</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -28,8 +28,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>406</width>
|
||||
<height>617</height>
|
||||
<width>402</width>
|
||||
<height>604</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
|
@ -73,64 +73,6 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelEditName">
|
||||
<property name="text">
|
||||
<string>Name of detail:</string>
|
||||
</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="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Priority:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxPriority">
|
||||
<property name="toolTip">
|
||||
<string>Controls priority in layout. 0 - no priority.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxForbidFlipping">
|
||||
<property name="toolTip">
|
||||
<string>Forbid piece be mirrored in a layout.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Forbid flipping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxForceFlipping">
|
||||
<property name="toolTip">
|
||||
<string>Force piece to be always flipped in a layout.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Force flipping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxHideMainPath">
|
||||
<property name="toolTip">
|
||||
|
@ -248,6 +190,101 @@
|
|||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabPiece">
|
||||
<attribute name="title">
|
||||
<string>Piece</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelEditUUID">
|
||||
<property name="text">
|
||||
<string notr="true">UUID:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Priority:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelEditName">
|
||||
<property name="text">
|
||||
<string>Name of detail:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="spinBoxPriority">
|
||||
<property name="toolTip">
|
||||
<string>Controls priority in layout. 0 - no priority.</string>
|
||||
</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">
|
||||
<string>Universally Unique IDentifier of piece. Used to identifier piece while updating manual layout. Left empty to generate new value.</string>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxForbidFlipping">
|
||||
<property name="toolTip">
|
||||
<string>Forbid piece be mirrored in a layout.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Forbid flipping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxForceFlipping">
|
||||
<property name="toolTip">
|
||||
<string>Force piece to be always flipped in a layout.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Force flipping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabSeamAllowance">
|
||||
<attribute name="title">
|
||||
<string>Seam allowance</string>
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
#include <QUuid>
|
||||
|
||||
// Current version of seam allowance tag need for backward compatibility
|
||||
const quint8 VToolSeamAllowance::pieceVersion = 2;
|
||||
|
@ -270,6 +271,7 @@ 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->SetAttribute(domElement, AttrVersion, QString().setNum(pieceVersion));
|
||||
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(piece.GetMx()));
|
||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(piece.GetMy()));
|
||||
|
|
Loading…
Reference in New Issue
Block a user