From dfd717fb24409b7a909df433cd31ae4ff6198b8a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 19 Jun 2015 15:08:27 +0300 Subject: [PATCH] Rename VToolSinglePoint to VToolBasePoint. --HG-- branch : develop --- src/app/core/vtooloptionspropertybrowser.cpp | 12 ++--- src/app/dialogs/dialoghistory.cpp | 2 +- src/app/mainwindow.cpp | 14 +++--- src/app/xml/vpattern.cpp | 24 +++++----- src/libs/vmisc/def.h | 2 +- src/libs/vtools/tools/drawTools/drawtools.h | 2 +- ...toolsinglepoint.cpp => vtoolbasepoint.cpp} | 48 +++++++++---------- .../{vtoolsinglepoint.h => vtoolbasepoint.h} | 16 +++---- src/libs/vtools/tools/tools.pri | 4 +- 9 files changed, 62 insertions(+), 62 deletions(-) rename src/libs/vtools/tools/drawTools/{vtoolsinglepoint.cpp => vtoolbasepoint.cpp} (88%) rename src/libs/vtools/tools/drawTools/{vtoolsinglepoint.h => vtoolbasepoint.h} (86%) diff --git a/src/app/core/vtooloptionspropertybrowser.cpp b/src/app/core/vtooloptionspropertybrowser.cpp index 3965a5d03..364011711 100644 --- a/src/app/core/vtooloptionspropertybrowser.cpp +++ b/src/app/core/vtooloptionspropertybrowser.cpp @@ -74,7 +74,7 @@ void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item) { switch (item->type()) { - case VToolSinglePoint::Type: + case VToolBasePoint::Type: ShowOptionsToolSinglePoint(item); break; case VToolEndLine::Type: @@ -176,7 +176,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions() switch (currentItem->type()) { - case VToolSinglePoint::Type: + case VToolBasePoint::Type: UpdateOptionsToolSinglePoint(); break; case VToolEndLine::Type: @@ -293,7 +293,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property) switch (currentItem->type()) { - case VToolSinglePoint::Type: + case VToolBasePoint::Type: ChangeDataToolSinglePoint(prop); break; case VToolEndLine::Type: @@ -555,7 +555,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolSinglePoint(VProperty *property) switch (PropertiesList().indexOf(id)) { case 0: // VAbstractTool::AttrName - SetPointName(value.toString()); + SetPointName(value.toString()); break; case 1: // QLatin1String("position") currentItem->setPos(value.toPointF()); @@ -1227,7 +1227,7 @@ void VToolOptionsPropertyBrowser::ChangeDataToolCurveIntersectAxis(VProperty *pr //--------------------------------------------------------------------------------------------------------------------- void VToolOptionsPropertyBrowser::ShowOptionsToolSinglePoint(QGraphicsItem *item) { - VToolSinglePoint *i = qgraphicsitem_cast(item); + VToolBasePoint *i = qgraphicsitem_cast(item); i->ShowVisualization(true); formView->setTitle(tr("Base point")); @@ -1551,7 +1551,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsToolCurveIntersectAxis(QGraphicsIte //--------------------------------------------------------------------------------------------------------------------- void VToolOptionsPropertyBrowser::UpdateOptionsToolSinglePoint() { - VToolSinglePoint *i = qgraphicsitem_cast(currentItem); + VToolBasePoint *i = qgraphicsitem_cast(currentItem); idToProperty[VAbstractTool::AttrName]->setValue(i->name()); idToProperty[QLatin1String("position")]->setValue(i->pos()); } diff --git a/src/app/dialogs/dialoghistory.cpp b/src/app/dialogs/dialoghistory.cpp index 527a319f0..d34542c61 100644 --- a/src/app/dialogs/dialoghistory.cpp +++ b/src/app/dialogs/dialoghistory.cpp @@ -213,7 +213,7 @@ QString DialogHistory::Record(const VToolRecord &tool) case Tool::Arrow: Q_UNREACHABLE(); break; - case Tool::SinglePoint: + case Tool::BasePoint: { return QString(tr("%1 - Base point")).arg(PointName(tool.getId())); } diff --git a/src/app/mainwindow.cpp b/src/app/mainwindow.cpp index b604823f4..31c0cff51 100644 --- a/src/app/mainwindow.cpp +++ b/src/app/mainwindow.cpp @@ -174,19 +174,19 @@ void MainWindow::AddPP(const QString &PPName, const QString &path) ui->view->itemClicked(nullptr);//hide options previous tool const QString label = doc->GenerateLabel(LabelType::NewPatternPiece); const quint32 id = pattern->AddGObject(new VPointF(30+comboBoxDraws->count()*5, 40, label, 5, 10)); - VToolSinglePoint *spoint = new VToolSinglePoint(doc, pattern, id, Source::FromGui, PPName, path); + VToolBasePoint *spoint = new VToolBasePoint(doc, pattern, id, Source::FromGui, PPName, path); sceneDraw->addItem(spoint); ui->view->itemClicked(spoint); connect(spoint, &VToolPoint::ChoosedTool, sceneDraw, &VMainGraphicsScene::ChoosedItem); - connect(sceneDraw, &VMainGraphicsScene::DisableItem, spoint, &VToolSinglePoint::Disable); - connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); - connect(sceneDraw, &VMainGraphicsScene::EnableToolMove, spoint, &VToolSinglePoint::EnableToolMove); + connect(sceneDraw, &VMainGraphicsScene::DisableItem, spoint, &VToolBasePoint::Disable); + connect(sceneDraw, &VMainGraphicsScene::NewFactor, spoint, &VToolBasePoint::SetFactor); + connect(sceneDraw, &VMainGraphicsScene::EnableToolMove, spoint, &VToolBasePoint::EnableToolMove); QHash* tools = doc->getTools(); SCASSERT(tools != nullptr); tools->insert(id, spoint); - VDrawTool::AddRecord(id, Tool::SinglePoint, doc); + VDrawTool::AddRecord(id, Tool::BasePoint, doc); SetEnableTool(true); SetEnableWidgets(true); @@ -1093,7 +1093,7 @@ void MainWindow::CancelTool() helpLabel->setText(""); ui->actionStopTool->setEnabled(true); return; - case Tool::SinglePoint: + case Tool::BasePoint: Q_UNREACHABLE(); //Nothing to do here because we can't create this tool from main window. break; @@ -2476,7 +2476,7 @@ void MainWindow::LastUsedTool() ui->actionArrowTool->setChecked(true); ArrowTool(); break; - case Tool::SinglePoint: + case Tool::BasePoint: Q_UNREACHABLE(); //Nothing to do here because we can't create this tool from main window. break; diff --git a/src/app/xml/vpattern.cpp b/src/app/xml/vpattern.cpp index fe923ca49..14b6b8d1d 100644 --- a/src/app/xml/vpattern.cpp +++ b/src/app/xml/vpattern.cpp @@ -294,7 +294,7 @@ quint32 VPattern::SPointActiveDraw() if (domElement.isNull() == false) { if (domElement.tagName() == VToolPoint::TagName && - domElement.attribute(AttrType, "") == VToolSinglePoint::ToolType) + domElement.attribute(AttrType, "") == VToolBasePoint::ToolType) { return GetParametrId(domElement); } @@ -666,7 +666,7 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem QString typeLine; QString lineColor; - QStringList points = QStringList() << VToolSinglePoint::ToolType << VToolEndLine::ToolType + QStringList points = QStringList() << VToolBasePoint::ToolType << VToolEndLine::ToolType << VToolAlongLine::ToolType << VToolShoulderPoint::ToolType << VToolNormal::ToolType << VToolBisector::ToolType << VToolLineIntersect::ToolType << VToolPointOfContact::ToolType @@ -680,9 +680,9 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem << VToolPointFromArcAndTangent::ToolType; switch (points.indexOf(type)) { - case 0: //VToolSinglePoint::ToolType + case 0: //VToolBasePoint::ToolType { - VToolSinglePoint *spoint = 0; + VToolBasePoint *spoint = 0; try { PointsCommonAttributes(domElement, id, name, mx, my); @@ -690,19 +690,19 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem const qreal y = qApp->toPixel(GetParametrDouble(domElement, VAbstractTool::AttrY, "10.0")); data->UpdateGObject(id, new VPointF(x, y, name, mx, my)); - VDrawTool::AddRecord(id, Tool::SinglePoint, this); + VDrawTool::AddRecord(id, Tool::BasePoint, this); if (parse != Document::FullParse) { UpdateToolData(id, data); } if (parse == Document::FullParse) { - spoint = new VToolSinglePoint(this, data, id, Source::FromFile, nameActivPP, MPath()); + spoint = new VToolBasePoint(this, data, id, Source::FromFile, nameActivPP, MPath()); scene->addItem(spoint); - connect(spoint, &VToolSinglePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); - connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolSinglePoint::SetFactor); - connect(scene, &VMainGraphicsScene::DisableItem, spoint, &VToolSinglePoint::Disable); - connect(scene, &VMainGraphicsScene::EnableToolMove, spoint, &VToolSinglePoint::EnableToolMove); + connect(spoint, &VToolBasePoint::ChoosedTool, scene, &VMainGraphicsScene::ChoosedItem); + connect(scene, &VMainGraphicsScene::NewFactor, spoint, &VToolBasePoint::SetFactor); + connect(scene, &VMainGraphicsScene::DisableItem, spoint, &VToolBasePoint::Disable); + connect(scene, &VMainGraphicsScene::EnableToolMove, spoint, &VToolBasePoint::EnableToolMove); tools[id] = spoint; } } @@ -1900,8 +1900,8 @@ QRectF VPattern::ActiveDrawBoundingRect() const case Tool::Arrow: Q_UNREACHABLE(); break; - case Tool::SinglePoint: - rec = ToolBoundingRect(rec, tool.getId()); + case Tool::BasePoint: + rec = ToolBoundingRect(rec, tool.getId()); break; case Tool::EndLine: rec = ToolBoundingRect(rec, tool.getId()); diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 067ae0b6d..4e57c9518 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -49,7 +49,7 @@ enum class Tool : unsigned char LinePoint, AbstractSpline, Cut, - SinglePoint, + BasePoint, EndLine, Line, AlongLine, diff --git a/src/libs/vtools/tools/drawTools/drawtools.h b/src/libs/vtools/tools/drawTools/drawtools.h index 1b8c70894..2b2e1eccc 100644 --- a/src/libs/vtools/tools/drawTools/drawtools.h +++ b/src/libs/vtools/tools/drawTools/drawtools.h @@ -39,7 +39,7 @@ #include "vtoolnormal.h" #include "vtoolpointofcontact.h" #include "vtoolshoulderpoint.h" -#include "vtoolsinglepoint.h" +#include "vtoolbasepoint.h" #include "vtoolspline.h" #include "vtoolsplinepath.h" #include "vtoolheight.h" diff --git a/src/libs/vtools/tools/drawTools/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/vtoolbasepoint.cpp similarity index 88% rename from src/libs/vtools/tools/drawTools/vtoolsinglepoint.cpp rename to src/libs/vtools/tools/drawTools/vtoolbasepoint.cpp index 8da862cfe..f30831f23 100644 --- a/src/libs/vtools/tools/drawTools/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolbasepoint.cpp @@ -26,7 +26,7 @@ ** *************************************************************************/ -#include "vtoolsinglepoint.h" +#include "vtoolbasepoint.h" #include "../../dialogs/tools/dialogsinglepoint.h" #include "../../../vwidgets/vgraphicssimpletextitem.h" #include "../../undocommands/movespoint.h" @@ -36,19 +36,19 @@ #include -const QString VToolSinglePoint::ToolType = QStringLiteral("single"); +const QString VToolBasePoint::ToolType = QStringLiteral("single"); //--------------------------------------------------------------------------------------------------------------------- /** - * @brief VToolSinglePoint constructor. + * @brief VToolBasePoint constructor. * @param doc dom document container. * @param data container with variables. * @param id object id in container. * @param typeCreation way we create this tool. * @param parent parent object. */ -VToolSinglePoint::VToolSinglePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, - const QString &namePP, const QString &mPath, QGraphicsItem * parent ) +VToolBasePoint::VToolBasePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, + const QString &namePP, const QString &mPath, QGraphicsItem * parent ) :VToolPoint(doc, data, id, parent), namePP(namePP), mPath(mPath) { baseColor = Qt::red; @@ -61,7 +61,7 @@ VToolSinglePoint::VToolSinglePoint (VAbstractPattern *doc, VContainer *data, qui } //--------------------------------------------------------------------------------------------------------------------- -VToolSinglePoint::~VToolSinglePoint() +VToolBasePoint::~VToolBasePoint() { //Disable cursor-arrow-openhand RestoreOverrideCursor(cursorArrowOpenHand); @@ -71,7 +71,7 @@ VToolSinglePoint::~VToolSinglePoint() /** * @brief setDialog set dialog when user want change tool option. */ -void VToolSinglePoint::setDialog() +void VToolBasePoint::setDialog() { SCASSERT(dialog != nullptr); DialogSinglePoint *dialogTool = qobject_cast(dialog); @@ -81,7 +81,7 @@ void VToolSinglePoint::setDialog() } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::ShowVisualization(bool show) +void VToolBasePoint::ShowVisualization(bool show) { Q_UNUSED(show); //don't have any visualization for base point yet } @@ -90,7 +90,7 @@ void VToolSinglePoint::ShowVisualization(bool show) /** * @brief AddToFile add tag with informations about tool into file. */ -void VToolSinglePoint::AddToFile() +void VToolBasePoint::AddToFile() { Q_ASSERT_X(namePP.isEmpty() == false, "AddToFile", "name pattern piece is empty"); @@ -124,7 +124,7 @@ void VToolSinglePoint::AddToFile() * @param value value. * @return value. */ -QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) +QVariant VToolBasePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) { if (change == ItemPositionChange && scene()) { @@ -155,7 +155,7 @@ QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, /** * @brief decrementReferens decrement referens parents objects. */ -void VToolSinglePoint::decrementReferens() +void VToolBasePoint::decrementReferens() { if (_referens > 1) { @@ -164,7 +164,7 @@ void VToolSinglePoint::decrementReferens() } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::DeleteTool(bool ask) +void VToolBasePoint::DeleteTool(bool ask) { if (_referens <= 1) { @@ -187,7 +187,7 @@ void VToolSinglePoint::DeleteTool(bool ask) /** * @brief SaveDialog save options into file after change in dialog. */ -void VToolSinglePoint::SaveDialog(QDomElement &domElement) +void VToolBasePoint::SaveDialog(QDomElement &domElement) { SCASSERT(dialog != nullptr); DialogSinglePoint *dialogTool = qobject_cast(dialog); @@ -200,7 +200,7 @@ void VToolSinglePoint::SaveDialog(QDomElement &domElement) } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event) +void VToolBasePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event) { VToolPoint::hoverEnterEvent(event); @@ -211,7 +211,7 @@ void VToolSinglePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event) } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) +void VToolBasePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { VToolPoint::hoverLeaveEvent(event); @@ -223,7 +223,7 @@ void VToolSinglePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event) +void VToolBasePoint::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (flags() & QGraphicsItem::ItemIsMovable) { @@ -236,7 +236,7 @@ void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event) } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) +void VToolBasePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { if (flags() & QGraphicsItem::ItemIsMovable) { @@ -254,14 +254,14 @@ void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) * @brief SetColorLabel change color for label and label line. * @param color new color. */ -void VToolSinglePoint::SetColorLabel(const Qt::GlobalColor &color) +void VToolBasePoint::SetColorLabel(const Qt::GlobalColor &color) { namePoint->setBrush(color); lineName->setPen(QPen(color, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer &obj) +void VToolBasePoint::SaveOptions(QDomElement &tag, QSharedPointer &obj) { VToolPoint::SaveOptions(tag, obj); @@ -274,7 +274,7 @@ void VToolSinglePoint::SaveOptions(QDomElement &tag, QSharedPointer &o } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::ReadToolAttributes(const QDomElement &domElement) +void VToolBasePoint::ReadToolAttributes(const QDomElement &domElement) { Q_UNUSED(domElement); // This tool doesn't need read attributes from file. @@ -285,7 +285,7 @@ void VToolSinglePoint::ReadToolAttributes(const QDomElement &domElement) * @brief contextMenuEvent handle context menu events. * @param event context menu event. */ -void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) +void VToolBasePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) { #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); @@ -308,7 +308,7 @@ void VToolSinglePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event /** * @brief FullUpdateFromFile update tool data form file. */ -void VToolSinglePoint::FullUpdateFromFile() +void VToolBasePoint::FullUpdateFromFile() { VPointF point = *VAbstractTool::data.GeometricObject(id); RefreshPointGeometry(point); @@ -319,14 +319,14 @@ void VToolSinglePoint::FullUpdateFromFile() * @brief SetFactor set current scale factor of scene. * @param factor scene scale factor. */ -void VToolSinglePoint::SetFactor(qreal factor) +void VToolBasePoint::SetFactor(qreal factor) { VDrawTool::SetFactor(factor); RefreshPointGeometry(*(VAbstractTool::data.GeometricObject(id))); } //--------------------------------------------------------------------------------------------------------------------- -void VToolSinglePoint::EnableToolMove(bool move) +void VToolBasePoint::EnableToolMove(bool move) { this->setFlag(QGraphicsItem::ItemIsMovable, move); VToolPoint::EnableToolMove(move); diff --git a/src/libs/vtools/tools/drawTools/vtoolsinglepoint.h b/src/libs/vtools/tools/drawTools/vtoolbasepoint.h similarity index 86% rename from src/libs/vtools/tools/drawTools/vtoolsinglepoint.h rename to src/libs/vtools/tools/drawTools/vtoolbasepoint.h index 73289eefa..790703207 100644 --- a/src/libs/vtools/tools/drawTools/vtoolsinglepoint.h +++ b/src/libs/vtools/tools/drawTools/vtoolbasepoint.h @@ -26,26 +26,26 @@ ** *************************************************************************/ -#ifndef VTOOLSINGLEPOINT_H -#define VTOOLSINGLEPOINT_H +#ifndef VTOOLBASEPOINT_H +#define VTOOLBASEPOINT_H #include "vtoolpoint.h" /** - * @brief The VToolSinglePoint class tool for creation pattern base point. Obly base point can move. All object + * @brief The VToolBasePoint class tool for creation pattern base point. Obly base point can move. All object * pattern peace depend on base point. */ -class VToolSinglePoint : public VToolPoint +class VToolBasePoint : public VToolPoint { Q_OBJECT public: - VToolSinglePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, + VToolBasePoint (VAbstractPattern *doc, VContainer *data, quint32 id, const Source &typeCreation, const QString &namePP, const QString &mPath, QGraphicsItem * parent = nullptr ); - virtual ~VToolSinglePoint(); + virtual ~VToolBasePoint(); virtual void setDialog(); static const QString ToolType; virtual int type() const {return Type;} - enum { Type = UserType + static_cast(Tool::SinglePoint)}; + enum { Type = UserType + static_cast(Tool::BasePoint)}; virtual void ShowVisualization(bool show); public slots: virtual void FullUpdateFromFile(); @@ -77,4 +77,4 @@ private: }; -#endif // VTOOLSINGLEPOINT_H +#endif // VTOOLBASEPOINT_H diff --git a/src/libs/vtools/tools/tools.pri b/src/libs/vtools/tools/tools.pri index 43251ec38..e7e62ad63 100644 --- a/src/libs/vtools/tools/tools.pri +++ b/src/libs/vtools/tools/tools.pri @@ -9,7 +9,7 @@ HEADERS += \ $$PWD/drawTools/vtooltriangle.h \ $$PWD/drawTools/vtoolsplinepath.h \ $$PWD/drawTools/vtoolspline.h \ - $$PWD/drawTools/vtoolsinglepoint.h \ + $$PWD/drawTools/vtoolbasepoint.h \ $$PWD/drawTools/vtoolshoulderpoint.h \ $$PWD/drawTools/vtoolpointofintersection.h \ $$PWD/drawTools/vtoolpointofcontact.h \ @@ -52,7 +52,7 @@ SOURCES += \ $$PWD/drawTools/vtooltriangle.cpp \ $$PWD/drawTools/vtoolsplinepath.cpp \ $$PWD/drawTools/vtoolspline.cpp \ - $$PWD/drawTools/vtoolsinglepoint.cpp \ + $$PWD/drawTools/vtoolbasepoint.cpp \ $$PWD/drawTools/vtoolshoulderpoint.cpp \ $$PWD/drawTools/vtoolpointofintersection.cpp \ $$PWD/drawTools/vtoolpointofcontact.cpp \