Seamly2D
Code documentation
union_dialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  ** @file union_dialog.h
3  ** @author Douglas S Caskey
4  ** @date Dec 27, 2022
5  **
6  ** @copyright
7  ** Copyright (C) 2017 - 2022 Seamly, LLC
8  ** https://github.com/fashionfreedom/seamly2d
9  **
10  ** @brief
11  ** Seamly2D is free software: you can redistribute it and/or modify
12  ** it under the terms of the GNU General Public License as published by
13  ** the Free Software Foundation, either version 3 of the License, or
14  ** (at your option) any later version.
15  **
16  ** Seamly2D is distributed in the hope that it will be useful,
17  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  ** GNU General Public License for more details.
20  **
21  ** You should have received a copy of the GNU General Public License
22  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
23  **************************************************************************/
24 
25 /************************************************************************
26  **
27  ** @file dialoguniondetails.h
28  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
29  ** @date 23 12, 2013
30  **
31  ** @brief
32  ** @copyright
33  ** This source code is part of the Valentine project, a pattern making
34  ** program, whose allow create and modeling patterns of clothing.
35  ** Copyright (C) 2013-2015 Valentina project
36  ** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
37  **
38  ** Valentina is free software: you can redistribute it and/or modify
39  ** it under the terms of the GNU General Public License as published by
40  ** the Free Software Foundation, either version 3 of the License, or
41  ** (at your option) any later version.
42  **
43  ** Valentina is distributed in the hope that it will be useful,
44  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
45  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46  ** GNU General Public License for more details.
47  **
48  ** You should have received a copy of the GNU General Public License
49  ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
50  **
51  *************************************************************************/
52 
53 #ifndef UNION_DIALOG_H
54 #define UNION_DIALOG_H
55 
56 #include <qcompilerdetection.h>
57 #include <QMetaObject>
58 #include <QObject>
59 #include <QSound>
60 #include <QString>
61 #include <QtGlobal>
62 
63 #include "../vmisc/def.h"
64 #include "dialogtool.h"
65 
66 namespace Ui
67 {
68  class UnionDialog;
69 }
70 
71 /**
72  * @brief The UnionDialog class dialog for Union Tool.
73  */
74 class UnionDialog : public DialogTool
75 {
76  Q_OBJECT
77 public:
78  UnionDialog(const VContainer *data, const quint32 &toolId,
79  QWidget *parent = nullptr);
80  virtual ~UnionDialog() Q_DECL_OVERRIDE;
81 
82  quint32 getPiece1Id() const;
83  quint32 getPiece2Id() const;
84  int getPiece1Index() const;
85  int getPiece2Index() const;
86 
87  bool retainPieces() const;
88 
89 public slots:
90  virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
91 
92 private:
93  Q_DISABLE_COPY(UnionDialog)
94 
95 
96  Ui::UnionDialog *ui; /** @brief ui keeps information about user interface */
97  int piece1_Index; /** @brief piece1_Index index edge first piece */
98  int piece2_Index; /** @brief piece2_Index index edge second piece */
99  quint32 d1; /** @brief d1 id first piece */
100  quint32 d2; /** @brief d2 id second piece */
101  qint32 numberD; /** @brief numberD number of piece, what we already have */
102  qint32 numberP; /** @brief numberP number of points, what we already have */
103  quint32 p1; /** @brief p1 id first point of piece */
104  quint32 p2; /** @brief p2 id second point of piece */
105  QSound *m_beep;
106 
107  bool CheckObject(const quint32 &id, const quint32 &pieceId) const;
108  bool checkPiece(const quint32 &pieceId) const;
109 
110  void chosenPiece(const quint32 &id, const SceneObject &type, quint32 &pieceId,
111  int &index);
112 };
113 
114 //---------------------------------------------------------------------------------------------------------------------
115 /**
116  * @brief getPiece1Id return id first piece
117  * @return id
118  */
119 inline quint32 UnionDialog::getPiece1Id() const
120 {
121  return d1;
122 }
123 
124 //---------------------------------------------------------------------------------------------------------------------
125 /**
126  * @brief getPiece2Id return id second piece
127  * @return id
128  */
129 inline quint32 UnionDialog::getPiece2Id() const
130 {
131  return d2;
132 }
133 
134 //---------------------------------------------------------------------------------------------------------------------
135 /**
136  * @brief getPiece1Index return index edge first piece
137  * @return index
138  */
139 inline int UnionDialog::getPiece1Index() const
140 {
141  return piece1_Index;
142 }
143 
144 //---------------------------------------------------------------------------------------------------------------------
145 /**
146  * @brief getPiece2Index return index edge second piece
147  * @return index
148  */
149 inline int UnionDialog::getPiece2Index() const
150 {
151  return piece2_Index;
152 }
153 
154 #endif // UNION_DIALOG_H
The DialogTool class parent for all dialog of tools.
Definition: dialogtool.h:107
quint32 toolId
Definition: dialogtool.h:225
const VContainer * data
data container with data
Definition: dialogtool.h:177
The UnionDialog class dialog for Union Tool.
Definition: union_dialog.h:75
qint32 numberP
numberD number of piece, what we already have
Definition: union_dialog.h:102
virtual ~UnionDialog() Q_DECL_OVERRIDE
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE
ChoosedObject gets id and type of selected object. Save correct data and ignore wrong.
void chosenPiece(const quint32 &id, const SceneObject &type, quint32 &pieceId, int &index)
chosenPiece help save information about piece and points on piece
qint32 numberD
d2 id second piece
Definition: union_dialog.h:101
quint32 getPiece2Id() const
getPiece2Id return id second piece
Definition: union_dialog.h:129
int piece2_Index
piece1_Index index edge first piece
Definition: union_dialog.h:98
QSound * m_beep
p2 id second point of piece
Definition: union_dialog.h:105
quint32 getPiece1Id() const
getPiece1Id return id first piece
Definition: union_dialog.h:119
quint32 p2
p1 id first point of piece
Definition: union_dialog.h:104
bool retainPieces() const
bool CheckObject(const quint32 &id, const quint32 &pieceId) const
CheckObject check if piece contains this id.
UnionDialog(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
UnionDialog create dialog.
bool checkPiece(const quint32 &pieceId) const
quint32 d1
piece2_Index index edge second piece
Definition: union_dialog.h:99
quint32 p1
numberP number of points, what we already have
Definition: union_dialog.h:103
quint32 d2
d1 id first piece
Definition: union_dialog.h:100
int getPiece2Index() const
getPiece2Index return index edge second piece
Definition: union_dialog.h:149
int piece1_Index
ui keeps information about user interface
Definition: union_dialog.h:97
int getPiece1Index() const
getPiece1Index return index edge first piece
Definition: union_dialog.h:139
Ui::UnionDialog * ui
Definition: union_dialog.h:96
The VContainer class container of all variables.
Definition: vcontainer.h:141
SceneObject
Definition: def.h:103