Class VToolDetail removed.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2017-01-21 16:30:14 +02:00
parent e15d4d9c05
commit 669d295804
17 changed files with 24 additions and 2209 deletions

View File

@ -76,7 +76,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser()
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
switch (item->type()) switch (item->type())
{ {
@ -203,7 +203,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
} }
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
switch (currentItem->type()) switch (currentItem->type())
{ {
@ -348,7 +348,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VPE::VProperty *property)
} }
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in switch."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in switch.");
switch (currentItem->type()) switch (currentItem->type())
{ {

View File

@ -212,7 +212,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
QString DialogHistory::Record(const VToolRecord &tool) QString DialogHistory::Record(const VToolRecord &tool)
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used in history."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used in history.");
const QDomElement domElem = doc->elementById(tool.getId()); const QDomElement domElem = doc->elementById(tool.getId());
if (domElem.isElement() == false) if (domElem.isElement() == false)
@ -392,7 +392,6 @@ QString DialogHistory::Record(const VToolRecord &tool)
} }
//Because "history" not only show history of pattern, but help restore current data for each pattern's //Because "history" not only show history of pattern, but help restore current data for each pattern's
//piece, we need add record about details and nodes, but don't show them. //piece, we need add record about details and nodes, but don't show them.
case Tool::Detail:
case Tool::Piece: case Tool::Piece:
case Tool::UnionDetails: case Tool::UnionDetails:
case Tool::NodeArc: case Tool::NodeArc:

View File

@ -51,7 +51,6 @@
#include "../vwidgets/vmaingraphicsscene.h" #include "../vwidgets/vmaingraphicsscene.h"
#include "tools/drawTools/drawtools.h" #include "tools/drawTools/drawtools.h"
#include "../vtools/dialogs/tooldialogs.h" #include "../vtools/dialogs/tooldialogs.h"
#include "tools/vtooldetail.h"
#include "tools/vtoolseamallowance.h" #include "tools/vtoolseamallowance.h"
#include "tools/nodeDetails/vtoolpiecepath.h" #include "tools/nodeDetails/vtoolpiecepath.h"
#include "tools/vtooluniondetails.h" #include "tools/vtooluniondetails.h"
@ -990,21 +989,6 @@ void MainWindow::ToolPiecePath(bool checked)
&MainWindow::ClosedDialogPiecePath); &MainWindow::ClosedDialogPiecePath);
} }
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogDetail actions after closing DialogDetail.
* @param result result of dialog working.
*/
void MainWindow::ClosedDialogDetail(int result)
{
if (result == QDialog::Accepted)
{
VToolDetail::Create(dialogTool, sceneDetails, doc, pattern);
}
ArrowTool();
doc->LiteParseTree(Document::LiteParse);
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
/** /**
* @brief ToolHeight handler tool height. * @brief ToolHeight handler tool height.
@ -1772,7 +1756,7 @@ void MainWindow::InitToolButtons()
} }
// This check helps to find missed tools // This check helps to find missed tools
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Check if all tools were connected."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Check if all tools were connected.");
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine); connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine); connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
@ -1845,7 +1829,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
void MainWindow::CancelTool() void MainWindow::CancelTool()
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
qCDebug(vMainWindow, "Canceling tool."); qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool; delete dialogTool;
@ -1929,9 +1913,6 @@ void MainWindow::CancelTool()
case Tool::PointOfContact: case Tool::PointOfContact:
ui->toolButtonPointOfContact->setChecked(false); ui->toolButtonPointOfContact->setChecked(false);
break; break;
case Tool::Detail:
ui->toolButtonNewDetail->setChecked(false);
break;
case Tool::Piece: case Tool::Piece:
ui->toolButtonNewDetail->setChecked(false); ui->toolButtonNewDetail->setChecked(false);
break; break;
@ -3055,7 +3036,7 @@ void MainWindow::SetEnableTool(bool enable)
} }
// This check helps to find missed tools // This check helps to find missed tools
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
//Drawing Tools //Drawing Tools
ui->toolButtonEndLine->setEnabled(drawTools); ui->toolButtonEndLine->setEnabled(drawTools);
@ -3377,7 +3358,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
void MainWindow::LastUsedTool() void MainWindow::LastUsedTool()
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were handled."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were handled.");
if (currentTool == lastUsedTool) if (currentTool == lastUsedTool)
{ {
@ -3464,10 +3445,6 @@ void MainWindow::LastUsedTool()
ui->toolButtonPointOfContact->setChecked(true); ui->toolButtonPointOfContact->setChecked(true);
ToolPointOfContact(true); ToolPointOfContact(true);
break; break;
case Tool::Detail:
ui->toolButtonNewDetail->setChecked(true);
ToolDetail(true);
break;
case Tool::Piece: case Tool::Piece:
ui->toolButtonNewDetail->setChecked(true); ui->toolButtonNewDetail->setChecked(true);
ToolDetail(true); ToolDetail(true);

View File

@ -168,7 +168,6 @@ private slots:
bool Save(); bool Save();
void Open(); void Open();
void ClosedDialogDetail(int result);
void ClosedDialogUnionDetails(int result); void ClosedDialogUnionDetails(int result);
void ClosedDialogGroup(int result); void ClosedDialogGroup(int result);
void ClosedDialogPiecePath(int result); void ClosedDialogPiecePath(int result);

View File

@ -29,7 +29,6 @@
#include "vpattern.h" #include "vpattern.h"
#include "../vwidgets/vabstractmainwindow.h" #include "../vwidgets/vabstractmainwindow.h"
#include "../vtools/tools/vdatatool.h" #include "../vtools/tools/vdatatool.h"
#include "../vtools/tools/vtooldetail.h"
#include "../vtools/tools/vtoolseamallowance.h" #include "../vtools/tools/vtoolseamallowance.h"
#include "../vtools/tools/vtooluniondetails.h" #include "../vtools/tools/vtooluniondetails.h"
#include "../vtools/tools/drawTools/drawtools.h" #include "../vtools/tools/drawTools/drawtools.h"
@ -812,13 +811,13 @@ void VPattern::ParsePieceDataTag(const QDomElement &domElement, VPiece &detail)
ptPos.setX(GetParametrDouble(domElement, AttrMx, "0")); ptPos.setX(GetParametrDouble(domElement, AttrMx, "0"));
ptPos.setY(GetParametrDouble(domElement, AttrMy, "0")); ptPos.setY(GetParametrDouble(domElement, AttrMy, "0"));
detail.GetPatternPieceData().SetPos(ptPos); detail.GetPatternPieceData().SetPos(ptPos);
qreal dLW = GetParametrDouble(domElement, VToolDetail::AttrWidth, "0"); qreal dLW = GetParametrDouble(domElement, VToolSeamAllowance::AttrWidth, "0");
detail.GetPatternPieceData().SetLabelWidth(dLW); detail.GetPatternPieceData().SetLabelWidth(dLW);
qreal dLH = GetParametrDouble(domElement, VToolDetail::AttrHeight, "0"); qreal dLH = GetParametrDouble(domElement, VToolSeamAllowance::AttrHeight, "0");
detail.GetPatternPieceData().SetLabelHeight(dLH); detail.GetPatternPieceData().SetLabelHeight(dLH);
int iFS = static_cast<int>(GetParametrUInt(domElement, VToolDetail::AttrFont, "0")); int iFS = static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, "0"));
detail.GetPatternPieceData().SetFontSize(iFS); detail.GetPatternPieceData().SetFontSize(iFS);
qreal dRot = GetParametrDouble(domElement, VToolDetail::AttrRotation, "0"); qreal dRot = GetParametrDouble(domElement, VToolSeamAllowance::AttrRotation, "0");
detail.GetPatternPieceData().SetRotation(dRot); detail.GetPatternPieceData().SetRotation(dRot);
QDomNodeList nodeListMCP = domElement.childNodes(); QDomNodeList nodeListMCP = domElement.childNodes();
@ -845,13 +844,13 @@ void VPattern::ParsePiecePatternInfo(const QDomElement &domElement, VPiece &deta
ptPos.setX(GetParametrDouble(domElement, AttrMx, "0")); ptPos.setX(GetParametrDouble(domElement, AttrMx, "0"));
ptPos.setY(GetParametrDouble(domElement, AttrMy, "0")); ptPos.setY(GetParametrDouble(domElement, AttrMy, "0"));
detail.GetPatternInfo().SetPos(ptPos); detail.GetPatternInfo().SetPos(ptPos);
qreal dLW = GetParametrDouble(domElement, VToolDetail::AttrWidth, "0"); qreal dLW = GetParametrDouble(domElement, VToolSeamAllowance::AttrWidth, "0");
detail.GetPatternInfo().SetLabelWidth(dLW); detail.GetPatternInfo().SetLabelWidth(dLW);
qreal dLH = GetParametrDouble(domElement, VToolDetail::AttrHeight, "0"); qreal dLH = GetParametrDouble(domElement, VToolSeamAllowance::AttrHeight, "0");
detail.GetPatternInfo().SetLabelHeight(dLH); detail.GetPatternInfo().SetLabelHeight(dLH);
int iFS = static_cast<int>(GetParametrUInt(domElement, VToolDetail::AttrFont, "0")); int iFS = static_cast<int>(GetParametrUInt(domElement, VToolSeamAllowance::AttrFont, "0"));
detail.GetPatternInfo().SetFontSize(iFS); detail.GetPatternInfo().SetFontSize(iFS);
qreal dRot = GetParametrDouble(domElement, VToolDetail::AttrRotation, "0"); qreal dRot = GetParametrDouble(domElement, VToolSeamAllowance::AttrRotation, "0");
detail.GetPatternInfo().SetRotation(dRot); detail.GetPatternInfo().SetRotation(dRot);
} }
@ -865,7 +864,7 @@ void VPattern::ParsePieceGrainline(const QDomElement &domElement, VPiece &detail
detail.GetGrainlineGeometry().SetPos(ptPos); detail.GetGrainlineGeometry().SetPos(ptPos);
QString qsLength = GetParametrString(domElement, AttrLength, "0"); QString qsLength = GetParametrString(domElement, AttrLength, "0");
detail.GetGrainlineGeometry().SetLength(qsLength); detail.GetGrainlineGeometry().SetLength(qsLength);
QString qsRot = GetParametrString(domElement, VToolDetail::AttrRotation, "90"); QString qsRot = GetParametrString(domElement, VToolSeamAllowance::AttrRotation, "90");
detail.GetGrainlineGeometry().SetRotation(qsRot); detail.GetGrainlineGeometry().SetRotation(qsRot);
VGrainlineGeometry::ArrowType eAT = VGrainlineGeometry::ArrowType eAT =
VGrainlineGeometry::ArrowType(GetParametrUInt(domElement, AttrArrows, "0")); VGrainlineGeometry::ArrowType(GetParametrUInt(domElement, AttrArrows, "0"));
@ -3737,7 +3736,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
QRectF VPattern::ActiveDrawBoundingRect() const QRectF VPattern::ActiveDrawBoundingRect() const
{ {
// This check helps to find missed tools in the switch // This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52, "Not all tools were used."); Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51, "Not all tools were used.");
QRectF rec; QRectF rec;
@ -3862,7 +3861,6 @@ QRectF VPattern::ActiveDrawBoundingRect() const
rec = ToolBoundingRect<VToolEllipticalArc>(rec, tool.getId()); rec = ToolBoundingRect<VToolEllipticalArc>(rec, tool.getId());
break; break;
//These tools are not accesseble in Draw mode, but still 'history' contains them. //These tools are not accesseble in Draw mode, but still 'history' contains them.
case Tool::Detail:
case Tool::Piece: case Tool::Piece:
case Tool::UnionDetails: case Tool::UnionDetails:
case Tool::NodeArc: case Tool::NodeArc:

View File

@ -774,7 +774,7 @@ quint32 VAbstractPattern::SiblingNodeId(const quint32 &nodeId) const
const VToolRecord tool = history.at(j-1); const VToolRecord tool = history.at(j-1);
switch ( tool.getTypeTool() ) switch ( tool.getTypeTool() )
{ {
case Tool::Detail: case Tool::Piece:
case Tool::UnionDetails: case Tool::UnionDetails:
case Tool::NodeArc: case Tool::NodeArc:
case Tool::NodeElArc: case Tool::NodeElArc:
@ -1566,7 +1566,7 @@ QStringList VAbstractPattern::ListPointExpressions() const
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment a number. // If no just increment a number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it. // If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagPoint); const QDomNodeList list = elementsByTagName(TagPoint);
@ -1638,7 +1638,7 @@ QStringList VAbstractPattern::ListArcExpressions() const
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment number. // If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it. // If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagArc); const QDomNodeList list = elementsByTagName(TagArc);
@ -1692,7 +1692,7 @@ QStringList VAbstractPattern::ListElArcExpressions() const
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment number. // If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it. // If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagElArc); const QDomNodeList list = elementsByTagName(TagElArc);
@ -1763,7 +1763,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment number. // If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it. // If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(AttrPathPoint); const QDomNodeList list = elementsByTagName(AttrPathPoint);
@ -1830,7 +1830,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const
// Check if new tool doesn't bring new attribute with a formula. // Check if new tool doesn't bring new attribute with a formula.
// If no just increment number. // If no just increment number.
// If new tool bring absolutely new type and has formula(s) create new method to cover it. // If new tool bring absolutely new type and has formula(s) create new method to cover it.
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 52); Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 51);
QStringList expressions; QStringList expressions;
const QDomNodeList list = elementsByTagName(TagOperation); const QDomNodeList list = elementsByTagName(TagOperation);

View File

@ -120,7 +120,6 @@ enum class Tool : ToolVisHolderType
CubicBezierPath, CubicBezierPath,
CutSplinePath, CutSplinePath,
PointOfContact, PointOfContact,
Detail,
Piece, Piece,
PiecePath, PiecePath,
NodePoint, NodePoint,

View File

@ -2,7 +2,6 @@
# This need for corect working file translations.pro # This need for corect working file translations.pro
HEADERS += \ HEADERS += \
$$PWD/vtooldetail.h \
$$PWD/vdatatool.h \ $$PWD/vdatatool.h \
$$PWD/vabstracttool.h \ $$PWD/vabstracttool.h \
$$PWD/tools.h \ $$PWD/tools.h \
@ -62,7 +61,6 @@ HEADERS += \
$$PWD/nodeDetails/vtoolpiecepath.h $$PWD/nodeDetails/vtoolpiecepath.h
SOURCES += \ SOURCES += \
$$PWD/vtooldetail.cpp \
$$PWD/vdatatool.cpp \ $$PWD/vdatatool.cpp \
$$PWD/vabstracttool.cpp \ $$PWD/vabstracttool.cpp \
$$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \ $$PWD/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp \

File diff suppressed because it is too large Load Diff

View File

@ -1,164 +0,0 @@
/************************************************************************
**
** @file vtooldetail.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date November 15, 2013
**
** @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) 2013-2015 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 VTOOLDETAIL_H
#define VTOOLDETAIL_H
#include <qcompilerdetection.h>
#include <QObject>
#include <QtGlobal>
#include "../vwidgets/vnobrushscalepathitem.h"
#include "vabstracttool.h"
#include "vtextgraphicsitem.h"
#include "vgrainlineitem.h"
class VMainGraphicsScene;
class DialogTool;
/**
* @brief The VToolDetail class for working with detail.
*/
class VToolDetail: public VAbstractTool, public VNoBrushScalePathItem
{
Q_OBJECT
public:
~VToolDetail();
virtual void setDialog();
template<typename T>
/**
* @brief CreateNode create new node for detail.
* @param data container.
* @param id id parent object.
* @return id for new object.
*/
static quint32 CreateNode(VContainer *data, const quint32 &id)
{
//We can't use exist object. Need create new.
T *node = new T(*data->GeometricObject<T>(id).data());
node->setMode(Draw::Modeling);
return data->AddGObject(node);
}
static void Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data);
static void Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene,
VAbstractPattern *doc, VContainer *data, const Document &parse,
const Source &typeCreation, const QString &drawName = QString());
static const QString TagNode;
static const QString AttrSupplement;
static const QString AttrClosed;
static const QString AttrForbidFlipping;
static const QString AttrWidth;
static const QString AttrHeight;
static const QString AttrNodeType;
static const QString AttrReverse;
static const QString AttrFont;
static const QString AttrRotation;
static const QString NodeTypeContour;
static const QString NodeTypeModeling;
static const QString NodeArc;
static const QString NodeElArc;
static const QString NodePoint;
static const QString NodeSpline;
static const QString NodeSplinePath;
void Remove(bool ask);
static void AddNode(VAbstractPattern *doc, QDomElement &domElement, const VNodeDetail &node);
virtual int type() const Q_DECL_OVERRIDE {return Type;}
enum { Type = UserType + static_cast<int>(Tool::Detail)};
virtual QString getTagName() const Q_DECL_OVERRIDE;
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
virtual void GroupVisibility(quint32 object, bool visible) Q_DECL_OVERRIDE;
public slots:
virtual void FullUpdateFromFile () Q_DECL_OVERRIDE;
virtual void FullUpdateFromGuiOk(int result);
void EnableToolMove(bool move);
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
virtual void ResetChildren(QGraphicsItem* pItem);
virtual void UpdateAll();
virtual void retranslateUi();
void Highlight(quint32 id);
protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget) Q_DECL_OVERRIDE;
virtual void AddToFile () Q_DECL_OVERRIDE;
virtual void RefreshDataInFile() Q_DECL_OVERRIDE;
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
virtual void mousePressEvent( QGraphicsSceneMouseEvent * event) Q_DECL_OVERRIDE;
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverMoveEvent( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
virtual void SetVisualization() Q_DECL_OVERRIDE {}
protected slots:
virtual void UpdateLabel();
virtual void UpdatePatternInfo();
virtual void UpdateGrainline();
virtual void SaveMoveDetail(const QPointF &ptPos);
virtual void SaveResizeDetail(qreal dLabelW, int iFontSize);
virtual void SaveRotationDetail(qreal dRot);
virtual void SaveMovePattern(const QPointF& ptPos);
virtual void SaveResizePattern(qreal dLabelW, int iFontSize);
virtual void SaveRotationPattern(qreal dRot);
virtual void SaveMoveGrainline(const QPointF& ptPos);
virtual void SaveResizeGrainline(qreal dLength);
virtual void SaveRotateGrainline(qreal dRot, const QPointF& ptPos);
private:
Q_DISABLE_COPY(VToolDetail)
/** @brief dialog dialog options. */
DialogTool *dialog;
/** @brief sceneDetails pointer to the scene. */
VMainGraphicsScene *sceneDetails;
QString drawName;
VNoBrushScalePathItem *seamAllowance;
VTextGraphicsItem *dataLabel;
VTextGraphicsItem *patternInfo;
VGrainlineItem *grainLine;
VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation,
VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem * parent = nullptr);
void RefreshGeometry ();
template <typename Tool>
/**
* @brief InitTool initial node item on scene
* @param scene pointer to scene.
* @param node node of detail.
*/
Tool* InitTool(VMainGraphicsScene *scene, const VNodeDetail &node);
virtual void DeleteTool(bool ask = true) Q_DECL_OVERRIDE;
};
#endif // VTOOLDETAIL_H

View File

@ -1,120 +0,0 @@
/************************************************************************
**
** @file adddet.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 15 6, 2014
**
** @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) 2013-2015 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/>.
**
*************************************************************************/
#include "adddet.h"
#include <QByteArray>
#include <QDomNode>
#include "../ifc/xml/vabstractpattern.h"
#include "../vmisc/logging.h"
#include "vundocommand.h"
class QDomElement;
class QUndoCommand;
//---------------------------------------------------------------------------------------------------------------------
AddDet::AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, const QString &drawName,
QUndoCommand *parent)
: VUndoCommand(xml, doc, parent), detail(detail), drawName(drawName)
{
setText(tr("add detail"));
nodeId = doc->GetParametrId(xml);
}
//---------------------------------------------------------------------------------------------------------------------
AddDet::~AddDet()
{}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
void AddDet::undo()
{
qCDebug(vUndo, "Undo.");
QDomElement details = GetDetailsSection();
if (not details.isNull())
{
QDomElement domElement = doc->elementById(nodeId);
if (domElement.isElement())
{
if (details.removeChild(domElement).isNull())
{
qCDebug(vUndo, "Can't delete node");
return;
}
DecrementReferences(detail.getNodes());
}
else
{
qCDebug(vUndo, "Can't get node by id = %u.", nodeId);
return;
}
}
else
{
qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagDetails));
return;
}
emit NeedFullParsing();
}
//---------------------------------------------------------------------------------------------------------------------
// cppcheck-suppress unusedFunction
void AddDet::redo()
{
qCDebug(vUndo, "Redo.");
QDomElement details = GetDetailsSection();
if (not details.isNull())
{
details.appendChild(xml);
}
else
{
qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagDetails));
return;
}
RedoFullParsing();
}
//---------------------------------------------------------------------------------------------------------------------
QDomElement AddDet::GetDetailsSection() const
{
QDomElement details;
if (drawName.isEmpty())
{
doc->GetActivNodeElement(VAbstractPattern::TagDetails, details);
}
else
{
details = doc->GetDraw(drawName).firstChildElement(VAbstractPattern::TagDetails);
}
return details;
}

View File

@ -1,66 +0,0 @@
/************************************************************************
**
** @file adddet.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 15 6, 2014
**
** @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) 2013-2015 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 ADDDET_H
#define ADDDET_H
#include <qcompilerdetection.h>
#include <QDomElement>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QtGlobal>
#include "../tools/vtooldetail.h"
#include "vdetail.h"
#include "vundocommand.h"
class QDomElement;
class QUndoCommand;
class VAbstractPattern;
class AddDet : public VUndoCommand
{
Q_OBJECT
public:
AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, const QString &drawName = QString(),
QUndoCommand *parent = 0);
virtual ~AddDet() Q_DECL_OVERRIDE;
// cppcheck-suppress unusedFunction
virtual void undo() Q_DECL_OVERRIDE;
// cppcheck-suppress unusedFunction
virtual void redo() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(AddDet)
VDetail detail;
QString drawName;
QDomElement GetDetailsSection() const;
};
#endif // ADDDET_H

View File

@ -1,111 +0,0 @@
/************************************************************************
**
** @file deletedetail.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 16 6, 2014
**
** @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) 2013-2015 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/>.
**
*************************************************************************/
#include "deletedetail.h"
#include <QDomElement>
#include <QHash>
#include "../tools/vtooldetail.h"
#include "../ifc/ifcdef.h"
#include "../ifc/xml/vabstractpattern.h"
#include "../ifc/xml/vdomdocument.h"
#include "../vmisc/logging.h"
#include "../vmisc/def.h"
#include "../tools/vdatatool.h"
#include "vundocommand.h"
class QUndoCommand;
//---------------------------------------------------------------------------------------------------------------------
DeleteDetail::DeleteDetail(VAbstractPattern *doc, quint32 id, const VDetail &detail, QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), parentNode(QDomNode()), siblingId(NULL_ID), detail(detail)
{
setText(tr("delete tool"));
nodeId = id;
QDomElement domElement = doc->elementById(id);
if (domElement.isElement())
{
xml = domElement.cloneNode().toElement();
parentNode = domElement.parentNode();
QDomNode previousDetail = domElement.previousSibling();
if (previousDetail.isNull())
{
siblingId = NULL_ID;
}
else
{
// Better save id of previous detail instead of reference to node.
siblingId = doc->GetParametrUInt(previousDetail.toElement(), VAbstractPattern::AttrId, NULL_ID_STR);
}
}
else
{
qCDebug(vUndo, "Can't get detail by id = %u.", nodeId);
return;
}
}
//---------------------------------------------------------------------------------------------------------------------
DeleteDetail::~DeleteDetail()
{}
//---------------------------------------------------------------------------------------------------------------------
void DeleteDetail::undo()
{
qCDebug(vUndo, "Undo.");
UndoDeleteAfterSibling(parentNode, siblingId);
emit NeedFullParsing();
}
//---------------------------------------------------------------------------------------------------------------------
void DeleteDetail::redo()
{
qCDebug(vUndo, "Redo.");
QDomElement domElement = doc->elementById(nodeId);
if (domElement.isElement())
{
parentNode.removeChild(domElement);
// UnionDetails delete two old details and create one new.
// So when UnionDetail delete detail we can't use FullParsing. So we hide detail on scene directly.
VToolDetail *toolDet = qobject_cast<VToolDetail*>(doc->getTool(nodeId));
SCASSERT(toolDet != nullptr)
toolDet->hide();
DecrementReferences(detail.getNodes());
emit NeedFullParsing(); // Doesn't work when UnionDetail delete detail.
}
else
{
qCDebug(vUndo, "Can't get detail by id = %u.", nodeId);
return;
}
}

View File

@ -1,62 +0,0 @@
/************************************************************************
**
** @file deletedetail.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 16 6, 2014
**
** @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) 2013-2015 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 DELETEDETAIL_H
#define DELETEDETAIL_H
#include <qcompilerdetection.h>
#include <QDomNode>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QtGlobal>
#include "../tools/vtooldetail.h"
#include "vdetail.h"
#include "vundocommand.h"
class QGraphicsItem;
class QUndoCommand;
class VAbstractPattern;
class DeleteDetail : public VUndoCommand
{
Q_OBJECT
public:
DeleteDetail(VAbstractPattern *doc, quint32 id, const VDetail &detail, QUndoCommand *parent = 0);
virtual ~DeleteDetail() Q_DECL_OVERRIDE;
virtual void undo() Q_DECL_OVERRIDE;
virtual void redo() Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(DeleteDetail)
QDomNode parentNode;
quint32 siblingId;
VDetail detail;
};
#endif // DELETEDETAIL_H

View File

@ -1,216 +0,0 @@
/************************************************************************
**
** @file savedetailoptions.cpp
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 12 6, 2014
**
** @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) 2013-2015 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/>.
**
*************************************************************************/
#include "savedetailoptions.h"
#include <QDomElement>
#include <QPointF>
#include <QUndoCommand>
#include <QDebug>
#include "../ifc/xml/vabstractpattern.h"
#include "../ifc/ifcdef.h"
#include "../vmisc/logging.h"
#include "../vmisc/def.h"
#include "../vpatterndb/vpatterninfogeometry.h"
#include "../vpatterndb/vpatternpiecedata.h"
#include "../vpatterndb/vgrainlinegeometry.h"
#include "../tools/vtooldetail.h"
#include "vundocommand.h"
class QDomElement;
class QUndoCommand;
//---------------------------------------------------------------------------------------------------------------------
SaveDetailOptions::SaveDetailOptions(const VDetail &oldDet, const VDetail &newDet, VAbstractPattern *doc,
const quint32 &id, QGraphicsScene *scene, QUndoCommand *parent)
: VUndoCommand(QDomElement(), doc, parent), oldDet(oldDet), newDet(newDet), scene(scene)
{
setText(tr("save detail option"));
nodeId = id;
}
//---------------------------------------------------------------------------------------------------------------------
SaveDetailOptions::~SaveDetailOptions()
{}
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::undo()
{
qCDebug(vUndo, "Undo.");
QDomElement domElement = doc->elementById(nodeId);
if (domElement.isElement())
{
SaveDet(domElement, oldDet);
doc->RemoveAllChildren(domElement);
SavePatternPieceData(domElement, oldDet);
SavePatternInfo(domElement, oldDet);
SaveGrainline(domElement, oldDet);
for (int i = 0; i < oldDet.CountNode(); ++i)
{
VToolDetail::AddNode(doc, domElement, oldDet.at(i));
}
IncrementReferences(oldDet.Missing(newDet));
emit NeedLiteParsing(Document::LiteParse);
}
else
{
qCDebug(vUndo, "Can't find detail with id = %u.", nodeId);
return;
}
}
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::redo()
{
qCDebug(vUndo, "Redo.");
QDomElement domElement = doc->elementById(nodeId);
if (domElement.isElement())
{
SaveDet(domElement, newDet);
doc->RemoveAllChildren(domElement);
SavePatternPieceData(domElement, newDet);
SavePatternInfo(domElement, newDet);
SaveGrainline(domElement, newDet);
for (int i = 0; i < newDet.CountNode(); ++i)
{
VToolDetail::AddNode(doc, domElement, newDet.at(i));
}
DecrementReferences(oldDet.Missing(newDet));
emit NeedLiteParsing(Document::LiteParse);
}
else
{
qCDebug(vUndo, "Can't find detail with id = %u.", nodeId);
return;
}
}
//---------------------------------------------------------------------------------------------------------------------
bool SaveDetailOptions::mergeWith(const QUndoCommand *command)
{
const SaveDetailOptions *saveCommand = static_cast<const SaveDetailOptions *>(command);
SCASSERT(saveCommand != nullptr)
const quint32 id = saveCommand->getDetId();
if (id != nodeId || text() != command->text())
{
return false;
}
newDet = saveCommand->getNewDet();
return true;
}
//---------------------------------------------------------------------------------------------------------------------
int SaveDetailOptions::id() const
{
return static_cast<int>(UndoCommand::SaveDetailOptions);
}
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::SaveDet(QDomElement &domElement, const VDetail &det)
{
doc->SetAttribute(domElement, AttrName, det.getName());
doc->SetAttribute(domElement, VToolDetail::AttrSupplement, QString().setNum(det.getSeamAllowance()));
doc->SetAttribute(domElement, VToolDetail::AttrClosed, QString().setNum(det.getClosed()));
doc->SetAttribute(domElement, VToolDetail::AttrWidth, QString().setNum(det.getWidth()));
doc->SetAttribute(domElement, VToolDetail::AttrForbidFlipping, QString().setNum(det.getForbidFlipping()));
}
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::SavePatternPieceData(QDomElement &domElement, const VDetail &det)
{
QDomElement domData = doc->createElement(VAbstractPattern::TagData);
const VPatternPieceData& data = det.GetPatternPieceData();
doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter());
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? trueStr : falseStr);
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
doc->SetAttribute(domData, VToolDetail::AttrHeight, data.GetLabelHeight());
doc->SetAttribute(domData, VToolDetail::AttrFont, data.GetFontSize());
doc->SetAttribute(domData, VToolDetail::AttrRotation, data.GetRotation());
for (int i = 0; i < data.GetMCPCount(); ++i)
{
MaterialCutPlacement mcp = data.GetMCP(i);
QDomElement domMCP = doc->createElement(VAbstractPattern::TagMCP);
doc->SetAttribute(domMCP, VAbstractPattern::AttrMaterial, int(mcp.m_eMaterial));
if (mcp.m_eMaterial == MaterialType::mtUserDefined)
{
qDebug() << "USER DEFINED MATERIAL";
doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef);
}
else
{
qDebug() << "PREDEFINED MATERIAL";
domMCP.removeAttribute(VAbstractPattern::AttrUserDefined);
}
doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber);
doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement));
domData.appendChild(domMCP);
}
domElement.appendChild(domData);
}
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::SavePatternInfo(QDomElement &domElement, const VDetail &det)
{
QDomElement domData = doc->createElement(VAbstractPattern::TagPatternInfo);
const VPatternInfoGeometry& data = det.GetPatternInfo();
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, data.IsVisible() == true? trueStr : falseStr);
doc->SetAttribute(domData, AttrMx, data.GetPos().x());
doc->SetAttribute(domData, AttrMy, data.GetPos().y());
doc->SetAttribute(domData, VToolDetail::AttrWidth, data.GetLabelWidth());
doc->SetAttribute(domData, VToolDetail::AttrHeight, data.GetLabelHeight());
doc->SetAttribute(domData, VToolDetail::AttrFont, data.GetFontSize());
doc->SetAttribute(domData, VToolDetail::AttrRotation, data.GetRotation());
domElement.appendChild(domData);
}
//---------------------------------------------------------------------------------------------------------------------
void SaveDetailOptions::SaveGrainline(QDomElement &domElement, const VDetail &det)
{
QDomElement domData = doc->createElement(VAbstractPattern::TagGrainline);
const VGrainlineGeometry& glGeom = det.GetGrainlineGeometry();
doc->SetAttribute(domData, VAbstractPattern::AttrVisible, glGeom.IsVisible() == true? trueStr : falseStr);
doc->SetAttribute(domData, AttrMx, glGeom.GetPos().x());
doc->SetAttribute(domData, AttrMy, glGeom.GetPos().y());
doc->SetAttribute(domData, AttrLength, glGeom.GetLength());
doc->SetAttribute(domData, VToolDetail::AttrRotation, glGeom.GetRotation());
doc->SetAttribute(domData, VAbstractPattern::AttrArrows, int(glGeom.GetArrowType()));
domElement.appendChild(domData);
}

View File

@ -1,83 +0,0 @@
/************************************************************************
**
** @file savedetailoptions.h
** @author Roman Telezhynskyi <dismine(at)gmail.com>
** @date 12 6, 2014
**
** @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) 2013-2015 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 SAVEDETAILOPTIONS_H
#define SAVEDETAILOPTIONS_H
#include <qcompilerdetection.h>
#include <QMetaObject>
#include <QObject>
#include <QString>
#include <QtGlobal>
#include "../tools/vtooldetail.h"
#include "vdetail.h"
#include "vundocommand.h"
class QDomElement;
class QGraphicsScene;
class QUndoCommand;
class VAbstractPattern;
class SaveDetailOptions : public VUndoCommand
{
Q_OBJECT
public:
SaveDetailOptions(const VDetail &oldDet, const VDetail &newDet, VAbstractPattern *doc, const quint32 &id,
QGraphicsScene *scene, QUndoCommand *parent = 0);
virtual ~SaveDetailOptions() Q_DECL_OVERRIDE;
virtual void undo() Q_DECL_OVERRIDE;
virtual void redo() Q_DECL_OVERRIDE;
virtual bool mergeWith(const QUndoCommand *command) Q_DECL_OVERRIDE;
virtual int id() const Q_DECL_OVERRIDE;
quint32 getDetId() const;
VDetail getNewDet() const;
private:
Q_DISABLE_COPY(SaveDetailOptions)
const VDetail oldDet;
VDetail newDet;
QGraphicsScene *scene;
void SaveDet(QDomElement &domElement, const VDetail &det);
void SavePatternPieceData(QDomElement &domElement, const VDetail &det);
void SavePatternInfo(QDomElement &domElement, const VDetail &det);
void SaveGrainline(QDomElement &domElement, const VDetail &det);
};
//---------------------------------------------------------------------------------------------------------------------
inline quint32 SaveDetailOptions::getDetId() const
{
return nodeId;
}
//---------------------------------------------------------------------------------------------------------------------
inline VDetail SaveDetailOptions::getNewDet() const
{
return newDet;
}
#endif // SAVEDETAILOPTIONS_H

View File

@ -8,12 +8,9 @@ HEADERS += \
$$PWD/movespline.h \ $$PWD/movespline.h \
$$PWD/movesplinepath.h \ $$PWD/movesplinepath.h \
$$PWD/savetooloptions.h \ $$PWD/savetooloptions.h \
$$PWD/savedetailoptions.h \
$$PWD/deltool.h \ $$PWD/deltool.h \
$$PWD/deletepatternpiece.h \ $$PWD/deletepatternpiece.h \
$$PWD/adddetnode.h \ $$PWD/adddetnode.h \
$$PWD/adddet.h \
$$PWD/deletedetail.h \
$$PWD/vundocommand.h \ $$PWD/vundocommand.h \
$$PWD/renamepp.h \ $$PWD/renamepp.h \
$$PWD/label/movelabel.h \ $$PWD/label/movelabel.h \
@ -36,12 +33,9 @@ SOURCES += \
$$PWD/movespline.cpp \ $$PWD/movespline.cpp \
$$PWD/movesplinepath.cpp \ $$PWD/movesplinepath.cpp \
$$PWD/savetooloptions.cpp \ $$PWD/savetooloptions.cpp \
$$PWD/savedetailoptions.cpp \
$$PWD/deltool.cpp \ $$PWD/deltool.cpp \
$$PWD/deletepatternpiece.cpp \ $$PWD/deletepatternpiece.cpp \
$$PWD/adddetnode.cpp \ $$PWD/adddetnode.cpp \
$$PWD/adddet.cpp \
$$PWD/deletedetail.cpp \
$$PWD/vundocommand.cpp \ $$PWD/vundocommand.cpp \
$$PWD/renamepp.cpp \ $$PWD/renamepp.cpp \
$$PWD/label/movelabel.cpp \ $$PWD/label/movelabel.cpp \