Seamly2D
Code documentation
history_dialog.h
Go to the documentation of this file.
1 /***************************************************************************
2  ** @file historyDialog.h
3  ** @author Douglas S Caskey
4  ** @date Mar 11, 2023
5  **
6  ** @copyright
7  ** Copyright (C) 2015 - 2023 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 dialoghistory.h
28  ** @author Roman Telezhynskyi <dismine(at)gmail.com>
29  ** @date November 15, 2013
30  **
31  ** @brief
32  ** @copyright
33  ** This source code is part of the Valentina 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 HISTORY_DIALOG_H
54 #define HISTORY_DIALOG_H
55 
56 #include "../vtools/dialogs/tools/dialogtool.h"
57 
58 #include <QDomElement>
59 
60 class VPattern;
61 
62 namespace Ui
63 {
64  class HistoryDialog;
65 }
66 
67 struct RowData
68 {
69  quint32 id{NULL_ID};
70  QString icon{QString()};
71  QString name{QString()};
72  QString tool{QString()};
73 };
74 
75 /**
76  * @brief The HistoryDialog class show dialog history.
77  */
78 class HistoryDialog : public DialogTool
79 {
80  Q_OBJECT
81 public:
82  HistoryDialog(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
83  virtual ~HistoryDialog() Q_DECL_OVERRIDE;
84 
85 public slots:
86  virtual void DialogAccepted() Q_DECL_OVERRIDE;
87  /** TODO ISSUE 79 : create real function
88  * @brief DialogApply apply data and emit signal about applied dialog.
89  */
90  virtual void DialogApply() Q_DECL_OVERRIDE {}
91  void cellClicked(int row, int column);
92  void changedCursor(quint32 id);
93  void updateHistory();
94 
95 signals:
96  /**
97  * @brief showHistoryTool signal change color of selected in records tool
98  * @param id id of tool
99  * @param enable true enable selection, false disable selection
100  */
101  void showHistoryTool(quint32 id, bool enable);
102 
103 protected:
104  virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
105  virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
106  virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
107 
108 private:
109  Q_DISABLE_COPY(HistoryDialog)
110 
111  Ui::HistoryDialog *ui; /** @brief ui keeps information about user interface */
112  VPattern *m_doc; /** @brief doc dom document container */
113  qint32 m_cursorRow; /** @brief cursorRow save number of row where is cursor */
114  qint32 m_cursorToolRecordRow; /** @brief cursorToolRecordRow save number of row selected record */
115 
116  void fillTable();
117  RowData record(const VToolRecord &tool);
118  void initializeTable();
119  void showTool();
120  QString getPointName(quint32 pointId);
121  quint32 attrUInt(const QDomElement &domElement, const QString &name);
122  void retranslateUi();
123  int cursorRow() const;
124  void findText(const QString &text);
125  void copyToClipboard();
126 };
127 
128 #endif // HISTORY_DIALOG_H
The DialogTool class parent for all dialog of tools.
Definition: dialogtool.h:107
QString getPointName() const
const VContainer * data
data container with data
Definition: dialogtool.h:177
The HistoryDialog class show dialog history.
VPattern * m_doc
ui keeps information about user interface
void updateHistory()
updateHistory update history table
void showTool()
showTool show selected point
void changedCursor(quint32 id)
changedCursor changed cursor of input. Cursor show after which record we will insert new object
void findText(const QString &text)
qint32 m_cursorRow
doc dom document container
qint32 m_cursorToolRecordRow
cursorRow save number of row where is cursor
virtual void DialogAccepted() Q_DECL_OVERRIDE
DialogAccepted save data and emit signal about closed dialog.
Ui::HistoryDialog * ui
virtual ~HistoryDialog() Q_DECL_OVERRIDE
virtual void changeEvent(QEvent *event) Q_DECL_OVERRIDE
void initializeTable()
initializeTable set initial option of table
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE
void cellClicked(int row, int column)
cellClicked changed history record
quint32 attrUInt(const QDomElement &domElement, const QString &name)
int cursorRow() const
RowData record(const VToolRecord &tool)
Record return description for record.
HistoryDialog(VContainer *data, VPattern *doc, QWidget *parent=nullptr)
HistoryDialog create dialog.
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE
closeEvent handle when windows is closing
void showHistoryTool(quint32 id, bool enable)
showHistoryTool signal change color of selected in records tool
void fillTable()
cursorToolRecordRow save number of row selected record
void copyToClipboard()
copyToClipboard copy dialog selection to clipboard as comma separated values.
virtual void DialogApply() Q_DECL_OVERRIDE
DialogApply apply data and emit signal about applied dialog.
The VContainer class container of all variables.
Definition: vcontainer.h:141
The VPattern class working with pattern file.
Definition: vpattern.h:68
The VToolRecord class record about tool in history.
Definition: vtoolrecord.h:64
#define NULL_ID
Definition: ifcdef.h:76
QString name
QString tool
QString icon