From 5fe41e8a998ab27d019f34fba12b9f5e0aec46af Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 20 Sep 2016 21:12:19 +0300 Subject: [PATCH 01/13] Suppress message inside noisyFailureMsgHandler. ref #568. --HG-- branch : develop --- src/app/tape/mapplication.cpp | 6 ++++++ src/app/valentina/core/vapplication.cpp | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index d134681da..4337f0899 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -108,6 +108,12 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con { type = QtDebugMsg; } + + // See issue #568 + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("Error receiving trust for a CA certificate"))) + { + type = QtDebugMsg; + } #endif // this is another one that doesn't make sense as just a debug message. pretty serious diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index c2b303348..c47cd4f9f 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -103,6 +103,12 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con { type = QtDebugMsg; } + + // See issue #568 + if ((type == QtWarningMsg) && msg.contains(QStringLiteral("Error receiving trust for a CA certificate"))) + { + type = QtDebugMsg; + } #endif // this is another one that doesn't make sense as just a debug message. pretty serious From d8874c844f5c0a05ea5878caecfaefeb6340c870 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 20 Sep 2016 21:33:33 +0300 Subject: [PATCH 02/13] Suppress all messages that contain string "Error receiving trust for a CA certificate". ref #568. --HG-- branch : develop --- src/app/tape/mapplication.cpp | 2 +- src/app/valentina/core/vapplication.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/tape/mapplication.cpp b/src/app/tape/mapplication.cpp index 4337f0899..cad65dc98 100644 --- a/src/app/tape/mapplication.cpp +++ b/src/app/tape/mapplication.cpp @@ -110,7 +110,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con } // See issue #568 - if ((type == QtWarningMsg) && msg.contains(QStringLiteral("Error receiving trust for a CA certificate"))) + if (msg.contains(QStringLiteral("Error receiving trust for a CA certificate"))) { type = QtDebugMsg; } diff --git a/src/app/valentina/core/vapplication.cpp b/src/app/valentina/core/vapplication.cpp index c47cd4f9f..8c9130e04 100644 --- a/src/app/valentina/core/vapplication.cpp +++ b/src/app/valentina/core/vapplication.cpp @@ -105,7 +105,7 @@ inline void noisyFailureMsgHandler(QtMsgType type, const QMessageLogContext &con } // See issue #568 - if ((type == QtWarningMsg) && msg.contains(QStringLiteral("Error receiving trust for a CA certificate"))) + if (msg.contains(QStringLiteral("Error receiving trust for a CA certificate"))) { type = QtDebugMsg; } From 378ec5f4b71b28a105c1023972b293d192029e39 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Fri, 23 Sep 2016 19:17:25 +0300 Subject: [PATCH 03/13] Add two news files to the collection. --HG-- branch : develop --- .../collection/Basic_block_women-2016.val | 649 +++++++ .../collection/Gent_Jacket_with_tummy.val | 1725 +++++++++++++++++ src/test/CollectionTest/CollectionTest.pro | 4 +- .../tst_valentinacommandline.cpp | 4 +- 4 files changed, 2380 insertions(+), 2 deletions(-) create mode 100644 src/app/share/collection/Basic_block_women-2016.val create mode 100644 src/app/share/collection/Gent_Jacket_with_tummy.val diff --git a/src/app/share/collection/Basic_block_women-2016.val b/src/app/share/collection/Basic_block_women-2016.val new file mode 100644 index 000000000..aab88b1f6 --- /dev/null +++ b/src/app/share/collection/Basic_block_women-2016.val @@ -0,0 +1,649 @@ + + + + 0.3.5 + cm + Timo Virtaneva + Female Basic Block + Differen Dart locations available + Female Basic Block + F-Basic-Bloack-2016 + Stinde Design + Customer + Measured + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/src/app/share/collection/Gent_Jacket_with_tummy.val b/src/app/share/collection/Gent_Jacket_with_tummy.val new file mode 100644 index 000000000..a2a5eb31e --- /dev/null +++ b/src/app/share/collection/Gent_Jacket_with_tummy.val @@ -0,0 +1,1725 @@ + + + + 0.3.5 + cm + + + + Gent jacket(with tummy) + Jacket_20160914 + StindeDesign + Customer + Bespoke + true + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
diff --git a/src/test/CollectionTest/CollectionTest.pro b/src/test/CollectionTest/CollectionTest.pro index 660d9a029..9a99bdb59 100644 --- a/src/test/CollectionTest/CollectionTest.pro +++ b/src/test/CollectionTest/CollectionTest.pro @@ -231,7 +231,9 @@ COLLECTION_FILES += \ $${PWD}/../../app/share/collection/Trousers/Trousers.val \ $${PWD}/../../app/share/collection/Trousers/trousers.vit \ $${PWD}/../../app/share/collection/Steampunk_trousers.val \ - $${PWD}/../../app/share/collection/Steampunk_trousers.vit + $${PWD}/../../app/share/collection/Steampunk_trousers.vit \ + $${PWD}/../../app/share/collection/Basic_block_women-2016.val \ + $${PWD}/../../app/share/collection/Gent_Jacket_with_tummy.val # Compilation will fail without this files after we added them to this section. OTHER_FILES += \ diff --git a/src/test/CollectionTest/tst_valentinacommandline.cpp b/src/test/CollectionTest/tst_valentinacommandline.cpp index 926b9352c..3085a70db 100644 --- a/src/test/CollectionTest/tst_valentinacommandline.cpp +++ b/src/test/CollectionTest/tst_valentinacommandline.cpp @@ -275,7 +275,9 @@ void TST_ValentinaCommandLine::TestOpenCollection_data() const QTest::newRow("TestDart") << "TestDart.val" << keyTest << true << V_EX_OK; QTest::newRow("MaleShirt") << "MaleShirt.val" << keyTest << true << V_EX_OK; QTest::newRow("Trousers") << "Trousers.val" << keyTest << true << V_EX_OK; - QTest::newRow("Steampunk_trousers") << "Steampunk_trousers.val" << keyTest << true << V_EX_OK; + QTest::newRow("Basic block women") << "Basic_block_women-2016.val" << keyTest << true << V_EX_OK; + QTest::newRow("Gent Jacket with tummy") << "Gent_Jacket_with_tummy.val" << keyTest << true << V_EX_OK; + QTest::newRow("Steampunk_trousers") << "Steampunk_trousers.val" << keyTest << true << V_EX_OK; #ifndef Q_OS_WIN QTest::newRow("patrón_blusa") << "patrón_blusa.val" << keyTest << true << V_EX_OK; QTest::newRow("PajamaTopWrap2") << "PajamaTopWrap2.val" << keyTest << true << V_EX_OK; From 1ed9983ee7f9336bc4031bf9d3702ace313843ba Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 24 Sep 2016 14:41:05 +0300 Subject: [PATCH 04/13] Fix wrong disabling VSimplePoint and VSimpleCurve after changing a pattern piece. --HG-- branch : develop --- src/libs/vwidgets/vabstractsimple.cpp | 15 ++++++++++- src/libs/vwidgets/vabstractsimple.h | 39 +++++---------------------- src/libs/vwidgets/vsimplecurve.cpp | 19 +++++-------- src/libs/vwidgets/vsimplecurve.h | 5 ++-- src/libs/vwidgets/vsimplepoint.cpp | 26 ++++-------------- src/libs/vwidgets/vsimplepoint.h | 3 --- 6 files changed, 34 insertions(+), 73 deletions(-) diff --git a/src/libs/vwidgets/vabstractsimple.cpp b/src/libs/vwidgets/vabstractsimple.cpp index ddf042afa..47796cf74 100644 --- a/src/libs/vwidgets/vabstractsimple.cpp +++ b/src/libs/vwidgets/vabstractsimple.cpp @@ -28,6 +28,8 @@ #include "vabstractsimple.h" +const qreal VAbstractSimple::m_defFactor = 1; + //--------------------------------------------------------------------------------------------------------------------- VAbstractSimple::VAbstractSimple(quint32 id, const QColor ¤tColor, Unit patternUnit, qreal *factor, QObject *parent) @@ -39,7 +41,12 @@ VAbstractSimple::VAbstractSimple(quint32 id, const QColor ¤tColor, Unit pa patternUnit(patternUnit), selectionType(SelectionType::ByMouseRelease), type(GOType::Unknown) -{} +{ + if (this->factor == nullptr) + { + this->factor = const_cast(&m_defFactor); + } +} //--------------------------------------------------------------------------------------------------------------------- VAbstractSimple::~VAbstractSimple() @@ -71,6 +78,12 @@ QColor VAbstractSimple::GetCurrentColor() const return currentColor; } +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractSimple::SetEnabled(bool enabled) +{ + this->enabled = enabled; +} + //--------------------------------------------------------------------------------------------------------------------- void VAbstractSimple::ContextMenu(QGraphicsSceneContextMenuEvent *event) { diff --git a/src/libs/vwidgets/vabstractsimple.h b/src/libs/vwidgets/vabstractsimple.h index 0caf5e974..8181168b6 100644 --- a/src/libs/vwidgets/vabstractsimple.h +++ b/src/libs/vwidgets/vabstractsimple.h @@ -49,14 +49,14 @@ class VAbstractSimple : public QObject Q_OBJECT public: VAbstractSimple(quint32 id, const QColor ¤tColor, Unit patternUnit, qreal *factor = nullptr, - QObject *parent = 0); + QObject *parent = nullptr); virtual ~VAbstractSimple(); virtual void ToolSelectionType(const SelectionType &type); QColor GetCurrentColor() const; - virtual void SetEnabled(bool enabled) { Q_UNUSED(enabled); } + virtual void SetEnabled(bool enabled); GOType GetType() const; void SetType(const GOType &value); @@ -91,45 +91,18 @@ protected: template void SetPen(T *item, const QColor &color, qreal width); - template - void SimpleChangedActivDraw(T *item, const bool &flag); - - template - void SetSimpleCurrentColor(T *item, const QColor &value); - private: Q_DISABLE_COPY(VAbstractSimple) + + const static qreal m_defFactor; }; //--------------------------------------------------------------------------------------------------------------------- template void VAbstractSimple::SetPen(T *item, const QColor &color, qreal width) { - if (factor == nullptr) - { - item->setPen(QPen(CorrectColor(color), ToPixel(width, patternUnit), Qt::SolidLine, Qt::RoundCap)); - } - else - { - item->setPen(QPen(CorrectColor(color), ToPixel(width, patternUnit)/ *factor, Qt::SolidLine, Qt::RoundCap)); - } -} - -//--------------------------------------------------------------------------------------------------------------------- -template -void VAbstractSimple::SimpleChangedActivDraw(T *item, const bool &flag) -{ - enabled = flag; - item->setEnabled(enabled); - SetPen(item, currentColor, WidthHairLine(patternUnit)); -} - -//--------------------------------------------------------------------------------------------------------------------- -template -void VAbstractSimple::SetSimpleCurrentColor(T *item, const QColor &value) -{ - currentColor = value; - SetPen(item, CorrectColor(currentColor), item->pen().widthF()); + SCASSERT(item); + item->setPen(QPen(CorrectColor(color), ToPixel(width, patternUnit)/ *factor, Qt::SolidLine, Qt::RoundCap)); } #endif // VABSTRACTSIMPLE_H diff --git a/src/libs/vwidgets/vsimplecurve.cpp b/src/libs/vwidgets/vsimplecurve.cpp index 08bf5cebb..79dd55d9d 100644 --- a/src/libs/vwidgets/vsimplecurve.cpp +++ b/src/libs/vwidgets/vsimplecurve.cpp @@ -66,18 +66,6 @@ VSimpleCurve::~VSimpleCurve() { } -//--------------------------------------------------------------------------------------------------------------------- -void VSimpleCurve::SetCurrentColor(const QColor &value) -{ - SetSimpleCurrentColor(this, value); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VSimpleCurve::ChangedActivDraw(bool flag) -{ - SimpleChangedActivDraw(this, flag); -} - //--------------------------------------------------------------------------------------------------------------------- void VSimpleCurve::RefreshGeometry(const QSharedPointer &curve) { @@ -85,6 +73,13 @@ void VSimpleCurve::RefreshGeometry(const QSharedPointer &curve) ShowPath(); } +//--------------------------------------------------------------------------------------------------------------------- +void VSimpleCurve::SetEnabled(bool enabled) +{ + VAbstractSimple::SetEnabled(enabled); + SetPen(this, currentColor, WidthHairLine(patternUnit)); +} + //--------------------------------------------------------------------------------------------------------------------- void VSimpleCurve::CurveChoosed() { diff --git a/src/libs/vwidgets/vsimplecurve.h b/src/libs/vwidgets/vsimplecurve.h index 4c5744283..d0847ed16 100644 --- a/src/libs/vwidgets/vsimplecurve.h +++ b/src/libs/vwidgets/vsimplecurve.h @@ -61,10 +61,9 @@ public: virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Vis::SimpleCurve)}; - void SetCurrentColor(const QColor &value); - - void ChangedActivDraw(bool flag); void RefreshGeometry(const QSharedPointer &curve); + + virtual void SetEnabled(bool enabled) Q_DECL_OVERRIDE; signals: /** * @brief Choosed send id when clicked. diff --git a/src/libs/vwidgets/vsimplepoint.cpp b/src/libs/vwidgets/vsimplepoint.cpp index 239dd4bee..676dbcf48 100644 --- a/src/libs/vwidgets/vsimplepoint.cpp +++ b/src/libs/vwidgets/vsimplepoint.cpp @@ -73,18 +73,6 @@ VSimplePoint::VSimplePoint(quint32 id, const QColor ¤tColor, Unit patternU VSimplePoint::~VSimplePoint() {} -//--------------------------------------------------------------------------------------------------------------------- -void VSimplePoint::SetCurrentColor(const QColor &value) -{ - SetSimpleCurrentColor(this, value); -} - -//--------------------------------------------------------------------------------------------------------------------- -void VSimplePoint::ChangedActivDraw(bool flag) -{ - SimpleChangedActivDraw(this, flag); -} - //--------------------------------------------------------------------------------------------------------------------- void VSimplePoint::RefreshLine() { @@ -97,7 +85,7 @@ void VSimplePoint::RefreshLine() VGObject::LineIntersectCircle(QPointF(), radius, QLineF(QPointF(), nameRec.center() - scenePos()), p1, p2); const QPointF pRec = VGObject::LineIntersectRect(nameRec, QLineF(scenePos(), nameRec.center())); lineName->setLine(QLineF(p1, pRec - scenePos())); - SetPen(lineName, QColor(Qt::black), WidthHairLine(patternUnit)); + SetPen(lineName, Qt::black, WidthHairLine(patternUnit)); if (QLineF(p1, pRec - scenePos()).length() <= ToPixel(4, Unit::Mm)) { @@ -126,14 +114,7 @@ void VSimplePoint::RefreshGeometry(const VPointF &point) this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); namePoint->blockSignals(true); QFont font = namePoint->font(); - if (factor == nullptr) - { - font.setPointSize(static_cast(namePoint->FontSize())); - } - else - { - font.setPointSize(static_cast(namePoint->FontSize()/ *factor)); - } + font.setPointSize(static_cast(namePoint->FontSize()/ *factor)); namePoint->setFont(font); namePoint->setText(point.name()); namePoint->setPos(QPointF(point.mx(), point.my())); @@ -145,6 +126,9 @@ void VSimplePoint::RefreshGeometry(const VPointF &point) //--------------------------------------------------------------------------------------------------------------------- void VSimplePoint::SetEnabled(bool enabled) { + VAbstractSimple::SetEnabled(enabled); + SetPen(this, currentColor, WidthHairLine(patternUnit)); + SetPen(lineName, Qt::black, WidthHairLine(patternUnit)); namePoint->setEnabled(enabled); } diff --git a/src/libs/vwidgets/vsimplepoint.h b/src/libs/vwidgets/vsimplepoint.h index b2d4649d4..009f914e0 100644 --- a/src/libs/vwidgets/vsimplepoint.h +++ b/src/libs/vwidgets/vsimplepoint.h @@ -62,7 +62,6 @@ public: virtual int type() const Q_DECL_OVERRIDE {return Type;} enum { Type = UserType + static_cast(Vis::SimplePoint)}; - void ChangedActivDraw(bool flag); void RefreshLine(); void RefreshGeometry(const VPointF &point); virtual void SetEnabled(bool enabled) Q_DECL_OVERRIDE; @@ -70,8 +69,6 @@ public: void AllowLabelHover(bool enabled); void AllowLabelSelecting(bool enabled); virtual void ToolSelectionType(const SelectionType &type) Q_DECL_OVERRIDE; - - void SetCurrentColor(const QColor &value); signals: /** * @brief Choosed send id when clicked. From 2b26b986bc80ccb941dd120548082a9781f1a045 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 24 Sep 2016 15:05:17 +0300 Subject: [PATCH 05/13] Fix recalculation scene after creating new PP. --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 3f0b08067..944ea75f5 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -271,8 +271,8 @@ void MainWindow::AddPP(const QString &PPName) comboBoxDraws->blockSignals(false); // Show best for new PP - ui->view->fitInView(doc->ActiveDrawBoundingRect(), Qt::KeepAspectRatio); VMainGraphicsView::NewSceneRect(ui->view->scene(), ui->view); + ui->view->fitInView(doc->ActiveDrawBoundingRect(), Qt::KeepAspectRatio); ui->view->NewFactor(ui->view->transform().m11()); ui->actionNewDraw->setEnabled(true); From eee2144483b64de72995e7f2d6aec36e90ffa0e4 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 24 Sep 2016 16:09:09 +0300 Subject: [PATCH 06/13] Fix crash. Each tool should delete visualization even if scene also can delete it. --HG-- branch : develop --- .../drawTools/operation/flipping/vtoolflippingbyaxis.cpp | 2 +- .../drawTools/operation/flipping/vtoolflippingbyline.cpp | 2 +- .../tools/drawTools/operation/vabstractoperation.h | 3 +-- .../vtools/tools/drawTools/operation/vtoolrotation.cpp | 2 +- .../vtools/tools/drawTools/toolcurve/vabstractspline.h | 3 +-- src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp | 2 +- .../tools/drawTools/toolcurve/vtoolarcwithlength.cpp | 2 +- .../tools/drawTools/toolcurve/vtoolcubicbezier.cpp | 2 +- .../tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp | 2 +- .../vtools/tools/drawTools/toolcurve/vtoolspline.cpp | 2 +- .../vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp | 2 +- .../toolpoint/tooldoublepoint/vtooltruedarts.cpp | 2 +- .../toolpoint/toolsinglepoint/toolcut/vtoolcut.h | 3 +-- .../toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp | 2 +- .../toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp | 2 +- .../toolsinglepoint/toolcut/vtoolcutsplinepath.cpp | 2 +- .../toolsinglepoint/toollinepoint/vtoolalongline.cpp | 2 +- .../toolsinglepoint/toollinepoint/vtoolbisector.cpp | 2 +- .../toollinepoint/vtoolcurveintersectaxis.cpp | 2 +- .../toolsinglepoint/toollinepoint/vtoolendline.cpp | 2 +- .../toolsinglepoint/toollinepoint/vtoolheight.cpp | 2 +- .../toollinepoint/vtoollineintersectaxis.cpp | 2 +- .../toolsinglepoint/toollinepoint/vtoolnormal.cpp | 2 +- .../toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp | 2 +- .../toolpoint/toolsinglepoint/vtoollineintersect.cpp | 4 ++-- .../toolsinglepoint/vtoolpointfromarcandtangent.cpp | 2 +- .../toolsinglepoint/vtoolpointfromcircleandtangent.cpp | 2 +- .../toolpoint/toolsinglepoint/vtoolpointofcontact.cpp | 2 +- .../toolsinglepoint/vtoolpointofintersection.cpp | 2 +- .../toolsinglepoint/vtoolpointofintersectionarcs.cpp | 2 +- .../toolsinglepoint/vtoolpointofintersectioncircles.cpp | 2 +- .../toolsinglepoint/vtoolpointofintersectioncurves.cpp | 2 +- .../toolpoint/toolsinglepoint/vtooltriangle.cpp | 2 +- .../vtools/tools/drawTools/toolpoint/vabstractpoint.h | 3 +-- src/libs/vtools/tools/drawTools/vtoolline.cpp | 7 +++---- src/libs/vtools/tools/vabstracttool.cpp | 9 +++++++-- src/libs/vtools/tools/vabstracttool.h | 4 ++-- 37 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp index 42d22be86..efebbbfa4 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyaxis.cpp @@ -174,7 +174,7 @@ void VToolFlippingByAxis::ShowVisualization(bool show) //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByAxis::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolFlippingByAxis *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp index 3b2165e14..3d0a9c443 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vtoolflippingbyline.cpp @@ -154,7 +154,7 @@ void VToolFlippingByLine::ShowVisualization(bool show) //--------------------------------------------------------------------------------------------------------------------- void VToolFlippingByLine::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolFlippingByLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h index e10123df3..7af49a93a 100644 --- a/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h +++ b/src/libs/vtools/tools/drawTools/operation/vabstractoperation.h @@ -156,7 +156,7 @@ void VAbstractOperation::ShowToolVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -172,7 +172,6 @@ void VAbstractOperation::ShowToolVisualization(bool show) else { delete vis; - vis = nullptr; } } diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp index a02019573..8959868bc 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp @@ -285,7 +285,7 @@ void VToolRotation::ShowVisualization(bool show) //--------------------------------------------------------------------------------------------------------------------- void VToolRotation::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolRotation *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h index e793ef6f6..cabef4603 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.h @@ -144,7 +144,7 @@ inline void VAbstractSpline::ShowToolVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -160,7 +160,6 @@ inline void VAbstractSpline::ShowToolVisualization(bool show) else { delete vis; - vis = nullptr; } if (detailsMode) diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index 4ae142e39..39327b779 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -365,7 +365,7 @@ void VToolArc::SaveOptions(QDomElement &tag, QSharedPointer &obj) //--------------------------------------------------------------------------------------------------------------------- void VToolArc::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { const QSharedPointer arc = VAbstractTool::data.GeometricObject(id); VisToolArc *visual = qobject_cast(vis); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index 0b1ea3239..03ce82bdb 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -322,7 +322,7 @@ void VToolArcWithLength::SaveOptions(QDomElement &tag, QSharedPointer //--------------------------------------------------------------------------------------------------------------------- void VToolArcWithLength::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { const QSharedPointer arc = VAbstractTool::data.GeometricObject(id); VisToolArcWithLength *visual = qobject_cast(vis); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index 50f46413b..e074b103d 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -216,7 +216,7 @@ void VToolCubicBezier::SaveOptions(QDomElement &tag, QSharedPointer &o //--------------------------------------------------------------------------------------------------------------------- void VToolCubicBezier::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { auto visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp index 5a990592d..89b5dafac 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp @@ -226,7 +226,7 @@ void VToolCubicBezierPath::SaveOptions(QDomElement &tag, QSharedPointer(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index a4943d1a9..b48024c1f 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -500,7 +500,7 @@ void VToolSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VToolSpline::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolSpline *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index e58082042..0da7aa71f 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -621,7 +621,7 @@ void VToolSplinePath::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) //--------------------------------------------------------------------------------------------------------------------- void VToolSplinePath::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolSplinePath *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp index 3548363b7..8b5d9187b 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/tooldoublepoint/vtooltruedarts.cpp @@ -376,7 +376,7 @@ void VToolTrueDarts::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolTrueDarts::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolTrueDarts *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h index 291e2f7cf..1cb1058b1 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcut.h @@ -89,7 +89,7 @@ inline void VToolCut::ShowToolVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -105,7 +105,6 @@ inline void VToolCut::ShowToolVisualization(bool show) else { delete vis; - vis = nullptr; } if (VAbstractSpline *parentCurve = qobject_cast(doc->getTool(curveCutId))) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp index 2069cf761..b3ee69974 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutarc.cpp @@ -241,7 +241,7 @@ void VToolCutArc::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolCutArc::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolCutArc *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index 7b0017c95..f58a42d8d 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -241,7 +241,7 @@ void VToolCutSpline::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolCutSpline::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolCutSpline *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index 0955bb05a..cdb998195 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -329,7 +329,7 @@ void VToolCutSplinePath::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolCutSplinePath::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolCutSplinePath *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp index 098d5ca51..2963d28b5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolalongline.cpp @@ -164,7 +164,7 @@ void VToolAlongLine::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolAlongLine::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolAlongLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp index aeb7d651a..93eb1e5cc 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolbisector.cpp @@ -320,7 +320,7 @@ void VToolBisector::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolBisector::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolBisector *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index c11517d78..e25800a43 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -313,7 +313,7 @@ void VToolCurveIntersectAxis::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolCurveIntersectAxis::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolCurveIntersectAxis *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp index 43843c392..75d8e0057 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolendline.cpp @@ -254,7 +254,7 @@ void VToolEndLine::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolEndLine::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolEndLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp index 3b8434869..dc9842c52 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolheight.cpp @@ -261,7 +261,7 @@ void VToolHeight::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolHeight::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolHeight *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp index 0c26c4fb8..507babace 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoollineintersectaxis.cpp @@ -313,7 +313,7 @@ void VToolLineIntersectAxis::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersectAxis::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolLineIntersectAxis *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp index 2a772b58b..4257ffc96 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolnormal.cpp @@ -295,7 +295,7 @@ void VToolNormal::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolNormal::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolNormal *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp index 7a5bb7d55..7c73bb109 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolshoulderpoint.cpp @@ -326,7 +326,7 @@ void VToolShoulderPoint::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolShoulderPoint::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolShoulderPoint *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp index 662801242..482f6d69e 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoollineintersect.cpp @@ -286,7 +286,7 @@ void VToolLineIntersect::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolLineIntersect::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolLineIntersect *visual = qobject_cast(vis); SCASSERT(visual != nullptr); @@ -295,7 +295,7 @@ void VToolLineIntersect::SetVisualization() visual->setLine1P2Id(p2Line1); visual->setLine2P1Id(p1Line2); visual->setLine2P2Id(p2Line2); - vis->RefreshGeometry(); + visual->RefreshGeometry(); } } diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp index b4f405e5c..91f02cb89 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromarcandtangent.cpp @@ -336,7 +336,7 @@ void VToolPointFromArcAndTangent::ReadToolAttributes(const QDomElement &domEleme //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromArcAndTangent::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointFromArcAndTangent *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp index e23e72d0a..88384ff46 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointfromcircleandtangent.cpp @@ -323,7 +323,7 @@ void VToolPointFromCircleAndTangent::ReadToolAttributes(const QDomElement &domEl //--------------------------------------------------------------------------------------------------------------------- void VToolPointFromCircleAndTangent::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointFromCircleAndTangent *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp index e604a4a46..40d4ae4e0 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofcontact.cpp @@ -339,7 +339,7 @@ void VToolPointOfContact::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfContact::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointOfContact *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp index dfb57b4aa..b66c963e5 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersection.cpp @@ -237,7 +237,7 @@ void VToolPointOfIntersection::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersection::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointOfIntersection *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp index 6c3c45edb..de622aa9f 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectionarcs.cpp @@ -341,7 +341,7 @@ void VToolPointOfIntersectionArcs::ReadToolAttributes(const QDomElement &domElem //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionArcs::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointOfIntersectionArcs *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp index b9a4cc29a..c85818732 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncircles.cpp @@ -362,7 +362,7 @@ void VToolPointOfIntersectionCircles::ReadToolAttributes(const QDomElement &domE //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCircles::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolPointOfIntersectionCircles *visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp index 6eb910b10..a26745a25 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolpointofintersectioncurves.cpp @@ -404,7 +404,7 @@ void VToolPointOfIntersectionCurves::ReadToolAttributes(const QDomElement &domEl //--------------------------------------------------------------------------------------------------------------------- void VToolPointOfIntersectionCurves::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { auto visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp index 5933c03f0..e0ef255f4 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtooltriangle.cpp @@ -307,7 +307,7 @@ void VToolTriangle::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolTriangle::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolTriangle * visual = qobject_cast(vis); SCASSERT(visual != nullptr); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/vabstractpoint.h b/src/libs/vtools/tools/drawTools/toolpoint/vabstractpoint.h index c7823a891..226fb2db2 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/vabstractpoint.h +++ b/src/libs/vtools/tools/drawTools/toolpoint/vabstractpoint.h @@ -95,7 +95,7 @@ void VAbstractPoint::ShowToolVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -111,7 +111,6 @@ void VAbstractPoint::ShowToolVisualization(bool show) else { delete vis; - vis = nullptr; } } diff --git a/src/libs/vtools/tools/drawTools/vtoolline.cpp b/src/libs/vtools/tools/drawTools/vtoolline.cpp index 7c9eeb849..90463e809 100644 --- a/src/libs/vtools/tools/drawTools/vtoolline.cpp +++ b/src/libs/vtools/tools/drawTools/vtoolline.cpp @@ -319,7 +319,7 @@ void VToolLine::hoverEnterEvent(QGraphicsSceneHoverEvent *event) void VToolLine::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) { Q_UNUSED(event); - if (vis == nullptr) + if (vis.isNull()) { this->setPen(QPen(CorrectColor(lineColor), qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor, @@ -421,7 +421,7 @@ void VToolLine::ReadToolAttributes(const QDomElement &domElement) //--------------------------------------------------------------------------------------------------------------------- void VToolLine::SetVisualization() { - if (vis != nullptr) + if (not vis.isNull()) { VisToolLine *visual = qobject_cast(vis); SCASSERT(visual != nullptr); @@ -456,7 +456,7 @@ void VToolLine::ShowVisualization(bool show) { if (show) { - if (vis == nullptr) + if (vis.isNull()) { AddVisualization(); SetVisualization(); @@ -472,7 +472,6 @@ void VToolLine::ShowVisualization(bool show) else { delete vis; - vis = nullptr; hoverLeaveEvent(nullptr); } } diff --git a/src/libs/vtools/tools/vabstracttool.cpp b/src/libs/vtools/tools/vabstracttool.cpp index 29bb6d395..3fd582eef 100644 --- a/src/libs/vtools/tools/vabstracttool.cpp +++ b/src/libs/vtools/tools/vabstracttool.cpp @@ -83,7 +83,7 @@ const QString VAbstractTool::AttrInUse = QStringLiteral("inUse"); * @param parent parent object. */ VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id, QObject *parent) - :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(nullptr), + :VDataTool(data, parent), doc(doc), id(id), baseColor(Qt::black), vis(), selectionType(SelectionType::ByMouseRelease) { SCASSERT(doc != nullptr); @@ -94,7 +94,12 @@ VAbstractTool::VAbstractTool(VAbstractPattern *doc, VContainer *data, quint32 id //--------------------------------------------------------------------------------------------------------------------- VAbstractTool::~VAbstractTool() -{} +{ + if (not vis.isNull()) + { + delete vis; + } +} //--------------------------------------------------------------------------------------------------------------------- /** diff --git a/src/libs/vtools/tools/vabstracttool.h b/src/libs/vtools/tools/vabstracttool.h index 6247375cd..35aa07daa 100644 --- a/src/libs/vtools/tools/vabstracttool.h +++ b/src/libs/vtools/tools/vabstracttool.h @@ -122,7 +122,7 @@ protected: /** @brief baseColor base color for tool. */ Qt::GlobalColor baseColor; - Visualization *vis; + QPointer vis; SelectionType selectionType; /** @@ -182,8 +182,8 @@ inline void VAbstractTool::AddVisualization() connect(scene, &VMainGraphicsScene::NewFactor, visual, &Visualization::SetFactor); scene->addItem(visual); + connect(visual, &Visualization::ToolTip, [=] (const QString &toolTip) {emit ToolTip(toolTip);}); vis = visual; - connect(vis, &Visualization::ToolTip, [=] (const QString &toolTip) {emit ToolTip(toolTip);}); } #endif // VABSTRACTTOOL_H From 3bb657ea1a4572cedbad1f17bc61c2d487d09b18 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 24 Sep 2016 20:44:06 +0300 Subject: [PATCH 07/13] New internal variable "Length to spline control point". --HG-- branch : develop --- .../valentina/dialogs/dialogincrements.cpp | 9 ++ src/app/valentina/dialogs/dialogincrements.h | 1 + src/app/valentina/dialogs/dialogincrements.ui | 45 +++++++- src/app/valentina/xml/vpattern.cpp | 1 + src/libs/ifc/ifcdef.cpp | 2 + src/libs/ifc/ifcdef.h | 2 + src/libs/vgeometry/vabstractbezier.cpp | 57 ++++++++++ src/libs/vgeometry/vabstractbezier.h | 48 ++++++++ src/libs/vgeometry/vabstractcubicbezier.cpp | 6 +- src/libs/vgeometry/vabstractcubicbezier.h | 4 +- .../vgeometry/vabstractcubicbezierpath.cpp | 6 +- src/libs/vgeometry/vabstractcubicbezierpath.h | 4 +- src/libs/vgeometry/vcubicbezier.cpp | 12 ++ src/libs/vgeometry/vcubicbezier.h | 3 + src/libs/vgeometry/vcubicbezierpath.cpp | 27 +++++ src/libs/vgeometry/vcubicbezierpath.h | 3 + src/libs/vgeometry/vgeometry.pri | 6 +- src/libs/vgeometry/vspline.h | 4 +- src/libs/vgeometry/vsplinepath.cpp | 26 +++++ src/libs/vgeometry/vsplinepath.h | 3 + src/libs/vmisc/def.h | 4 +- src/libs/vpatterndb/variables.h | 1 + .../vpatterndb/variables/vcurveclength.cpp | 105 ++++++++++++++++++ src/libs/vpatterndb/variables/vcurveclength.h | 56 ++++++++++ src/libs/vpatterndb/vcontainer.cpp | 30 ++++- src/libs/vpatterndb/vcontainer.h | 22 ++-- src/libs/vpatterndb/vpatterndb.pri | 6 +- .../support/dialogeditwrongformula.cpp | 8 ++ .../dialogs/support/dialogeditwrongformula.h | 1 + .../dialogs/support/dialogeditwrongformula.ui | 11 +- .../operation/flipping/vabstractflipping.h | 4 +- .../drawTools/operation/vtoolrotation.cpp | 10 +- .../drawTools/toolcurve/vtoolcubicbezier.cpp | 4 +- .../tools/drawTools/toolcurve/vtoolspline.cpp | 4 +- .../toolcut/vtoolcutspline.cpp | 12 +- .../toolcut/vtoolcutsplinepath.cpp | 8 +- .../toollinepoint/vtoolcurveintersectaxis.cpp | 32 +++--- 37 files changed, 515 insertions(+), 72 deletions(-) create mode 100644 src/libs/vgeometry/vabstractbezier.cpp create mode 100644 src/libs/vgeometry/vabstractbezier.h create mode 100644 src/libs/vpatterndb/variables/vcurveclength.cpp create mode 100644 src/libs/vpatterndb/variables/vcurveclength.h diff --git a/src/app/valentina/dialogs/dialogincrements.cpp b/src/app/valentina/dialogs/dialogincrements.cpp index 45f750104..93ba69a91 100644 --- a/src/app/valentina/dialogs/dialogincrements.cpp +++ b/src/app/valentina/dialogs/dialogincrements.cpp @@ -84,6 +84,7 @@ DialogIncrements::DialogIncrements(VContainer *data, VPattern *doc, QWidget *par FillLengthsLines(); FillLengthLinesAngles(); FillLengthsCurves(); + FillCurvesCLengths(); FillRadiusesArcs(); FillAnglesCurves(); @@ -232,6 +233,12 @@ void DialogIncrements::FillLengthsCurves() FillTable(data->DataLengthCurves(), ui->tableWidgetSplines); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogIncrements::FillCurvesCLengths() +{ + FillTable(data->DataCurvesCLength(), ui->tableWidgetCLength); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogIncrements::FillRadiusesArcs() { @@ -254,6 +261,7 @@ void DialogIncrements::ShowUnits() ShowHeaderUnits(ui->tableWidgetLines, 1, unit);// lengths ShowHeaderUnits(ui->tableWidgetSplines, 1, unit);// lengths + ShowHeaderUnits(ui->tableWidgetCLength, 1, unit);// lengths ShowHeaderUnits(ui->tableWidgetLinesAngles, 1, degreeSymbol);// angle ShowHeaderUnits(ui->tableWidgetRadiusesArcs, 1, unit);// radius ShowHeaderUnits(ui->tableWidgetAnglesCurves, 1, degreeSymbol);// angle @@ -445,6 +453,7 @@ void DialogIncrements::FullUpdateFromFile() FillLengthsLines(); FillLengthLinesAngles(); FillLengthsCurves(); + FillCurvesCLengths(); FillRadiusesArcs(); FillAnglesCurves(); diff --git a/src/app/valentina/dialogs/dialogincrements.h b/src/app/valentina/dialogs/dialogincrements.h index af30e4b45..8de446295 100644 --- a/src/app/valentina/dialogs/dialogincrements.h +++ b/src/app/valentina/dialogs/dialogincrements.h @@ -98,6 +98,7 @@ private: void FillLengthsLines(); void FillLengthLinesAngles(); void FillLengthsCurves(); + void FillCurvesCLengths(); void FillRadiusesArcs(); void FillAnglesCurves(); diff --git a/src/app/valentina/dialogs/dialogincrements.ui b/src/app/valentina/dialogs/dialogincrements.ui index 0f9e62962..287243e7e 100644 --- a/src/app/valentina/dialogs/dialogincrements.ui +++ b/src/app/valentina/dialogs/dialogincrements.ui @@ -273,8 +273,7 @@ - - + .. @@ -288,8 +287,7 @@ - - + .. @@ -572,6 +570,45 @@ + + + Curves control point lengths + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + false + + + 137 + + + false + + + false + + + + Curve + + + + + Length + + + + + + Angles curves diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index c779f1896..5a93aa209 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -3356,6 +3356,7 @@ void VPattern::PrepareForParse(const Document &parse) data->ClearVariables(VarType::LineAngle); data->ClearVariables(VarType::LineLength); data->ClearVariables(VarType::CurveLength); + data->ClearVariables(VarType::CurveCLength); data->ClearVariables(VarType::ArcRadius); data->ClearVariables(VarType::CurveAngle); } diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index 5a47465c1..0e21829b1 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -162,6 +162,8 @@ const QString radius_V = QStringLiteral("Radius"); const QString radiusArc_ = radius_V + arc_; const QString angle1_V = QStringLiteral("Angle1"); const QString angle2_V = QStringLiteral("Angle2"); +const QString c1Length_V = QStringLiteral("C1Length"); +const QString c2Length_V = QStringLiteral("C2Length"); const QString angle1Arc_ = angle1_V + arc_; const QString angle2Arc_ = angle2_V + arc_; const QString angle1Spl_ = angle1_V + spl_; diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index 900c31aa6..359edcce2 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -168,6 +168,8 @@ extern const QString radius_V; extern const QString radiusArc_; extern const QString angle1_V; extern const QString angle2_V; +extern const QString c1Length_V; +extern const QString c2Length_V; extern const QString angle1Arc_; extern const QString angle2Arc_; extern const QString angle1Spl_; diff --git a/src/libs/vgeometry/vabstractbezier.cpp b/src/libs/vgeometry/vabstractbezier.cpp new file mode 100644 index 000000000..9d2eea0c1 --- /dev/null +++ b/src/libs/vgeometry/vabstractbezier.cpp @@ -0,0 +1,57 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 24 9, 2016 + ** + ** @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) 2016 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 "vabstractbezier.h" + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractBezier::VAbstractBezier(const GOType &type, const quint32 &idObject, const Draw &mode) + : VAbstractCurve(type, idObject, mode) +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractBezier::VAbstractBezier(const VAbstractBezier &curve) + : VAbstractCurve(curve) +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractBezier &VAbstractBezier::operator=(const VAbstractBezier &curve) +{ + if ( &curve == this ) + { + return *this; + } + VAbstractCurve::operator=(curve); + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VAbstractBezier::~VAbstractBezier() +{ +} diff --git a/src/libs/vgeometry/vabstractbezier.h b/src/libs/vgeometry/vabstractbezier.h new file mode 100644 index 000000000..d59959bba --- /dev/null +++ b/src/libs/vgeometry/vabstractbezier.h @@ -0,0 +1,48 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 24 9, 2016 + ** + ** @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) 2016 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 VABSTRACTBEZIER_H +#define VABSTRACTBEZIER_H + +#include + +#include "vabstractcurve.h" + +class VAbstractBezier : public VAbstractCurve +{ +public: + VAbstractBezier(const GOType &type, const quint32 &idObject = NULL_ID, const Draw &mode = Draw::Calculation); + VAbstractBezier(const VAbstractBezier &curve); + VAbstractBezier& operator= (const VAbstractBezier &curve); + virtual ~VAbstractBezier(); + + virtual qreal GetC1Length() const =0; + virtual qreal GetC2Length() const =0; +}; + +#endif // VABSTRACTBEZIER_H diff --git a/src/libs/vgeometry/vabstractcubicbezier.cpp b/src/libs/vgeometry/vabstractcubicbezier.cpp index 35179a844..7694e9cc1 100644 --- a/src/libs/vgeometry/vabstractcubicbezier.cpp +++ b/src/libs/vgeometry/vabstractcubicbezier.cpp @@ -39,13 +39,13 @@ //--------------------------------------------------------------------------------------------------------------------- VAbstractCubicBezier::VAbstractCubicBezier(const GOType &type, const quint32 &idObject, const Draw &mode) - : VAbstractCurve(type, idObject, mode) + : VAbstractBezier(type, idObject, mode) { } //--------------------------------------------------------------------------------------------------------------------- VAbstractCubicBezier::VAbstractCubicBezier(const VAbstractCubicBezier &curve) - : VAbstractCurve(curve) + : VAbstractBezier(curve) { } @@ -56,7 +56,7 @@ VAbstractCubicBezier &VAbstractCubicBezier::operator=(const VAbstractCubicBezier { return *this; } - VAbstractCurve::operator=(curve); + VAbstractBezier::operator=(curve); return *this; } diff --git a/src/libs/vgeometry/vabstractcubicbezier.h b/src/libs/vgeometry/vabstractcubicbezier.h index 3cf0d2769..1e30d698e 100644 --- a/src/libs/vgeometry/vabstractcubicbezier.h +++ b/src/libs/vgeometry/vabstractcubicbezier.h @@ -36,13 +36,13 @@ #include #include "../ifc/ifcdef.h" -#include "vabstractcurve.h" +#include "vabstractbezier.h" #include "vgeometrydef.h" class QPointF; class VPointF; -class VAbstractCubicBezier : public VAbstractCurve +class VAbstractCubicBezier : public VAbstractBezier { public: VAbstractCubicBezier(const GOType &type, const quint32 &idObject = NULL_ID, const Draw &mode = Draw::Calculation); diff --git a/src/libs/vgeometry/vabstractcubicbezierpath.cpp b/src/libs/vgeometry/vabstractcubicbezierpath.cpp index 6a9ffadc0..5c56a8d56 100644 --- a/src/libs/vgeometry/vabstractcubicbezierpath.cpp +++ b/src/libs/vgeometry/vabstractcubicbezierpath.cpp @@ -40,13 +40,13 @@ class QPointF; //--------------------------------------------------------------------------------------------------------------------- VAbstractCubicBezierPath::VAbstractCubicBezierPath(const GOType &type, const quint32 &idObject, const Draw &mode) - : VAbstractCurve(type, idObject, mode) + : VAbstractBezier(type, idObject, mode) { } //--------------------------------------------------------------------------------------------------------------------- VAbstractCubicBezierPath::VAbstractCubicBezierPath(const VAbstractCubicBezierPath &curve) - : VAbstractCurve(curve) + : VAbstractBezier(curve) { } @@ -57,7 +57,7 @@ VAbstractCubicBezierPath &VAbstractCubicBezierPath::operator=(const VAbstractCub { return *this; } - VAbstractCurve::operator=(curve); + VAbstractBezier::operator=(curve); return *this; } diff --git a/src/libs/vgeometry/vabstractcubicbezierpath.h b/src/libs/vgeometry/vabstractcubicbezierpath.h index 79ff14f92..f1caa1648 100644 --- a/src/libs/vgeometry/vabstractcubicbezierpath.h +++ b/src/libs/vgeometry/vabstractcubicbezierpath.h @@ -36,7 +36,7 @@ #include #include -#include "vabstractcurve.h" +#include "vabstractbezier.h" #include "vgeometrydef.h" class QPainterPath; @@ -45,7 +45,7 @@ class VPointF; class VSpline; class VSplinePoint; -class VAbstractCubicBezierPath : public VAbstractCurve +class VAbstractCubicBezierPath : public VAbstractBezier { Q_DECLARE_TR_FUNCTIONS(VAbstractCubicBezierPath) public: diff --git a/src/libs/vgeometry/vcubicbezier.cpp b/src/libs/vgeometry/vcubicbezier.cpp index 3b3d88786..3f710e339 100644 --- a/src/libs/vgeometry/vcubicbezier.cpp +++ b/src/libs/vgeometry/vcubicbezier.cpp @@ -175,6 +175,18 @@ QVector VCubicBezier::GetPoints() const return GetCubicBezierPoints(GetP1(), GetP2(), GetP3(), GetP4()); } +//--------------------------------------------------------------------------------------------------------------------- +qreal VCubicBezier::GetC1Length() const +{ + return QLineF(GetP1(), GetP2()).length(); +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VCubicBezier::GetC2Length() const +{ + return QLineF(GetP4(), GetP3()).length(); +} + //--------------------------------------------------------------------------------------------------------------------- QPointF VCubicBezier::GetControlPoint1() const { diff --git a/src/libs/vgeometry/vcubicbezier.h b/src/libs/vgeometry/vcubicbezier.h index 283141884..3e5b138ab 100644 --- a/src/libs/vgeometry/vcubicbezier.h +++ b/src/libs/vgeometry/vcubicbezier.h @@ -73,6 +73,9 @@ public: virtual qreal GetLength() const Q_DECL_OVERRIDE; virtual QVector GetPoints() const Q_DECL_OVERRIDE; + virtual qreal GetC1Length() const Q_DECL_OVERRIDE; + virtual qreal GetC2Length() const Q_DECL_OVERRIDE; + protected: virtual QPointF GetControlPoint1() const Q_DECL_OVERRIDE; virtual QPointF GetControlPoint2() const Q_DECL_OVERRIDE; diff --git a/src/libs/vgeometry/vcubicbezierpath.cpp b/src/libs/vgeometry/vcubicbezierpath.cpp index 1cc4c9c1b..208c38206 100644 --- a/src/libs/vgeometry/vcubicbezierpath.cpp +++ b/src/libs/vgeometry/vcubicbezierpath.cpp @@ -210,6 +210,33 @@ qreal VCubicBezierPath::GetEndAngle() const } } +//--------------------------------------------------------------------------------------------------------------------- +qreal VCubicBezierPath::GetC1Length() const +{ + if (CountSubSpl() > 0) + { + return GetSpline(1).GetC1Length(); + } + else + { + return 0; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VCubicBezierPath::GetC2Length() const +{ + const qint32 count = CountSubSpl(); + if (count > 0) + { + return GetSpline(count).GetC2Length(); + } + else + { + return 0; + } +} + //--------------------------------------------------------------------------------------------------------------------- QVector VCubicBezierPath::GetSplinePath() const { diff --git a/src/libs/vgeometry/vcubicbezierpath.h b/src/libs/vgeometry/vcubicbezierpath.h index c0c38cd8e..d483264f1 100644 --- a/src/libs/vgeometry/vcubicbezierpath.h +++ b/src/libs/vgeometry/vcubicbezierpath.h @@ -72,6 +72,9 @@ public: virtual qreal GetStartAngle () const Q_DECL_OVERRIDE; virtual qreal GetEndAngle () const Q_DECL_OVERRIDE; + virtual qreal GetC1Length() const Q_DECL_OVERRIDE; + virtual qreal GetC2Length() const Q_DECL_OVERRIDE; + virtual QVector GetSplinePath() const Q_DECL_OVERRIDE; QVector GetCubicPath() const; diff --git a/src/libs/vgeometry/vgeometry.pri b/src/libs/vgeometry/vgeometry.pri index 2b05f9b20..9caf4e3a3 100644 --- a/src/libs/vgeometry/vgeometry.pri +++ b/src/libs/vgeometry/vgeometry.pri @@ -14,7 +14,8 @@ SOURCES += \ $$PWD/vabstractcubicbezier.cpp \ $$PWD/vabstractcubicbezierpath.cpp \ $$PWD/vcubicbezierpath.cpp \ - $$PWD/vabstractarc.cpp + $$PWD/vabstractarc.cpp \ + $$PWD/vabstractbezier.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -44,4 +45,5 @@ HEADERS += \ $$PWD/vcubicbezierpath.h \ $$PWD/vcubicbezierpath_p.h \ $$PWD/vabstractarc.h \ - $$PWD/vabstractarc_p.h + $$PWD/vabstractarc_p.h \ + $$PWD/vabstractbezier.h diff --git a/src/libs/vgeometry/vspline.h b/src/libs/vgeometry/vspline.h index 78705e496..325aea0ff 100644 --- a/src/libs/vgeometry/vspline.h +++ b/src/libs/vgeometry/vspline.h @@ -85,8 +85,8 @@ public: void SetStartAngle(qreal angle, const QString &formula); void SetEndAngle(qreal angle, const QString &formula); - qreal GetC1Length() const; - qreal GetC2Length() const; + virtual qreal GetC1Length() const Q_DECL_OVERRIDE; + virtual qreal GetC2Length() const Q_DECL_OVERRIDE; QString GetC1LengthFormula() const; QString GetC2LengthFormula() const; diff --git a/src/libs/vgeometry/vsplinepath.cpp b/src/libs/vgeometry/vsplinepath.cpp index bbf0be400..e21938d11 100644 --- a/src/libs/vgeometry/vsplinepath.cpp +++ b/src/libs/vgeometry/vsplinepath.cpp @@ -317,6 +317,32 @@ qreal VSplinePath::GetEndAngle() const } } +//--------------------------------------------------------------------------------------------------------------------- +qreal VSplinePath::GetC1Length() const +{ + if (CountPoints() > 0) + { + return GetSplinePath().first().Length2(); + } + else + { + return 0; + } +} + +//--------------------------------------------------------------------------------------------------------------------- +qreal VSplinePath::GetC2Length() const +{ + if (CountPoints() > 0) + { + return GetSplinePath().last().Length1(); + } + else + { + return 0; + } +} + //--------------------------------------------------------------------------------------------------------------------- VPointF VSplinePath::FirstPoint() const { diff --git a/src/libs/vgeometry/vsplinepath.h b/src/libs/vgeometry/vsplinepath.h index 424e1de44..da3b73c49 100644 --- a/src/libs/vgeometry/vsplinepath.h +++ b/src/libs/vgeometry/vsplinepath.h @@ -80,6 +80,9 @@ public: virtual qreal GetStartAngle () const Q_DECL_OVERRIDE; virtual qreal GetEndAngle () const Q_DECL_OVERRIDE; + virtual qreal GetC1Length() const Q_DECL_OVERRIDE; + virtual qreal GetC2Length() const Q_DECL_OVERRIDE; + void UpdatePoint(qint32 indexSpline, const SplinePointPosition &pos, const VSplinePoint &point); VSplinePoint GetSplinePoint(qint32 indexSpline, SplinePointPosition pos) const; diff --git a/src/libs/vmisc/def.h b/src/libs/vmisc/def.h index 31b04099f..80a92c9d1 100644 --- a/src/libs/vmisc/def.h +++ b/src/libs/vmisc/def.h @@ -157,8 +157,8 @@ enum class Vis : ToolVisHolderType ToolFlippingByAxis }; -enum class VarType : char { Measurement, Increment, LineLength, CurveLength, LineAngle, CurveAngle, ArcRadius, - Unknown }; +enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle, + ArcRadius, Unknown }; enum class GHeights : unsigned char { ALL, H92=92, H98=98, H104=104, H110=110, H116=116, H122=122, H128=128, H134=134, diff --git a/src/libs/vpatterndb/variables.h b/src/libs/vpatterndb/variables.h index f07b5a709..5504c1904 100644 --- a/src/libs/vpatterndb/variables.h +++ b/src/libs/vpatterndb/variables.h @@ -37,5 +37,6 @@ #include "variables/vlineangle.h" #include "variables/varcradius.h" #include "variables/vcurveangle.h" +#include "variables/vcurveclength.h" #endif // VARIABLES_H diff --git a/src/libs/vpatterndb/variables/vcurveclength.cpp b/src/libs/vpatterndb/variables/vcurveclength.cpp new file mode 100644 index 000000000..1262cd832 --- /dev/null +++ b/src/libs/vpatterndb/variables/vcurveclength.cpp @@ -0,0 +1,105 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 24 9, 2016 + ** + ** @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) 2016 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 "vcurveclength.h" + +#include +#include + +#include "../vmisc/def.h" +#include "../ifc/ifcdef.h" +#include "../vgeometry/vabstractcurve.h" +#include "../vgeometry/vspline.h" +#include "vcurvevariable.h" + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::VCurveCLength() + : VCurveVariable() +{ + SetType(VarType::CurveCLength); +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const VAbstractBezier *curve, + CurveCLength cType, Unit patternUnit) + : VCurveVariable(id, parentId) +{ + SetType(VarType::CurveCLength); + SCASSERT(curve != nullptr); + if (cType == CurveCLength::C1) + { + SetValue(FromPixel(curve->GetC1Length(), patternUnit)); + SetName(c1Length_V + curve->name()); + } + else + { + SetValue(FromPixel(curve->GetC2Length(), patternUnit)); + SetName(c2Length_V + curve->name()); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::VCurveCLength(const quint32 &id, const quint32 &parentId, const QString &baseCurveName, + const VSpline &spl, CurveCLength cType, Unit patternUnit, qint32 segment) + : VCurveVariable(id, parentId) +{ + SetType(VarType::CurveCLength); + if (cType == CurveCLength::C1) + { + SetValue(FromPixel(spl.GetC1Length(), patternUnit)); + SetName(c1Length_V + baseCurveName + QLatin1String("_") + seg_ + QString().setNum(segment)); + } + else + { + SetValue(FromPixel(spl.GetC2Length(), patternUnit)); + SetName(c2Length_V + baseCurveName + QLatin1String("_") + seg_ + QString().setNum(segment)); + } +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::VCurveCLength(const VCurveCLength &var) + : VCurveVariable(var) +{ +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength &VCurveCLength::operator=(const VCurveCLength &var) +{ + if ( &var == this ) + { + return *this; + } + VCurveVariable::operator=(var); + return *this; +} + +//--------------------------------------------------------------------------------------------------------------------- +VCurveCLength::~VCurveCLength() +{ +} + diff --git a/src/libs/vpatterndb/variables/vcurveclength.h b/src/libs/vpatterndb/variables/vcurveclength.h new file mode 100644 index 000000000..b20dabc89 --- /dev/null +++ b/src/libs/vpatterndb/variables/vcurveclength.h @@ -0,0 +1,56 @@ +/************************************************************************ + ** + ** @file + ** @author Roman Telezhynskyi + ** @date 24 9, 2016 + ** + ** @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) 2016 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 VCURVECLENGTH_H +#define VCURVECLENGTH_H + +#include +#include +#include + +#include "vcurvevariable.h" + +enum class CurveCLength : char { C1, C2 }; + +class VAbstractBezier; +class VSpline; + +class VCurveCLength : public VCurveVariable +{ +public: + VCurveCLength(); + VCurveCLength(const quint32 &id, const quint32 &parentId, const VAbstractBezier *curve, CurveCLength cType, + Unit patternUnit); + VCurveCLength(const quint32 &id, const quint32 &parentId, const QString &baseCurveName, const VSpline &spl, + CurveCLength cType, Unit patternUnit, qint32 segment); + VCurveCLength(const VCurveCLength &var); + VCurveCLength &operator=(const VCurveCLength &var); + virtual ~VCurveCLength() Q_DECL_OVERRIDE; +}; + +#endif // VCURVECLENGTH_H diff --git a/src/libs/vpatterndb/vcontainer.cpp b/src/libs/vpatterndb/vcontainer.cpp index 9843c0659..ea350a8a9 100644 --- a/src/libs/vpatterndb/vcontainer.cpp +++ b/src/libs/vpatterndb/vcontainer.cpp @@ -46,6 +46,7 @@ #include "variables/varcradius.h" #include "variables/vcurveangle.h" #include "variables/vcurvelength.h" +#include "variables/vcurveclength.h" #include "variables/vincrement.h" #include "variables/vlineangle.h" #include "variables/vlinelength.h" @@ -276,6 +277,7 @@ void VContainer::ClearForFullParse() ClearVariables(VarType::LineAngle); ClearVariables(VarType::LineLength); ClearVariables(VarType::CurveLength); + ClearVariables(VarType::CurveCLength); ClearVariables(VarType::ArcRadius); ClearVariables(VarType::CurveAngle); ClearGObjects(); @@ -407,11 +409,23 @@ void VContainer::AddCurve(const QSharedPointer &curve, const qui AddVariable(endAngle->GetName(), endAngle); } +//--------------------------------------------------------------------------------------------------------------------- +void VContainer::AddSpline(const QSharedPointer &curve, quint32 id, quint32 parentId) +{ + AddCurve(curve, id, parentId); + + VCurveCLength *c1Length = new VCurveCLength(id, parentId, curve.data(), CurveCLength::C1, *GetPatternUnit()); + AddVariable(c1Length->GetName(), c1Length); + + VCurveCLength *c2Length = new VCurveCLength(id, parentId, curve.data(), CurveCLength::C2, *GetPatternUnit()); + AddVariable(c2Length->GetName(), c2Length); +} + //--------------------------------------------------------------------------------------------------------------------- void VContainer::AddCurveWithSegments(const QSharedPointer &curve, const quint32 &id, quint32 parentId) { - AddCurve(curve, id, parentId); + AddSpline(curve, id, parentId); for (qint32 i = 1; i <= curve->CountSubSpl(); ++i) { @@ -425,6 +439,14 @@ void VContainer::AddCurveWithSegments(const QSharedPointername(), spl, CurveAngle::EndAngle, i); AddVariable(endAngle->GetName(), endAngle); + + VCurveCLength *c1Length = new VCurveCLength(id, parentId, curve->name(), spl, CurveCLength::C1, + *GetPatternUnit(), i); + AddVariable(c1Length->GetName(), c1Length); + + VCurveCLength *c2Length = new VCurveCLength(id, parentId, curve->name(), spl, CurveCLength::C2, + *GetPatternUnit(), i); + AddVariable(c2Length->GetName(), c2Length); } } @@ -524,6 +546,12 @@ const QMap > VContainer::DataLengthCurves( return DataVar(VarType::CurveLength); } +//--------------------------------------------------------------------------------------------------------------------- +const QMap > VContainer::DataCurvesCLength() const +{ + return DataVar(VarType::CurveCLength); +} + //--------------------------------------------------------------------------------------------------------------------- const QMap > VContainer::DataAngleLines() const { diff --git a/src/libs/vpatterndb/vcontainer.h b/src/libs/vpatterndb/vcontainer.h index 849c30ca7..6a581f94c 100644 --- a/src/libs/vpatterndb/vcontainer.h +++ b/src/libs/vpatterndb/vcontainer.h @@ -140,9 +140,8 @@ public: quint32 AddGObject(VGObject *obj); quint32 AddDetail(const VDetail &detail); void AddLine(const quint32 &firstPointId, const quint32 &secondPointId); - void AddArc(const QSharedPointer &arc, const quint32 &arcId, const quint32 &parentId = 0); - void AddCurve(const QSharedPointer &curve, const quint32 &id, - quint32 parentId = NULL_ID); + void AddArc(const QSharedPointer &arc, const quint32 &arcId, const quint32 &parentId = NULL_ID); + void AddSpline(const QSharedPointer &curve, quint32 id, quint32 parentId = NULL_ID); void AddCurveWithSegments(const QSharedPointer &curve, const quint32 &id, quint32 parentId = NULL_ID); @@ -176,13 +175,14 @@ public: const QHash *DataDetails() const; const QHash> *DataVariables() const; - const QMap > DataMeasurements() const; - const QMap > DataIncrements() const; - const QMap > DataLengthLines() const; - const QMap > DataLengthCurves() const; - const QMap > DataAngleLines() const; - const QMap > DataRadiusesArcs() const; - const QMap > DataAnglesCurves() const; + const QMap > DataMeasurements() const; + const QMap > DataIncrements() const; + const QMap > DataLengthLines() const; + const QMap > DataLengthCurves() const; + const QMap > DataCurvesCLength() const; + const QMap > DataAngleLines() const; + const QMap > DataRadiusesArcs() const; + const QMap > DataAnglesCurves() const; const QHash PlainVariables() const; @@ -203,6 +203,8 @@ private: QSharedDataPointer d; + void AddCurve(const QSharedPointer &curve, const quint32 &id, quint32 parentId = NULL_ID); + template uint qHash( const QSharedPointer &p ); diff --git a/src/libs/vpatterndb/vpatterndb.pri b/src/libs/vpatterndb/vpatterndb.pri index b2e055a6e..93f7d3490 100644 --- a/src/libs/vpatterndb/vpatterndb.pri +++ b/src/libs/vpatterndb/vpatterndb.pri @@ -19,7 +19,8 @@ SOURCES += \ $$PWD/variables/vvariable.cpp \ $$PWD/vformula.cpp \ $$PWD/vpatternpiecedata.cpp \ - $$PWD/vpatterninfogeometry.cpp + $$PWD/vpatterninfogeometry.cpp \ + $$PWD/variables/vcurveclength.cpp win32-msvc*:SOURCES += $$PWD/stable.cpp @@ -53,4 +54,5 @@ HEADERS += \ $$PWD/variables/vvariable_p.h \ $$PWD/vformula.h \ $$PWD/vpatternpiecedata.h \ - $$PWD/vpatterninfogeometry.h + $$PWD/vpatterninfogeometry.h \ + $$PWD/variables/vcurveclength.h diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp index 7bc6e8ab2..b9603cfaa 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.cpp @@ -297,6 +297,13 @@ void DialogEditWrongFormula::LengthCurves() ShowVariable(data->DataLengthCurves()); } +//--------------------------------------------------------------------------------------------------------------------- +void DialogEditWrongFormula::CurvesCLength() +{ + ui->checkBoxHideEmpty->setEnabled(false); + ShowVariable(data->DataCurvesCLength()); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogEditWrongFormula::AngleLines() { @@ -399,6 +406,7 @@ void DialogEditWrongFormula::InitVariables() connect(ui->checkBoxHideEmpty, &QCheckBox::stateChanged, this, &DialogEditWrongFormula::Measurements); connect(ui->radioButtonRadiusesArcs, &QRadioButton::clicked, this, &DialogEditWrongFormula::RadiusArcs); connect(ui->radioButtonAnglesCurves, &QRadioButton::clicked, this, &DialogEditWrongFormula::AnglesCurves); + connect(ui->radioButtonCLength, &QRadioButton::clicked, this, &DialogEditWrongFormula::CurvesCLength); connect(ui->radioButtonFunctions, &QRadioButton::clicked, this, &DialogEditWrongFormula::Functions); } diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h index 3eed52e9c..2e1255e85 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.h +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.h @@ -88,6 +88,7 @@ public slots: void RadiusArcs(); void AnglesCurves(); void LengthCurves(); + void CurvesCLength(); void AngleLines(); void Increments(); void Functions(); diff --git a/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui b/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui index 9a6c353ae..8f952605e 100644 --- a/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui +++ b/src/libs/vtools/dialogs/support/dialogeditwrongformula.ui @@ -9,8 +9,8 @@ 0 0 - 390 - 453 + 448 + 425 @@ -329,6 +329,13 @@ + + + + Lengths to control points + + + diff --git a/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h b/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h index 0bc98b1be..72bd275d9 100644 --- a/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h +++ b/src/libs/vtools/tools/drawTools/operation/flipping/vabstractflipping.h @@ -103,7 +103,7 @@ DestinationItem VAbstractFlipping::CreateCurve(quint32 idTool, quint32 idItem, c const QPointF &secondPoint, const QString &suffix, VContainer *data) { const DestinationItem item = CreateItem(idTool, idItem, firstPoint, secondPoint, suffix, data); - data->AddCurve(data->GeometricObject(item.id), item.id); + data->AddSpline(data->GeometricObject(item.id), item.id); return item; } @@ -135,7 +135,7 @@ void VAbstractFlipping::UpdateCurve(quint32 idTool, quint32 idItem, const QPoint const QPointF &secondPoint, const QString &suffix, VContainer *data, quint32 id) { UpdateItem(idTool, idItem, firstPoint, secondPoint, suffix, data, id); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp index 8959868bc..4dd3e640c 100644 --- a/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp +++ b/src/libs/vtools/tools/drawTools/operation/vtoolrotation.cpp @@ -390,7 +390,7 @@ DestinationItem VToolRotation::CreateCurve(quint32 idTool, quint32 idItem, const const QString &suffix, VContainer *data) { const DestinationItem item = CreateItem(idTool, idItem, origin, angle, suffix, data); - data->AddCurve(data->GeometricObject(item.id), item.id); + data->AddSpline(data->GeometricObject(item.id), item.id); return item; } @@ -429,7 +429,7 @@ void VToolRotation::UpdateItem(quint32 idTool, quint32 idItem, const QPointF &or //--------------------------------------------------------------------------------------------------------------------- void VToolRotation::UpdateArc(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, - const QString &suffix, VContainer *data, quint32 id) + const QString &suffix, VContainer *data, quint32 id) { UpdateItem(idTool, idItem, origin, angle, suffix, data, id); data->AddArc(data->GeometricObject(id), id); @@ -438,16 +438,16 @@ void VToolRotation::UpdateArc(quint32 idTool, quint32 idItem, const QPointF &ori //--------------------------------------------------------------------------------------------------------------------- template void VToolRotation::UpdateCurve(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, - const QString &suffix, VContainer *data, quint32 id) + const QString &suffix, VContainer *data, quint32 id) { UpdateItem(idTool, idItem, origin, angle, suffix, data, id); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); } //--------------------------------------------------------------------------------------------------------------------- template void VToolRotation::UpdateCurveWithSegments(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle, - const QString &suffix, VContainer *data, quint32 id) + const QString &suffix, VContainer *data, quint32 id) { UpdateItem(idTool, idItem, origin, angle, suffix, data, id); data->AddCurveWithSegments(data->GeometricObject(id), id); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index e074b103d..6da275d30 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -117,12 +117,12 @@ VToolCubicBezier *VToolCubicBezier::Create(const quint32 _id, VCubicBezier *spli if (typeCreation == Source::FromGui) { id = data->AddGObject(spline); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); } else { data->UpdateGObject(id, spline); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index b48024c1f..1ae884da6 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -196,12 +196,12 @@ VToolSpline* VToolSpline::Create(const quint32 _id, VSpline *spline, const QStri if (typeCreation == Source::FromGui) { id = data->AddGObject(spline); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); } else { data->UpdateGObject(id, spline); - data->AddCurve(data->GeometricObject(id), id); + data->AddSpline(data->GeometricObject(id), id); if (parse != Document::FullParse) { doc->UpdateToolData(id, data); diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp index f58a42d8d..2e29d3e90 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutspline.cpp @@ -150,20 +150,20 @@ VToolCutSpline* VToolCutSpline::Create(const quint32 _id, const QString &pointNa quint32 id = _id; VPointF *p = new VPointF(point, pointName, mx, my); - auto spline1 = QSharedPointer(new VSpline(spl->GetP1(), spl1p2, spl1p3, *p)); - auto spline2 = QSharedPointer(new VSpline(*p, spl2p2, spl2p3, spl->GetP4())); + auto spline1 = QSharedPointer(new VSpline(spl->GetP1(), spl1p2, spl1p3, *p)); + auto spline2 = QSharedPointer(new VSpline(*p, spl2p2, spl2p3, spl->GetP4())); if (typeCreation == Source::FromGui) { id = data->AddGObject(p); - data->AddCurve(spline1, NULL_ID, id); - data->AddCurve(spline2, NULL_ID, id); + data->AddSpline(spline1, NULL_ID, id); + data->AddSpline(spline2, NULL_ID, id); } else { data->UpdateGObject(id, p); - data->AddCurve(spline1, NULL_ID, id); - data->AddCurve(spline2, NULL_ID, id); + data->AddSpline(spline1, NULL_ID, id); + data->AddSpline(spline2, NULL_ID, id); if (parse != Document::FullParse) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp index cdb998195..d300c3d02 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toolcut/vtoolcutsplinepath.cpp @@ -166,15 +166,15 @@ VToolCutSplinePath* VToolCutSplinePath::Create(const quint32 _id, const QString { id = data->AddGObject(p); - data->AddCurve(QSharedPointer(splPath1), NULL_ID, id); - data->AddCurve(QSharedPointer(splPath2), NULL_ID, id); + data->AddSpline(QSharedPointer(splPath1), NULL_ID, id); + data->AddSpline(QSharedPointer(splPath2), NULL_ID, id); } else { data->UpdateGObject(id, p); - data->AddCurve(QSharedPointer(splPath1), NULL_ID, id); - data->AddCurve(QSharedPointer(splPath2), NULL_ID, id); + data->AddSpline(QSharedPointer(splPath1), NULL_ID, id); + data->AddSpline(QSharedPointer(splPath2), NULL_ID, id); if (parse != Document::FullParse) { diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp index e25800a43..54c5d2b7a 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/toollinepoint/vtoolcurveintersectaxis.cpp @@ -378,8 +378,8 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen case GOType::CubicBezier: case GOType::Spline: { - QSharedPointer spline1; - QSharedPointer spline2; + QSharedPointer spline1; + QSharedPointer spline2; const auto spl = data->GeometricObject(curveId); QPointF spl1p2, spl1p3, spl2p2, spl2p3; @@ -397,13 +397,13 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen if (not VFuzzyComparePossibleNulls(segLength, -1)) { - spline1 = QSharedPointer(spl1); - spline2 = QSharedPointer(spl2); + spline1 = QSharedPointer(spl1); + spline2 = QSharedPointer(spl2); } else { - spline1 = QSharedPointer(new VSpline()); - spline2 = QSharedPointer(new VSpline()); + spline1 = QSharedPointer(new VSpline()); + spline2 = QSharedPointer(new VSpline()); // Take names for empty splines from donors. spline1->setName(spl1->name()); @@ -413,15 +413,15 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen delete spl2; } - data->AddCurve(spline1, NULL_ID, p->id()); - data->AddCurve(spline2, NULL_ID, p->id()); + data->AddSpline(spline1, NULL_ID, p->id()); + data->AddSpline(spline2, NULL_ID, p->id()); break; } case GOType::CubicBezierPath: case GOType::SplinePath: { - QSharedPointer splP1; - QSharedPointer splP2; + QSharedPointer splP1; + QSharedPointer splP2; const auto splPath = data->GeometricObject(curveId); VSplinePath *splPath1 = nullptr; @@ -442,13 +442,13 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen if (not VFuzzyComparePossibleNulls(segLength, -1)) { - splP1 = QSharedPointer(splPath1); - splP2 = QSharedPointer(splPath2); + splP1 = QSharedPointer(splPath1); + splP2 = QSharedPointer(splPath2); } else { - splP1 = QSharedPointer(new VSplinePath()); - splP2 = QSharedPointer(new VSplinePath()); + splP1 = QSharedPointer(new VSplinePath()); + splP2 = QSharedPointer(new VSplinePath()); // Take names for empty spline paths from donors. splP1->setName(splPath1->name()); @@ -458,8 +458,8 @@ void VToolCurveIntersectAxis::InitSegments(const GOType &curveType, qreal segLen delete splPath2; } - data->AddCurve(splP1, NULL_ID, p->id()); - data->AddCurve(splP2, NULL_ID, p->id()); + data->AddSpline(splP1, NULL_ID, p->id()); + data->AddSpline(splP2, NULL_ID, p->id()); break; } case GOType::EllipticalArc: From fd8ab6123c3588adff9adc9d739f6bc73fe754a2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Sat, 24 Sep 2016 22:30:33 +0300 Subject: [PATCH 08/13] Fixed issue #565. Bug : Some informations not saved in "Seam allowance tool" in Draw Mode. --HG-- branch : develop --- src/libs/vpatterndb/vdetail.cpp | 12 ++++++++++++ src/libs/vpatterndb/vdetail.h | 8 ++++++-- src/libs/vtools/tools/vtooldetail.cpp | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/libs/vpatterndb/vdetail.cpp b/src/libs/vpatterndb/vdetail.cpp index 555f54a83..cd364168f 100644 --- a/src/libs/vpatterndb/vdetail.cpp +++ b/src/libs/vpatterndb/vdetail.cpp @@ -540,6 +540,12 @@ QVector VDetail::listNodePoint() const return list; } +//--------------------------------------------------------------------------------------------------------------------- +void VDetail::SetPatternPieceData(const VPatternPieceData &data) +{ + d->m_ppData = data; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief Returns full access to the pattern piece data object @@ -560,6 +566,12 @@ const VPatternPieceData& VDetail::GetPatternPieceData() const return d->m_ppData; } +//--------------------------------------------------------------------------------------------------------------------- +void VDetail::SetPatternInfo(const VPatternInfoGeometry &info) +{ + d->m_piPatternInfo = info; +} + //--------------------------------------------------------------------------------------------------------------------- /** * @brief Returns full access to the pattern info geometry object diff --git a/src/libs/vpatterndb/vdetail.h b/src/libs/vpatterndb/vdetail.h index 626fb4a0f..8ea1f0be9 100644 --- a/src/libs/vpatterndb/vdetail.h +++ b/src/libs/vpatterndb/vdetail.h @@ -97,9 +97,13 @@ public: QPainterPath ContourPath(const VContainer *data) const; QPainterPath SeamAllowancePath(const VContainer *data) const; QVector listNodePoint()const; - VPatternPieceData& GetPatternPieceData(); + + void SetPatternPieceData(const VPatternPieceData &data); + VPatternPieceData& GetPatternPieceData(); const VPatternPieceData& GetPatternPieceData() const; - VPatternInfoGeometry& GetPatternInfo(); + + void SetPatternInfo(const VPatternInfoGeometry &info); + VPatternInfoGeometry& GetPatternInfo(); const VPatternInfoGeometry& GetPatternInfo() const; private: diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index ed036006c..ab2a4897b 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -308,6 +308,8 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac det.setClosed(detail.getClosed()); det.setSeamAllowance(detail.getSeamAllowance()); det.setForbidFlipping(detail.getForbidFlipping()); + det.SetPatternPieceData(detail.GetPatternPieceData()); + det.SetPatternInfo(detail.GetPatternInfo()); Create(0, det, scene, doc, data, Document::FullParse, Source::FromGui); } @@ -470,6 +472,7 @@ void VToolDetail::AddToFile() doc->SetAttribute(domData, AttrHeight, geom.GetLabelHeight()); doc->SetAttribute(domData, AttrFont, geom.GetFontSize()); doc->SetAttribute(domData, AttrRotation, geom.GetRotation()); + domElement.appendChild(domData); for (int i = 0; i < detail.CountNode(); ++i) { From 014ce1e45e6eacbdc584ead51b0c89d702011b8d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 26 Sep 2016 22:33:28 +0300 Subject: [PATCH 09/13] Translation for new internal variable. --HG-- branch : develop --- src/libs/ifc/ifcdef.cpp | 51 ++++++++++--------- src/libs/ifc/ifcdef.h | 4 ++ src/libs/vpatterndb/vtranslatevars.cpp | 6 +++ .../tst_measurementregexp.cpp | 7 +-- 4 files changed, 42 insertions(+), 26 deletions(-) diff --git a/src/libs/ifc/ifcdef.cpp b/src/libs/ifc/ifcdef.cpp index 0e21829b1..d581ea542 100644 --- a/src/libs/ifc/ifcdef.cpp +++ b/src/libs/ifc/ifcdef.cpp @@ -153,35 +153,36 @@ const QString ColorDarkBlue = QStringLiteral("darkBlue"); const QString ColorYellow = QStringLiteral("yellow"); //variables -const QString line_ = QStringLiteral("Line_"); -const QString angleLine_ = QStringLiteral("AngleLine_"); -const QString spl_ = QStringLiteral(SPL_); -const QString arc_ = QStringLiteral(ARC_); -const QString splPath = QStringLiteral("SplPath"); -const QString radius_V = QStringLiteral("Radius"); -const QString radiusArc_ = radius_V + arc_; -const QString angle1_V = QStringLiteral("Angle1"); -const QString angle2_V = QStringLiteral("Angle2"); -const QString c1Length_V = QStringLiteral("C1Length"); -const QString c2Length_V = QStringLiteral("C2Length"); -const QString angle1Arc_ = angle1_V + arc_; -const QString angle2Arc_ = angle2_V + arc_; -const QString angle1Spl_ = angle1_V + spl_; -const QString angle2Spl_ = angle2_V + spl_; -const QString angle1SplPath = angle1_V + splPath; -const QString angle2SplPath = angle2_V + splPath; -const QString seg_ = QStringLiteral("Seg_"); -const QString currentLength = QStringLiteral("CurrentLength"); +const QString line_ = QStringLiteral("Line_"); +const QString angleLine_ = QStringLiteral("AngleLine_"); +const QString spl_ = QStringLiteral(SPL_); +const QString arc_ = QStringLiteral(ARC_); +const QString splPath = QStringLiteral("SplPath"); +const QString radius_V = QStringLiteral("Radius"); +const QString radiusArc_ = radius_V + arc_; +const QString angle1_V = QStringLiteral("Angle1"); +const QString angle2_V = QStringLiteral("Angle2"); +const QString c1Length_V = QStringLiteral("C1Length"); +const QString c2Length_V = QStringLiteral("C2Length"); +const QString c1LengthSpl_ = c1Length_V + spl_; +const QString c2LengthSpl_ = c2Length_V + spl_; +const QString c1LengthSplPath = c1Length_V + splPath; +const QString c2LengthSplPath = c2Length_V + splPath; +const QString angle1Arc_ = angle1_V + arc_; +const QString angle2Arc_ = angle2_V + arc_; +const QString angle1Spl_ = angle1_V + spl_; +const QString angle2Spl_ = angle2_V + spl_; +const QString angle1SplPath = angle1_V + splPath; +const QString angle2SplPath = angle2_V + splPath; +const QString seg_ = QStringLiteral("Seg_"); +const QString currentLength = QStringLiteral("CurrentLength"); const QStringList builInVariables = QStringList() << line_ << angleLine_ << arc_ << spl_ << splPath - << radius_V << radiusArc_ - << angle1_V - << angle2_V << angle1Arc_ << angle2Arc_ << angle1Spl_ @@ -189,4 +190,8 @@ const QStringList builInVariables = QStringList() << line_ << angle1SplPath << angle2SplPath << seg_ - << currentLength; + << currentLength + << c1LengthSpl_ + << c2LengthSpl_ + << c1LengthSplPath + << c2LengthSplPath; diff --git a/src/libs/ifc/ifcdef.h b/src/libs/ifc/ifcdef.h index 359edcce2..0d376157d 100644 --- a/src/libs/ifc/ifcdef.h +++ b/src/libs/ifc/ifcdef.h @@ -170,6 +170,10 @@ extern const QString angle1_V; extern const QString angle2_V; extern const QString c1Length_V; extern const QString c2Length_V; +extern const QString c1LengthSpl_; +extern const QString c2LengthSpl_; +extern const QString c1LengthSplPath; +extern const QString c2LengthSplPath; extern const QString angle1Arc_; extern const QString angle2Arc_; extern const QString angle1Spl_; diff --git a/src/libs/vpatterndb/vtranslatevars.cpp b/src/libs/vpatterndb/vtranslatevars.cpp index 0ec2efa96..6f7ce3429 100644 --- a/src/libs/vpatterndb/vtranslatevars.cpp +++ b/src/libs/vpatterndb/vtranslatevars.cpp @@ -390,6 +390,12 @@ void VTranslateVars::InitVariables() "Do not add symbol _ to the end of the name")); variables.insert(seg_, translate("VTranslateVars", "Seg_", "Segment. Left symbol _ in the name")); variables.insert(currentLength, translate("VTranslateVars", "CurrentLength", "Do not add space between words")); + variables.insert(c1LengthSpl_, translate("VTranslateVars", "C1LengthSpl_", "Left symbol _ in the name")); + variables.insert(c2LengthSpl_, translate("VTranslateVars", "C2LengthSpl_", "Left symbol _ in the name")); + variables.insert(c1LengthSplPath, translate("VTranslateVars", "C1LengthSplPath", + "Do not add symbol _ to the end of the name")); + variables.insert(c2LengthSplPath, translate("VTranslateVars", "C2LengthSplPath", + "Do not add symbol _ to the end of the name")); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/test/TranslationsTest/tst_measurementregexp.cpp b/src/test/TranslationsTest/tst_measurementregexp.cpp index 1b2317bc5..8cb82c789 100644 --- a/src/test/TranslationsTest/tst_measurementregexp.cpp +++ b/src/test/TranslationsTest/tst_measurementregexp.cpp @@ -201,10 +201,7 @@ void TST_MeasurementRegExp::TestCheckUnderlineExists_data() data.insert(arc_, true); data.insert(spl_, true); data.insert(splPath, false); - data.insert(radius_V, false); data.insert(radiusArc_, true); - data.insert(angle1_V, false); - data.insert(angle2_V, false); data.insert(angle1Arc_, true); data.insert(angle2Arc_, true); data.insert(angle1Spl_, true); @@ -213,6 +210,10 @@ void TST_MeasurementRegExp::TestCheckUnderlineExists_data() data.insert(angle2SplPath, false); data.insert(seg_, true); data.insert(currentLength, false); + data.insert(c1LengthSpl_, true); + data.insert(c2LengthSpl_, true); + data.insert(c1LengthSplPath, false); + data.insert(c2LengthSplPath, false); //Catch case when new internal variable appears. QCOMPARE(data.size(), builInVariables.size()); From de1c7cd9f3767883bc779b79b887332044445240 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 27 Sep 2016 12:27:52 +0300 Subject: [PATCH 10/13] Resolved issue #569. Tape app. Options that open new file open new instance even if a user doesn't want this. (grafted from a74c6d9fac8dd6920d7d0914e68770b893920380) --HG-- branch : develop --- ChangeLog.txt | 3 +- src/app/tape/tmainwindow.cpp | 97 +++++++++++++++--------------------- 2 files changed, 41 insertions(+), 59 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index a8034a2bd..fa362ec19 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -62,7 +62,8 @@ - [#543] Detail loses details. - [#548] Bug Detail tool. Case when seam allowance is wrong. - Called the main app in console mode doesn't show opening file error in some cases. -- [#553] Tape.exe crash. Issue with the Search field. +- [#553] Tape.exe crash. Issue with the Search field. +- [#569] Tape app. Options that open new file open new instance even if a user doesn't want this. # Version 0.4.4 April 12, 2016 - Updated measurement templates with all measurements. Added new template Aldrich/Women measurements. diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index da3ae388b..b041de9fa 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -384,79 +384,57 @@ void TMainWindow::FileNew() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::OpenIndividual() { - if (m == nullptr) - { - const QString filter = tr("Individual measurements (*.vit);;Standard measurements (*.vst);;All files (*.*)"); - //Use standard path to individual measurements - const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements(); - Open(pathTo, filter); - } - else - { - qApp->NewMainWindow(); - qApp->MainWindow()->OpenIndividual(); - } + const QString filter = tr("Individual measurements (*.vit);;Standard measurements (*.vst);;All files (*.*)"); + //Use standard path to individual measurements + const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements(); + + Open(pathTo, filter); } //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::OpenStandard() { - if (m == nullptr) - { - const QString filter = tr("Standard measurements (*.vst);;Individual measurements (*.vit);;All files (*.*)"); - //Use standard path to standard measurements - const QString pathTo = qApp->TapeSettings()->GetPathStandardMeasurements(); - Open(pathTo, filter); - } - else - { - qApp->NewMainWindow(); - qApp->MainWindow()->OpenStandard(); - } + const QString filter = tr("Standard measurements (*.vst);;Individual measurements (*.vit);;All files (*.*)"); + //Use standard path to standard measurements + const QString pathTo = qApp->TapeSettings()->GetPathStandardMeasurements(); + + Open(pathTo, filter); } //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::OpenTemplate() { - if (m == nullptr) - { - const QString filter = tr("Measurements (*.vst *.vit);;All files (*.*)"); - //Use standard path to template files - const QString pathTo = qApp->TapeSettings()->GetPathTemplate(); - Open(pathTo, filter); + const QString filter = tr("Measurements (*.vst *.vit);;All files (*.*)"); + //Use standard path to template files + const QString pathTo = qApp->TapeSettings()->GetPathTemplate(); - if (m != nullptr) - {// The file was opened. - SetCurrentFile(""); // Force user to to save new file - lock.reset();// remove lock from template - } - } - else - { - qApp->NewMainWindow(); - qApp->MainWindow()->OpenTemplate(); + Open(pathTo, filter); + + if (m != nullptr) + {// The file was opened. + SetCurrentFile(""); // Force user to to save new file + lock.reset();// remove lock from template } } //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::CreateFromExisting() { - if (m == nullptr) - { - const QString filter = tr("Individual measurements (*.vit)"); - //Use standard path to standard measurements - const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements(); - const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter); + const QString filter = tr("Individual measurements (*.vit)"); + //Use standard path to standard measurements + const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements(); + const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter); - if (not mPath.isEmpty()) + if (not mPath.isEmpty()) + { + if (m == nullptr) { LoadFromExistingFile(mPath); } - } - else - { - qApp->NewMainWindow(); - qApp->MainWindow()->CreateFromExisting(); + else + { + qApp->NewMainWindow()->CreateFromExisting(); + } } } @@ -2522,13 +2500,16 @@ void TMainWindow::Open(const QString &pathTo, const QString &filter) { const QString mPath = QFileDialog::getOpenFileName(this, tr("Open file"), pathTo, filter); - if (mPath.isEmpty()) + if (not mPath.isEmpty()) { - return; - } - else - { - LoadFile(mPath); + if (m == nullptr) + { + LoadFile(mPath); + } + else + { + qApp->NewMainWindow()->LoadFile(mPath); + } } } From aefdd21ac7570dcbcb7e732b252f6b49d51f28f0 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 27 Sep 2016 12:37:41 +0300 Subject: [PATCH 11/13] Try avoid translators errors. Translate only parts of filters that really should be translated. --HG-- branch : develop --- src/app/tape/tmainwindow.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index b041de9fa..3b60b895c 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -384,7 +384,8 @@ void TMainWindow::FileNew() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::OpenIndividual() { - const QString filter = tr("Individual measurements (*.vit);;Standard measurements (*.vst);;All files (*.*)"); + const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit);;") + tr("Standard measurements") + + QLatin1String(" (*.vst);;") + tr("All files") + QLatin1String(" (*.*)"); //Use standard path to individual measurements const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements(); @@ -394,7 +395,8 @@ void TMainWindow::OpenIndividual() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::OpenStandard() { - const QString filter = tr("Standard measurements (*.vst);;Individual measurements (*.vit);;All files (*.*)"); + const QString filter = tr("Standard measurements") + QLatin1String(" (*.vst);;") + tr("Individual measurements") + + QLatin1String(" (*.vit);;") + tr("All files") + QLatin1String(" (*.*)"); //Use standard path to standard measurements const QString pathTo = qApp->TapeSettings()->GetPathStandardMeasurements(); @@ -404,7 +406,8 @@ void TMainWindow::OpenStandard() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::OpenTemplate() { - const QString filter = tr("Measurements (*.vst *.vit);;All files (*.*)"); + const QString filter = tr("Measurements") + QLatin1String(" (*.vst *.vit);;") + tr("All files") + + QLatin1String(" (*.*)"); //Use standard path to template files const QString pathTo = qApp->TapeSettings()->GetPathTemplate(); @@ -420,7 +423,7 @@ void TMainWindow::OpenTemplate() //--------------------------------------------------------------------------------------------------------------------- void TMainWindow::CreateFromExisting() { - const QString filter = tr("Individual measurements (*.vit)"); + const QString filter = tr("Individual measurements") + QLatin1String(" (*.vit)"); //Use standard path to standard measurements const QString pathTo = qApp->TapeSettings()->GetPathIndividualMeasurements(); const QString mPath = QFileDialog::getOpenFileName(this, tr("Select file"), pathTo, filter); From 4bd615cda42c0b0a385c1f629ae4a3ec6280e39a Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 27 Sep 2016 13:00:56 +0300 Subject: [PATCH 12/13] Fixed typo. --HG-- branch : develop --- src/app/valentina/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 944ea75f5..5be170aaf 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -179,7 +179,7 @@ MainWindow::MainWindow(QWidget *parent) { mChangesAsked = true; const auto answer = QMessageBox::question(this, tr("Measurements"), - tr("Measurements was changed. Do you want to sync measurements now?"), + tr("Measurements were changed. Do you want to sync measurements now?"), QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes); if (answer == QMessageBox::Yes) { @@ -1495,7 +1495,7 @@ void MainWindow::SyncMeasurements() { watcher->addPath(path); } - const QString msg = tr("Measurements was synced"); + const QString msg = tr("Measurements have been synced"); qCDebug(vMainWindow, "%s", qUtf8Printable(msg)); helpLabel->setText(msg); VWidgetPopup::PopupMessage(this, msg); From bf1e4aeb0c803b86d55fb60014ee6605e8bd3eb1 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 27 Sep 2016 14:18:08 +0300 Subject: [PATCH 13/13] Fixed issue #539. Infinite alert loop "Gradation doesn't support inches" when loading standard table. (grafted from 9e1dee53ca8fb5d116359f9aff4b62220a10bb39) --HG-- branch : develop --- ChangeLog.txt | 1 + src/app/valentina/mainwindow.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index fa362ec19..19b8a74e6 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -64,6 +64,7 @@ - Called the main app in console mode doesn't show opening file error in some cases. - [#553] Tape.exe crash. Issue with the Search field. - [#569] Tape app. Options that open new file open new instance even if a user doesn't want this. +- [#539] Infinite alert loop "Gradation doesn't support inches" when loading standard table. # Version 0.4.4 April 12, 2016 - Updated measurement templates with all measurements. Added new template Aldrich/Women measurements. diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 5be170aaf..a45d2ab8f 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -446,6 +446,12 @@ bool MainWindow::LoadMeasurements(const QString &path) return false; } + if (qApp->patternUnit() == Unit::Inch && m->Type() == MeasurementsType::Standard) + { + qWarning()<Type() == MeasurementsType::Standard) { m->SetDataSize();