Seamly2D
Code documentation
editlabeltemplate_dialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  ** @file editlabeltemplate_dialog.h
3  ** @author Douglas S Caskey
4  ** @date Dec 26, 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  **
28  ** @file dialogeditlabel.h
29  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
30  ** @date 11 8, 2017
31  **
32  ** @brief
33  ** @copyright
34  ** This source code is part of the Valentina project, a pattern making
35  ** program, whose allow create and modeling patterns of clothing.
36  ** Copyright (C) 2017 Valentina project
37  ** <https://bitbucket.org/dismine/valentina> All Rights Reserved.
38  **
39  ** Valentina is free software: you can redistribute it and/or modify
40  ** it under the terms of the GNU General Public License as published by
41  ** the Free Software Foundation, either version 3 of the License, or
42  ** (at your option) any later version.
43  **
44  ** Valentina is distributed in the hope that it will be useful,
45  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
46  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47  ** GNU General Public License for more details.
48  **
49  ** You should have received a copy of the GNU General Public License
50  ** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
51  **
52  *************************************************************************/
53 
54 #ifndef EDITLABELTEMPLATE_DIALOG_H
55 #define EDITLABELTEMPLATE_DIALOG_H
56 
57 #include <QDialog>
58 #include <QMap>
59 
60 namespace Ui
61 {
63 }
64 
65 struct VLabelTemplateLine;
66 
67 class QMenu;
68 class VAbstractPattern;
69 class VPiece;
70 
71 class EditLabelTemplateDialog : public QDialog
72 {
73  Q_OBJECT
74 
75 public:
76  explicit EditLabelTemplateDialog(VAbstractPattern *doc, QWidget *parent = nullptr);
77  virtual ~EditLabelTemplateDialog();
78 
80  void SetTemplate(const QVector<VLabelTemplateLine> &lines);
81 
82  void SetPiece(const VPiece &piece);
83 
84 private slots:
85  void ShowLineDetails();
86  void AddLine();
87  void RemoveLine();
88  void SaveLineText(const QString &text);
89  void SaveFontStyle(bool checked);
90  void SaveTextFormating(bool checked);
91  void NewTemplate();
92  void ExportTemplate();
93  void ImportTemplate();
94  void InsertPlaceholder();
95  void TabChanged(int index);
96  void SaveAdditionalFontSize(int i);
97 
98 private:
99  Q_DISABLE_COPY(EditLabelTemplateDialog)
103 
104  QMap<QString, QPair<QString, QString>> m_placeholders;
105 
106  void SetupControls();
107  void InitPlaceholdersMenu();
108  void InitPlaceholders();
109 
110  QString ReplacePlaceholders(QString line) const;
111 
112  void InitPreviewLines(const QVector<VLabelTemplateLine> &lines);
113 };
114 
115 #endif // EDITLABELTEMPLATE_DIALOG_H
void SetTemplate(const QVector< VLabelTemplateLine > &lines)
QVector< VLabelTemplateLine > GetTemplate() const
Ui::EditLabelTemplateDialog * ui
void SetPiece(const VPiece &piece)
void InitPreviewLines(const QVector< VLabelTemplateLine > &lines)
QMap< QString, QPair< QString, QString > > m_placeholders
void SaveLineText(const QString &text)
QString ReplacePlaceholders(QString line) const
EditLabelTemplateDialog(VAbstractPattern *doc, QWidget *parent=nullptr)
Definition: vpiece.h:88