Returned undocommand "Toggle piece in layout".
--HG-- branch : feature
This commit is contained in:
parent
988ce8f7f2
commit
39d2ea41ac
|
@ -31,7 +31,7 @@
|
|||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vmisc/vabstractapplication.h"
|
||||
#include "../vtools/undocommands/toggledetailinlayout.h"
|
||||
#include "../vtools/undocommands/togglepieceinlayout.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QUndoStack>
|
||||
|
@ -45,7 +45,7 @@ VWidgetDetails::VWidgetDetails(VContainer *data, VAbstractPattern *doc, QWidget
|
|||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
FillTable(m_data->DataDetails());
|
||||
FillTable(m_data->DataPieces());
|
||||
|
||||
ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
|
||||
|
@ -62,7 +62,7 @@ VWidgetDetails::~VWidgetDetails()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VWidgetDetails::UpdateList()
|
||||
{
|
||||
FillTable(m_data->DataDetails());
|
||||
FillTable(m_data->DataPieces());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -93,16 +93,16 @@ void VWidgetDetails::InLayoutStateChanged(int row, int column)
|
|||
return;
|
||||
}
|
||||
|
||||
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
|
||||
const QHash<quint32, VPiece> *allDetails = m_data->DataPieces();
|
||||
const bool inLayout = not allDetails->value(id).IsInLayout();
|
||||
|
||||
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, inLayout, m_data, m_doc);
|
||||
connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, inLayout, m_data, m_doc);
|
||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||
qApp->getUndoStack()->push(togglePrint);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VWidgetDetails::FillTable(const QHash<quint32, VDetail> *details)
|
||||
void VWidgetDetails::FillTable(const QHash<quint32, VPiece> *details)
|
||||
{
|
||||
const int selectedRow = ui->tableWidget->currentRow();
|
||||
ui->tableWidget->clear();
|
||||
|
@ -114,7 +114,7 @@ void VWidgetDetails::FillTable(const QHash<quint32, VDetail> *details)
|
|||
while (i != details->constEnd())
|
||||
{
|
||||
++currentRow;
|
||||
const VDetail det = i.value();
|
||||
const VPiece det = i.value();
|
||||
|
||||
QTableWidgetItem *item = new QTableWidgetItem();
|
||||
item->setTextAlignment(Qt::AlignHCenter);
|
||||
|
@ -134,7 +134,7 @@ void VWidgetDetails::FillTable(const QHash<quint32, VDetail> *details)
|
|||
|
||||
ui->tableWidget->setItem(currentRow, 0, item);
|
||||
|
||||
QString name = det.getName();
|
||||
QString name = det.GetName();
|
||||
if (name.isEmpty())
|
||||
{
|
||||
name = tr("Unnamed");
|
||||
|
@ -158,7 +158,7 @@ void VWidgetDetails::FillTable(const QHash<quint32, VDetail> *details)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VWidgetDetails::ToggleSectionDetails(bool select)
|
||||
{
|
||||
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
|
||||
const QHash<quint32, VPiece> *allDetails = m_data->DataPieces();
|
||||
if (allDetails->count() == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -172,8 +172,8 @@ void VWidgetDetails::ToggleSectionDetails(bool select)
|
|||
{
|
||||
if (not select == allDetails->value(id).IsInLayout())
|
||||
{
|
||||
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc);
|
||||
connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||
qApp->getUndoStack()->push(togglePrint);
|
||||
}
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
|||
|
||||
QAction *actionInvertSelection = menu->addAction(tr("Invert selection"));
|
||||
|
||||
const QHash<quint32, VDetail> *allDetails = m_data->DataDetails();
|
||||
const QHash<quint32, VPiece> *allDetails = m_data->DataPieces();
|
||||
if (allDetails->count() == 0)
|
||||
{
|
||||
return;
|
||||
|
@ -201,7 +201,7 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
|||
|
||||
int selectedDetails = 0;
|
||||
|
||||
QHash<quint32, VDetail>::const_iterator iter = allDetails->constBegin();
|
||||
auto iter = allDetails->constBegin();
|
||||
while (iter != allDetails->constEnd())
|
||||
{
|
||||
if(iter.value().IsInLayout())
|
||||
|
@ -220,7 +220,6 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
|||
actionSelectAll->setDisabled(true);
|
||||
}
|
||||
|
||||
|
||||
QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos));
|
||||
|
||||
bool select;
|
||||
|
@ -250,8 +249,8 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos)
|
|||
{
|
||||
select = not allDetails->value(id).IsInLayout();
|
||||
|
||||
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc);
|
||||
connect(togglePrint, &ToggleDetailInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, select, m_data, m_doc);
|
||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, this, &VWidgetDetails::UpdateList);
|
||||
qApp->getUndoStack()->push(togglePrint);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
class VAbstractPattern;
|
||||
class VContainer;
|
||||
class VDetail;
|
||||
class VPiece;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ private:
|
|||
VAbstractPattern *m_doc;
|
||||
VContainer *m_data;
|
||||
|
||||
void FillTable(const QHash<quint32, VDetail> *details);
|
||||
void FillTable(const QHash<quint32, VPiece> *details);
|
||||
void ToggleSectionDetails(bool select);
|
||||
};
|
||||
|
||||
|
|
|
@ -615,7 +615,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
|||
{
|
||||
VPiece detail;
|
||||
const quint32 id = GetParametrId(domElement);
|
||||
// detail.setName(GetParametrString(domElement, AttrName, ""));
|
||||
detail.SetName(GetParametrString(domElement, AttrName, ""));
|
||||
detail.SetMx(qApp->toPixel(GetParametrDouble(domElement, AttrMx, "0.0")));
|
||||
detail.SetMy(qApp->toPixel(GetParametrDouble(domElement, AttrMy, "0.0")));
|
||||
// detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1"));
|
||||
|
@ -623,7 +623,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document
|
|||
// detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1"));
|
||||
// detail.setForbidFlipping(GetParametrUInt(domElement, VToolDetail::AttrForbidFlipping,
|
||||
// QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping())));
|
||||
// detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
||||
detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr));
|
||||
|
||||
const QStringList tags = QStringList() << VToolSeamAllowance::TagNodes
|
||||
<< TagData
|
||||
|
|
|
@ -412,6 +412,8 @@
|
|||
<xs:attribute name="version" type="pieceVersion"></xs:attribute>
|
||||
<xs:attribute name="mx" type="xs:double"></xs:attribute>
|
||||
<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:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
|
|
|
@ -1694,12 +1694,10 @@ void VPatternConverter::TagDetailToV0_4_0()
|
|||
|
||||
if (not dom.isNull())
|
||||
{
|
||||
dom.removeAttribute(strName);
|
||||
dom.removeAttribute(strSupplement);
|
||||
dom.removeAttribute(strClosed);
|
||||
dom.removeAttribute(strWidth);
|
||||
dom.removeAttribute(strForbidFlipping);
|
||||
dom.removeAttribute(strInLayout);
|
||||
|
||||
dom.setAttribute(strVersion, "1");
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*************************************************************************/
|
||||
|
||||
#include "vabstractpiece.h"
|
||||
#include "vabstractpiece_p.h"
|
||||
|
||||
#include <QLineF>
|
||||
#include <QSet>
|
||||
|
@ -37,13 +38,13 @@
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractPiece::VAbstractPiece()
|
||||
: d(new VAbstractPieceData)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractPiece::VAbstractPiece(const VAbstractPiece &piece)
|
||||
{
|
||||
Q_UNUSED(piece)
|
||||
}
|
||||
:d (piece.d)
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VAbstractPiece &VAbstractPiece::operator=(const VAbstractPiece &piece)
|
||||
|
@ -52,6 +53,7 @@ VAbstractPiece &VAbstractPiece::operator=(const VAbstractPiece &piece)
|
|||
{
|
||||
return *this;
|
||||
}
|
||||
d = piece.d;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -59,6 +61,18 @@ VAbstractPiece &VAbstractPiece::operator=(const VAbstractPiece &piece)
|
|||
VAbstractPiece::~VAbstractPiece()
|
||||
{}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractPiece::GetName() const
|
||||
{
|
||||
return d->m_name;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractPiece::SetName(const QString &value)
|
||||
{
|
||||
d->m_name = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
qreal VAbstractPiece::SumTrapezoids(const QVector<QPointF> &points)
|
||||
{
|
||||
|
|
|
@ -30,9 +30,11 @@
|
|||
#define VABSTRACTPIECE_H
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QSharedDataPointer>
|
||||
|
||||
template <class T> class QVector;
|
||||
class QPointF;
|
||||
class VAbstractPieceData;
|
||||
|
||||
class VAbstractPiece
|
||||
{
|
||||
|
@ -42,12 +44,18 @@ public:
|
|||
VAbstractPiece &operator=(const VAbstractPiece &piece);
|
||||
virtual ~VAbstractPiece();
|
||||
|
||||
QString GetName() const;
|
||||
void SetName(const QString &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);
|
||||
|
||||
protected:
|
||||
static QVector<QPointF> RemoveDublicates(const QVector<QPointF> &points, bool removeFirstAndLast = true);
|
||||
|
||||
private:
|
||||
QSharedDataPointer<VAbstractPieceData> d;
|
||||
};
|
||||
|
||||
#endif // VABSTRACTPIECE_H
|
||||
|
|
66
src/libs/vlayout/vabstractpiece_p.h
Normal file
66
src/libs/vlayout/vabstractpiece_p.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 9 11, 2016
|
||||
**
|
||||
** @brief
|
||||
** @copyright
|
||||
** This source code is part of the Valentine project, a pattern making
|
||||
** program, whose allow create and modeling patterns of clothing.
|
||||
** Copyright (C) 2016 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
|
||||
**
|
||||
** Valentina is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** Valentina is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef VABSTRACTPIECE_P_H
|
||||
#define VABSTRACTPIECE_P_H
|
||||
|
||||
#include <QSharedData>
|
||||
#include <QString>
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_GCC("-Weffc++")
|
||||
|
||||
class VAbstractPieceData : public QSharedData
|
||||
{
|
||||
public:
|
||||
VAbstractPieceData()
|
||||
: m_name()
|
||||
{}
|
||||
|
||||
VAbstractPieceData(const VAbstractPieceData &piece)
|
||||
: QSharedData(piece),
|
||||
m_name(piece.m_name)
|
||||
{}
|
||||
|
||||
~VAbstractPieceData();
|
||||
|
||||
QString m_name;
|
||||
|
||||
private:
|
||||
VAbstractPieceData &operator=(const VAbstractPieceData &) Q_DECL_EQ_DELETE;
|
||||
};
|
||||
|
||||
VAbstractPieceData::~VAbstractPieceData()
|
||||
{}
|
||||
|
||||
QT_WARNING_POP
|
||||
|
||||
#endif // VABSTRACTPIECE_P_H
|
||||
|
|
@ -19,7 +19,8 @@ HEADERS += \
|
|||
$$PWD/vtextmanager.h \
|
||||
$$PWD/vposter.h \
|
||||
$$PWD/vgraphicsfillitem.h \
|
||||
$$PWD/vabstractpiece.h
|
||||
$$PWD/vabstractpiece.h \
|
||||
$$PWD/vabstractpiece_p.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vlayoutgenerator.cpp \
|
||||
|
|
|
@ -244,6 +244,18 @@ void VPiece::SetMy(qreal value)
|
|||
d->m_my = value;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VPiece::IsInLayout() const
|
||||
{
|
||||
return d->m_inLayout;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VPiece::SetInLayout(bool inLayout)
|
||||
{
|
||||
d->m_inLayout = inLayout;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief Missing find missing nodes in detail. When we deleted object in detail and return this detail need
|
||||
|
|
|
@ -71,6 +71,9 @@ public:
|
|||
qreal GetMy() const;
|
||||
void SetMy(qreal value);
|
||||
|
||||
bool IsInLayout() const;
|
||||
void SetInLayout(bool inLayout);
|
||||
|
||||
QVector<VPieceNode> Missing(const VPiece &det) const;
|
||||
|
||||
int indexOfNode(const quint32 &id) const;
|
||||
|
|
|
@ -44,14 +44,16 @@ public:
|
|||
VPieceData()
|
||||
: m_nodes(),
|
||||
m_mx(0),
|
||||
m_my(0)
|
||||
m_my(0),
|
||||
m_inLayout(true)
|
||||
{}
|
||||
|
||||
VPieceData(const VPieceData &detail)
|
||||
: QSharedData(detail),
|
||||
m_nodes(detail.m_nodes),
|
||||
m_mx(detail.m_mx),
|
||||
m_my(detail.m_my)
|
||||
m_my(detail.m_my),
|
||||
m_inLayout(detail.m_inLayout)
|
||||
{}
|
||||
|
||||
~VPieceData();
|
||||
|
@ -62,6 +64,8 @@ public:
|
|||
qreal m_mx;
|
||||
qreal m_my;
|
||||
|
||||
bool m_inLayout;
|
||||
|
||||
private:
|
||||
VPieceData &operator=(const VPieceData &) Q_DECL_EQ_DELETE;
|
||||
};
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
#include "../undocommands/deletedetail.h"
|
||||
#include "../undocommands/movepiece.h"
|
||||
#include "../undocommands/savedetailoptions.h"
|
||||
#include "../undocommands/toggledetailinlayout.h"
|
||||
#include "../undocommands/togglepieceinlayout.h"
|
||||
#include "../vgeometry/varc.h"
|
||||
#include "../vgeometry/vcubicbezier.h"
|
||||
#include "../vgeometry/vcubicbezierpath.h"
|
||||
|
@ -805,9 +805,9 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
}
|
||||
else if (selectedAction == inLayoutOption)
|
||||
{
|
||||
ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, selectedAction->isChecked(),
|
||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, selectedAction->isChecked(),
|
||||
&(VAbstractTool::data), doc);
|
||||
connect(togglePrint, &ToggleDetailInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList);
|
||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList);
|
||||
qApp->getUndoStack()->push(togglePrint);
|
||||
}
|
||||
else if (selectedAction == actionRemove)
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "../undocommands/deletepiece.h"
|
||||
#include "../undocommands/movepiece.h"
|
||||
#include "../undocommands/savepieceoptions.h"
|
||||
//#include "../undocommands/togglepieceinlayout.h"
|
||||
#include "../undocommands/togglepieceinlayout.h"
|
||||
#include "../vwidgets/vmaingraphicsview.h"
|
||||
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
|
@ -247,9 +247,11 @@ void VToolSeamAllowance::AddAttributes(VAbstractPattern *doc, QDomElement &domEl
|
|||
SCASSERT(doc != nullptr);
|
||||
|
||||
doc->SetAttribute(domElement, VDomDocument::AttrId, id);
|
||||
doc->SetAttribute(domElement, AttrName, piece.GetName());
|
||||
doc->SetAttribute(domElement, AttrVersion, QString().setNum(pieceVersion));
|
||||
doc->SetAttribute(domElement, AttrMx, qApp->fromPixel(piece.GetMx()));
|
||||
doc->SetAttribute(domElement, AttrMy, qApp->fromPixel(piece.GetMy()));
|
||||
doc->SetAttribute(domElement, AttrInLayout, piece.IsInLayout());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -518,10 +520,10 @@ void VToolSeamAllowance::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
QMenu menu;
|
||||
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
||||
|
||||
// QAction *inLayoutOption = menu.addAction(tr("In layout"));
|
||||
// inLayoutOption->setCheckable(true);
|
||||
// const VDetail detail = VAbstractTool::data.GetDetail(id);
|
||||
// inLayoutOption->setChecked(detail.IsInLayout());
|
||||
QAction *inLayoutOption = menu.addAction(tr("In layout"));
|
||||
inLayoutOption->setCheckable(true);
|
||||
const VPiece detail = VAbstractTool::data.GetPiece(id);
|
||||
inLayoutOption->setChecked(detail.IsInLayout());
|
||||
|
||||
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||
_referens > 1 ? actionRemove->setEnabled(false) : actionRemove->setEnabled(true);
|
||||
|
@ -537,13 +539,13 @@ void VToolSeamAllowance::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
|||
SetDialog();
|
||||
m_dialog->show();
|
||||
}
|
||||
// else if (selectedAction == inLayoutOption)
|
||||
// {
|
||||
// ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, selectedAction->isChecked(),
|
||||
// &(VAbstractTool::data), doc);
|
||||
// connect(togglePrint, &ToggleDetailInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList);
|
||||
// qApp->getUndoStack()->push(togglePrint);
|
||||
// }
|
||||
else if (selectedAction == inLayoutOption)
|
||||
{
|
||||
TogglePieceInLayout *togglePrint = new TogglePieceInLayout(id, selectedAction->isChecked(),
|
||||
&(VAbstractTool::data), doc);
|
||||
connect(togglePrint, &TogglePieceInLayout::UpdateList, doc, &VAbstractPattern::CheckInLayoutList);
|
||||
qApp->getUndoStack()->push(togglePrint);
|
||||
}
|
||||
else if (selectedAction == actionRemove)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "toggledetailinlayout.h"
|
||||
#include "togglepieceinlayout.h"
|
||||
|
||||
#include <QDomElement>
|
||||
#include <QHash>
|
||||
|
@ -38,30 +38,30 @@
|
|||
#include "../vmisc/def.h"
|
||||
#include "../vmisc/logging.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../vpatterndb/vdetail.h"
|
||||
#include "../vpatterndb/vpiece.h"
|
||||
#include "vundocommand.h"
|
||||
|
||||
class QUndoCommand;
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
ToggleDetailInLayout::ToggleDetailInLayout(quint32 id, bool state, VContainer *data, VAbstractPattern *doc,
|
||||
TogglePieceInLayout::TogglePieceInLayout(quint32 id, bool state, VContainer *data, VAbstractPattern *doc,
|
||||
QUndoCommand *parent)
|
||||
: VUndoCommand(QDomElement(), doc, parent),
|
||||
m_id(id),
|
||||
m_data(data),
|
||||
m_oldState(m_data->DataDetails()->value(m_id).IsInLayout()),
|
||||
m_oldState(m_data->DataPieces()->value(m_id).IsInLayout()),
|
||||
m_newState(state)
|
||||
{
|
||||
setText(tr("detail in layout list"));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
ToggleDetailInLayout::~ToggleDetailInLayout()
|
||||
TogglePieceInLayout::~TogglePieceInLayout()
|
||||
{
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void ToggleDetailInLayout::undo()
|
||||
void TogglePieceInLayout::undo()
|
||||
{
|
||||
qCDebug(vUndo, "ToggleDetailInLayout::undo().");
|
||||
|
||||
|
@ -72,7 +72,7 @@ void ToggleDetailInLayout::undo()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void ToggleDetailInLayout::redo()
|
||||
void TogglePieceInLayout::redo()
|
||||
{
|
||||
qCDebug(vUndo, "ToggleDetailInLayout::redo().");
|
||||
|
||||
|
@ -83,25 +83,25 @@ void ToggleDetailInLayout::redo()
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
int ToggleDetailInLayout::id() const
|
||||
int TogglePieceInLayout::id() const
|
||||
{
|
||||
return static_cast<int>(UndoCommand::ToggleDetailInLayout);
|
||||
return static_cast<int>(UndoCommand::TogglePieceInLayout);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
quint32 ToggleDetailInLayout::getDetId() const
|
||||
quint32 TogglePieceInLayout::getDetId() const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool ToggleDetailInLayout::getNewState() const
|
||||
bool TogglePieceInLayout::getNewState() const
|
||||
{
|
||||
return m_newState;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void ToggleDetailInLayout::Do(bool state)
|
||||
void TogglePieceInLayout::Do(bool state)
|
||||
{
|
||||
QDomElement detail = doc->elementById(m_id);
|
||||
if (detail.isElement())
|
||||
|
@ -115,9 +115,9 @@ void ToggleDetailInLayout::Do(bool state)
|
|||
detail.removeAttribute(AttrInLayout);
|
||||
}
|
||||
|
||||
VDetail det = m_data->DataDetails()->value(m_id);
|
||||
VPiece det = m_data->DataPieces()->value(m_id);
|
||||
det.SetInLayout(state);
|
||||
m_data->UpdateDetail(m_id, det);
|
||||
m_data->UpdatePiece(m_id, det);
|
||||
emit UpdateList();
|
||||
}
|
||||
else
|
|
@ -41,13 +41,13 @@ class QUndoCommand;
|
|||
class VAbstractPattern;
|
||||
class VContainer;
|
||||
|
||||
class ToggleDetailInLayout : public VUndoCommand
|
||||
class TogglePieceInLayout : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ToggleDetailInLayout(quint32 id, bool state, VContainer *data, VAbstractPattern *doc,
|
||||
QUndoCommand *parent = nullptr);
|
||||
virtual ~ToggleDetailInLayout();
|
||||
TogglePieceInLayout(quint32 id, bool state, VContainer *data, VAbstractPattern *doc,
|
||||
QUndoCommand *parent = nullptr);
|
||||
virtual ~TogglePieceInLayout();
|
||||
virtual void undo() Q_DECL_OVERRIDE;
|
||||
virtual void redo() Q_DECL_OVERRIDE;
|
||||
virtual int id() const Q_DECL_OVERRIDE;
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
signals:
|
||||
void UpdateList();
|
||||
private:
|
||||
Q_DISABLE_COPY(ToggleDetailInLayout)
|
||||
Q_DISABLE_COPY(TogglePieceInLayout)
|
||||
quint32 m_id;
|
||||
VContainer *m_data;
|
||||
bool m_oldState;
|
|
@ -21,12 +21,12 @@ HEADERS += \
|
|||
$$PWD/addgroup.h \
|
||||
$$PWD/delgroup.h \
|
||||
$$PWD/label/moveabstractlabel.h \
|
||||
$$PWD/toggledetailinlayout.h \
|
||||
$$PWD/label/operationmovelabel.h \
|
||||
$$PWD/addpiece.h \
|
||||
$$PWD/deletepiece.h \
|
||||
$$PWD/movepiece.h \
|
||||
$$PWD/savepieceoptions.h
|
||||
$$PWD/savepieceoptions.h \
|
||||
$$PWD/togglepieceinlayout.h
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/addtocalc.cpp \
|
||||
|
@ -48,9 +48,9 @@ SOURCES += \
|
|||
$$PWD/addgroup.cpp \
|
||||
$$PWD/delgroup.cpp \
|
||||
$$PWD/label/moveabstractlabel.cpp \
|
||||
$$PWD/toggledetailinlayout.cpp \
|
||||
$$PWD/label/operationmovelabel.cpp \
|
||||
$$PWD/addpiece.cpp \
|
||||
$$PWD/deletepiece.cpp \
|
||||
$$PWD/movepiece.cpp \
|
||||
$$PWD/savepieceoptions.cpp
|
||||
$$PWD/savepieceoptions.cpp \
|
||||
$$PWD/togglepieceinlayout.cpp
|
||||
|
|
|
@ -62,7 +62,7 @@ enum class UndoCommand: char { AddPatternPiece,
|
|||
MoveLabel,
|
||||
MoveDoubleLabel,
|
||||
RotationMoveLabel,
|
||||
ToggleDetailInLayout
|
||||
TogglePieceInLayout
|
||||
};
|
||||
|
||||
class VNodeDetail;
|
||||
|
|
Loading…
Reference in New Issue
Block a user