Seamly2D
Code documentation
dialogpatternproperties.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 dialogpatternproperties.h
27  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
28  ** @date 18 2, 2014
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 DIALOGPATTERNPROPERTIES_H
53 #define DIALOGPATTERNPROPERTIES_H
54 
55 #include <QDialog>
56 #include "../options.h"
57 #include <QMap>
58 
59 class VPattern;
60 class VContainer;
61 class QCheckBox;
62 
63 namespace Ui
64 {
66 }
67 
68 class DialogPatternProperties : public QDialog
69 {
70  Q_OBJECT
71 public:
72  explicit DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent = nullptr);
73  virtual ~DialogPatternProperties() Q_DECL_OVERRIDE;
74 signals:
76 private slots:
77  void DefValueChanged();
78  void LabelDataChanged();
79  void Apply();
80  void Ok();
81  void SelectAll(int state);
82  void CheckStateHeight(int state);
83  void CheckStateSize(int state);
84  void DescEdited();
85  void ChangeImage();
86  void SaveImage();
87  void EditLabel();
88 private:
89  Q_DISABLE_COPY(DialogPatternProperties)
96  QMap<GSizes, bool> sizes;
97  QMap<QCheckBox *, int> data;
105  QAction *deleteAction;
107  QAction *saveImageAction;
108  QAction *showImageAction;
109 
111 
112  void SetHeightsChecked(bool enabled);
113  void SetSizesChecked(bool enabled);
114  void InitHeights();
115  void InitSizes();
116  template<typename Func>
117  void Init(QCheckBox *check, int val, Func slot);
118  template<typename GVal>
119  void SetOptions(const QMap<GVal, bool> &option);
120  template<typename GVal>
121  void InitComboBox(QComboBox *box, const QMap<GVal, bool> &option);
122  void initComboBoxFormats(QComboBox *box, const QStringList &items, const QString &currentFormat);
123  void CheckApplyOk();
124  void SaveDescription();
125  void SaveGradation();
126  void SaveDefValues();
127  void SaveLabelData();
128  void SaveTemplateData();
129  void SaveReadOnlyState();
130 
131  void SetDefaultHeight(const QString &def);
132  void SetDefaultSize(const QString &def);
133 
134  void UpdateDefHeight();
135  void UpdateDefSize();
136  void InitImage();
137  QImage GetImage();
138 };
139 
140 #endif // DIALOGPATTERNPROPERTIES_H
virtual ~DialogPatternProperties() Q_DECL_OVERRIDE
void SetDefaultHeight(const QString &def)
QVector< VLabelTemplateLine > templateLines
DialogPatternProperties(VPattern *doc, VContainer *pattern, QWidget *parent=nullptr)
Ui::DialogPatternProperties * ui
void InitComboBox(QComboBox *box, const QMap< GVal, bool > &option)
void initComboBoxFormats(QComboBox *box, const QStringList &items, const QString &currentFormat)
void Init(QCheckBox *check, int val, Func slot)
void SetOptions(const QMap< GVal, bool > &option)
QMap< QCheckBox *, int > data
void SetDefaultSize(const QString &def)
QMap< GHeights, bool > heights
The VContainer class container of all variables.
Definition: vcontainer.h:141
The VPattern class working with pattern file.
Definition: vpattern.h:68
GHeights
Definition: def.h:280
GSizes
Definition: def.h:287