From 45454a8955ce491585002ad183b79c5acded3e48 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Thu, 7 Jan 2016 18:43:08 +0200 Subject: [PATCH] Fix tool UnionDetails. Always left last poit of detail, save children ids, save in correct section. --HG-- branch : develop --- src/app/valentina/xml/vpattern.cpp | 2 +- src/libs/ifc/schema.qrc | 1 + src/libs/ifc/schema/pattern/v0.2.4.xsd | 423 ++++++++++++++++++ src/libs/ifc/xml/vabstractpattern.cpp | 20 + src/libs/ifc/xml/vabstractpattern.h | 2 + src/libs/ifc/xml/vpatternconverter.cpp | 89 +++- src/libs/ifc/xml/vpatternconverter.h | 5 + .../tools/nodeDetails/vabstractnode.cpp | 15 +- .../vtools/tools/nodeDetails/vabstractnode.h | 8 + .../vtools/tools/nodeDetails/vnodearc.cpp | 16 +- .../vtools/tools/nodeDetails/vnodepoint.cpp | 16 +- .../vtools/tools/nodeDetails/vnodespline.cpp | 16 +- .../tools/nodeDetails/vnodesplinepath.cpp | 31 +- src/libs/vtools/tools/vtooldetail.cpp | 11 +- src/libs/vtools/tools/vtooldetail.h | 5 +- src/libs/vtools/tools/vtooluniondetails.cpp | 283 +++++++++--- src/libs/vtools/tools/vtooluniondetails.h | 22 +- src/libs/vtools/undocommands/adddet.cpp | 32 +- src/libs/vtools/undocommands/adddet.h | 6 +- .../vtools/undocommands/adduniondetails.cpp | 90 ---- .../vtools/undocommands/adduniondetails.h | 46 -- src/libs/vtools/undocommands/undocommands.pri | 2 - 22 files changed, 881 insertions(+), 260 deletions(-) create mode 100644 src/libs/ifc/schema/pattern/v0.2.4.xsd delete mode 100644 src/libs/vtools/undocommands/adduniondetails.cpp delete mode 100644 src/libs/vtools/undocommands/adduniondetails.h diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index dc9aab7fc..0dcbece19 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -2264,7 +2264,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d const QVector vector = VToolUnionDetails::GetDetailFromFile(this, domElement); VToolUnionDetails::Create(id, vector[0], vector[1], 0, 0, indexD1, indexD2, scene, this, data, parse, - Source::FromFile); + Source::FromFile); } catch (const VExceptionBadId &e) { diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index a53d2a278..f3ac287da 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -18,5 +18,6 @@ schema/individual_measurements/v0.3.1.xsd schema/individual_measurements/v0.3.2.xsd schema/individual_measurements/v0.3.3.xsd + schema/pattern/v0.2.4.xsd diff --git a/src/libs/ifc/schema/pattern/v0.2.4.xsd b/src/libs/ifc/schema/pattern/v0.2.4.xsd new file mode 100644 index 000000000..04c58e516 --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.2.4.xsd @@ -0,0 +1,423 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vabstractpattern.cpp b/src/libs/ifc/xml/vabstractpattern.cpp index dcdf98303..df3f07c02 100644 --- a/src/libs/ifc/xml/vabstractpattern.cpp +++ b/src/libs/ifc/xml/vabstractpattern.cpp @@ -1311,3 +1311,23 @@ bool VAbstractPattern::IsModified() const { return modified; } + +//--------------------------------------------------------------------------------------------------------------------- +QDomElement VAbstractPattern::GetDraw(const QString &name) const +{ + const QDomNodeList draws = documentElement().elementsByTagName(TagDraw); + for (int i=0; i < draws.size(); ++i) + { + QDomElement draw = draws.at(i).toElement(); + if (draw.isNull()) + { + continue; + } + + if (draw.attribute(AttrName) == name) + { + return draw; + } + } + return QDomElement(); +} diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 39fb27d67..bd7bfef1c 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -105,6 +105,8 @@ public: bool IsModified() const; + QDomElement GetDraw(const QString &name) const; + static const QString TagPattern; static const QString TagCalculation; static const QString TagModeling; diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index d9a127429..b88a4e561 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -43,8 +43,8 @@ */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.2.3"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.2.3.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.2.4"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.2.4.xsd"); //--------------------------------------------------------------------------------------------------------------------- VPatternConverter::VPatternConverter(const QString &fileName) @@ -106,6 +106,8 @@ QString VPatternConverter::XSDSchema(int ver) const case (0x000202): return QStringLiteral("://schema/pattern/v0.2.2.xsd"); case (0x000203): + return QStringLiteral("://schema/pattern/v0.2.3.xsd"); + case (0x000204): return CurrentSchema; default: { @@ -179,6 +181,13 @@ void VPatternConverter::ApplyPatches() V_FALLTHROUGH } case (0x000203): + { + ToV0_2_4(); + const QString schema = XSDSchema(0x000204); + ValidateXML(schema, fileName); + V_FALLTHROUGH + } + case (0x000204): break; default: break; @@ -264,6 +273,14 @@ void VPatternConverter::ToV0_2_3() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_2_4() +{ + FixToolUnionToV0_2_4(); + SetVersion(QStringLiteral("0.2.4")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { @@ -807,6 +824,74 @@ QStringList VPatternConverter::ListPathPointExpressionsV0_1_4() const return expressions; } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::FixToolUnionToV0_2_4() +{ + QDomElement root = documentElement(); + const QDomNodeList modelings = root.elementsByTagName(QStringLiteral("modeling")); + for (int i=0; i children; + QDomElement childNode = node.nextSibling().toElement(); + const QString attrIdTool = QStringLiteral("idTool"); + while (not childNode.isNull()) + { + if (childNode.hasAttribute(attrIdTool) && childNode.attribute(attrIdTool).toUInt() == toolId) + { + children.append(childNode.attribute(QStringLiteral("idObject")).toUInt()); + } + else + { + break; + } + childNode = childNode.nextSibling().toElement(); + } + + if (not children.isEmpty()) + { + SaveChildrenToolUnionToV0_2_4(toolId, children); + } + node = childNode; + continue; + } + node = node.nextSibling().toElement(); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector &children) +{ + QDomElement toolUnion = elementById(id); + if (toolUnion.isNull()) + { + return; + } + + QDomElement tagChildren = createElement(QString("children")); + + for (int i=0; i VPatternConverter::OldNamesToNewNames_InV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index f5f9e7ff2..28038c1d5 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -63,6 +63,7 @@ private: void ToV0_2_1(); void ToV0_2_2(); void ToV0_2_3(); + void ToV0_2_4(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0(); @@ -87,6 +88,10 @@ private: QDomElement TagIncrementsV0_1_4() const; QStringList ListPathPointExpressionsV0_1_4() const; + void FixToolUnionToV0_2_4(); + void ParseModelingToV0_2_4(const QDomElement &modeling); + void SaveChildrenToolUnionToV0_2_4(quint32 id, const QVector &children); + static QMap OldNamesToNewNames_InV0_2_0(); static QMap OldNamesToNewNames_InV0_2_1(); }; diff --git a/src/libs/vtools/tools/nodeDetails/vabstractnode.cpp b/src/libs/vtools/tools/nodeDetails/vabstractnode.cpp index f75fe4330..2435b77f9 100644 --- a/src/libs/vtools/tools/nodeDetails/vabstractnode.cpp +++ b/src/libs/vtools/tools/nodeDetails/vabstractnode.cpp @@ -46,7 +46,8 @@ const QString VAbstractNode::AttrIdTool = QStringLiteral("idTool"); */ VAbstractNode::VAbstractNode(VAbstractPattern *doc, VContainer *data, const quint32 &id, const quint32 &idNode, const quint32 &idTool, QObject *parent) - : VAbstractTool(doc, data, id, parent), idNode(idNode), idTool(idTool), currentColor(Qt::black) + : VAbstractTool(doc, data, id, parent), parentType(ParentType::Item), idNode(idNode), idTool(idTool), + currentColor(Qt::black) { _referens = 0; } @@ -95,6 +96,18 @@ void VAbstractNode::decrementReferens() } } +//--------------------------------------------------------------------------------------------------------------------- +ParentType VAbstractNode::GetParentType() const +{ + return parentType; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractNode::SetParentType(const ParentType &value) +{ + parentType = value; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief AddToModeling add tag to modeling tag current pattern peace. diff --git a/src/libs/vtools/tools/nodeDetails/vabstractnode.h b/src/libs/vtools/tools/nodeDetails/vabstractnode.h index 09532ca05..037eef068 100644 --- a/src/libs/vtools/tools/nodeDetails/vabstractnode.h +++ b/src/libs/vtools/tools/nodeDetails/vabstractnode.h @@ -33,6 +33,8 @@ #include +enum class ParentType : bool {Scene, Item}; + /** * @brief The VAbstractNode class parent class for all detail node. */ @@ -48,6 +50,12 @@ public: virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE; virtual void incrementReferens() Q_DECL_OVERRIDE; virtual void decrementReferens() Q_DECL_OVERRIDE; + + ParentType GetParentType() const; + void SetParentType(const ParentType &value); + +protected: + ParentType parentType; protected: /** @brief idNodenode id. */ quint32 idNode; diff --git a/src/libs/vtools/tools/nodeDetails/vnodearc.cpp b/src/libs/vtools/tools/nodeDetails/vnodearc.cpp index 092c051bf..9e41cc818 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodearc.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodearc.cpp @@ -76,10 +76,6 @@ void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScen { VNodeArc *arc = new VNodeArc(doc, data, id, idArc, typeCreation, idTool, parent); - // Try to prevent memory leak - arc->hide();// If no one will use node, it will stay hidden - scene->addItem(arc);// First adopted by scene - doc->AddTool(id, arc); if (idTool != NULL_ID) { @@ -88,6 +84,13 @@ void VNodeArc::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsScen SCASSERT(tool != nullptr); arc->setParent(tool);// Adopted by a tool } + else + { + // Try to prevent memory leak + scene->addItem(arc);// First adopted by scene + arc->hide();// If no one will use node, it will stay hidden + arc->SetParentType(ParentType::Scene); + } } else { @@ -186,7 +189,10 @@ void VNodeArc::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VNodeArc::ShowNode() { - show(); + if (parentType != ParentType::Scene) + { + show(); + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp index a87dc7afd..4ceca428e 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodepoint.cpp @@ -90,10 +90,6 @@ void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsSc //Better check garbage before each saving file. Check only modeling tags. VNodePoint *point = new VNodePoint(doc, data, id, idPoint, typeCreation, idTool, parent); - // Try to prevent memory leak - point->hide();// If no one will use node, it will stay hidden - scene->addItem(point);// First adopted by scene - connect(scene, &VMainGraphicsScene::EnableToolMove, point, &VNodePoint::EnableToolMove); doc->AddTool(id, point); if (idTool != NULL_ID) @@ -103,6 +99,13 @@ void VNodePoint::Create(VAbstractPattern *doc, VContainer *data, VMainGraphicsSc SCASSERT(tool != nullptr); point->setParent(tool);// Adopted by a tool } + else + { + // Try to prevent memory leak + scene->addItem(point);// First adopted by scene + point->hide();// If no one will use node, it will stay hidden + point->SetParentType(ParentType::Scene); + } } else { @@ -274,7 +277,10 @@ void VNodePoint::RefreshLine() //--------------------------------------------------------------------------------------------------------------------- void VNodePoint::ShowNode() { - show(); + if (parentType != ParentType::Scene) + { + show(); + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/nodeDetails/vnodespline.cpp b/src/libs/vtools/tools/nodeDetails/vnodespline.cpp index 9b3c4afe0..56211a3ac 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodespline.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodespline.cpp @@ -79,10 +79,6 @@ VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, VMainG { spl = new VNodeSpline(doc, data, id, idSpline, typeCreation, idTool, parent); - // Try to prevent memory leak - spl->hide();// If no one will use node, it will stay hidden - scene->addItem(spl);// First adopted by scene - doc->AddTool(id, spl); if (idTool != NULL_ID) { @@ -91,6 +87,13 @@ VNodeSpline *VNodeSpline::Create(VAbstractPattern *doc, VContainer *data, VMainG SCASSERT(tool != nullptr); spl->setParent(tool);// Adopted by a tool } + else + { + // Try to prevent memory leak + scene->addItem(spl);// First adopted by scene + spl->hide();// If no one will use node, it will stay hidden + spl->SetParentType(ParentType::Scene); + } } else { @@ -189,7 +192,10 @@ void VNodeSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VNodeSpline::ShowNode() { - show(); + if (parentType != ParentType::Scene) + { + show(); + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/nodeDetails/vnodesplinepath.cpp b/src/libs/vtools/tools/nodeDetails/vnodesplinepath.cpp index 3d3780a11..06b547ac3 100644 --- a/src/libs/vtools/tools/nodeDetails/vnodesplinepath.cpp +++ b/src/libs/vtools/tools/nodeDetails/vnodesplinepath.cpp @@ -79,22 +79,20 @@ void VNodeSplinePath::Create(VAbstractPattern *doc, VContainer *data, VMainGraph { VNodeSplinePath *splPath = new VNodeSplinePath(doc, data, id, idSpline, typeCreation, idTool, parent); - // Try to prevent memory leak - splPath->hide();// If no one will use node, it will stay hidden - scene->addItem(splPath);// First adopted by scene - doc->AddTool(id, splPath); - const QSharedPointer path = data->GeometricObject(id); - const QVector *points = path->GetPoint(); - for (qint32 i = 0; isize(); ++i) + if (idTool != NULL_ID) { - if (idTool != NULL_ID) - { - //Some nodes we don't show on scene. Tool that create this nodes must free memory. - VDataTool *tool = doc->getTool(idTool); - SCASSERT(tool != nullptr); - splPath->setParent(tool);// Adopted by a tool - } + //Some nodes we don't show on scene. Tool that create this nodes must free memory. + VDataTool *tool = doc->getTool(idTool); + SCASSERT(tool != nullptr); + splPath->setParent(tool);// Adopted by a tool + } + else + { + // Try to prevent memory leak + scene->addItem(splPath);// First adopted by scene + splPath->hide();// If no one will use node, it will stay hidden + splPath->SetParentType(ParentType::Scene); } } else @@ -193,7 +191,10 @@ void VNodeSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VNodeSplinePath::ShowNode() { - show(); + if (parentType != ParentType::Scene) + { + show(); + } } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index 669f6a570..ad3838fef 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -74,8 +74,8 @@ const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); * @param parent parent object */ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation, - VMainGraphicsScene *scene, QGraphicsItem *parent) - :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene) + VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem *parent) + :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene), drawName(drawName) { VDetail detail = data->GetDetail(id); for (int i = 0; i< detail.CountNode(); ++i) @@ -208,7 +208,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac * @param typeCreation way we create this tool. */ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGraphicsScene *scene, VAbstractPattern *doc, - VContainer *data, const Document &parse, const Source &typeCreation) + VContainer *data, const Document &parse, const Source &typeCreation, const QString &drawName) { quint32 id = _id; if (typeCreation == Source::FromGui || typeCreation == Source::FromTool) @@ -226,7 +226,7 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap VAbstractTool::AddRecord(id, Tool::Detail, doc); if (parse == Document::FullParse) { - VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene); + VToolDetail *detail = new VToolDetail(doc, data, id, typeCreation, scene, drawName); scene->addItem(detail); connect(detail, &VToolDetail::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); QHash* tools = doc->getTools(); @@ -305,7 +305,7 @@ void VToolDetail::AddToFile() AddNode(doc, domElement, detail.at(i)); } - AddDet *addDet = new AddDet(domElement, doc, detail); + AddDet *addDet = new AddDet(domElement, doc, detail, drawName); connect(addDet, &AddDet::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing); qApp->getUndoStack()->push(addDet); } @@ -602,6 +602,7 @@ void VToolDetail::InitTool(VMainGraphicsScene *scene, const VNodeDetail &node) SCASSERT(tool != nullptr); connect(tool, &Tool::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); tool->setParentItem(this); + tool->SetParentType(ParentType::Item); doc->IncrementReferens(node.getId()); } diff --git a/src/libs/vtools/tools/vtooldetail.h b/src/libs/vtools/tools/vtooldetail.h index f4be08e2c..ea05ab084 100644 --- a/src/libs/vtools/tools/vtooldetail.h +++ b/src/libs/vtools/tools/vtooldetail.h @@ -43,7 +43,7 @@ class VToolDetail: public VAbstractTool, public QGraphicsPathItem Q_OBJECT public: VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 &id, const Source &typeCreation, - VMainGraphicsScene *scene, QGraphicsItem * parent = nullptr); + VMainGraphicsScene *scene, const QString &drawName, QGraphicsItem * parent = nullptr); ~VToolDetail(); virtual void setDialog(); @@ -65,7 +65,7 @@ public: 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 Source &typeCreation, const QString &drawName = QString()); static const QString TagName; static const QString TagNode; static const QString AttrSupplement; @@ -109,6 +109,7 @@ private: /** @brief sceneDetails pointer to the scene. */ VMainGraphicsScene *sceneDetails; + QString drawName; void RefreshGeometry (); template diff --git a/src/libs/vtools/tools/vtooluniondetails.cpp b/src/libs/vtools/tools/vtooluniondetails.cpp index 3b5b8568b..1e966fcd7 100644 --- a/src/libs/vtools/tools/vtooluniondetails.cpp +++ b/src/libs/vtools/tools/vtooluniondetails.cpp @@ -33,12 +33,15 @@ #include "../../vgeometry/varc.h" #include "../../vgeometry/vsplinepath.h" #include "../dialogs/tools/dialoguniondetails.h" -#include "../undocommands/adduniondetails.h" + +#include const QString VToolUnionDetails::TagName = QStringLiteral("tools"); const QString VToolUnionDetails::ToolType = QStringLiteral("unionDetails"); const QString VToolUnionDetails::TagDetail = QStringLiteral("det"); const QString VToolUnionDetails::TagNode = QStringLiteral("node"); +const QString VToolUnionDetails::TagChildren = QStringLiteral("children"); +const QString VToolUnionDetails::TagChild = QStringLiteral("child"); const QString VToolUnionDetails::AttrIndexD1 = QStringLiteral("indexD1"); const QString VToolUnionDetails::AttrIndexD2 = QStringLiteral("indexD2"); const QString VToolUnionDetails::AttrIdObject = QStringLiteral("idObject"); @@ -46,6 +49,22 @@ const QString VToolUnionDetails::AttrNodeType = QStringLiteral("nodeType"); const QString VToolUnionDetails::NodeTypeContour = QStringLiteral("Contour"); const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling"); +#if defined(Q_CC_CLANG) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wmissing-prototypes" +#elif defined(Q_CC_INTEL) + #pragma warning( push ) + #pragma warning( disable: 1418 ) +#endif + +Q_LOGGING_CATEGORY(vToolUnion, "v.toolUnion") + +#if defined(Q_CC_CLANG) + #pragma clang diagnostic pop +#elif defined(Q_CC_INTEL) + #pragma warning( pop ) +#endif + //--------------------------------------------------------------------------------------------------------------------- /** * @brief VToolUnionDetails costructor. @@ -61,8 +80,8 @@ const QString VToolUnionDetails::NodeTypeModeling = QStringLiteral("Modeling"); */ VToolUnionDetails::VToolUnionDetails(VAbstractPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2, - const Source &typeCreation, QObject *parent) - :VAbstractTool(doc, data, id, parent), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2) + const Source &typeCreation, const QString &drawName, QObject *parent) + :VAbstractTool(doc, data, id, parent), d1(d1), d2(d2), indexD1(indexD1), indexD2(indexD2), drawName(drawName) { _referens = 0; ToolCreation(typeCreation); @@ -83,8 +102,9 @@ VToolUnionDetails::VToolUnionDetails(VAbstractPattern *doc, VContainer *data, co * @param pRotate point rotation. * @param angle angle rotation. */ -void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, VDetail &newDetail, - const VDetail &det, const int &i, const quint32 &idTool, const qreal &dx, +void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc, + VContainer *data, VDetail &newDetail, const VDetail &det, const int &i, + const quint32 &idTool, QVector &children, const qreal &dx, const qreal &dy, const quint32 &pRotate, const qreal &angle) { quint32 id = 0, idObject = 0; @@ -103,6 +123,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); idObject = data->AddGObject(point); + children.append(idObject); VPointF *point1 = new VPointF(*point); point1->setMode(Draw::Modeling); id = data->AddGObject(point1); @@ -137,6 +158,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, QString().setNum(l2.angle())); arc1->setMode(Draw::Modeling); idObject = data->AddGObject(arc1); + children.append(idObject); VArc *arc2 = new VArc(*arc1); arc2->setMode(Draw::Modeling); @@ -172,6 +194,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); idObject = data->AddGObject(spl); + children.append(idObject); VSpline *spl1 = new VSpline(*spl); spl1->setMode(Draw::Modeling); @@ -227,6 +250,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, delete p1; } idObject = data->AddGObject(path); + children.append(idObject); VSplinePath *path1 = new VSplinePath(*path); path1->setMode(Draw::Modeling); @@ -250,14 +274,15 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, * @param data container with variables. * @param det detail what we union. * @param i index node in detail. - * @param idCount count updated or created objects. + * @param children list ids of all children. * @param dx bias node x axis. * @param dy bias node y axis. * @param pRotate point rotation. * @param angle angle rotation. */ -void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const int &i, - quint32 &idCount, const qreal &dx, const qreal &dy, const quint32 &pRotate, +void VToolUnionDetails::UpdatePoints(VContainer *data, const VDetail &det, const int &i, + QVector &children, const qreal &dx, const qreal &dy, + const quint32 &pRotate, const qreal &angle) { switch (det.at(i).getTypeTool()) @@ -269,10 +294,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VPointF *point = new VPointF(*data->GeometricObject(det.at(i).getId())); point->setMode(Draw::Modeling); BiasRotatePoint(point, dx, dy, data->GeometricObject(pRotate)->toQPointF(), angle); - ++idCount;// For parent - data->UpdateGObject(idDetail+idCount, point); - - ++idCount;// For child + data->UpdateGObject(TakeNextId(children), point); } } break; @@ -297,10 +319,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VArc *arc1 = new VArc(*center, arc->GetRadius(), arc->GetFormulaRadius(), l1.angle(), QString().setNum(l1.angle()), l2.angle(), QString().setNum(l2.angle())); arc1->setMode(Draw::Modeling); - ++idCount;// For parent - data->UpdateGObject(idDetail+idCount, arc1); - - ++idCount;// For child + data->UpdateGObject(TakeNextId(children), arc1); delete center; } } @@ -326,11 +345,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, VSpline *spl = new VSpline(*p1, p2.toQPointF(), p3.toQPointF(), *p4, spline->GetKcurve(), 0, Draw::Modeling); - - ++idCount;// For parent - data->UpdateGObject(idDetail+idCount, spl); - - ++idCount;// For child + data->UpdateGObject(TakeNextId(children), spl); delete p1; delete p4; } @@ -376,11 +391,7 @@ void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, delete p1; delete p4; } - - ++idCount;//For parent - data->UpdateGObject(idDetail+idCount, path); - - ++idCount;// For child + data->UpdateGObject(TakeNextId(children), path); } } break; @@ -520,9 +531,12 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d { VToolUnionDetails *unionDetails = 0; quint32 id = _id; + QString drawName; if (typeCreation == Source::FromGui) { id = data->getNextId(); + drawName = DrawName(doc, d1id, d2id); + SCASSERT(not drawName.isEmpty()); } else { @@ -536,7 +550,7 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d if (parse == Document::FullParse) { //Scene doesn't show this tool, so doc will destroy this object. - unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, doc); + unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, drawName, doc); QHash* tools = doc->getTools(); tools->insert(id, unionDetails); } @@ -566,18 +580,6 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d const QLineF p4p3 = QLineF(point4.toQPointF(), point3.toQPointF()); const QLineF p1p2 = QLineF(point1.toQPointF(), point2.toQPointF()); - // How many points do we need to skip? - // If lengths of edges not equal we should left the second point of the second detail. - qint32 skip; - if (qFuzzyCompare(p1p2.length(), p4p3.length())) - { - skip = 2; - } - else - { - skip = 1; - } - const qreal angle = p4p3.angleTo(p1p2); qint32 pointsD2 = 0; //Keeps number points the second detail, what we have already added. @@ -588,11 +590,12 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d { qint32 i = 0; VDetail newDetail; + QVector children; do { - AddToNewDetail(unionDetails, scene, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id); + AddToNewDetail(unionDetails, scene, doc, data, newDetail, d1.RemoveEdge(indexD1), i, id, children); ++i; - if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-2) + if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-1) { qint32 j = 0; FindIndexJ(pointsD2, d2, indexD2, j); @@ -602,17 +605,17 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d { j=0; } - AddToNewDetail(unionDetails, scene, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, dx, dy, - det1p1.getId(), angle); + AddToNewDetail(unionDetails, scene, doc, data, newDetail, d2.RemoveEdge(indexD2), j, id, children, + dx, dy, det1p1.getId(), angle); ++pointsD2; ++j; - } while (pointsD2 < countNodeD2-skip); + } while (pointsD2 < countNodeD2-1); } } while (i < countNodeD1); newDetail.setName("Detail"); newDetail.setWidth(d1.getWidth()); - VToolDetail::Create(0, newDetail, scene, doc, data, parse, Source::FromTool); + VToolDetail::Create(0, newDetail, scene, doc, data, parse, Source::FromTool, drawName); QHash* tools = doc->getTools(); SCASSERT(tools != nullptr); @@ -627,31 +630,40 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d SCASSERT(toolDet != nullptr); bool ask = false; toolDet->Remove(ask); + + SCASSERT(not children.isEmpty()) + SaveChildren(doc, id, children); } else { - quint32 idCount = 0; - qint32 i = 0; - do + QVector children = AllChildren(doc, id); + if (not children.isEmpty()) { - UpdatePoints(id, data, d1.RemoveEdge(indexD1), i, idCount); - ++i; - if (i > d1.indexOfNode(det1p1.getId()) && pointsD2 < countNodeD2-2) + qint32 i = 0; + do { - qint32 j = 0; - FindIndexJ(pointsD2, d2, indexD2, j); - do + //UpdatePoints(data, d1.RemoveEdge(indexD1), i, children); + ++i; + if (i > d1.indexOfNode(det1p1.getId())) { - if (j >= d2.RemoveEdge(indexD2).CountNode()) + const int childrenCount = children.size(); + VDetail d2REdge = d2.RemoveEdge(indexD2); + qint32 j = 0; + FindIndexJ(pointsD2, d2, indexD2, j); + do { - j=0; - } - UpdatePoints(id, data, d2.RemoveEdge(indexD2), j, idCount, dx, dy, det1p1.getId(), angle); - ++pointsD2; - ++j; - } while (pointsD2 < countNodeD2-skip); - } - } while (i= countNodeD2) + { + j=0; + } + UpdatePoints(data, d2REdge, j, children, dx, dy, det1p1.getId(), angle); + ++pointsD2; + ++j; + } while (pointsD2 < childrenCount); + break; + } + } while (igetUndoStack()->push(addUnion); + QDomElement modeling = doc->GetDraw(drawName).firstChildElement(VAbstractPattern::TagModeling); + if (not modeling.isNull()) + { + modeling.appendChild(domElement); + } + else + { + qCDebug(vToolUnion, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling)); + return; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +void VToolUnionDetails::SaveChildren(VAbstractPattern *doc, quint32 id, const QVector &children) +{ + QDomElement toolUnion = doc->elementById(id); + if (toolUnion.isNull()) + { + return; + } + + QDomElement tagChildren = doc->createElement(TagChildren); + + for (int i=0; icreateElement(TagChild); + tagChild.appendChild(doc->createTextNode(QString().setNum(children.at(i)))); + tagChildren.appendChild(tagChild); + } + + toolUnion.appendChild(tagChildren); +} + +//--------------------------------------------------------------------------------------------------------------------- +QVector VToolUnionDetails::AllChildren(VAbstractPattern *doc, quint32 id) +{ + const QDomElement toolUnion = doc->elementById(id); + if (toolUnion.isNull()) + { + return QVector(); + } + + const QDomElement tagChildren = toolUnion.firstChildElement(TagChildren); + if (tagChildren.isNull()) + { + return QVector(); + } + + QVector childrenId; + const QDomNodeList listChildren = tagChildren.elementsByTagName(TagChild); + for (int i=0; i < listChildren.size(); ++i) + { + const QDomElement domElement = listChildren.at(i).toElement(); + if (not domElement.isNull()) + { + childrenId.append(domElement.text().toUInt()); + } + } + return childrenId; +} + +//--------------------------------------------------------------------------------------------------------------------- +quint32 VToolUnionDetails::TakeNextId(QVector &children) +{ + quint32 idChild = NULL_ID; + if (not children.isEmpty()) + { + idChild = children.takeFirst(); + } + else + { + idChild = NULL_ID; + } + return idChild; +} + +//--------------------------------------------------------------------------------------------------------------------- +QString VToolUnionDetails::DrawName(VAbstractPattern *doc, quint32 d1id, quint32 d2id) +{ + const QDomElement detail1 = doc->elementById(d1id); + if (detail1.isNull()) + { + return QString(); + } + + const QDomElement detail2 = doc->elementById(d2id); + if (detail2.isNull()) + { + return QString(); + } + + const QDomElement draw1 = detail1.parentNode().parentNode().toElement(); + if (draw1.isNull() || not draw1.hasAttribute(VAbstractPattern::AttrName)) + { + return QString(); + } + + const QDomElement draw2 = detail2.parentNode().parentNode().toElement(); + if (draw2.isNull() || not draw2.hasAttribute(VAbstractPattern::AttrName)) + { + return QString(); + } + + const QString draw1Name = draw1.attribute(VAbstractPattern::AttrName); + const QString draw2Name = draw2.attribute(VAbstractPattern::AttrName); + + if (draw1Name == draw2Name) + { + return draw1Name; + } + + const QDomElement pattern = draw1.parentNode().toElement(); + if (pattern.isNull()) + { + return QString(); + } + + int indexD1 = 0; + int indexD2 = 0; + const QDomNodeList listDraws = pattern.elementsByTagName(VAbstractPattern::TagDraw); + for (int i=0; i < listDraws.size(); ++i) + { + const QDomElement draw = listDraws.at(i).toElement(); + if (draw == draw1) + { + indexD1 = i; + } + + if (draw == draw2) + { + indexD2 = i; + } + } + + if (indexD1 >= indexD2) + { + return draw1Name; + } + else + { + return draw2Name; + } } diff --git a/src/libs/vtools/tools/vtooluniondetails.h b/src/libs/vtools/tools/vtooluniondetails.h index e5cb984d2..53abece45 100644 --- a/src/libs/vtools/tools/vtooluniondetails.h +++ b/src/libs/vtools/tools/vtooluniondetails.h @@ -44,7 +44,7 @@ class VToolUnionDetails : public VAbstractTool public: VToolUnionDetails(VAbstractPattern *doc, VContainer *data, const quint32 &id, const VDetail &d1, const VDetail &d2, const quint32 &indexD1, const quint32 &indexD2, const Source &typeCreation, - QObject *parent = nullptr); + const QString &drawName, QObject *parent = nullptr); /** * @brief setDialog set dialog when user want change tool option. */ @@ -63,18 +63,21 @@ public: static const QString ToolType; static const QString TagDetail; static const QString TagNode; + static const QString TagChildren; + static const QString TagChild; static const QString AttrIndexD1; static const QString AttrIndexD2; static const QString AttrIdObject; static const QString AttrNodeType; static const QString NodeTypeContour; static const QString NodeTypeModeling; - static void AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, VDetail &newDetail, - const VDetail &det, const int &i, const quint32 &idTool, const qreal &dx = 0, + static void AddToNewDetail(QObject *tool, VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data, + VDetail &newDetail, const VDetail &det, const int &i, const quint32 &idTool, + QVector &children, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0, const qreal &angle = 0); - static void UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const int &i, - quint32 &idCount, const qreal &dx = 0, const qreal &dy = 0, const quint32 &pRotate = 0, - const qreal &angle = 0); + static void UpdatePoints(VContainer *data, const VDetail &det, const int &i, + QVector &children, const qreal &dx = 0, const qreal &dy = 0, + const quint32 &pRotate = 0, const qreal &angle = 0); static void BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate, const qreal &angle); virtual QString getTagName() const Q_DECL_OVERRIDE; @@ -104,10 +107,17 @@ private: /** @brief indexD2 index edge in second detail. */ quint32 indexD2; + QString drawName; + void AddDetail(QDomElement &domElement, VDetail &d); void AddNode(QDomElement &domElement, const VNodeDetail &node); QDomNode UpdateDetail(const QDomNode &domNode, const VDetail &d); void AddToModeling(const QDomElement &domElement); + + static void SaveChildren(VAbstractPattern *doc, quint32 id, const QVector &children); + static QVector AllChildren(VAbstractPattern *doc, quint32 id); + static quint32 TakeNextId(QVector &children); + static QString DrawName(VAbstractPattern *doc, quint32 d1id, quint32 d2id); }; #endif // VTOOLUNIONDETAILS_H diff --git a/src/libs/vtools/undocommands/adddet.cpp b/src/libs/vtools/undocommands/adddet.cpp index 5fbd7a1e2..8cd86b384 100644 --- a/src/libs/vtools/undocommands/adddet.cpp +++ b/src/libs/vtools/undocommands/adddet.cpp @@ -29,8 +29,9 @@ #include "adddet.h" //--------------------------------------------------------------------------------------------------------------------- -AddDet::AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, QUndoCommand *parent) - : VUndoCommand(xml, doc, parent), detail(detail) +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); @@ -46,13 +47,13 @@ void AddDet::undo() { qCDebug(vUndo, "Undo."); - QDomElement element; - if (doc->GetActivNodeElement(VAbstractPattern::TagDetails, element)) + QDomElement details = GetDetailsSection(); + if (not details.isNull()) { QDomElement domElement = doc->elementById(nodeId); if (domElement.isElement()) { - if (element.removeChild(domElement).isNull()) + if (details.removeChild(domElement).isNull()) { qCDebug(vUndo, "Can't delete node"); return; @@ -87,10 +88,10 @@ void AddDet::redo() { qCDebug(vUndo, "Redo."); - QDomElement element; - if (doc->GetActivNodeElement(VAbstractPattern::TagDetails, element)) + QDomElement details = GetDetailsSection(); + if (not details.isNull()) { - element.appendChild(xml); + details.appendChild(xml); } else { @@ -99,3 +100,18 @@ void AddDet::redo() } 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; +} diff --git a/src/libs/vtools/undocommands/adddet.h b/src/libs/vtools/undocommands/adddet.h index 0bbfa4f1d..ff5187180 100644 --- a/src/libs/vtools/undocommands/adddet.h +++ b/src/libs/vtools/undocommands/adddet.h @@ -36,7 +36,8 @@ class AddDet : public VUndoCommand { Q_OBJECT public: - AddDet(const QDomElement &xml, VAbstractPattern *doc, const VDetail &detail, QUndoCommand *parent = 0); + 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; @@ -45,6 +46,9 @@ public: private: Q_DISABLE_COPY(AddDet) VDetail detail; + QString drawName; + + QDomElement GetDetailsSection() const; }; #endif // ADDDET_H diff --git a/src/libs/vtools/undocommands/adduniondetails.cpp b/src/libs/vtools/undocommands/adduniondetails.cpp deleted file mode 100644 index fdd4a286c..000000000 --- a/src/libs/vtools/undocommands/adduniondetails.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/************************************************************************ - ** - ** @file adduniondetails.cpp - ** @author Roman Telezhynskyi - ** @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 - ** 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 . - ** - *************************************************************************/ - -#include "adduniondetails.h" - -//--------------------------------------------------------------------------------------------------------------------- -AddUnionDetails::AddUnionDetails(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent) - : VUndoCommand(xml, doc, parent) -{ - setText(tr("add union details")); - nodeId = doc->GetParametrId(xml); -} - -//--------------------------------------------------------------------------------------------------------------------- -AddUnionDetails::~AddUnionDetails() -{} - -//--------------------------------------------------------------------------------------------------------------------- -void AddUnionDetails::undo() -{ - qCDebug(vUndo, "Undo."); - - QDomElement modelingElement; - if (doc->GetActivNodeElement(VAbstractPattern::TagModeling, modelingElement)) - { - QDomElement domElement = doc->elementById(nodeId); - if (domElement.isElement()) - { - if (modelingElement.removeChild(domElement).isNull()) - { - qCDebug(vUndo, "Can't delete node."); - return; - } - } - else - { - qCDebug(vUndo, "Can't get node by id = %u.", nodeId); - return; - } - } - else - { - qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling)); - return; - } - emit NeedFullParsing(); -} - -//--------------------------------------------------------------------------------------------------------------------- -void AddUnionDetails::redo() -{ - qCDebug(vUndo, "Redo."); - - QDomElement modelingElement; - if (doc->GetActivNodeElement(VAbstractPattern::TagModeling, modelingElement)) - { - modelingElement.appendChild(xml); - } - else - { - qCDebug(vUndo, "Can't find tag %s.", qUtf8Printable(VAbstractPattern::TagModeling)); - return; - } - RedoFullParsing(); -} diff --git a/src/libs/vtools/undocommands/adduniondetails.h b/src/libs/vtools/undocommands/adduniondetails.h deleted file mode 100644 index 0afb1b146..000000000 --- a/src/libs/vtools/undocommands/adduniondetails.h +++ /dev/null @@ -1,46 +0,0 @@ -/************************************************************************ - ** - ** @file adduniondetails.h - ** @author Roman Telezhynskyi - ** @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 - ** 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 . - ** - *************************************************************************/ - -#ifndef ADDUNIONDETAILS_H -#define ADDUNIONDETAILS_H - -#include "vundocommand.h" - -class AddUnionDetails : public VUndoCommand -{ - Q_OBJECT -public: - AddUnionDetails(const QDomElement &xml, VAbstractPattern *doc, QUndoCommand *parent = 0); - virtual ~AddUnionDetails() Q_DECL_OVERRIDE; - virtual void undo() Q_DECL_OVERRIDE; - virtual void redo() Q_DECL_OVERRIDE; -private: - Q_DISABLE_COPY(AddUnionDetails) -}; - -#endif // ADDUNIONDETAILS_H diff --git a/src/libs/vtools/undocommands/undocommands.pri b/src/libs/vtools/undocommands/undocommands.pri index ab4307d71..46d553b32 100644 --- a/src/libs/vtools/undocommands/undocommands.pri +++ b/src/libs/vtools/undocommands/undocommands.pri @@ -14,7 +14,6 @@ HEADERS += \ $$PWD/deletepatternpiece.h \ $$PWD/adddetnode.h \ $$PWD/adddet.h \ - $$PWD/adduniondetails.h \ $$PWD/deletedetail.h \ $$PWD/vundocommand.h \ $$PWD/renamepp.h \ @@ -34,7 +33,6 @@ SOURCES += \ $$PWD/deletepatternpiece.cpp \ $$PWD/adddetnode.cpp \ $$PWD/adddet.cpp \ - $$PWD/adduniondetails.cpp \ $$PWD/deletedetail.cpp \ $$PWD/vundocommand.cpp \ $$PWD/renamepp.cpp \