From a067b19d8f904db470d662b72869a71473219468 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 31 Aug 2016 16:18:34 +0300 Subject: [PATCH 01/12] Added "All/None" menu in detail list area for easier handling of many parts. --HG-- branch : feature --- src/app/valentina/dialogs/vwidgetdetails.cpp | 36 ++++++++++++++++++++ src/app/valentina/dialogs/vwidgetdetails.h | 1 + 2 files changed, 37 insertions(+) diff --git a/src/app/valentina/dialogs/vwidgetdetails.cpp b/src/app/valentina/dialogs/vwidgetdetails.cpp index 315d84997..d03c363a0 100644 --- a/src/app/valentina/dialogs/vwidgetdetails.cpp +++ b/src/app/valentina/dialogs/vwidgetdetails.cpp @@ -33,6 +33,7 @@ #include "../vmisc/vabstractapplication.h" #include "../vtools/undocommands/toggledetailinlayout.h" +#include #include //--------------------------------------------------------------------------------------------------------------------- @@ -46,7 +47,10 @@ VWidgetDetails::VWidgetDetails(VContainer *data, VAbstractPattern *doc, QWidget FillTable(m_data->DataDetails()); + ui->tableWidget->setContextMenuPolicy(Qt::CustomContextMenu); + connect(ui->tableWidget, &QTableWidget::cellClicked, this, &VWidgetDetails::InLayoutStateChanged); + connect(ui->tableWidget, &QTableWidget::customContextMenuRequested, this, &VWidgetDetails::ShowContextMenu); } //--------------------------------------------------------------------------------------------------------------------- @@ -132,3 +136,35 @@ void VWidgetDetails::FillTable(const QHash *details) ui->tableWidget->setCurrentCell(selectedRow, 0); } + +//--------------------------------------------------------------------------------------------------------------------- +void VWidgetDetails::ShowContextMenu(const QPoint &pos) +{ + QMenu *menu = new QMenu; + QAction *actionSelectAll = menu->addAction(tr("Select all")); + QAction *actionSelectNone = menu->addAction(tr("Select none")); + QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos)); + + bool select; + if (selectedAction == actionSelectAll) + { + select = true; + } + else if (selectedAction == actionSelectNone) + { + select = false; + } + else + { + return; + } + + for (int i = 0; itableWidget->rowCount(); ++i) + { + QTableWidgetItem *item = ui->tableWidget->item(i, 0); + const quint32 id = item->data(Qt::UserRole).toUInt(); + ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc); + connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree); + qApp->getUndoStack()->push(togglePrint); + } +} diff --git a/src/app/valentina/dialogs/vwidgetdetails.h b/src/app/valentina/dialogs/vwidgetdetails.h index c59147007..431cbd0ac 100644 --- a/src/app/valentina/dialogs/vwidgetdetails.h +++ b/src/app/valentina/dialogs/vwidgetdetails.h @@ -53,6 +53,7 @@ public slots: private slots: void InLayoutStateChanged(int row, int column); + void ShowContextMenu(const QPoint &pos); private: Q_DISABLE_COPY(VWidgetDetails) From d13bf23bf7acb564f7d98c94a8fdb13069c01e99 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 31 Aug 2016 16:33:31 +0300 Subject: [PATCH 02/12] Updated Changelog.txt. --HG-- branch : feature --- ChangeLog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4fac8d9b1..e5970b86a 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -37,6 +37,7 @@ - [#520] Improve Union tool. An option to select about original pieces. - [#262] Automatic Update notification. - [#424] Improve Formula Wizard dialog. +- Added "All/None" menu in detail list area for easier handling of many parts. # Version 0.4.5 - [#435] Valentina doesn't change the cursor. From 4283cc8ef22e507fbfb91c21d62e303f5a9eb7b6 Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Tue, 6 Sep 2016 12:37:20 +0300 Subject: [PATCH 03/12] Used QUndoStack::beginMacro and QUndoStack::endMacro. --HG-- branch : feature --- src/app/valentina/dialogs/vwidgetdetails.cpp | 69 +++++++++++++++----- 1 file changed, 52 insertions(+), 17 deletions(-) diff --git a/src/app/valentina/dialogs/vwidgetdetails.cpp b/src/app/valentina/dialogs/vwidgetdetails.cpp index d03c363a0..103729fe4 100644 --- a/src/app/valentina/dialogs/vwidgetdetails.cpp +++ b/src/app/valentina/dialogs/vwidgetdetails.cpp @@ -143,28 +143,63 @@ void VWidgetDetails::ShowContextMenu(const QPoint &pos) QMenu *menu = new QMenu; QAction *actionSelectAll = menu->addAction(tr("Select all")); QAction *actionSelectNone = menu->addAction(tr("Select none")); - QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos)); - bool select; - if (selectedAction == actionSelectAll) + const QHash *allDetails = m_data->DataDetails(); + if (not allDetails->count() == 0) { - select = true; - } - else if (selectedAction == actionSelectNone) - { - select = false; + int selectedDetails = 0; + + QHash::const_iterator iter = allDetails->constBegin(); + while (iter != allDetails->constEnd()) + { + if(iter.value().IsInLayout()) + { + selectedDetails++; + } + ++iter; + } + if (selectedDetails == 0) + { + actionSelectNone->setDisabled(true); + } + else if (selectedDetails == allDetails->size()) + { + actionSelectAll->setDisabled(true); + } + + QAction *selectedAction = menu->exec(ui->tableWidget->viewport()->mapToGlobal(pos)); + + bool select; + if (selectedAction == actionSelectAll) + { + select = true; + qApp->getUndoStack()->beginMacro(tr("select all details")); + } + else if (selectedAction == actionSelectNone) + { + select = false; + qApp->getUndoStack()->beginMacro(tr("select none details")); + } + else + { + return; + } + + for (int i = 0; itableWidget->rowCount(); ++i) + { + QTableWidgetItem *item = ui->tableWidget->item(i, 0); + const quint32 id = item->data(Qt::UserRole).toUInt(); + if (not select == m_data->DataDetails()->value(id).IsInLayout()) + { + ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc); + connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree); + qApp->getUndoStack()->push(togglePrint); + } + } + qApp->getUndoStack()->endMacro(); } else { return; } - - for (int i = 0; itableWidget->rowCount(); ++i) - { - QTableWidgetItem *item = ui->tableWidget->item(i, 0); - const quint32 id = item->data(Qt::UserRole).toUInt(); - ToggleDetailInLayout *togglePrint = new ToggleDetailInLayout(id, select, m_data, m_doc); - connect(togglePrint, &ToggleDetailInLayout::NeedLiteParsing, m_doc, &VAbstractPattern::LiteParseTree); - qApp->getUndoStack()->push(togglePrint); - } } From 4c8210afc2bf7b7162d37ff17cb9d2910d15f5d4 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 5 Sep 2016 19:16:17 +0300 Subject: [PATCH 04/12] Little improvements for make_install.bat. 1. Detect Windows version and set UTF-8 codepage if Windows 7 or higher. 2. Write error message if build finished successful, but a package was not created. 3. Check if exists "build" directory and remove it before new build. --HG-- branch : develop --- scripts/make_install.bat | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/make_install.bat b/scripts/make_install.bat index 30321070a..13c010583 100644 --- a/scripts/make_install.bat +++ b/scripts/make_install.bat @@ -1,5 +1,15 @@ rem script helps create installer +rem detect windows version +ver | find "6.1" > nul + +IF ERRORLEVEL = 1 GOTO ARCHITECTURE +IF ERRORLEVEL = 0 GOTO WIN7 + +:WIN7 +chcp 65001 + +:ARCHITECTURE rem find target architecture reg Query "HKLM\Hardware\Description\System\CentralProcessor\0" | find /i "x86" > NUL && set ARCHITECTURE=32BIT || set ARCHITECTURE=64BIT @@ -8,6 +18,7 @@ if %ARCHITECTURE%==32BIT set nsis_path="C:/Program Files/Inno Setup 5/iscc.exe" if %ARCHITECTURE%==64BIT set nsis_path="C:/Program Files (x86)/Inno Setup 5/iscc.exe" if not exist %nsis_path% ( + SET package_error="Package was not created!" SET /P promt="Coudn't find Inno Setup. Do you want to continue?[Y\N]" IF "%promt%" == "Y" GOTO PREPARE IF "%promt%" == "y" GOTO PREPARE @@ -19,7 +30,11 @@ cd .. cd rem force qmake create new qm files del /Q share\translations\*.qm -mkdir build +IF exist build ( + echo Build exists. Clearing. + rd /s /q build +) +mkdir build && echo build created cd build cd @@ -54,5 +69,6 @@ echo Failed to make the first run qmake! @pause exit /b 1 :ONEXIT -echo Done! +echo Done! %package_error% @pause + From 59f397631b921cd9d65f7cd8aea158cd9c39e71e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 11:54:18 +0300 Subject: [PATCH 05/12] Stop building if PWD or OUT_PWD contains space. --HG-- branch : develop --- Valentina.pro | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Valentina.pro b/Valentina.pro index 88a4b619e..2064c3d5f 100644 --- a/Valentina.pro +++ b/Valentina.pro @@ -6,6 +6,13 @@ include(common.pri) error("Use at least Qt 5.0.0.") } +#These checks need because we can quote all paths that contain space. +LIST = $$split(PWD,' ') +count(LIST, 1, >): error("The build will fail. Path '$${PWD}' contains space!!!") + +LIST = $$split(OUT_PWD,' ') +count(LIST, 1, >): error("The build will fail. Path '$${OUT_PWD}' contains space!!!") + unix { *-g++ { GCC_VERSION = $$system("g++ -dumpversion") From 038863fbdf5b7dbce032d87cd379e5784f7f9fcb Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 13:24:52 +0300 Subject: [PATCH 06/12] Resolved issue #560. Flipped pattern pieces in Layout. --HG-- branch : develop --- ChangeLog.txt | 1 + src/app/valentina/mainwindowsnogui.cpp | 1 + src/app/valentina/xml/vpattern.cpp | 1 + src/libs/ifc/schema.qrc | 1 + src/libs/ifc/schema/pattern/v0.3.4.xsd | 572 ++++++++++++++++++ src/libs/ifc/xml/vpatternconverter.cpp | 17 +- src/libs/ifc/xml/vpatternconverter.h | 5 +- src/libs/vlayout/vabstractdetail.cpp | 12 + src/libs/vlayout/vabstractdetail.h | 3 + src/libs/vlayout/vabstractdetail_p.h | 8 +- src/libs/vlayout/vbank.cpp | 14 + src/libs/vlayout/vbank.h | 2 + src/libs/vlayout/vlayoutgenerator.cpp | 6 + src/libs/vlayout/vposition.cpp | 2 +- .../vtools/dialogs/tools/dialogdetail.cpp | 2 + src/libs/vtools/dialogs/tools/dialogdetail.ui | 18 +- src/libs/vtools/tools/vtooldetail.cpp | 41 +- src/libs/vtools/tools/vtooldetail.h | 1 + .../vtools/undocommands/savedetailoptions.cpp | 9 + 19 files changed, 685 insertions(+), 31 deletions(-) create mode 100644 src/libs/ifc/schema/pattern/v0.3.4.xsd diff --git a/ChangeLog.txt b/ChangeLog.txt index e5970b86a..592abbc6e 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -38,6 +38,7 @@ - [#262] Automatic Update notification. - [#424] Improve Formula Wizard dialog. - Added "All/None" menu in detail list area for easier handling of many parts. +- [#560] Flipped pattern pieces in Layout. # Version 0.4.5 - [#435] Valentina doesn't change the cursor. diff --git a/src/app/valentina/mainwindowsnogui.cpp b/src/app/valentina/mainwindowsnogui.cpp index 6def41607..253185689 100644 --- a/src/app/valentina/mainwindowsnogui.cpp +++ b/src/app/valentina/mainwindowsnogui.cpp @@ -476,6 +476,7 @@ void MainWindowsNoGUI::PrepareDetailsForLayout(const QHash *de } det.setWidth(qApp->toPixel(d.getWidth())); det.CreateTextItems(); + det.setForbidFlipping(d.getForbidFlipping()); listDetails.append(det); ++i; diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index 61b45100e..ef5e50824 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -616,6 +616,7 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1")); detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0")); detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1")); + detail.setForbidFlipping(GetParametrUInt(domElement, VToolDetail::AttrForbidFlipping, "0")); detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr)); QStringList types = QStringList() << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline diff --git a/src/libs/ifc/schema.qrc b/src/libs/ifc/schema.qrc index 9b8a3e493..c55cd654e 100644 --- a/src/libs/ifc/schema.qrc +++ b/src/libs/ifc/schema.qrc @@ -17,6 +17,7 @@ schema/pattern/v0.3.1.xsd schema/pattern/v0.3.2.xsd schema/pattern/v0.3.3.xsd + schema/pattern/v0.3.4.xsd schema/standard_measurements/v0.3.0.xsd schema/standard_measurements/v0.4.0.xsd schema/standard_measurements/v0.4.1.xsd diff --git a/src/libs/ifc/schema/pattern/v0.3.4.xsd b/src/libs/ifc/schema/pattern/v0.3.4.xsd new file mode 100644 index 000000000..98bdfd73e --- /dev/null +++ b/src/libs/ifc/schema/pattern/v0.3.4.xsd @@ -0,0 +1,572 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libs/ifc/xml/vpatternconverter.cpp b/src/libs/ifc/xml/vpatternconverter.cpp index 731f47a14..33b652163 100644 --- a/src/libs/ifc/xml/vpatternconverter.cpp +++ b/src/libs/ifc/xml/vpatternconverter.cpp @@ -58,8 +58,8 @@ class QDomElement; */ const QString VPatternConverter::PatternMinVerStr = QStringLiteral("0.1.0"); -const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.3"); -const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.3.xsd"); +const QString VPatternConverter::PatternMaxVerStr = QStringLiteral("0.3.4"); +const QString VPatternConverter::CurrentSchema = QStringLiteral("://schema/pattern/v0.3.4.xsd"); //VPatternConverter::PatternMinVer; // <== DON'T FORGET TO UPDATE TOO!!!! //VPatternConverter::PatternMaxVer; // <== DON'T FORGET TO UPDATE TOO!!!! @@ -165,6 +165,8 @@ QString VPatternConverter::XSDSchema(int ver) const case (0x000302): return QStringLiteral("://schema/pattern/v0.3.2.xsd"); case (0x000303): + return QStringLiteral("://schema/pattern/v0.3.3.xsd"); + case (0x000304): return CurrentSchema; default: InvalidVersion(ver); @@ -244,6 +246,10 @@ void VPatternConverter::ApplyPatches() ValidateXML(XSDSchema(0x000303), fileName); V_FALLTHROUGH case (0x000303): + ToV0_3_4(); + ValidateXML(XSDSchema(0x000304), fileName); + V_FALLTHROUGH + case (0x000304): break; default: break; @@ -397,6 +403,13 @@ void VPatternConverter::ToV0_3_3() Save(); } +//--------------------------------------------------------------------------------------------------------------------- +void VPatternConverter::ToV0_3_4() +{ + SetVersion(QStringLiteral("0.3.4")); + Save(); +} + //--------------------------------------------------------------------------------------------------------------------- void VPatternConverter::TagUnitToV0_2_0() { diff --git a/src/libs/ifc/xml/vpatternconverter.h b/src/libs/ifc/xml/vpatternconverter.h index bbb307a79..b4af935ac 100644 --- a/src/libs/ifc/xml/vpatternconverter.h +++ b/src/libs/ifc/xml/vpatternconverter.h @@ -55,10 +55,10 @@ public: // GCC 4.6 doesn't allow constexpr and const together #if !defined(__INTEL_COMPILER) && !defined(__clang__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) <= 406 static Q_DECL_CONSTEXPR int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3); + static Q_DECL_CONSTEXPR int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 4); #else static Q_DECL_CONSTEXPR const int PatternMinVer = CONVERTER_VERSION_CHECK(0, 1, 0); - static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 3); + static Q_DECL_CONSTEXPR const int PatternMaxVer = CONVERTER_VERSION_CHECK(0, 3, 4); #endif protected: @@ -92,6 +92,7 @@ private: void ToV0_3_1(); void ToV0_3_2(); void ToV0_3_3(); + void ToV0_3_4(); void TagUnitToV0_2_0(); void TagIncrementToV0_2_0(); diff --git a/src/libs/vlayout/vabstractdetail.cpp b/src/libs/vlayout/vabstractdetail.cpp index 36bc71826..967581e0f 100644 --- a/src/libs/vlayout/vabstractdetail.cpp +++ b/src/libs/vlayout/vabstractdetail.cpp @@ -178,6 +178,18 @@ void VAbstractDetail::setWidth(const qreal &value) d->width = value; } +//--------------------------------------------------------------------------------------------------------------------- +bool VAbstractDetail::getForbidFlipping() const +{ + return d->forbidFlipping; +} + +//--------------------------------------------------------------------------------------------------------------------- +void VAbstractDetail::setForbidFlipping(bool value) +{ + d->forbidFlipping = value; +} + //--------------------------------------------------------------------------------------------------------------------- QVector VAbstractDetail::Equidistant(const QVector &points, const EquidistantType &eqv, qreal width) { diff --git a/src/libs/vlayout/vabstractdetail.h b/src/libs/vlayout/vabstractdetail.h index 25324a1f8..b73ba99bd 100644 --- a/src/libs/vlayout/vabstractdetail.h +++ b/src/libs/vlayout/vabstractdetail.h @@ -67,6 +67,9 @@ public: qreal getWidth() const; void setWidth(const qreal &value); + bool getForbidFlipping() const; + void setForbidFlipping(bool value); + static QVector Equidistant(const QVector &points, const EquidistantType &eqv, qreal width); static qreal SumTrapezoids(const QVector &points); static QVector CheckLoops(const QVector &points); diff --git a/src/libs/vlayout/vabstractdetail_p.h b/src/libs/vlayout/vabstractdetail_p.h index a84bb5980..54fded0b3 100644 --- a/src/libs/vlayout/vabstractdetail_p.h +++ b/src/libs/vlayout/vabstractdetail_p.h @@ -41,16 +41,16 @@ class VAbstractDetailData : public QSharedData { public: VAbstractDetailData() - :name(QString()), seamAllowance(false), closed(true), width(0) + :name(QString()), seamAllowance(false), closed(true), width(0), forbidFlipping(false) {} explicit VAbstractDetailData(const QString &name) - :name(name), seamAllowance(false), closed(true), width(0) + :name(name), seamAllowance(false), closed(true), width(0), forbidFlipping(false) {} VAbstractDetailData(const VAbstractDetailData &detail) :QSharedData(detail), name(detail.name), seamAllowance(detail.seamAllowance), closed(detail.closed), - width(detail.width) + width(detail.width), forbidFlipping(detail.forbidFlipping) {} ~VAbstractDetailData() {} @@ -63,6 +63,8 @@ public: bool closed; /** @brief width value seamAllowance in mm. */ qreal width; + /** @brief forbidFlipping forbid piece be mirrored in a layout. */ + bool forbidFlipping; private: VAbstractDetailData &operator=(const VAbstractDetailData &) Q_DECL_EQ_DELETE; diff --git a/src/libs/vlayout/vbank.cpp b/src/libs/vlayout/vbank.cpp index f28787391..2b62ccfe7 100644 --- a/src/libs/vlayout/vbank.cpp +++ b/src/libs/vlayout/vbank.cpp @@ -250,6 +250,20 @@ qreal VBank::GetBiggestDiagonal() const return diagonal; } +//--------------------------------------------------------------------------------------------------------------------- +bool VBank::IsForbiddenFlipping() const +{ + for (int i = 0; i < details.size(); ++i) + { + if (details.at(i).getForbidFlipping()) + { + return true; + } + } + + return false; +} + //--------------------------------------------------------------------------------------------------------------------- int VBank::ArrangedCount() const { diff --git a/src/libs/vlayout/vbank.h b/src/libs/vlayout/vbank.h index 51cd7e312..fdbc8a765 100644 --- a/src/libs/vlayout/vbank.h +++ b/src/libs/vlayout/vbank.h @@ -72,6 +72,8 @@ public: qreal GetBiggestDiagonal() const; + bool IsForbiddenFlipping() const; + private: Q_DISABLE_COPY(VBank) QVector details; diff --git a/src/libs/vlayout/vlayoutgenerator.cpp b/src/libs/vlayout/vlayoutgenerator.cpp index ed0359639..7179851bb 100644 --- a/src/libs/vlayout/vlayoutgenerator.cpp +++ b/src/libs/vlayout/vlayoutgenerator.cpp @@ -85,6 +85,12 @@ void VLayoutGenerator::Generate() papers.clear(); state = LayoutErrors::NoError; + if (bank->IsForbiddenFlipping() && not rotate) + { // Compensate forbidden flipping by rotating. 180 degree will be enough. + rotate = true; + rotationIncrease = 180; + } + #ifdef LAYOUT_DEBUG const QString path = QDir::homePath()+QStringLiteral("/LayoutDebug"); QDir debugDir(path); diff --git a/src/libs/vlayout/vposition.cpp b/src/libs/vlayout/vposition.cpp index c1288551d..ef7afd472 100644 --- a/src/libs/vlayout/vposition.cpp +++ b/src/libs/vlayout/vposition.cpp @@ -294,7 +294,7 @@ bool VPosition::CheckCombineEdges(VLayoutDetail &detail, int j, int &dEdge) break; } - if (flagMirror) + if (flagMirror && not detail.getForbidFlipping()) { #ifdef LAYOUT_DEBUG #ifdef SHOW_MIRROR diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp index 2bea5c536..fa1993949 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp +++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp @@ -442,6 +442,7 @@ VDetail DialogDetail::CreateDetail() const detail.setName(ui.lineEditName->text()); detail.setSeamAllowance(supplement); detail.setClosed(closed); + detail.setForbidFlipping(ui.checkBoxForbidFlipping->isChecked()); detail.GetPatternPieceData().SetLetter(ui.lineEditLetter->text()); @@ -510,6 +511,7 @@ void DialogDetail::setDetail(const VDetail &value) ui.lineEditName->setText(detail.getName()); ui.checkBoxSeams->setChecked(detail.getSeamAllowance()); ui.checkBoxClosed->setChecked(detail.getClosed()); + ui.checkBoxForbidFlipping->setChecked(detail.getForbidFlipping()); ClickedClosed(detail.getClosed()); ClickedSeams(detail.getSeamAllowance()); ui.doubleSpinBoxSeams->setValue(detail.getWidth()); diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.ui b/src/libs/vtools/dialogs/tools/dialogdetail.ui index 49bca0cf7..6c9496446 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.ui +++ b/src/libs/vtools/dialogs/tools/dialogdetail.ui @@ -7,7 +7,7 @@ 0 0 581 - 442 + 468 @@ -24,7 +24,7 @@ - 1 + 0 @@ -66,7 +66,7 @@ Qt::Horizontal - + @@ -186,6 +186,16 @@ Options + + + + Forbid piece be mirrored in a layout. + + + Forbid flipping + + + @@ -361,7 +371,7 @@ Qt::Horizontal - + diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index 2b5e4f35e..313ef38ee 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -112,24 +112,25 @@ class QStyleOptionGraphicsItem; class QWidget; class VDataTool; -const QString VToolDetail::TagNode = QStringLiteral("node"); +const QString VToolDetail::TagNode = QStringLiteral("node"); -const QString VToolDetail::AttrSupplement = QStringLiteral("supplement"); -const QString VToolDetail::AttrClosed = QStringLiteral("closed"); -const QString VToolDetail::AttrWidth = QStringLiteral("width"); -const QString VToolDetail::AttrHeight = QStringLiteral("height"); -const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); -const QString VToolDetail::AttrReverse = QStringLiteral("reverse"); -const QString VToolDetail::AttrFont = QStringLiteral("fontSize"); -const QString VToolDetail::AttrRotation = QStringLiteral("rotation"); +const QString VToolDetail::AttrSupplement = QStringLiteral("supplement"); +const QString VToolDetail::AttrClosed = QStringLiteral("closed"); +const QString VToolDetail::AttrForbidFlipping = QStringLiteral("forbidFlipping"); +const QString VToolDetail::AttrWidth = QStringLiteral("width"); +const QString VToolDetail::AttrHeight = QStringLiteral("height"); +const QString VToolDetail::AttrNodeType = QStringLiteral("nodeType"); +const QString VToolDetail::AttrReverse = QStringLiteral("reverse"); +const QString VToolDetail::AttrFont = QStringLiteral("fontSize"); +const QString VToolDetail::AttrRotation = QStringLiteral("rotation"); -const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); -const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); +const QString VToolDetail::NodeTypeContour = QStringLiteral("Contour"); +const QString VToolDetail::NodeTypeModeling = QStringLiteral("Modeling"); -const QString VToolDetail::NodeArc = QStringLiteral("NodeArc"); -const QString VToolDetail::NodePoint = QStringLiteral("NodePoint"); -const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline"); -const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); +const QString VToolDetail::NodeArc = QStringLiteral("NodeArc"); +const QString VToolDetail::NodePoint = QStringLiteral("NodePoint"); +const QString VToolDetail::NodeSpline = QStringLiteral("NodeSpline"); +const QString VToolDetail::NodeSplinePath = QStringLiteral("NodeSplinePath"); //--------------------------------------------------------------------------------------------------------------------- /** @@ -306,6 +307,7 @@ void VToolDetail::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstrac det.setWidth(detail.getWidth()); det.setClosed(detail.getClosed()); det.setSeamAllowance(detail.getSeamAllowance()); + det.setForbidFlipping(detail.getForbidFlipping()); Create(0, det, scene, doc, data, Document::FullParse, Source::FromGui); } @@ -432,6 +434,11 @@ void VToolDetail::AddToFile() doc->SetAttribute(domElement, AttrClosed, static_cast(detail.getClosed())); doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); + if (detail.getForbidFlipping())//for backward compatibility + { + doc->SetAttribute(domElement, AttrForbidFlipping, static_cast(detail.getForbidFlipping())); + } + QDomElement domData = doc->createElement(VAbstractPattern::TagData); const VPatternPieceData& data = detail.GetPatternPieceData(); doc->SetAttribute(domData, VAbstractPattern::AttrLetter, data.GetLetter()); @@ -452,10 +459,6 @@ void VToolDetail::AddToFile() { doc->SetAttribute(domMCP, VAbstractPattern::AttrUserDefined, mcp.m_qsMaterialUserDef); } - else - { - domMCP.removeAttribute(VAbstractPattern::AttrUserDefined); - } doc->SetAttribute(domMCP, VAbstractPattern::AttrCutNumber, mcp.m_iCutNumber); doc->SetAttribute(domMCP, VAbstractPattern::AttrPlacement, int(mcp.m_ePlacement)); domData.appendChild(domMCP); diff --git a/src/libs/vtools/tools/vtooldetail.h b/src/libs/vtools/tools/vtooldetail.h index 250129deb..b2b19e5ed 100644 --- a/src/libs/vtools/tools/vtooldetail.h +++ b/src/libs/vtools/tools/vtooldetail.h @@ -72,6 +72,7 @@ public: static const QString TagNode; static const QString AttrSupplement; static const QString AttrClosed; + static const QString AttrForbidFlipping; static const QString AttrWidth; static const QString AttrHeight; static const QString AttrNodeType; diff --git a/src/libs/vtools/undocommands/savedetailoptions.cpp b/src/libs/vtools/undocommands/savedetailoptions.cpp index e16d4c107..300648f15 100644 --- a/src/libs/vtools/undocommands/savedetailoptions.cpp +++ b/src/libs/vtools/undocommands/savedetailoptions.cpp @@ -140,6 +140,15 @@ void SaveDetailOptions::SaveDet(QDomElement &domElement, const VDetail &det) doc->SetAttribute(domElement, VToolDetail::AttrSupplement, QString().setNum(det.getSeamAllowance())); doc->SetAttribute(domElement, VToolDetail::AttrClosed, QString().setNum(det.getClosed())); doc->SetAttribute(domElement, VToolDetail::AttrWidth, QString().setNum(det.getWidth())); + + if (det.getForbidFlipping())//for backward compatibility + { + doc->SetAttribute(domElement, VToolDetail::AttrForbidFlipping, QString().setNum(det.getForbidFlipping())); + } + else + { + domElement.removeAttribute(VToolDetail::AttrForbidFlipping); + } } //--------------------------------------------------------------------------------------------------------------------- From c72f57e7e24e3b20aa698413f4b089b5cd558e83 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 13:31:57 +0300 Subject: [PATCH 07/12] Added code of conduct. --HG-- branch : develop --- code_of_conduct.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 code_of_conduct.md diff --git a/code_of_conduct.md b/code_of_conduct.md new file mode 100644 index 000000000..6e226f09b --- /dev/null +++ b/code_of_conduct.md @@ -0,0 +1,74 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, gender identity and expression, level of experience, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or +advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at [contact@valentina-project.org]. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ From ef576d76464dd2c15288f9f3fd2faca04a3d738b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 16:00:25 +0300 Subject: [PATCH 08/12] Enable rotation only for workpieces that forbid flipping. ref #560. --HG-- branch : develop --- src/libs/vlayout/vbank.cpp | 14 ---- src/libs/vlayout/vbank.h | 2 - src/libs/vlayout/vlayoutgenerator.cpp | 6 -- src/libs/vlayout/vlayoutpaper.cpp | 33 +++++++-- src/libs/vlayout/vlayoutpaper_p.h | 101 ++++++++++++++++---------- 5 files changed, 89 insertions(+), 67 deletions(-) diff --git a/src/libs/vlayout/vbank.cpp b/src/libs/vlayout/vbank.cpp index 2b62ccfe7..f28787391 100644 --- a/src/libs/vlayout/vbank.cpp +++ b/src/libs/vlayout/vbank.cpp @@ -250,20 +250,6 @@ qreal VBank::GetBiggestDiagonal() const return diagonal; } -//--------------------------------------------------------------------------------------------------------------------- -bool VBank::IsForbiddenFlipping() const -{ - for (int i = 0; i < details.size(); ++i) - { - if (details.at(i).getForbidFlipping()) - { - return true; - } - } - - return false; -} - //--------------------------------------------------------------------------------------------------------------------- int VBank::ArrangedCount() const { diff --git a/src/libs/vlayout/vbank.h b/src/libs/vlayout/vbank.h index fdbc8a765..51cd7e312 100644 --- a/src/libs/vlayout/vbank.h +++ b/src/libs/vlayout/vbank.h @@ -72,8 +72,6 @@ public: qreal GetBiggestDiagonal() const; - bool IsForbiddenFlipping() const; - private: Q_DISABLE_COPY(VBank) QVector details; diff --git a/src/libs/vlayout/vlayoutgenerator.cpp b/src/libs/vlayout/vlayoutgenerator.cpp index 7179851bb..ed0359639 100644 --- a/src/libs/vlayout/vlayoutgenerator.cpp +++ b/src/libs/vlayout/vlayoutgenerator.cpp @@ -85,12 +85,6 @@ void VLayoutGenerator::Generate() papers.clear(); state = LayoutErrors::NoError; - if (bank->IsForbiddenFlipping() && not rotate) - { // Compensate forbidden flipping by rotating. 180 degree will be enough. - rotate = true; - rotationIncrease = 180; - } - #ifdef LAYOUT_DEBUG const QString path = QDir::homePath()+QStringLiteral("/LayoutDebug"); QDir debugDir(path); diff --git a/src/libs/vlayout/vlayoutpaper.cpp b/src/libs/vlayout/vlayoutpaper.cpp index 8895a1beb..638d43503 100644 --- a/src/libs/vlayout/vlayoutpaper.cpp +++ b/src/libs/vlayout/vlayoutpaper.cpp @@ -135,30 +135,35 @@ void VLayoutPaper::SetShift(quint32 shift) //--------------------------------------------------------------------------------------------------------------------- bool VLayoutPaper::GetRotate() const { - return d->rotate; + return d->globalRotate; } //--------------------------------------------------------------------------------------------------------------------- void VLayoutPaper::SetRotate(bool value) { - d->rotate = value; + d->globalRotate = value; + d->localRotate = d->globalRotate; } //--------------------------------------------------------------------------------------------------------------------- int VLayoutPaper::GetRotationIncrease() const { - return d->rotationIncrease; + return d->globalRotationIncrease; } //--------------------------------------------------------------------------------------------------------------------- void VLayoutPaper::SetRotationIncrease(int value) { - d->rotationIncrease = value; + d->globalRotationIncrease = value; - if ((d->rotationIncrease >= 1 && d->rotationIncrease <= 180 && 360 % d->rotationIncrease == 0) == false) + if ((d->globalRotationIncrease >= 1 + && d->globalRotationIncrease <= 180 + && 360 % d->globalRotationIncrease == 0) == false) { - d->rotationIncrease = 180; + d->globalRotationIncrease = 180; } + + d->localRotationIncrease = d->globalRotationIncrease; } //--------------------------------------------------------------------------------------------------------------------- @@ -193,6 +198,17 @@ bool VLayoutPaper::ArrangeDetail(const VLayoutDetail &detail, volatile bool &sto return false;//Not enough edges } + if (detail.getForbidFlipping() && not d->globalRotate) + { // Compensate forbidden flipping by rotating. 180 degree will be enough. + d->localRotate = true; + d->localRotationIncrease = 180; + } + else + { // Return to global values if was changed + d->localRotate = d->globalRotate; + d->localRotationIncrease = d->globalRotationIncrease; + } + d->frame = 0; return AddToSheet(detail, stop); @@ -216,7 +232,8 @@ bool VLayoutPaper::AddToSheet(const VLayoutDetail &detail, volatile bool &stop) { for (int i=1; i<= detail.EdgesCount(); ++i) { - VPosition *thread = new VPosition(d->globalContour, j, detail, i, &stop, d->rotate, d->rotationIncrease, + VPosition *thread = new VPosition(d->globalContour, j, detail, i, &stop, d->localRotate, + d->localRotationIncrease, d->saveLength); //Info for debug #ifdef LAYOUT_DEBUG @@ -230,7 +247,7 @@ bool VLayoutPaper::AddToSheet(const VLayoutDetail &detail, volatile bool &stop) threads.append(thread); thread_pool->start(thread); - d->frame = d->frame + 3 + static_cast(360/d->rotationIncrease*2); + d->frame = d->frame + 3 + static_cast(360/d->localRotationIncrease*2); } } diff --git a/src/libs/vlayout/vlayoutpaper_p.h b/src/libs/vlayout/vlayoutpaper_p.h index 373ffff84..34ec699bf 100644 --- a/src/libs/vlayout/vlayoutpaper_p.h +++ b/src/libs/vlayout/vlayoutpaper_p.h @@ -1,30 +1,30 @@ /************************************************************************ - ** - ** @file vlayoutpaper_p.h - ** @author Roman Telezhynskyi - ** @date 8 1, 2015 - ** - ** @brief - ** @copyright - ** This source code is part of the Valentine project, a pattern making - ** program, whose allow create and modeling patterns of clothing. - ** Copyright (C) 2013-2015 Valentina project - ** All Rights Reserved. - ** - ** Valentina is free software: you can redistribute it and/or modify - ** it under the terms of the GNU General Public License as published by - ** the Free Software Foundation, either version 3 of the License, or - ** (at your option) any later version. - ** - ** Valentina is distributed in the hope that it will be useful, - ** but WITHOUT ANY WARRANTY; without even the implied warranty of - ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - ** GNU General Public License for more details. - ** - ** You should have received a copy of the GNU General Public License - ** along with Valentina. If not, see . - ** - *************************************************************************/ +** +** @file vlayoutpaper_p.h +** @author Roman Telezhynskyi +** @date 8 1, 2015 +** +** @brief +** @copyright +** This source code is part of the Valentine project, a pattern making +** program, whose allow create and modeling patterns of clothing. +** Copyright (C) 2013-2015 Valentina project +** All Rights Reserved. +** +** Valentina is free software: you can redistribute it and/or modify +** it under the terms of the GNU General Public License as published by +** the Free Software Foundation, either version 3 of the License, or +** (at your option) any later version. +** +** Valentina is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +** GNU General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with Valentina. If not, see . +** +*************************************************************************/ #ifndef VLAYOUTPAPER_P_H #define VLAYOUTPAPER_P_H @@ -43,19 +43,44 @@ class VLayoutPaperData : public QSharedData { public: VLayoutPaperData() - :details(QVector()), globalContour(VContour()), paperIndex(0), frame(0), layoutWidth(0), - rotate(true), rotationIncrease(180), saveLength(false) + : details(QVector()), + globalContour(VContour()), + paperIndex(0), + frame(0), + layoutWidth(0), + globalRotate(true), + localRotate(true), + globalRotationIncrease(180), + localRotationIncrease(180), + saveLength(false) {} - VLayoutPaperData(int height, int width) - :details(QVector()), globalContour(VContour(height, width)), paperIndex(0), frame(0), - layoutWidth(0), rotate(true), rotationIncrease(180), saveLength(false) + VLayoutPaperData(int height, + int width) + : details(QVector()), + globalContour(VContour(height, width)), + paperIndex(0), + frame(0), + layoutWidth(0), + globalRotate(true), + localRotate(true), + globalRotationIncrease(180), + localRotationIncrease(180), + saveLength(false) {} VLayoutPaperData(const VLayoutPaperData &paper) - :QSharedData(paper), details(paper.details), globalContour(paper.globalContour), paperIndex(paper.paperIndex), - frame(paper.frame), layoutWidth(paper.layoutWidth), rotate(paper.rotate), - rotationIncrease(paper.rotationIncrease), saveLength(paper.saveLength) + : QSharedData(paper), + details(paper.details), + globalContour(paper.globalContour), + paperIndex(paper.paperIndex), + frame(paper.frame), + layoutWidth(paper.layoutWidth), + globalRotate(paper.globalRotate), + localRotate(paper.localRotate), + globalRotationIncrease(paper.globalRotationIncrease), + localRotationIncrease(paper.localRotationIncrease), + saveLength(paper.saveLength) {} ~VLayoutPaperData() {} @@ -69,12 +94,14 @@ public: quint32 paperIndex; quint32 frame; qreal layoutWidth; - bool rotate; - int rotationIncrease; + bool globalRotate; + bool localRotate; + int globalRotationIncrease; + int localRotationIncrease; bool saveLength; private: - VLayoutPaperData &operator=(const VLayoutPaperData &) Q_DECL_EQ_DELETE; + VLayoutPaperData& operator=(const VLayoutPaperData&) Q_DECL_EQ_DELETE; }; QT_WARNING_POP From 0d35033275bcd71f757267d3417a58412da593c2 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 17:05:54 +0300 Subject: [PATCH 09/12] Added global option "Forbid Flipping". ref #560. --HG-- branch : develop --- .../dialogs/configpages/patternpage.cpp | 26 +++++++++++++++++-- .../dialogs/configpages/patternpage.h | 3 +++ src/app/valentina/xml/vpattern.cpp | 3 ++- src/libs/vmisc/vcommonsettings.cpp | 15 ++++++++++- src/libs/vmisc/vcommonsettings.h | 4 +++ .../vtools/dialogs/tools/dialogdetail.cpp | 2 ++ src/libs/vtools/tools/vtooldetail.cpp | 6 +---- .../vtools/undocommands/savedetailoptions.cpp | 10 +------ 8 files changed, 51 insertions(+), 18 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/patternpage.cpp b/src/app/valentina/dialogs/configpages/patternpage.cpp index 072e9cd93..8660a3804 100644 --- a/src/app/valentina/dialogs/configpages/patternpage.cpp +++ b/src/app/valentina/dialogs/configpages/patternpage.cpp @@ -54,18 +54,22 @@ PatternPage::PatternPage(QWidget *parent): undoCount(nullptr), countStepsLabel(nullptr), userMaterialsGroup(nullptr), - userMaterialClearButton(nullptr) + userMaterialClearButton(nullptr), + workpieceGroup(nullptr), + forbidFlippingCheck(nullptr) { QGroupBox *userGroup = UserGroup(); QGroupBox *graphOutputGroup = GraphOutputGroup(); QGroupBox *undoGroup = UndoGroup(); - QGroupBox *userMatGroup = UserMaterialGroup(); + QGroupBox *userMatGroup = UserMaterialGroup(); + QGroupBox *workpieceGroup = UserWorkpieceGroup(); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addWidget(userGroup); mainLayout->addWidget(graphOutputGroup); mainLayout->addWidget(undoGroup); mainLayout->addWidget(userMatGroup); + mainLayout->addWidget(workpieceGroup); mainLayout->addStretch(1); setLayout(mainLayout); } @@ -85,6 +89,8 @@ void PatternPage::Apply() * non-empty stack might delete the command at the current index. Calling setUndoLimit() on a non-empty stack * prints a warning and does nothing.*/ settings->SetUndoCount(undoCount->value()); + + settings->SetForbidWorkpieceFlipping(forbidFlippingCheck->isChecked()); } //--------------------------------------------------------------------------------------------------------------------- @@ -183,6 +189,22 @@ QGroupBox *PatternPage::UserMaterialGroup() return userMaterialsGroup; } +//--------------------------------------------------------------------------------------------------------------------- +QGroupBox *PatternPage::UserWorkpieceGroup() +{ + workpieceGroup = new QGroupBox(tr("Workpiece")); + + forbidFlippingCheck = new QCheckBox(tr("Forbid flipping")); + forbidFlippingCheck->setToolTip(tr("By default forbid flipping for all workpieces")); + forbidFlippingCheck->setChecked(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping()); + + QVBoxLayout *editLayout = new QVBoxLayout; + editLayout->addWidget(forbidFlippingCheck); + + workpieceGroup->setLayout(editLayout); + return workpieceGroup; +} + //--------------------------------------------------------------------------------------------------------------------- void PatternPage::RetranslateUi() { diff --git a/src/app/valentina/dialogs/configpages/patternpage.h b/src/app/valentina/dialogs/configpages/patternpage.h index 176d004c4..39de06c09 100644 --- a/src/app/valentina/dialogs/configpages/patternpage.h +++ b/src/app/valentina/dialogs/configpages/patternpage.h @@ -61,11 +61,14 @@ private: QLabel *countStepsLabel; QGroupBox *userMaterialsGroup; QPushButton* userMaterialClearButton; + QGroupBox *workpieceGroup; + QCheckBox *forbidFlippingCheck; QGroupBox *UserGroup() Q_REQUIRED_RESULT; QGroupBox *GraphOutputGroup() Q_REQUIRED_RESULT; QGroupBox *UndoGroup() Q_REQUIRED_RESULT; QGroupBox *UserMaterialGroup() Q_REQUIRED_RESULT; + QGroupBox *UserWorkpieceGroup() Q_REQUIRED_RESULT; void RetranslateUi(); }; diff --git a/src/app/valentina/xml/vpattern.cpp b/src/app/valentina/xml/vpattern.cpp index ef5e50824..faf18ed06 100644 --- a/src/app/valentina/xml/vpattern.cpp +++ b/src/app/valentina/xml/vpattern.cpp @@ -616,7 +616,8 @@ void VPattern::ParseDetailElement(const QDomElement &domElement, const Document detail.setSeamAllowance(GetParametrUInt(domElement, VToolDetail::AttrSupplement, "1")); detail.setWidth(GetParametrDouble(domElement, VToolDetail::AttrWidth, "10.0")); detail.setClosed(GetParametrUInt(domElement, VToolDetail::AttrClosed, "1")); - detail.setForbidFlipping(GetParametrUInt(domElement, VToolDetail::AttrForbidFlipping, "0")); + detail.setForbidFlipping(GetParametrUInt(domElement, VToolDetail::AttrForbidFlipping, + QString().setNum(qApp->ValentinaSettings()->GetForbidWorkpieceFlipping()))); detail.SetInLayout(GetParametrBool(domElement, AttrInLayout, trueStr)); QStringList types = QStringList() << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 5d6e6818b..b780b2744 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -61,6 +61,7 @@ const QString VCommonSettings::SettingConfigurationToolBarStyle = QString const QString VCommonSettings::SettingPatternUser = QStringLiteral("pattern/user"); const QString VCommonSettings::SettingPatternUndo = QStringLiteral("pattern/undo"); +const QString VCommonSettings::SettingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipping"); const QString VCommonSettings::SettingGeneralRecentFileList = QStringLiteral("recentFileList"); const QString VCommonSettings::SettingGeneralRestoreFileList = QStringLiteral("restoreFileList"); @@ -70,7 +71,7 @@ const QString VCommonSettings::SettingGeneralToolbarsState = QString const QString VCommonSettings::SettingPreferenceDialogSize = QStringLiteral("preferenceDialogSize"); const QString VCommonSettings::SettingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion"); const QString VCommonSettings::SettingDateOfLastRemind = QStringLiteral("dateOfLastRemind"); -const QString VCommonSettings::SettingUserDefinedMaterials = QStringLiteral("configuration/userDefinedMaterials"); +const QString VCommonSettings::SettingUserDefinedMaterials = QStringLiteral("configuration/userDefinedMaterials"); static const QString commonIniFilename = QStringLiteral("common"); @@ -486,3 +487,15 @@ void VCommonSettings::ClearUserDefinedMaterial() QStringList qsl; setValue(SettingUserDefinedMaterials, qsl); } + +//--------------------------------------------------------------------------------------------------------------------- +bool VCommonSettings::GetForbidWorkpieceFlipping() const +{ + return value(SettingPatternForbidFlipping, false).toBool(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetForbidWorkpieceFlipping(bool value) +{ + setValue(SettingPatternForbidFlipping, value); +} diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 258879e66..7ce7433c9 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -122,6 +122,9 @@ public: void AddUserDefinedMaterial(QString qsMaterial); void ClearUserDefinedMaterial(); + bool GetForbidWorkpieceFlipping() const; + void SetForbidWorkpieceFlipping(bool value); + private: Q_DISABLE_COPY(VCommonSettings) @@ -141,6 +144,7 @@ private: static const QString SettingPatternUser; static const QString SettingPatternUndo; + static const QString SettingPatternForbidFlipping; static const QString SettingGeneralRecentFileList; static const QString SettingGeneralRestoreFileList; diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp index fa1993949..6ee916db0 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp +++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp @@ -85,6 +85,8 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge ui.lineEditLetter->setClearButtonEnabled(true); #endif + ui.checkBoxForbidFlipping->setChecked(qApp->Settings()->GetForbidWorkpieceFlipping()); + labelEditNamePoint = ui.labelEditName; ui.labelUnit->setText( VDomDocument::UnitsToStr(qApp->patternUnit(), true)); ui.labelUnitX->setText(VDomDocument::UnitsToStr(qApp->patternUnit(), true)); diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index 313ef38ee..ed036006c 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -433,11 +433,7 @@ void VToolDetail::AddToFile() doc->SetAttribute(domElement, AttrSupplement, static_cast(detail.getSeamAllowance())); doc->SetAttribute(domElement, AttrClosed, static_cast(detail.getClosed())); doc->SetAttribute(domElement, AttrWidth, detail.getWidth()); - - if (detail.getForbidFlipping())//for backward compatibility - { - doc->SetAttribute(domElement, AttrForbidFlipping, static_cast(detail.getForbidFlipping())); - } + doc->SetAttribute(domElement, AttrForbidFlipping, static_cast(detail.getForbidFlipping())); QDomElement domData = doc->createElement(VAbstractPattern::TagData); const VPatternPieceData& data = detail.GetPatternPieceData(); diff --git a/src/libs/vtools/undocommands/savedetailoptions.cpp b/src/libs/vtools/undocommands/savedetailoptions.cpp index 300648f15..7da804348 100644 --- a/src/libs/vtools/undocommands/savedetailoptions.cpp +++ b/src/libs/vtools/undocommands/savedetailoptions.cpp @@ -140,15 +140,7 @@ void SaveDetailOptions::SaveDet(QDomElement &domElement, const VDetail &det) doc->SetAttribute(domElement, VToolDetail::AttrSupplement, QString().setNum(det.getSeamAllowance())); doc->SetAttribute(domElement, VToolDetail::AttrClosed, QString().setNum(det.getClosed())); doc->SetAttribute(domElement, VToolDetail::AttrWidth, QString().setNum(det.getWidth())); - - if (det.getForbidFlipping())//for backward compatibility - { - doc->SetAttribute(domElement, VToolDetail::AttrForbidFlipping, QString().setNum(det.getForbidFlipping())); - } - else - { - domElement.removeAttribute(VToolDetail::AttrForbidFlipping); - } + doc->SetAttribute(domElement, VToolDetail::AttrForbidFlipping, QString().setNum(det.getForbidFlipping())); } //--------------------------------------------------------------------------------------------------------------------- From cbd2e4a91271cd41a695a8031d20e9c64c58e14d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 17:26:53 +0300 Subject: [PATCH 10/12] Fix issue #547. Compiler warning. --HG-- branch : develop --- src/libs/vdxf/dxflib/dl_codes.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/libs/vdxf/dxflib/dl_codes.h b/src/libs/vdxf/dxflib/dl_codes.h index 321d1d34a..131efc5b3 100644 --- a/src/libs/vdxf/dxflib/dl_codes.h +++ b/src/libs/vdxf/dxflib/dl_codes.h @@ -39,15 +39,6 @@ #endif // _MSC_VER > 1000 #endif // Q_CC_MSVC -#if defined(__OS2__)||defined(__EMX__) -#define strcasecmp(s,t) stricmp(s,t) -#endif - -#if defined(_WIN32)&&!defined(strcasecmp) -#define strcasecmp(s,t) _stricmp(s,t) -#endif - - #ifdef _WIN32 #undef M_PI #define M_PI 3.14159265358979323846 From c622d173ddbff1d5e1b8c48b39c8f683f27c9852 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 17:48:28 +0300 Subject: [PATCH 11/12] Several useful constans. --HG-- branch : develop --- src/libs/vdxf/dxflib/dl_codes.h | 19 ------------------- src/libs/vgeometry/vabstractcurve.h | 5 +---- src/libs/vmisc/vmath.h | 28 ++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/libs/vdxf/dxflib/dl_codes.h b/src/libs/vdxf/dxflib/dl_codes.h index 131efc5b3..0bbcabcaf 100644 --- a/src/libs/vdxf/dxflib/dl_codes.h +++ b/src/libs/vdxf/dxflib/dl_codes.h @@ -39,25 +39,6 @@ #endif // _MSC_VER > 1000 #endif // Q_CC_MSVC -#ifdef _WIN32 -#undef M_PI -#define M_PI 3.14159265358979323846 -QT_WARNING_DISABLE_MSVC(4800) -#endif - -#ifndef M_PI -#define M_PI 3.14159265358979323846 /* pi */ -#endif - -#ifndef M_2PI -#define M_2PI 6.28318530717958647692 /* 2*pi */ -#endif - -#ifndef M_PI_2 -#define M_PI_2 1.57079632679489661923 /* pi/2 */ - -#endif - #define DL_DXF_MAXLINE 1024 #define DL_DXF_MAXGROUPCODE 1100 diff --git a/src/libs/vgeometry/vabstractcurve.h b/src/libs/vgeometry/vabstractcurve.h index f8546885b..13d16969c 100644 --- a/src/libs/vgeometry/vabstractcurve.h +++ b/src/libs/vgeometry/vabstractcurve.h @@ -38,15 +38,12 @@ #include #include "../ifc/ifcdef.h" +#include "../vmisc/vmath.h" #include "vgeometrydef.h" #include "vgobject.h" class QPointF; -#ifndef M_2PI -#define M_2PI 6.28318530717958647692528676655900576 -#endif - enum class PathDirection : char { Hide, Show }; class QLineF; diff --git a/src/libs/vmisc/vmath.h b/src/libs/vmisc/vmath.h index a24c656b7..cf43762c3 100644 --- a/src/libs/vmisc/vmath.h +++ b/src/libs/vmisc/vmath.h @@ -48,5 +48,33 @@ Q_DECL_CONSTEXPR inline double qRadiansToDegrees(double radians) #endif // QT_VERSION < QT_VERSION_CHECK(5, 1, 0) +#ifndef M_2PI +#define M_2PI (6.28318530717958647692) /* 2*pi */ +#endif + +#ifndef M_3PI_4 +#define M_3PI_4 (2.35619449019234492884) /* 3*pi/4 */ +#endif + +#ifndef M_3PI_8 +#define M_3PI_8 (1.17809724509617246442) /* 3*pi/8 */ +#endif + +#ifndef M_PI_8 +#define M_PI_8 (0.39269908169872415480) /* pi/8 */ +#endif + +#ifndef M_4_PI +#define M_4_PI (1.27323954473516268615) /* 4/pi */ +#endif + +#ifndef M_1_SQRT2 +#define M_1_SQRT2 (0.70710678118654752440) /* 1/sqrt(2) */ +#endif + +#ifndef M_EULER +#define M_EULER (0.57721566490153286060) +#endif + #endif // VMATH_H From b6e9a7bab3feef6e8735934ea5ba2152f64fea1b Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 6 Sep 2016 18:47:56 +0300 Subject: [PATCH 12/12] Fixed issue #561. UI compiler warning in dialogdetail.ui. --HG-- branch : develop --- src/libs/vtools/dialogs/tools/dialogdetail.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.ui b/src/libs/vtools/dialogs/tools/dialogdetail.ui index 6c9496446..be5300e33 100644 --- a/src/libs/vtools/dialogs/tools/dialogdetail.ui +++ b/src/libs/vtools/dialogs/tools/dialogdetail.ui @@ -371,7 +371,7 @@ Qt::Horizontal - +