From 3590ebac74f99def5adc163745d92c7133375e3a Mon Sep 17 00:00:00 2001 From: dismine Date: Sun, 5 Oct 2014 23:25:07 +0300 Subject: [PATCH] int instead ptrdiff_t. --HG-- branch : develop --- src/app/dialogs/tools/dialogdetail.cpp | 2 +- src/app/dialogs/tools/dialoguniondetails.cpp | 2 +- src/app/dialogs/tools/dialoguniondetails.h | 14 +++++++------- src/app/geometry/vdetail.h | 8 ++++---- src/app/geometry/vequidistant.cpp | 2 +- src/app/geometry/vsplinepath.cpp | 4 ++-- src/app/geometry/vsplinepath.h | 4 ++-- src/app/tools/vtooldetail.cpp | 10 +++++----- src/app/tools/vtooluniondetails.cpp | 14 +++++++------- src/app/tools/vtooluniondetails.h | 4 ++-- src/app/undocommands/savedetailoptions.cpp | 4 ++-- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/app/dialogs/tools/dialogdetail.cpp b/src/app/dialogs/tools/dialogdetail.cpp index 08b61a90a..92943718f 100644 --- a/src/app/dialogs/tools/dialogdetail.cpp +++ b/src/app/dialogs/tools/dialogdetail.cpp @@ -192,7 +192,7 @@ void DialogDetail::setDetails(const VDetail &value) { details = value; ui.listWidget->clear(); - for (ptrdiff_t i = 0; i < details.CountNode(); ++i) + for (int i = 0; i < details.CountNode(); ++i) { NewItem(details.at(i).getId(), details.at(i).getTypeTool(), details.at(i).getTypeNode(), details.at(i).getMx(), details.at(i).getMy()); diff --git a/src/app/dialogs/tools/dialoguniondetails.cpp b/src/app/dialogs/tools/dialoguniondetails.cpp index fd7de39bd..80b08877c 100644 --- a/src/app/dialogs/tools/dialoguniondetails.cpp +++ b/src/app/dialogs/tools/dialoguniondetails.cpp @@ -104,7 +104,7 @@ bool DialogUnionDetails::CheckObject(const quint32 &id, const quint32 &idDetail) * @param index index of edge */ void DialogUnionDetails::ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail, - ptrdiff_t &index) + int &index) { if (idDetail == 0) { diff --git a/src/app/dialogs/tools/dialoguniondetails.h b/src/app/dialogs/tools/dialoguniondetails.h index 37a34f29c..01aff8904 100644 --- a/src/app/dialogs/tools/dialoguniondetails.h +++ b/src/app/dialogs/tools/dialoguniondetails.h @@ -48,8 +48,8 @@ public: quint32 getD1() const; quint32 getD2() const; - ptrdiff_t getIndexD1() const; - ptrdiff_t getIndexD2() const; + int getIndexD1() const; + int getIndexD2() const; public slots: void ChosenObject(quint32 id, const SceneObject &type); virtual void UpdateList(); @@ -60,10 +60,10 @@ private: Ui::DialogUnionDetails *ui; /** @brief indexD1 index edge first detail */ - ptrdiff_t indexD1; + int indexD1; /** @brief indexD2 index edge second detail */ - ptrdiff_t indexD2; + int indexD2; /** @brief d1 id first detail */ quint32 d1; @@ -85,7 +85,7 @@ private: bool CheckObject(const quint32 &id, const quint32 &idDetail) const; void ChoosedDetail(const quint32 &id, const SceneObject &type, quint32 &idDetail, - ptrdiff_t &index); + int &index); }; //--------------------------------------------------------------------------------------------------------------------- @@ -113,7 +113,7 @@ inline quint32 DialogUnionDetails::getD2() const * @brief getIndexD1 return index edge first detail * @return index */ -inline ptrdiff_t DialogUnionDetails::getIndexD1() const +inline int DialogUnionDetails::getIndexD1() const { return indexD1; } @@ -123,7 +123,7 @@ inline ptrdiff_t DialogUnionDetails::getIndexD1() const * @brief getIndexD2 return index edge second detail * @return index */ -inline ptrdiff_t DialogUnionDetails::getIndexD2() const +inline int DialogUnionDetails::getIndexD2() const { return indexD2; } diff --git a/src/app/geometry/vdetail.h b/src/app/geometry/vdetail.h index 8e324d59d..50a3ac12c 100644 --- a/src/app/geometry/vdetail.h +++ b/src/app/geometry/vdetail.h @@ -93,13 +93,13 @@ public: * @param indx index node in list. * @return node */ - VNodeDetail & operator[](ptrdiff_t indx); + VNodeDetail & operator[](int indx); /** * @brief at find node by index in list. * @param indx index node in list. * @return const node. */ - const VNodeDetail & at ( ptrdiff_t indx ) const; + const VNodeDetail & at ( int indx ) const; /** * @brief getName return detail name. * @return name. @@ -175,7 +175,7 @@ public: * @param id object (arc, point, spline, splinePath) id. * @return index in list or -1 id can't find. */ - ptrdiff_t indexOfNode(const quint32 &id) const; + int indexOfNode(const quint32 &id) const; /** * @brief id return id detail in list data. * @return id. @@ -201,7 +201,7 @@ public: * @param p2 id second point. * @return edge index or -1 if points don't located on edge */ - ptrdiff_t Edge(const quint32 &p1, const quint32 &p2)const; + int Edge(const quint32 &p1, const quint32 &p2)const; /** * @brief NodeOnEdge return nodes located on edge with index. * @param index index of edge. diff --git a/src/app/geometry/vequidistant.cpp b/src/app/geometry/vequidistant.cpp index 28e640f7a..ec0bdcf90 100644 --- a/src/app/geometry/vequidistant.cpp +++ b/src/app/geometry/vequidistant.cpp @@ -43,7 +43,7 @@ QPainterPath VEquidistant::ContourPath(const quint32 &idDetail, const VContainer VDetail detail = data->GetDetail(idDetail); QVector points; QVector pointsEkv; - for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) + for (int i = 0; i< detail.CountNode(); ++i) { switch (detail.at(i).getTypeTool()) { diff --git a/src/app/geometry/vsplinepath.cpp b/src/app/geometry/vsplinepath.cpp index 4fa7736d9..33df03750 100644 --- a/src/app/geometry/vsplinepath.cpp +++ b/src/app/geometry/vsplinepath.cpp @@ -172,13 +172,13 @@ VSplinePath &VSplinePath::operator =(const VSplinePath &path) } //--------------------------------------------------------------------------------------------------------------------- -VSplinePoint & VSplinePath::operator[](ptrdiff_t indx) +VSplinePoint & VSplinePath::operator[](int indx) { return d->path[indx]; } //--------------------------------------------------------------------------------------------------------------------- -const VSplinePoint &VSplinePath::at(ptrdiff_t indx) const +const VSplinePoint &VSplinePath::at(int indx) const { return d->path[indx]; } diff --git a/src/app/geometry/vsplinepath.h b/src/app/geometry/vsplinepath.h index e0c3592f9..e562be232 100644 --- a/src/app/geometry/vsplinepath.h +++ b/src/app/geometry/vsplinepath.h @@ -143,13 +143,13 @@ public: * @param indx index in list. * @return spline point. */ - VSplinePoint &operator[](ptrdiff_t indx); + VSplinePoint &operator[](int indx); /** * @brief at return spline point by index. * @param indx index in list. * @return spline point. */ - const VSplinePoint &at(ptrdiff_t indx) const; + const VSplinePoint &at(int indx) const; /** * @brief CutSplinePath cut spline path into two. This method don't return two spline path. You must create spline * paths by yourself. diff --git a/src/app/tools/vtooldetail.cpp b/src/app/tools/vtooldetail.cpp index 66435ccd9..4e715b73c 100644 --- a/src/app/tools/vtooldetail.cpp +++ b/src/app/tools/vtooldetail.cpp @@ -76,7 +76,7 @@ VToolDetail::VToolDetail(VPattern *doc, VContainer *data, const quint32 &id, con :VAbstractTool(doc, data, id), QGraphicsPathItem(parent), dialog(nullptr), sceneDetails(scene) { VDetail detail = data->GetDetail(id); - for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) + for (int i = 0; i< detail.CountNode(); ++i) { switch (detail.at(i).getTypeTool()) { @@ -148,7 +148,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VPattern VDetail detail = dialogTool->getDetails(); VDetail det; qApp->getUndoStack()->beginMacro("add detail"); - for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) + for (int i = 0; i< detail.CountNode(); ++i) { quint32 id = 0; switch (detail.at(i).getTypeTool()) @@ -285,7 +285,7 @@ void VToolDetail::AddToFile() doc->SetAttribute(domElement, AttrClosed, detail.getClosed()); doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); - for (ptrdiff_t i = 0; i < detail.CountNode(); ++i) + for (int i = 0; i < detail.CountNode(); ++i) { AddNode(doc, domElement, detail.at(i)); } @@ -310,7 +310,7 @@ void VToolDetail::RefreshDataInFile() doc->SetAttribute(domElement, AttrClosed, QString().setNum(det.getClosed())); doc->SetAttribute(domElement, AttrWidth, QString().setNum(det.getWidth())); doc->RemoveAllChild(domElement); - for (ptrdiff_t i = 0; i < det.CountNode(); ++i) + for (int i = 0; i < det.CountNode(); ++i) { AddNode(doc, domElement, det.at(i)); } @@ -434,7 +434,7 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) void VToolDetail::RemoveReferens() { VDetail detail = VAbstractTool::data.GetDetail(id); - for (ptrdiff_t i = 0; i< detail.CountNode(); ++i) + for (int i = 0; i< detail.CountNode(); ++i) { doc->DecrementReferens(detail.at(i).getId()); } diff --git a/src/app/tools/vtooluniondetails.cpp b/src/app/tools/vtooluniondetails.cpp index 7eb134cc3..2e9373bba 100644 --- a/src/app/tools/vtooluniondetails.cpp +++ b/src/app/tools/vtooluniondetails.cpp @@ -90,7 +90,7 @@ VToolUnionDetails::VToolUnionDetails(VPattern *doc, VContainer *data, const quin * @param angle angle rotation. */ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, - const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx, + const VDetail &det, const int &i, const quint32 &idTool, const qreal &dx, const qreal &dy, const quint32 &pRotate, const qreal &angle) { quint32 id = 0, idObject = 0; @@ -273,7 +273,7 @@ void VToolUnionDetails::AddToNewDetail(QObject *tool, VPattern *doc, VContainer * @param pRotate point rotation. * @param angle angle rotation. */ -void VToolUnionDetails::UpdatePoints(const quint32 &idDetail, VContainer *data, const VDetail &det, const ptrdiff_t &i, +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, const qreal &angle) { @@ -518,11 +518,11 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d unionDetails = new VToolUnionDetails(doc, data, id, d1, d2, indexD1, indexD2, typeCreation, doc); QHash* tools = doc->getTools(); tools->insert(id, unionDetails); - for (ptrdiff_t i = 0; i < d1.CountNode(); ++i) + for (int i = 0; i < d1.CountNode(); ++i) { doc->IncrementReferens(d1.at(i).getId()); } - for (ptrdiff_t i = 0; i < d2.CountNode(); ++i) + for (int i = 0; i < d2.CountNode(); ++i) { doc->IncrementReferens(d2.at(i).getId()); } @@ -650,7 +650,7 @@ void VToolUnionDetails::FindJ(const qint32 &pointsD2, const VDetail &d2, const q VNodeDetail node1; VNodeDetail node2; d2.NodeOnEdge(indexD2, node1, node2); - ptrdiff_t k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId()); + int k = d2.RemoveEdge(indexD2).indexOfNode(node2.getId()); if (k == d2.RemoveEdge(indexD2).CountNode()-1) { j = 0; @@ -778,7 +778,7 @@ void VToolUnionDetails::AddDetail(QDomElement &domElement, VDetail &d) { QDomElement det = doc->createElement(TagDetail); - for (ptrdiff_t i = 0; i < d.CountNode(); ++i) + for (int i = 0; i < d.CountNode(); ++i) { AddNode(det, d.at(i)); } @@ -818,7 +818,7 @@ QDomNode VToolUnionDetails::UpdateDetail(const QDomNode &domNode, const VDetail if (domElement.tagName() == VToolUnionDetails::TagDetail) { doc->removeAllChilds(domElement);//delete all nodes in detail - for (ptrdiff_t i = 0; i < d.CountNode(); ++i) + for (int i = 0; i < d.CountNode(); ++i) { AddNode(domElement, d.at(i));//rewrite nodes of detail } diff --git a/src/app/tools/vtooluniondetails.h b/src/app/tools/vtooluniondetails.h index 737778532..2685bf049 100644 --- a/src/app/tools/vtooluniondetails.h +++ b/src/app/tools/vtooluniondetails.h @@ -69,9 +69,9 @@ public: static const QString NodeTypeContour; static const QString NodeTypeModeling; static void AddToNewDetail(QObject *tool, VPattern *doc, VContainer *data, VDetail &newDetail, - const VDetail &det, const ptrdiff_t &i, const quint32 &idTool, const qreal &dx = 0, + const VDetail &det, const int &i, const quint32 &idTool, 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 ptrdiff_t &i, + 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 BiasRotatePoint(VPointF *point, const qreal &dx, const qreal &dy, const QPointF &pRotate, diff --git a/src/app/undocommands/savedetailoptions.cpp b/src/app/undocommands/savedetailoptions.cpp index 9d2dc6c24..c3776104f 100644 --- a/src/app/undocommands/savedetailoptions.cpp +++ b/src/app/undocommands/savedetailoptions.cpp @@ -50,7 +50,7 @@ void SaveDetailOptions::undo() { SaveDet(domElement, oldDet); doc->RemoveAllChild(domElement); - for (ptrdiff_t i = 0; i < oldDet.CountNode(); ++i) + for (int i = 0; i < oldDet.CountNode(); ++i) { VToolDetail::AddNode(doc, domElement, oldDet.at(i)); } @@ -85,7 +85,7 @@ void SaveDetailOptions::redo() { SaveDet(domElement, newDet); doc->RemoveAllChild(domElement); - for (ptrdiff_t i = 0; i < newDet.CountNode(); ++i) + for (int i = 0; i < newDet.CountNode(); ++i) { VToolDetail::AddNode(doc, domElement, newDet.at(i)); }