From fab30e999f8e98a7fa2a798111570f44322b3a66 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 16 Jun 2015 18:01:17 +0300 Subject: [PATCH] Use VAbstractPattern in tools. --HG-- branch : feature --- src/app/tools/drawTools/vdrawtool.cpp | 4 ++-- src/app/tools/drawTools/vtoolpoint.cpp | 2 +- src/app/tools/drawTools/vtoolsinglepoint.cpp | 2 +- src/app/tools/drawTools/vtoolspline.cpp | 4 ++-- src/app/tools/drawTools/vtoolsplinepath.cpp | 4 ++-- src/app/tools/vabstracttool.cpp | 12 ++++++------ src/app/tools/vabstracttool.h | 8 ++++---- src/app/tools/vtooldetail.cpp | 4 ++-- src/app/undocommands/addtocalc.cpp | 4 ++-- src/libs/ifc/xml/vabstractpattern.h | 1 + 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/src/app/tools/drawTools/vdrawtool.cpp b/src/app/tools/drawTools/vdrawtool.cpp index eeabe8c91..c52726d64 100644 --- a/src/app/tools/drawTools/vdrawtool.cpp +++ b/src/app/tools/drawTools/vdrawtool.cpp @@ -131,7 +131,7 @@ void VDrawTool::SaveDialogChange() SaveDialog(newDomElement); SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id); - connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(saveOptions); } else @@ -182,7 +182,7 @@ void VDrawTool::SaveOption(QSharedPointer &obj) SaveOptions(newDomElement, obj); SaveToolOptions *saveOptions = new SaveToolOptions(oldDomElement, newDomElement, doc, id); - connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(saveOptions, &SaveToolOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(saveOptions); } else diff --git a/src/app/tools/drawTools/vtoolpoint.cpp b/src/app/tools/drawTools/vtoolpoint.cpp index 91d2ddf01..d1c0a94bb 100644 --- a/src/app/tools/drawTools/vtoolpoint.cpp +++ b/src/app/tools/drawTools/vtoolpoint.cpp @@ -136,7 +136,7 @@ void VToolPoint::NameChangePosition(const QPointF &pos) void VToolPoint::UpdateNamePosition(qreal mx, qreal my) { MoveLabel *moveLabel = new MoveLabel(doc, mx, my, id, this->scene()); - connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(moveLabel, &MoveLabel::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveLabel); } diff --git a/src/app/tools/drawTools/vtoolsinglepoint.cpp b/src/app/tools/drawTools/vtoolsinglepoint.cpp index f8b8c521c..0804cd307 100644 --- a/src/app/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/app/tools/drawTools/vtoolsinglepoint.cpp @@ -146,7 +146,7 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, QPointF newPos = value.toPointF(); MoveSPoint *moveSP = new MoveSPoint(doc, newPos.x(), newPos.y(), id, this->scene()); - connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(moveSP, &MoveSPoint::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSP); } return QGraphicsItem::itemChange(change, value); diff --git a/src/app/tools/drawTools/vtoolspline.cpp b/src/app/tools/drawTools/vtoolspline.cpp index 0985f93c1..8d9b1fba4 100644 --- a/src/app/tools/drawTools/vtoolspline.cpp +++ b/src/app/tools/drawTools/vtoolspline.cpp @@ -253,7 +253,7 @@ void VToolSpline::ControlPointChangePosition(const qint32 &indexSpline, const Sp } MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene()); - connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSpl); } @@ -416,7 +416,7 @@ void VToolSpline::mouseMoveEvent(QGraphicsSceneMouseEvent *event) VSpline spl = VSpline(spline->GetP1(), p2, p3, spline->GetP4(), spline->GetKcurve()); MoveSpline *moveSpl = new MoveSpline(doc, spline.data(), spl, id, this->scene()); - connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(moveSpl, &MoveSpline::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSpl); } diff --git a/src/app/tools/drawTools/vtoolsplinepath.cpp b/src/app/tools/drawTools/vtoolsplinepath.cpp index 0b176cfa1..e316f7a6e 100644 --- a/src/app/tools/drawTools/vtoolsplinepath.cpp +++ b/src/app/tools/drawTools/vtoolsplinepath.cpp @@ -211,7 +211,7 @@ void VToolSplinePath::ControlPointChangePosition(const qint32 &indexSpline, cons UpdateControlPoints(spl, newSplPath, indexSpline); MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene()); - connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSplPath); } @@ -493,7 +493,7 @@ void VToolSplinePath::mouseMoveEvent(QGraphicsSceneMouseEvent *event) UpdateControlPoints(spl, newSplPath, indexSpline); MoveSplinePath *moveSplPath = new MoveSplinePath(doc, oldSplPath, newSplPath, id, this->scene()); - connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(moveSplPath, &VUndoCommand::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveSplPath); } diff --git a/src/app/tools/vabstracttool.cpp b/src/app/tools/vabstracttool.cpp index f85c369f9..d68c3268a 100644 --- a/src/app/tools/vabstracttool.cpp +++ b/src/app/tools/vabstracttool.cpp @@ -111,13 +111,13 @@ const QString VAbstractTool::ColorYellow = QStringLiteral("yellow"); * @param id object id in container. * @param parent parent object. */ -VAbstractTool::VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent) +VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent) :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(nullptr) { SCASSERT(doc != nullptr); - connect(this, &VAbstractTool::toolhaveChange, this->doc, &VPattern::haveLiteChange); - connect(this->doc, &VPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile); - connect(this, &VAbstractTool::LiteUpdateTree, this->doc, &VPattern::LiteParseTree); + connect(this, &VAbstractTool::toolhaveChange, this->doc, &VAbstractPattern::haveLiteChange); + connect(this->doc, &VAbstractPattern::FullUpdateFromFile, this, &VAbstractTool::FullUpdateFromFile); + connect(this, &VAbstractTool::LiteUpdateTree, this->doc, &VAbstractPattern::LiteParseTree); } //--------------------------------------------------------------------------------------------------------------------- @@ -141,7 +141,7 @@ void VAbstractTool::DeleteTool(bool ask) } } DelTool *delTool = new DelTool(doc, id); - connect(delTool, &DelTool::NeedFullParsing, doc, &VPattern::NeedFullParsing); + connect(delTool, &DelTool::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing); qApp->getUndoStack()->push(delTool); } } @@ -333,7 +333,7 @@ const QStringList VAbstractTool::StylesList() * @param toolType tool type * @param doc dom document container */ -void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VPattern *doc) +void VAbstractTool::AddRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc) { QVector *history = doc->getHistory(); VToolRecord record = VToolRecord(id, toolType, doc->GetNameActivPP()); diff --git a/src/app/tools/vabstracttool.h b/src/app/tools/vabstracttool.h index 92510807b..e2d029bab 100644 --- a/src/app/tools/vabstracttool.h +++ b/src/app/tools/vabstracttool.h @@ -30,7 +30,7 @@ #define VABSTRACTTOOL_H #include "vdatatool.h" -#include "../xml/vpattern.h" +#include "../../libs/ifc/xml/vabstractpattern.h" #include "../core/vapplication.h" #include "../libs/vwidgets/vmaingraphicsscene.h" #include "../visualization/visualization.h" @@ -51,7 +51,7 @@ class VAbstractTool: public VDataTool { Q_OBJECT public: - VAbstractTool(VPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr); + VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent = nullptr); virtual ~VAbstractTool(); quint32 getId() const; static const QString AttrType; @@ -124,7 +124,7 @@ public: static const QStringList Colors(); static QMap ColorsList(); - static void AddRecord(const quint32 id, const Tool &toolType, VPattern *doc); + static void AddRecord(const quint32 id, const Tool &toolType, VAbstractPattern *doc); const VContainer *getData() const; @@ -153,7 +153,7 @@ signals: void LiteUpdateTree(const Document &parse); protected: /** @brief doc dom document container */ - VPattern *doc; + VAbstractPattern *doc; /** @brief id object id. */ const quint32 id; diff --git a/src/app/tools/vtooldetail.cpp b/src/app/tools/vtooldetail.cpp index 6303b5284..a698b8b29 100644 --- a/src/app/tools/vtooldetail.cpp +++ b/src/app/tools/vtooldetail.cpp @@ -264,7 +264,7 @@ void VToolDetail::FullUpdateFromGuiOk(int result) VDetail oldDet = VAbstractTool::data.GetDetail(id); SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene()); - connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(saveCommand); } delete dialog; @@ -335,7 +335,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const QPointF newPos = value.toPointF(); MoveDetail *moveDet = new MoveDetail(doc, newPos.x(), newPos.y(), id, this->scene()); - connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VPattern::LiteParseTree); + connect(moveDet, &MoveDetail::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree); qApp->getUndoStack()->push(moveDet); } diff --git a/src/app/undocommands/addtocalc.cpp b/src/app/undocommands/addtocalc.cpp index 0ef79f65b..1e7148ebf 100644 --- a/src/app/undocommands/addtocalc.cpp +++ b/src/app/undocommands/addtocalc.cpp @@ -53,7 +53,7 @@ void AddToCalc::undo() doc->setCursor(cursor); QDomElement calcElement; - if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement)) + if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement)) { QDomElement domElement = doc->elementById(nodeId); if (domElement.isElement()) @@ -93,7 +93,7 @@ void AddToCalc::redo() doc->setCursor(cursor); QDomElement calcElement; - if (doc->GetActivNodeElement(VPattern::TagCalculation, calcElement)) + if (doc->GetActivNodeElement(VAbstractPattern::TagCalculation, calcElement)) { if (cursor <= 0) { diff --git a/src/libs/ifc/xml/vabstractpattern.h b/src/libs/ifc/xml/vabstractpattern.h index 5c2511a5d..c6f0acf30 100644 --- a/src/libs/ifc/xml/vabstractpattern.h +++ b/src/libs/ifc/xml/vabstractpattern.h @@ -205,6 +205,7 @@ signals: void SetCurrentPP(const QString &patterPiece); public slots: + virtual void LiteParseTree(const Document &parse)=0; void haveLiteChange(); void ShowHistoryTool(quint32 id, bool enable); void NeedFullParsing();