Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-06-30 20:50:07 +02:00
commit 9a64ddf6a3
6 changed files with 41 additions and 14 deletions

View File

@ -33,6 +33,7 @@
- [#514] Read only setting not working properly.
- [#480] New tool: Midpoint between two points.
- [#496] Selector for selecting which pieces to print.
- [#520] Improve Union tool. An option to select about original pieces.
# Version 0.4.5
- [#435] Valentina doesn't change the cursor.
@ -46,6 +47,7 @@
- [#515] Seam allowance wrong way.
- [#494] Printing is not working.
- [#516] Valentina crashes when use "Point intersect line and axis" instrument.
- [#483] File lost.
# Version 0.4.4 April 12, 2016
- Updated measurement templates with all measurements. Added new template Aldrich/Women measurements.

View File

@ -51,6 +51,12 @@ DialogUnionDetails::~DialogUnionDetails()
delete ui;
}
//---------------------------------------------------------------------------------------------------------------------
bool DialogUnionDetails::RetainPieces() const
{
return ui->checkBox->isChecked();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ChoosedObject gets id and type of selected object. Save correct data and ignore wrong.

View File

@ -50,6 +50,8 @@ public:
quint32 getD2() const;
int getIndexD1() const;
int getIndexD2() const;
bool RetainPieces() const;
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
private:

View File

@ -10,7 +10,7 @@
<x>0</x>
<y>0</y>
<width>300</width>
<height>78</height>
<height>96</height>
</rect>
</property>
<property name="windowTitle">
@ -24,13 +24,20 @@
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item alignment="Qt::AlignHCenter">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Do you really want to unite details?&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Retain original pieces</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">

View File

@ -520,9 +520,10 @@ VToolUnionDetails* VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsSc
VDetail d2 = data->GetDetail(dialogTool->getD2());
quint32 indexD1 = static_cast<quint32>(dialogTool->getIndexD1());
quint32 indexD2 = static_cast<quint32>(dialogTool->getIndexD2());
const bool retainPieces = dialogTool->RetainPieces();
qApp->getUndoStack()->beginMacro(tr("union details"));
VToolUnionDetails* tool = Create(0, d1, d2, dialogTool->getD1(), dialogTool->getD2(), indexD1, indexD2, scene,
doc, data, Document::FullParse, Source::FromGui);
doc, data, Document::FullParse, Source::FromGui, retainPieces);
qApp->getUndoStack()->endMacro();
return tool;
}
@ -546,7 +547,8 @@ VToolUnionDetails* VToolUnionDetails::Create(DialogTool *dialog, VMainGraphicsSc
VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d1, const VDetail &d2,
const quint32 &d1id, const quint32 &d2id, const quint32 &indexD1,
const quint32 &indexD2, VMainGraphicsScene *scene, VAbstractPattern *doc,
VContainer *data, const Document &parse, const Source &typeCreation)
VContainer *data, const Document &parse, const Source &typeCreation,
bool retainPieces)
{
VToolUnionDetails *unionDetails = 0;
quint32 id = _id;
@ -635,10 +637,14 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
newDetail.setName(tr("United detail"));
newDetail.setWidth(d1.getWidth());
newDetail.setMx(d1.getMx());
newDetail.setMy(d1.getMy());
VToolDetail::Create(0, newDetail, scene, doc, data, parse, Source::FromTool, drawName);
QHash<quint32, VDataTool*>* tools = doc->getTools();
SCASSERT(tools != nullptr);
if (not retainPieces)
{
{
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d1id));
SCASSERT(toolDet != nullptr);
@ -646,10 +652,13 @@ VToolUnionDetails* VToolUnionDetails::Create(const quint32 _id, const VDetail &d
toolDet->Remove(ask);
}
{
VToolDetail *toolDet = qobject_cast<VToolDetail*>(tools->value(d2id));
SCASSERT(toolDet != nullptr);
bool ask = false;
const bool ask = false;
toolDet->Remove(ask);
}
}
SCASSERT(not children.isEmpty())
SaveChildren(doc, id, children);

View File

@ -52,7 +52,8 @@ public:
const quint32 &d2id, const quint32 &indexD1, const quint32 &indexD2,
VMainGraphicsScene *scene, VAbstractPattern *doc, VContainer *data,
const Document &parse,
const Source &typeCreation);
const Source &typeCreation,
bool retainPieces = false);
static void PointsOnEdge(const VDetail &d, const quint32 &index, VPointF &p1, VPointF &p2, VContainer *data);
static void FindIndexJ(const qint32 &pointsD2, const VDetail &d2, const quint32 &indexD2, qint32 &j);
static QVector<VDetail> GetDetailFromFile(VAbstractPattern *doc, const QDomElement &domElement);