1 /************************************************************************
2 **
3 ** @file dialogendline.h
4 ** @author Roman Telezhynskyi <dismine(at)gmail.com>
5 ** @date November 15, 2013
6 **
7 ** @brief
8 ** @copyright
9 ** This source code is part of the Valentina project, a pattern making
10 ** program, whose allow create and modeling patterns of clothing.
11 ** Copyright (C) 2013-2015 Valentina project
12 ** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
13 **
14 ** Valentina is free software: you can redistribute it and/or modify
15 ** it under the terms of the GNU General Public License as published by
16 ** the Free Software Foundation, either version 3 of the License, or
17 ** (at your option) any later version.
18 **
19 ** Valentina is distributed in the hope that it will be useful,
20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ** GNU General Public License for more details.
23 **
24 ** You should have received a copy of the GNU General Public License
25 ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
26 **
27 *************************************************************************/
28
29 #ifndef DIALOGENDLINE_H
30 #define DIALOGENDLINE_H
31
32 #include <qcompilerdetection.h>
33 #include <QMetaObject>
34 #include <QObject>
35 #include <QString>
36 #include <QtGlobal>
37
38 #include "../vmisc/def.h"
39 #include "dialogtool.h"
40
41 namespace Ui
42 {
43 class DialogEndLine;
44 }
45
46 /**
47 * @brief The DialogEndLine class dialog for ToolEndLine. Help create point and edit option.
48 */
49 class DialogEndLine : public DialogTool
50 {
51 Q_OBJECT
52 public:
53 DialogEndLine(const VContainer *data, quint32 toolId, QWidget *parent = nullptr);
54 virtual ~DialogEndLine() override;
55
56 QString GetPointName() const;
57 void SetPointName(const QString &value);
58
59 QString GetTypeLine() const;
60 void SetTypeLine(const QString &value);
61
62 QString GetFormula() const;
63 void SetFormula(const QString &value);
64
65 QString GetAngle() const;
66 void SetAngle(const QString &value);
67
68 quint32 GetBasePointId() const;
69 void SetBasePointId(const quint32 &value);
70
71 QString GetLineColor() const;
72 void SetLineColor(const QString &value);
73
74 void SetNotes(const QString ¬es);
75 QString GetNotes() const;
76
77 virtual void ShowDialog(bool click) override;
78 public slots:
79 virtual void ChosenObject(quint32 id, const SceneObject &type) override;
80
81 void EvalLength();
82 void EvalAngle();
83
84 /** @brief DeployFormulaTextEdit grow or shrink formula input */
85 void DeployFormulaTextEdit();
86 void DeployAngleTextEdit();
87
88 void FXAngle();
89 void FXLength();
90 protected:
91 virtual void ShowVisualization() override;
92 /**
93 * @brief SaveData Put dialog data in local variables
94 */
95 virtual void SaveData() override;
96 virtual void closeEvent(QCloseEvent *event) override;
97 virtual bool IsValid() const final;
98 private:
99 Q_DISABLE_COPY(DialogEndLine)
100
101 /** @brief ui keeps information about user interface */
102 Ui::DialogEndLine *ui;
103
104 /** @brief formula formula */
105 QString formulaLength;
106
107 /** @brief angle angle of line */
108 QString formulaAngle;
109
110 /** @brief formulaBaseHeight base height defined by dialogui */
111 int formulaBaseHeight;
112 int formulaBaseHeightAngle;
113
114 QString pointName;
115
116 bool m_firstRelease;
117
118 QTimer *timerFormulaLength;
119 QTimer *timerFormulaAngle;
120
121 bool flagFormula;
122 bool flagError;
123 bool flagName;
124 };
125
126 //---------------------------------------------------------------------------------------------------------------------
IsValid()127 inline bool DialogEndLine::IsValid() const
128 {
129 return flagFormula && flagError && flagName;
130 }
131
132 #endif // DIALOGENDLINE_H
133