Dialog for tool "UnitDetails".
--HG-- branch : feature
This commit is contained in:
parent
b2378b4fad
commit
60224819e4
|
@ -20,7 +20,8 @@ HEADERS += \
|
|||
src/dialogs/dialogarc.h \
|
||||
src/dialogs/dialogalongline.h \
|
||||
src/dialogs/dialogcutspline.h \
|
||||
src/dialogs/dialogcutsplinepath.h
|
||||
src/dialogs/dialogcutsplinepath.h \
|
||||
src/dialogs/dialoguniondetails.h
|
||||
|
||||
SOURCES += \
|
||||
src/dialogs/dialogtriangle.cpp \
|
||||
|
@ -43,7 +44,8 @@ SOURCES += \
|
|||
src/dialogs/dialogarc.cpp \
|
||||
src/dialogs/dialogalongline.cpp \
|
||||
src/dialogs/dialogcutspline.cpp \
|
||||
src/dialogs/dialogcutsplinepath.cpp
|
||||
src/dialogs/dialogcutsplinepath.cpp \
|
||||
src/dialogs/dialoguniondetails.cpp
|
||||
|
||||
FORMS += \
|
||||
src/dialogs/dialogtriangle.ui \
|
||||
|
@ -65,4 +67,5 @@ FORMS += \
|
|||
src/dialogs/dialogarc.ui \
|
||||
src/dialogs/dialogalongline.ui \
|
||||
src/dialogs/dialogcutspline.ui \
|
||||
src/dialogs/dialogcutsplinepath.ui
|
||||
src/dialogs/dialogcutsplinepath.ui \
|
||||
src/dialogs/dialoguniondetails.ui
|
||||
|
|
117
src/dialogs/dialoguniondetails.cpp
Normal file
117
src/dialogs/dialoguniondetails.cpp
Normal file
|
@ -0,0 +1,117 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialoguniondetails.cpp
|
||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||
** @date 23 12, 2013
|
||||
**
|
||||
** @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 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#include "dialoguniondetails.h"
|
||||
#include "ui_dialoguniondetails.h"
|
||||
|
||||
DialogUnionDetails::DialogUnionDetails(const VContainer *data, QWidget *parent) :
|
||||
DialogTool(data, parent), ui(new Ui::DialogUnionDetails), details(VDetail()), d1(0), d2(0), d1P1(0), d1P2(0),
|
||||
d2P1(0), d2P2(0), numberD(0), numberP(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
bOk = ui->buttonBox->button(QDialogButtonBox::Ok);
|
||||
connect(bOk, &QPushButton::clicked, this, &DialogUnionDetails::DialogAccepted);
|
||||
QPushButton *bCansel = ui->buttonBox->button(QDialogButtonBox::Cancel);
|
||||
connect(bCansel, &QPushButton::clicked, this, &DialogUnionDetails::DialogRejected);
|
||||
}
|
||||
|
||||
DialogUnionDetails::~DialogUnionDetails()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DialogUnionDetails::ChoosedObject(qint64 id, const Scene::Scenes &type)
|
||||
{
|
||||
if(numberD == 0)
|
||||
{
|
||||
ChoosedDetail(id, type, d1, d1P1, d1P2);
|
||||
}
|
||||
else
|
||||
{
|
||||
ChoosedDetail(id, type, d2, d2P1, d2P2);
|
||||
}
|
||||
}
|
||||
|
||||
void DialogUnionDetails::DialogAccepted()
|
||||
{
|
||||
emit ToolTip("");
|
||||
emit DialogClosed(QDialog::Accepted);
|
||||
}
|
||||
|
||||
bool DialogUnionDetails::CheckObject(const qint64 &id, const qint64 &idDetail) const
|
||||
{
|
||||
if (idDetail == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
VDetail det = data->GetDetail(idDetail);
|
||||
return det.Containes(id);
|
||||
}
|
||||
|
||||
void DialogUnionDetails::ChoosedDetail(const qint64 &id, const Scene::Scenes &type, qint64 &idDetail, qint64 &p1,
|
||||
qint64 &p2)
|
||||
{
|
||||
if (idDetail == 0)
|
||||
{
|
||||
if (type == Scene::Detail)
|
||||
{
|
||||
idDetail = id;
|
||||
emit ToolTip(tr("Select first point"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (CheckObject(id, idDetail) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (type == Scene::Point)
|
||||
{
|
||||
if (numberP == 0)
|
||||
{
|
||||
p1 = id;
|
||||
++numberP;
|
||||
emit ToolTip(tr("Select second point"));
|
||||
}
|
||||
if (numberP == 1)
|
||||
{
|
||||
p2 = id;
|
||||
++numberD;
|
||||
if(numberD > 1)
|
||||
{
|
||||
++numberP;
|
||||
emit ToolTip("");
|
||||
this->show();
|
||||
}
|
||||
else
|
||||
{
|
||||
numberP = 0;
|
||||
emit ToolTip(tr("Select detail"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
75
src/dialogs/dialoguniondetails.h
Normal file
75
src/dialogs/dialoguniondetails.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file dialoguniondetails.h
|
||||
** @author Roman Telezhinsky <dismine@gmail.com>
|
||||
** @date 23 12, 2013
|
||||
**
|
||||
** @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 Valentina project
|
||||
** <https://bitbucket.org/dismine/valentina> 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 <http://www.gnu.org/licenses/>.
|
||||
**
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef DIALOGUNIONDETAILS_H
|
||||
#define DIALOGUNIONDETAILS_H
|
||||
|
||||
#include "dialogtool.h"
|
||||
|
||||
namespace Ui {
|
||||
class DialogUnionDetails;
|
||||
}
|
||||
|
||||
class DialogUnionDetails : public DialogTool
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DialogUnionDetails(const VContainer *data, QWidget *parent = 0);
|
||||
~DialogUnionDetails();
|
||||
public slots:
|
||||
/**
|
||||
* @brief ChoosedObject gets id and type of selected object. Save correct data and ignore wrong.
|
||||
* @param id id of point or detail
|
||||
* @param type type of object
|
||||
*/
|
||||
void ChoosedObject(qint64 id, const Scene::Scenes &type);
|
||||
/**
|
||||
* @brief DialogAccepted save data and emit signal about closed dialog.
|
||||
*/
|
||||
virtual void DialogAccepted();
|
||||
private:
|
||||
Q_DISABLE_COPY(DialogUnionDetails)
|
||||
Ui::DialogUnionDetails *ui;
|
||||
/**
|
||||
* @brief details detail
|
||||
*/
|
||||
VDetail details;
|
||||
qint64 d1;
|
||||
qint64 d2;
|
||||
qint64 d1P1;
|
||||
qint64 d1P2;
|
||||
qint64 d2P1;
|
||||
qint64 d2P2;
|
||||
qint32 numberD;
|
||||
qint32 numberP;
|
||||
bool CheckObject(const qint64 &id, const qint64 &idDetail) const;
|
||||
void ChoosedDetail(const qint64 &id, const Scene::Scenes &type, qint64 &idDetail, qint64 &p1,
|
||||
qint64 &p2);
|
||||
};
|
||||
|
||||
#endif // DIALOGUNIONDETAILS_H
|
81
src/dialogs/dialoguniondetails.ui
Normal file
81
src/dialogs/dialoguniondetails.ui
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogUnionDetails</class>
|
||||
<widget class="QDialog" name="DialogUnionDetails">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>473</width>
|
||||
<height>78</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>40</y>
|
||||
<width>341</width>
|
||||
<height>32</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>451</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Do you really want union details? This operation can't be undone.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DialogUnionDetails</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DialogUnionDetails</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1080,7 +1080,7 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
}
|
||||
else
|
||||
{
|
||||
modelingTools = enable; // Soon we will have some tools for modeling.
|
||||
modelingTools = enable;
|
||||
}
|
||||
//Drawing Tools
|
||||
ui->toolButtonEndLine->setEnabled(drawTools);
|
||||
|
@ -1100,6 +1100,9 @@ void MainWindow::SetEnableTool(bool enable)
|
|||
ui->toolButtonPointOfIntersection->setEnabled(drawTools);
|
||||
ui->toolButtonSplineCutPoint->setEnabled(drawTools);
|
||||
ui->toolButtonSplinePathCutPoint->setEnabled(drawTools);
|
||||
|
||||
//Modeling Tools
|
||||
ui->toolButtonUnionDetails->setEnabled(modelingTools);
|
||||
}
|
||||
|
||||
void MainWindow::MinimumScrollBar()
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<string/>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>3</number>
|
||||
<number>4</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page">
|
||||
<property name="geometry">
|
||||
|
@ -597,7 +597,10 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="toolButton">
|
||||
<widget class="QToolButton" name="toolButtonUnionDetails">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
|
|
|
@ -39,8 +39,6 @@ VNodeArc::VNodeArc(VDomDocument *doc, VContainer *data, qint64 id, qint64 idArc,
|
|||
{
|
||||
RefreshGeometry();
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
|
|
|
@ -39,8 +39,6 @@ VNodeSpline::VNodeSpline(VDomDocument *doc, VContainer *data, qint64 id, qint64
|
|||
{
|
||||
RefreshGeometry();
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
|
|
|
@ -39,8 +39,6 @@ VNodeSplinePath::VNodeSplinePath(VDomDocument *doc, VContainer *data, qint64 id,
|
|||
{
|
||||
RefreshGeometry();
|
||||
this->setPen(QPen(baseColor, widthHairLine));
|
||||
this->setFlag(QGraphicsItem::ItemIsSelectable, true);
|
||||
this->setAcceptHoverEvents(true);
|
||||
|
||||
if (typeCreation == Tool::FromGui)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user