diff --git a/src/libs/vpatterndb/vdetail_p.h b/src/libs/vpatterndb/vdetail_p.h
index bcb470238..1c7dcfce0 100644
--- a/src/libs/vpatterndb/vdetail_p.h
+++ b/src/libs/vpatterndb/vdetail_p.h
@@ -51,7 +51,8 @@ public:
{}
VDetailData(const VDetailData &detail)
- :QSharedData(detail), _id(NULL_ID), nodes(detail.nodes), mx(detail.mx), my(detail.my)
+ :QSharedData(detail), _id(NULL_ID), nodes(detail.nodes), mx(detail.mx), my(detail.my),
+ m_ppData(detail.m_ppData)
{}
~VDetailData() {}
diff --git a/src/libs/vtools/dialogs/dialogs.pri b/src/libs/vtools/dialogs/dialogs.pri
index e737ebe87..5c1cc848e 100644
--- a/src/libs/vtools/dialogs/dialogs.pri
+++ b/src/libs/vtools/dialogs/dialogs.pri
@@ -38,8 +38,7 @@ HEADERS += \
$$PWD/tools/dialogcubicbezier.h \
$$PWD/tools/dialogcubicbezierpath.h \
$$PWD/tools/dialoggroup.h \
- $$PWD/tools/dialogrotation.h \
- $$PWD/tools/dialogpatternpiecedata.h
+ $$PWD/tools/dialogrotation.h
SOURCES += \
@@ -78,8 +77,7 @@ SOURCES += \
$$PWD/tools/dialogcubicbezier.cpp \
$$PWD/tools/dialogcubicbezierpath.cpp \
$$PWD/tools/dialoggroup.cpp \
- $$PWD/tools/dialogrotation.cpp \
- $$PWD/tools/dialogpatternpiecedata.cpp
+ $$PWD/tools/dialogrotation.cpp
FORMS += \
$$PWD/tools/dialogalongline.ui \
diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.cpp b/src/libs/vtools/dialogs/tools/dialogdetail.cpp
index b81f76934..0fdb49ca4 100644
--- a/src/libs/vtools/dialogs/tools/dialogdetail.cpp
+++ b/src/libs/vtools/dialogs/tools/dialogdetail.cpp
@@ -36,6 +36,7 @@
#include "../../../vgeometry/vsplinepath.h"
#include "../../../vpatterndb/vcontainer.h"
#include "../../../ifc/xml/vdomdocument.h"
+#include "vpatternpiecedata.h"
//---------------------------------------------------------------------------------------------------------------------
/**
@@ -90,6 +91,19 @@ DialogDetail::DialogDetail(const VContainer *data, const quint32 &toolId, QWidge
connect(ui.toolButtonDelete, &QToolButton::clicked, this, &DialogDetail::DeleteItem);
connect(ui.toolButtonUp, &QToolButton::clicked, this, &DialogDetail::ScrollUp);
connect(ui.toolButtonDown, &QToolButton::clicked, this, &DialogDetail::ScrollDown);
+
+ m_qslMaterials << tr("Fabric") << tr("Lining") << tr("Interfacing") << tr("Interlining");
+ ui.comboBoxMaterial->addItems(m_qslMaterials);
+ m_qslPlacements << tr("None") << tr("Cut on fold");
+ ui.comboBoxPlacement->addItems(m_qslPlacements);
+
+ connect(ui.pushButtonAdd, &QPushButton::clicked, this, &DialogDetail::AddUpdate);
+ connect(ui.pushButtonCancel, &QPushButton::clicked, this, &DialogDetail::Cancel);
+ connect(ui.pushButtonRemove, &QPushButton::clicked, this, &DialogDetail::Remove);
+ connect(ui.listWidgetMCP, &QListWidget::itemClicked, this, &DialogDetail::SetEditMode);
+ SetAddMode();
+
+ ui.tabWidget->setCurrentIndex(0);
}
//---------------------------------------------------------------------------------------------------------------------
@@ -153,6 +167,74 @@ void DialogDetail::CheckState()
}
}
+//---------------------------------------------------------------------------------------------------------------------
+void DialogDetail::UpdateList()
+{
+ ui.listWidgetMCP->clear();
+ for (int i = 0; i < detail.GetPatternPieceData().GetMCPCount(); ++i)
+ {
+ MaterialCutPlacement mcp = detail.GetPatternPieceData().GetMCP(i);
+ QString qsText = tr("Cut %1 of %2%3");
+ qsText = qsText.arg(mcp.m_iCutNumber);
+ if (mcp.m_eMaterial < MaterialType::mtUserDefined)
+ qsText = qsText.arg(m_qslMaterials[int(mcp.m_eMaterial)]);
+ else
+ qsText = qsText.arg(mcp.m_qsMaterialUserDef);
+ if (mcp.m_ePlacement == PlacementType::ptCutOnFold)
+ qsText = qsText.arg(tr(" on Fold"));
+ else
+ qsText = qsText.arg("");
+
+ ui.listWidgetMCP->addItem(qsText);
+ }
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogDetail::AddUpdate()
+{
+ MaterialCutPlacement mcp;
+ mcp.m_qsMaterialUserDef = ui.comboBoxMaterial->currentText();
+ mcp.m_eMaterial = MaterialType::mtUserDefined;
+ for (int i = 0; i < m_qslMaterials.count(); ++i)
+ if (mcp.m_qsMaterialUserDef == m_qslMaterials[i])
+ mcp.m_eMaterial = MaterialType(i);
+
+ mcp.m_iCutNumber = ui.spinBoxCutNumber->value();
+ mcp.m_ePlacement = PlacementType(ui.comboBoxPlacement->currentIndex());
+
+ if (m_bAddMode == true)
+ {
+ detail.GetPatternPieceData().Append(mcp);
+ }
+ else
+ {
+ int iR = ui.listWidgetMCP->currentRow();
+ SCASSERT(iR >= 0);
+ detail.GetPatternPieceData().Set(iR, mcp);
+ SetAddMode();
+ }
+ UpdateList();
+ ClearFields();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogDetail::Cancel()
+{
+ ClearFields();
+ SetAddMode();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogDetail::Remove()
+{
+ int iR = ui.listWidgetMCP->currentRow();
+ SCASSERT(iR >= 0);
+ detail.GetPatternPieceData().RemoveMCP(iR);
+ UpdateList();
+ ClearFields();
+ SetAddMode();
+}
+
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief NewItem add new object (point, arc, spline or spline path) to list
@@ -245,6 +327,14 @@ VDetail DialogDetail::CreateDetail() const
detail.setName(ui.lineEditNameDetail->text());
detail.setSeamAllowance(supplement);
detail.setClosed(closed);
+
+ detail.GetPatternPieceData().SetLetter(ui.lineEditLetter->text());
+ detail.GetPatternPieceData().SetName(ui.lineEditName->text());
+
+ qDebug() << "DD" << detail.GetPatternPieceData().GetLetter()
+ << detail.GetPatternPieceData().GetName()
+ << detail.GetPatternPieceData().GetMCPCount();
+
return detail;
}
@@ -292,6 +382,11 @@ void DialogDetail::setDetail(const VDetail &value)
ui.listWidget->setCurrentRow(0);
ui.listWidget->setFocus(Qt::OtherFocusReason);
ui.toolButtonDelete->setEnabled(true);
+
+ ui.lineEditLetter->setText(detail.GetPatternPieceData().GetLetter());
+ ui.lineEditName->setText(detail.GetPatternPieceData().GetName());
+ UpdateList();
+
ValidObjects(DetailIsValid());
}
@@ -555,3 +650,41 @@ bool DialogDetail::DetailIsClockwise() const
}
return false;
}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogDetail::ClearFields()
+{
+ ui.comboBoxMaterial->setCurrentIndex(0);
+ ui.spinBoxCutNumber->setValue(0);
+ ui.comboBoxPlacement->setCurrentIndex(0);
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogDetail::SetAddMode()
+{
+ ui.pushButtonAdd->setText(tr("Add"));
+ ui.pushButtonCancel->hide();
+ ui.pushButtonRemove->hide();
+ ui.listWidgetMCP->setCurrentRow(-1);
+ m_bAddMode = true;
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void DialogDetail::SetEditMode()
+{
+ int iR = ui.listWidgetMCP->currentRow();
+ // this method can be called by clicking on item or by update. In the latter case there is nothing else to do!
+ if (iR < 0 || iR >= detail.GetPatternPieceData().GetMCPCount())
+ return;
+
+ ui.pushButtonAdd->setText(tr("Update"));
+ ui.pushButtonCancel->show();
+ ui.pushButtonRemove->show();
+
+ MaterialCutPlacement mcp = detail.GetPatternPieceData().GetMCP(iR);
+ ui.comboBoxMaterial->setCurrentText(mcp.m_qsMaterialUserDef);
+ ui.spinBoxCutNumber->setValue(mcp.m_iCutNumber);
+ ui.comboBoxPlacement->setCurrentIndex(int(mcp.m_ePlacement));
+
+ m_bAddMode = false;
+}
diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.h b/src/libs/vtools/dialogs/tools/dialogdetail.h
index 6dcd5c43e..4169696ae 100644
--- a/src/libs/vtools/dialogs/tools/dialogdetail.h
+++ b/src/libs/vtools/dialogs/tools/dialogdetail.h
@@ -62,6 +62,13 @@ protected:
*/
virtual void SaveData() Q_DECL_OVERRIDE;
virtual void CheckState() Q_DECL_OVERRIDE;
+
+protected slots:
+ void UpdateList();
+ void AddUpdate();
+ void Cancel();
+ void Remove();
+
private:
/** @brief ui keeps information about user interface */
@@ -85,6 +92,18 @@ private:
VDetail CreateDetail() const;
void ValidObjects(bool value);
void EnableObjectGUI(bool value);
+
+ bool m_bAddMode;
+
+ QStringList m_qslMaterials;
+ QStringList m_qslPlacements;
+
+ void ClearFields();
+
+
+private slots:
+ void SetAddMode();
+ void SetEditMode();
};
//---------------------------------------------------------------------------------------------------------------------
diff --git a/src/libs/vtools/dialogs/tools/dialogdetail.ui b/src/libs/vtools/dialogs/tools/dialogdetail.ui
index 29a7ae68b..8faa4a01f 100644
--- a/src/libs/vtools/dialogs/tools/dialogdetail.ui
+++ b/src/libs/vtools/dialogs/tools/dialogdetail.ui
@@ -7,7 +7,7 @@
0
0
522
- 425
+ 481
@@ -20,11 +20,422 @@
-
- -
-
-
-
+
+
-
+
+
+ 1
+
+
+
+ General
+
+
+
+
+ 59
+ 468
+ 504
+ 15
+
+
+
+ Ready!
+
+
+ Qt::RichText
+
+
+ false
+
+
+
+
+
+ 50
+ 40
+ 367
+ 34
+
+
+
+
+
+
+
+ 0
+ 30
+ 561
+ 361
+
+
+
+
-
+
+
-
+
+
+ 6
+
+
+ QLayout::SetDefaultConstraint
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+
+ 1
+ 0
+
+
+
+ Bias X:
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ -900.990000000000009
+
+
+ 900.990000000000009
+
+
+ 0.100000000000000
+
+
+ 0.000000000000000
+
+
+
+ -
+
+
+ cm
+
+
+
+
+
+ -
+
+
-
+
+
+
+ 1
+ 0
+
+
+
+ Bias Y:
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ -900.990000000000009
+
+
+ 900.990000000000009
+
+
+ 0.100000000000000
+
+
+
+ -
+
+
+ cm
+
+
+
+
+
+ -
+
+
-
+
+
+ Reverse
+
+
+
+
+
+ -
+
+
+ Options
+
+
+
-
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 255
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 255
+ 0
+ 0
+
+
+
+
+
+
+
+
+ 159
+ 158
+ 158
+
+
+
+
+
+
+
+
+
+
+ Name of detail:
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Detail
+
+
+
+
+
+ -
+
+
+ Seam allowance
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+
+ 1
+ 0
+
+
+
+
+
+
+ Width:
+
+
+
+ -
+
+
+
+ 1
+ 0
+
+
+
+ 900.990000000000009
+
+
+ 0.100000000000000
+
+
+ 1.000000000000000
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ cm
+
+
+
+
+
+ -
+
+
+ Closed
+
+
+ true
+
+
+
+ -
+
+
+ QLayout::SetFixedSize
+
+
+ 10
+
+
+ 10
+
+
+ 10
+
+
+ 10
+
+
-
+
+
+ false
+
+
+ Delete
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Scroll down the list
+
+
+ ...
+
+
+
+
+
+
+
+
+ -
+
+
+ Scroll up the list
+
+
+ ...
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+ 50
+ 0
+ 327
+ 32
+
+
+
+ All objects in path should follow in clockwise direction.
+
+
+
+
+ 10
+ 0
+ 32
+ 32
+
+
0
@@ -38,376 +449,160 @@
:/icon/32x32/clockwise.png
-
- -
-
-
- All objects in path should follow in clockwise direction.
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
- 6
-
-
- QLayout::SetDefaultConstraint
-
-
- 0
-
-
- 0
-
-
-
-
-
-
- 1
- 0
-
-
-
- Bias X:
-
-
-
- -
-
-
-
- 1
- 0
-
-
-
- -900.990000000000009
-
-
- 900.990000000000009
-
-
- 0.100000000000000
-
-
- 0.000000000000000
-
-
-
- -
-
-
- cm
-
-
-
-
-
- -
-
-
-
-
-
-
- 1
- 0
-
-
-
- Bias Y:
-
-
-
- -
-
-
-
- 1
- 0
-
-
-
- -900.990000000000009
-
-
- 900.990000000000009
-
-
- 0.100000000000000
-
-
-
- -
-
-
- cm
-
-
-
-
-
- -
-
-
-
-
-
- Reverse
-
-
-
-
-
- -
-
-
- Options
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
-
-
-
-
- 255
- 0
- 0
-
-
-
-
-
-
-
-
- 255
- 0
- 0
-
-
-
-
-
-
-
-
- 159
- 158
- 158
-
-
-
-
-
-
-
-
-
-
- Name of detail:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- Detail
-
-
-
-
-
- -
-
-
- Seam allowance
-
-
- true
-
-
-
- -
-
-
-
-
-
-
- 1
- 0
-
-
-
-
-
-
- Width:
-
-
-
- -
-
-
-
- 1
- 0
-
-
-
- 900.990000000000009
-
-
- 0.100000000000000
-
-
- 1.000000000000000
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- cm
-
-
-
-
-
- -
-
-
- Closed
-
-
- true
-
-
-
- -
-
-
- QLayout::SetFixedSize
-
-
- 10
-
-
- 10
-
-
- 10
-
-
- 10
-
-
-
-
-
- false
-
-
- Delete
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- Scroll down the list
-
-
- ...
-
-
-
-
-
-
-
-
- -
-
-
- Scroll up the list
-
-
- ...
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+ Pattern piece data
+
+
+ -
+
+
+
+
+ 9
+ 38
+ 40
+ 16
+
+
+
+ Name:
+
+
+
+
+
+ 55
+ 38
+ 125
+ 23
+
+
+
+ 15
+
+
+
+
+
+ 280
+ 0
+ 201
+ 381
+
+
+
+ Qt::ClickFocus
+
+
+
+
+
+ 0
+ 70
+ 271
+ 153
+
+
+
+ Material/Cut number/Placement
+
+
+
-
+
+
+ Material type:
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ Cut number:
+
+
+
+ -
+
+
+ 1000
+
+
+
+ -
+
+
+ Placement:
+
+
+
+ -
+
+
+ -
+
+
+ Add
+
+
+
+ -
+
+
+ Cancel
+
+
+
+ -
+
+
+ Remove
+
+
+
+
+
+
+
+
+ 9
+ 9
+ 40
+ 16
+
+
+
+ Letter:
+
+
+
+
+
+ 55
+ 9
+ 125
+ 23
+
+
+
+ 3
+
+
-
- -
-
-
-
-
- -
-
-
- Ready!
-
-
- Qt::RichText
-
-
- false
-
+
- -
+
-
Qt::Horizontal
@@ -420,14 +615,28 @@
+ lineEditLetter
+ lineEditName
+ comboBoxMaterial
+ spinBoxCutNumber
+ comboBoxPlacement
+ pushButtonAdd
+ pushButtonCancel
+ pushButtonRemove
+ tabWidget
+ listWidgetMCP
+ buttonBox
+ toolButtonUp
listWidget
+ checkBoxClosed
+ toolButtonDelete
doubleSpinBoxBiasX
doubleSpinBoxBiasY
+ checkBoxReverse
lineEditNameDetail
checkBoxSeams
doubleSpinBoxSeams
- checkBoxClosed
- buttonBox
+ toolButtonDown
diff --git a/src/libs/vtools/dialogs/tools/dialogpatternpiecedata.cpp b/src/libs/vtools/dialogs/tools/dialogpatternpiecedata.cpp
deleted file mode 100644
index 3bdcc4b37..000000000
--- a/src/libs/vtools/dialogs/tools/dialogpatternpiecedata.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/************************************************************************
- **
- ** @file vpatternconverter.cpp
- ** @author Roman Telezhynskyi
- ** @date 11 12, 2014
- **
- ** @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 .
- **
- *************************************************************************/
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "vpatternpiecedata.h"
-#include "dialogpatternpiecedata.h"
-
-//---------------------------------------------------------------------------------------------------------------------
-DialogPatternPieceData::DialogPatternPieceData(const VContainer *data, const quint32 &toolId, QWidget *parent) :
- DialogTool(data, toolId, parent)
-{
- // main dialog layout
- QVBoxLayout* pLayout = new QVBoxLayout(this);
-
- // widgets layout
- QHBoxLayout* pWidgetsLayout = new QHBoxLayout;
-
- setWindowTitle(tr("Pattern piece data"));
- QFormLayout* pFormLayout = new QFormLayout;
- QLabel* plb;
-
- plb = new QLabel(tr("Letter") + ":");
- m_pleLetter = new QLineEdit;
- m_pleLetter->setMaxLength(3);
- pFormLayout->addRow(plb, m_pleLetter);
-
- plb = new QLabel(tr("Name") + ":");
- m_pleName = new QLineEdit;
- m_pleName->setMaxLength(15);
- pFormLayout->addRow(plb, m_pleName);
-
- pWidgetsLayout->addLayout(pFormLayout);
-
- QGroupBox* pgb = new QGroupBox(tr("Material/Cut number/Placement"));
- QGridLayout* pLayoutGB = new QGridLayout(pgb);
-
- pFormLayout = new QFormLayout;
-
- plb = new QLabel(tr("Material type") + ":");
- m_pcbMaterial = new QComboBox;
- m_pcbMaterial->setFixedWidth(200);
- m_qslMaterials << tr("Fabric") << tr("Lining") << tr("Interfacing") << tr("Interlining");
- m_pcbMaterial->addItems(m_qslMaterials);
- m_pcbMaterial->setEditable(true);
- pFormLayout->addRow(plb, m_pcbMaterial);
-
- plb = new QLabel(tr("Cut number") + ":");
- m_psbCutNumber = new QSpinBox;
- m_psbCutNumber->setRange(0, 1000);
- pFormLayout->addRow(plb, m_psbCutNumber);
-
- plb = new QLabel(tr("Placement type") + ":");
- m_pcbPlacement = new QComboBox;
- m_qslPlacements << tr("None") << tr("Cut on fold");
- m_pcbPlacement->addItems(m_qslPlacements);
- pFormLayout->addRow(plb, m_pcbPlacement);
- pLayoutGB->addLayout(pFormLayout, 0, 0);
-
- QHBoxLayout* pMCPButtonLayout = new QHBoxLayout;
- m_pbOpAddUpdate = new QPushButton;
- connect(m_pbOpAddUpdate, &QPushButton::clicked, this, &DialogPatternPieceData::AddUpdate);
- pMCPButtonLayout->addStretch(1);
- pMCPButtonLayout->addWidget(m_pbOpAddUpdate);
- m_pbOpCancel = new QPushButton(tr("Cancel"));
- connect(m_pbOpCancel, &QPushButton::clicked, this, &DialogPatternPieceData::Cancel);
- pMCPButtonLayout->addWidget(m_pbOpCancel);
- m_pbOpRemove = new QPushButton(tr("Remove"));
- connect(m_pbOpRemove, &QPushButton::clicked, this, &DialogPatternPieceData::Remove);
- pMCPButtonLayout->addWidget(m_pbOpRemove);
- pLayoutGB->addLayout(pMCPButtonLayout, 1, 0);
-
- m_plwMCP = new QListWidget;
- connect(m_plwMCP, &QListWidget::itemClicked, this, &DialogPatternPieceData::SetEditMode);
- pLayoutGB->addWidget(m_plwMCP, 0, 1, 3, 1);
- pLayoutGB->setRowStretch(2, 1);
- pLayoutGB->setColumnStretch(2, 1);
-
- pWidgetsLayout->addWidget(pgb);
-
- pWidgetsLayout->setStretch(2, 1);
-
- pLayout->addLayout(pWidgetsLayout);
-
- QHBoxLayout* pButtonsLayout = new QHBoxLayout;
- pButtonsLayout->addStretch(0);
- bOk = new QPushButton(tr("OK"));
- connect(bOk, &QPushButton::clicked, this, &DialogTool::DialogAccepted);
- QPushButton* pbCancel = new QPushButton(tr("Cancel"));
- connect(pbCancel, &QPushButton::clicked, this, &DialogTool::DialogRejected);
- pButtonsLayout->addWidget(bOk);
- pButtonsLayout->addWidget(pbCancel);
-
- pLayout->addLayout(pButtonsLayout);
- pLayout->setStretch(0, 1);
-
- SetAddMode();
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::SetDetail(const VDetail& rDetail)
-{
- m_detail = rDetail;
- m_pleLetter->setText(m_detail.GetPatternPieceData().GetLetter());
- m_pleName->setText(m_detail.GetPatternPieceData().GetName());
- UpdateList();
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::SaveData()
-{
- m_detail.GetPatternPieceData().SetLetter(m_pleLetter->text());
- m_detail.GetPatternPieceData().SetName(m_pleName->text());
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::UpdateList()
-{
- m_plwMCP->clear();
- for (int i = 0; i < m_detail.GetPatternPieceData().GetMCPCount(); ++i)
- {
- MaterialCutPlacement mcp = m_detail.GetPatternPieceData().GetMCP(i);
- QString qsText = tr("Cut %1 of %2%3");
- qsText = qsText.arg(mcp.m_iCutNumber);
- if (mcp.m_eMaterial < MaterialType::mtUserDefined)
- qsText = qsText.arg(m_qslMaterials[int(mcp.m_eMaterial)]);
- else
- qsText = qsText.arg(mcp.m_qsMaterialUserDef);
- if (mcp.m_ePlacement == PlacementType::ptCutOnFold)
- qsText = qsText.arg(tr(" on Fold"));
- else
- qsText = qsText.arg("");
-
- m_plwMCP->addItem(qsText);
- }
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::AddUpdate()
-{
- MaterialCutPlacement mcp;
- mcp.m_qsMaterialUserDef = m_pcbMaterial->currentText();
- mcp.m_eMaterial = MaterialType::mtUserDefined;
- for (int i = 0; i < m_qslMaterials.count(); ++i)
- if (mcp.m_qsMaterialUserDef == m_qslMaterials[i])
- mcp.m_eMaterial = MaterialType(i);
-
- mcp.m_iCutNumber = m_psbCutNumber->value();
- mcp.m_ePlacement = PlacementType(m_pcbPlacement->currentIndex());
-
- if (m_bAddMode == true)
- {
- m_detail.GetPatternPieceData().Append(mcp);
- }
- else
- {
- int iR = m_plwMCP->currentRow();
- SCASSERT(iR >= 0);
- m_detail.GetPatternPieceData().Set(iR, mcp);
- SetAddMode();
- }
- UpdateList();
- ClearFields();
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::Cancel()
-{
- ClearFields();
- SetAddMode();
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::Remove()
-{
- int iR = m_plwMCP->currentRow();
- SCASSERT(iR >= 0);
- m_detail.GetPatternPieceData().RemoveMCP(iR);
- UpdateList();
- ClearFields();
- SetAddMode();
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::ClearFields()
-{
- m_pcbMaterial->setCurrentIndex(0);
- m_psbCutNumber->setValue(0);
- m_pcbPlacement->setCurrentIndex(0);
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::SetAddMode()
-{
- m_pbOpAddUpdate->setText(tr("Add"));
- m_pbOpCancel->hide();
- m_pbOpRemove->hide();
- m_plwMCP->setCurrentRow(-1);
- m_bAddMode = true;
-}
-
-//---------------------------------------------------------------------------------------------------------------------
-void DialogPatternPieceData::SetEditMode()
-{
- int iR = m_plwMCP->currentRow();
- // this method can be called by clicking on item or by update. In the latter case there is nothing else to do!
- if (iR < 0 || iR >= m_detail.GetPatternPieceData().GetMCPCount())
- return;
-
- m_pbOpAddUpdate->setText(tr("Update"));
- m_pbOpCancel->show();
- m_pbOpRemove->show();
-
- MaterialCutPlacement mcp = m_detail.GetPatternPieceData().GetMCP(iR);
- m_pcbMaterial->setCurrentText(mcp.m_qsMaterialUserDef);
- m_psbCutNumber->setValue(mcp.m_iCutNumber);
- m_pcbPlacement->setCurrentIndex(int(mcp.m_ePlacement));
-
- m_bAddMode = false;
-}
diff --git a/src/libs/vtools/dialogs/tools/dialogpatternpiecedata.h b/src/libs/vtools/dialogs/tools/dialogpatternpiecedata.h
deleted file mode 100644
index ff2511c3a..000000000
--- a/src/libs/vtools/dialogs/tools/dialogpatternpiecedata.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/************************************************************************
- **
- ** @file vpatternconverter.cpp
- ** @author Roman Telezhynskyi
- ** @date 11 12, 2014
- **
- ** @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 DIALOGPATTERNPIECEDATA_H
-#define DIALOGPATTERNPIECEDATA_H
-
-#include
-#include
-#include
-#include
-#include
-
-#include "vdetail.h"
-#include "dialogtool.h"
-
-/**
- * @brief This dialog allows user to edit pattern piece meta data
- */
-class DialogPatternPieceData : public DialogTool
-{
- Q_OBJECT
-
-public:
- DialogPatternPieceData(const VContainer* data, const quint32& toolId, QWidget* parent = nullptr);
-
- VDetail GetDetail() const;
- void SetDetail(const VDetail& rDetail);
-
- void SaveData();
-
-protected slots:
- void UpdateList();
- void AddUpdate();
- void Cancel();
- void Remove();
-
-private:
- VDetail m_detail;
-
- QLineEdit* m_pleName;
- QLineEdit* m_pleLetter;
- QComboBox* m_pcbMaterial;
- QSpinBox* m_psbCutNumber;
- QComboBox* m_pcbPlacement;
-
- QPushButton* m_pbOpAddUpdate;
- QPushButton* m_pbOpCancel;
- QPushButton* m_pbOpRemove;
-
- QListWidget* m_plwMCP;
-
- QStringList m_qslMaterials;
- QStringList m_qslPlacements;
-
- bool m_bAddMode;
-
- void ClearFields();
-
-private slots:
- void SetAddMode();
- void SetEditMode();
-};
-
-inline VDetail DialogPatternPieceData::GetDetail() const
-{
- return m_detail;
-}
-
-#endif // DIALOGPATTERNPIECEDATA_H
diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp
index b2292b28a..3f8f9ba7f 100644
--- a/src/libs/vtools/tools/vtooldetail.cpp
+++ b/src/libs/vtools/tools/vtooldetail.cpp
@@ -36,7 +36,6 @@
#include "../vwidgets/vmaingraphicsview.h"
#include "../dialogs/tools/dialogtool.h"
#include "../dialogs/tools/dialogdetail.h"
-#include "../dialogs/tools/dialogpatternpiecedata.h"
#include "../undocommands/savedetailoptions.h"
#include "../undocommands/movedetail.h"
#include "../undocommands/adddet.h"
@@ -295,21 +294,17 @@ void VToolDetail::FullUpdateFromGuiOk(int result)
if (result == QDialog::Accepted)
{
SCASSERT(dialog != nullptr);
- VDetail newDet;
- VDetail oldDet = VAbstractTool::data.GetDetail(id);
DialogDetail *dialogTool = qobject_cast(dialog);
- //SCASSERT(dialogTool != nullptr);
+ SCASSERT(dialogTool != nullptr);
+
+ VDetail newDet = dialogTool->getDetail();
+ VDetail oldDet = VAbstractTool::data.GetDetail(id);
+
+ qDebug() << "VTOOL" << newDet.GetPatternPieceData().GetLetter()
+ << newDet.GetPatternPieceData().GetName()
+ << newDet.GetPatternPieceData().GetMCPCount()
+ << dialogTool->getDetail().GetPatternPieceData().GetName();
- if (dialogTool != nullptr)
- {
- newDet = dialogTool->getDetail();
- }
- else
- {
- DialogPatternPieceData* dialogPPD = qobject_cast(dialog);
- SCASSERT(dialogPPD != nullptr);
- newDet = dialogPPD->GetDetail();
- }
SaveDetailOptions *saveCommand = new SaveDetailOptions(oldDet, newDet, doc, id, this->scene());
connect(saveCommand, &SaveDetailOptions::NeedLiteParsing, doc, &VAbstractPattern::LiteParseTree);
@@ -551,7 +546,6 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
QMenu menu;
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
- QAction* actionData = menu.addAction(tr("Details info"));
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
if (_referens > 1)
{
@@ -572,16 +566,6 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
setDialog();
dialog->show();
}
- else if (selectedAction == actionData)
- {
- dialog = new DialogPatternPieceData(getData(), id, qApp->getMainWindow());
- dialog->setModal(true);
-
- connect(dialog, &DialogTool::DialogClosed, this, &VToolDetail::FullUpdateFromGuiOk);
- VDetail detail = VAbstractTool::data.GetDetail(id);
- qobject_cast(dialog)->SetDetail(detail);
- dialog->show();
- }
else if (selectedAction == actionRemove)
{
try