Seamly2D
Code documentation
dialogspline.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * Copyright (C) 2017 Seamly, LLC *
4  * *
5  * https://github.com/fashionfreedom/seamly2d *
6  * *
7  ***************************************************************************
8  **
9  ** Seamly2D is free software: you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation, either version 3 of the License, or
12  ** (at your option) any later version.
13  **
14  ** Seamly2D is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** You should have received a copy of the GNU General Public License
20  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
21  **
22  **************************************************************************
23 
24  ************************************************************************
25  **
26  ** @file dialogspline.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date November 15, 2013
29  **
30  ** @brief
31  ** @copyright
32  ** This source code is part of the Valentine project, a pattern making
33  ** program, whose allow create and modeling patterns of clothing.
34  ** Copyright (C) 2013-2015 Seamly2D project
35  ** <https://github.com/fashionfreedom/seamly2d> All Rights Reserved.
36  **
37  ** Seamly2D is free software: you can redistribute it and/or modify
38  ** it under the terms of the GNU General Public License as published by
39  ** the Free Software Foundation, either version 3 of the License, or
40  ** (at your option) any later version.
41  **
42  ** Seamly2D is distributed in the hope that it will be useful,
43  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
44  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45  ** GNU General Public License for more details.
46  **
47  ** You should have received a copy of the GNU General Public License
48  ** along with Seamly2D. If not, see <http://www.gnu.org/licenses/>.
49  **
50  *************************************************************************/
51 
52 #ifndef DIALOGSPLINE_H
53 #define DIALOGSPLINE_H
54 
55 #include <qcompilerdetection.h>
56 #include <QMetaObject>
57 #include <QObject>
58 #include <QSharedPointer>
59 #include <QString>
60 #include <QtGlobal>
61 
62 #include "../vgeometry/vspline.h"
63 #include "../vmisc/def.h"
64 #include "dialogtool.h"
65 
66 template <class T> class QSharedPointer;
67 
68 namespace Ui
69 {
70  class DialogSpline;
71 }
72 
73 /**
74  * @brief The DialogSpline class dialog for ToolSpline. Help create spline and edit option.
75  */
76 class DialogSpline : public DialogTool
77 {
78  Q_OBJECT
79 public:
80  DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent = nullptr);
81  virtual ~DialogSpline() Q_DECL_OVERRIDE;
82 
83  VSpline GetSpline() const;
84  void SetSpline(const VSpline &spline);
85 
86  QString getPenStyle() const;
87  void setPenStyle(const QString &value);
88 
89  QString getLineWeight() const;
90  void setLineWeight(const QString &value);
91 
92  QString getLineColor() const;
93  void setLineColor(const QString &value);
94 
95 public slots:
96  virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
97  virtual void PointNameChanged() Q_DECL_OVERRIDE;
98  virtual void ShowDialog(bool click) Q_DECL_OVERRIDE;
99 
100 protected:
101  virtual void CheckState() Q_DECL_FINAL;
102  virtual void ShowVisualization() Q_DECL_OVERRIDE;
103  /**
104  * @brief SaveData Put dialog data in local variables
105  */
106  virtual void SaveData() Q_DECL_OVERRIDE;
107  virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
108 
109 private slots:
110  void DeployAngle1TextEdit();
111  void DeployAngle2TextEdit();
112  void DeployLength1TextEdit();
113  void DeployLength2TextEdit();
114 
115  void Angle1Changed();
116  void Angle2Changed();
117  void Length1Changed();
118  void Length2Changed();
119 
120  void FXAngle1();
121  void FXAngle2();
122  void FXLength1();
123  void FXLength2();
124 
125 private:
126  Q_DISABLE_COPY(DialogSpline)
127 
128  Ui::DialogSpline *ui; /** @brief ui keeps information about user interface */
129  VSpline spl; /** @brief spl spline */
130  qint32 newDuplicate;
131 
132  /** @brief formulaBaseHeight base height defined by dialogui */
137 
138  /** @brief timerAngle1 timer of check first angle formula */
139  QTimer *timerAngle1;
140  QTimer *timerAngle2;
141  QTimer *timerLength1;
142  QTimer *timerLength2;
143 
144  /** @brief flagAngle1 true if value of first angle is correct */
149 
150  const QSharedPointer<VPointF> GetP1() const;
151  const QSharedPointer<VPointF> GetP4() const;
152 
153  void EvalAngle1();
154  void EvalAngle2();
155  void EvalLength1();
156  void EvalLength2();
157 
158  VSpline CurrentSpline() const;
159 };
160 
161 #endif // DIALOGSPLINE_H
The DialogSpline class dialog for ToolSpline. Help create spline and edit option.
Definition: dialogspline.h:77
void Angle1Changed()
virtual void ShowVisualization() Q_DECL_OVERRIDE
void setPenStyle(const QString &value)
int formulaBaseHeightAngle1
formulaBaseHeight base height defined by dialogui
Definition: dialogspline.h:133
DialogSpline(const VContainer *data, const quint32 &toolId, QWidget *parent=nullptr)
DialogSpline create dialog.
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when dialog cloded
virtual ~DialogSpline() Q_DECL_OVERRIDE
void DeployAngle2TextEdit()
QTimer * timerLength2
Definition: dialogspline.h:142
const QSharedPointer< VPointF > GetP4() const
qint32 newDuplicate
spl spline
Definition: dialogspline.h:130
virtual void CheckState() Q_DECL_FINAL
CheckState enable, when all is correct, or disable, when something wrong, button ok.
bool flagAngle1
flagAngle1 true if value of first angle is correct
Definition: dialogspline.h:145
QString getLineWeight() const
getLineWeight return weight of the lines
void EvalLength2()
VSpline CurrentSpline() const
QString getLineColor() const
void EvalLength1()
virtual void ShowDialog(bool click) Q_DECL_OVERRIDE
void setLineColor(const QString &value)
void SetSpline(const VSpline &spline)
void Angle2Changed()
QTimer * timerAngle1
timerAngle1 timer of check first angle formula
Definition: dialogspline.h:139
VSpline GetSpline() const
Ui::DialogSpline * ui
Definition: dialogspline.h:128
void setLineWeight(const QString &value)
setLineWeight set weight of the lines
const QSharedPointer< VPointF > GetP1() const
QTimer * timerAngle2
Definition: dialogspline.h:140
void Length1Changed()
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE
ChoosedObject gets id and type of selected object. Save right data and ignore wrong.
int formulaBaseHeightAngle2
Definition: dialogspline.h:134
QTimer * timerLength1
Definition: dialogspline.h:141
virtual void SaveData() Q_DECL_OVERRIDE
SaveData Put dialog data in local variables.
void Length2Changed()
virtual void PointNameChanged() Q_DECL_OVERRIDE
QString getPenStyle() const
void DeployAngle1TextEdit()
VSpline spl
ui keeps information about user interface
Definition: dialogspline.h:129
void DeployLength1TextEdit()
int formulaBaseHeightLength1
Definition: dialogspline.h:135
int formulaBaseHeightLength2
Definition: dialogspline.h:136
void DeployLength2TextEdit()
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 VContainer class container of all variables.
Definition: vcontainer.h:141
The VPointF class keep data of point.
Definition: vpointf.h:75
VSpline class that implements the spline.
Definition: vspline.h:75
SceneObject
Definition: def.h:103