Returned "Forbid flipping" feature.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-10 11:56:40 +02:00
parent 0dbf26a109
commit df20415e9e
10 changed files with 45 additions and 7 deletions

View File

@ -621,8 +621,8 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
// detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
// detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0"));
// detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
// detail.setForbidFlipping(GetParametrUInt(domElement, VToolDetail::AttrForbidFlipping,
// QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
detail.SetForbidFlipping(GetParametrUInt(domElement, VToolSeamAllowance::AttrForbidFlipping,
QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
const QStringList tags = QStringList() << VToolSeamAllowance::TagNodes

View File

@ -414,6 +414,7 @@
<xs:attribute name="my" type="xs:double"></xs:attribute>
<xs:attribute name="name" type="xs:string"></xs:attribute>
<xs:attribute name="inLayout" type="xs:boolean"></xs:attribute>
<xs:attribute name="forbidFlipping" type="xs:unsignedInt"></xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>

View File

@ -1697,7 +1697,6 @@ void VPatternConverter::TagDetailToV0_4_0()
dom.removeAttribute(strSupplement);
dom.removeAttribute(strClosed);
dom.removeAttribute(strWidth);
dom.removeAttribute(strForbidFlipping);
dom.setAttribute(strVersion, "1");

View File

@ -73,6 +73,18 @@ void VAbstractPiece::SetName(const QString &value)
d->m_name = value;
}
//---------------------------------------------------------------------------------------------------------------------
bool VAbstractPiece::IsForbidFlipping() const
{
return d->m_forbidFlipping;
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPiece::SetForbidFlipping(bool value)
{
d->m_forbidFlipping = value;
}
//---------------------------------------------------------------------------------------------------------------------
qreal VAbstractPiece::SumTrapezoids(const QVector<QPointF> &points)
{

View File

@ -47,6 +47,9 @@ public:
QString GetName() const;
void SetName(const QString &value);
bool IsForbidFlipping() const;
void SetForbidFlipping(bool value);
static qreal SumTrapezoids(const QVector<QPointF> &points);
static QVector<QPointF> CheckLoops(const QVector<QPointF> &points);
static QVector<QPointF> CorrectEquidistantPoints(const QVector<QPointF> &points, bool removeFirstAndLast = true);

View File

@ -41,17 +41,21 @@ class VAbstractPieceData : public QSharedData
{
public:
VAbstractPieceData()
: m_name()
: m_name(),
m_forbidFlipping(false)
{}
VAbstractPieceData(const VAbstractPieceData &piece)
: QSharedData(piece),
m_name(piece.m_name)
m_name(piece.m_name),
m_forbidFlipping(piece.m_forbidFlipping)
{}
~VAbstractPieceData();
QString m_name;
/** @brief forbidFlipping forbid piece be mirrored in a layout. */
bool m_forbidFlipping;
private:
VAbstractPieceData &operator=(const VAbstractPieceData &) Q_DECL_EQ_DELETE;

View File

@ -50,6 +50,8 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
flagError = MainPathIsValid();
CheckState();
ui->checkBoxForbidFlipping->setChecked(qApp->Settings()->GetForbidWorkpieceFlipping());
ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &DialogSeamAllowance::ShowContextMenu);
connect(ui->listWidget->model(), &QAbstractItemModel::rowsMoved, this, &DialogSeamAllowance::ListChanged);
@ -91,6 +93,8 @@ void DialogSeamAllowance::SetPiece(const VPiece &piece)
NewItem(m_piece.at(i));
}
ui->checkBoxForbidFlipping->setChecked(m_piece.IsForbidFlipping());
ValidObjects(MainPathIsValid());
}
@ -260,6 +264,8 @@ VPiece DialogSeamAllowance::CreatePiece() const
piece.Append(qvariant_cast<VPieceNode>(item->data(Qt::UserRole)));
}
piece.SetForbidFlipping(ui->checkBoxForbidFlipping->isChecked());
return piece;
}

View File

@ -58,6 +58,16 @@
</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="QListWidget" name="listWidget">
<property name="dragDropMode">

View File

@ -61,6 +61,7 @@ const QString VToolSeamAllowance::TagNode = QStringLiteral("node");
const QString VToolSeamAllowance::AttrVersion = QStringLiteral("version");
const QString VToolSeamAllowance::AttrNodeReverse = QStringLiteral("reverse");
const QString VToolSeamAllowance::AttrForbidFlipping = QStringLiteral("forbidFlipping");
const QString VToolSeamAllowance::NodeArc = QStringLiteral("NodeArc");
const QString VToolSeamAllowance::NodePoint = QStringLiteral("NodePoint");
@ -252,6 +253,7 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(piece.GetMx()));
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(piece.GetMy()));
doc->SetAttribute(domElement, AttrInLayout, piece.IsInLayout());
doc->SetAttribute(domElement, AttrForbidFlipping, static_cast<quint8>(piece.IsForbidFlipping()));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -59,6 +59,7 @@ public:
static const QString AttrVersion;
static const QString AttrNodeReverse;
static const QString AttrForbidFlipping;
static const QString NodeArc;
static const QString NodePoint;