-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmenueditor.h
More file actions
131 lines (115 loc) · 3.47 KB
/
Copy pathmenueditor.h
File metadata and controls
131 lines (115 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
/****************************************************************************
** Copyright (C) 2017 Olaf Japp
**
** This file is part of FlatSiteBuilder.
**
** FlatSiteBuilder is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** FlatSiteBuilder is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with FlatSiteBuilder. If not, see <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#ifndef MENUEDITOR_H
#define MENUEDITOR_H
#include "interfaces.h"
#include "animateableeditor.h"
#include "menuitem.h"
class QUndoStack;
class FlatButton;
class QLineEdit;
class QPushButton;
class QTableWidget;
class QTreeWidget;
class QTreeWidgetItem;
class ImageSelector;
class MenuEditorTableCellButtons : public QWidget
{
Q_OBJECT
public:
MenuEditorTableCellButtons();
void setMenuItem(MenuItem *m) {m_item = m;}
void setEnableLeft(bool);
void setEnableRight(bool);
void setEnableUp(bool);
void setEnableDown(bool);
private slots:
void deleteItemClicked();
void editItemClicked();
void itemLeftClicked();
void itemRightClicked();
void itemUpClicked();
void itemDownClicked();
signals:
void deleteItem(MenuItem *);
void editItem(MenuItem *);
void itemLeft(MenuItem *);
void itemRight(MenuItem *);
void itemUp(MenuItem *);
void itemDown(MenuItem *);
private:
FlatButton *m_delete;
FlatButton *m_edit;
FlatButton *m_left;
FlatButton *m_right;
FlatButton *m_up;
FlatButton *m_down;
MenuItem *m_item;
};
class MenuEditor : public AnimateableEditor
{
Q_OBJECT
public:
MenuEditor(QMainWindow *win, Menu *menu, Site *site);
void setContent(QString) {/* not used */}
void registerUndoStack(QUndoStack *stack);
void reloadMenu(Menu *menu);
signals:
void contentChanged(Menu *menu);
void menuChanged(QString text);
private slots:
void closeEditor();
void nameChanged();
void addButtonClicked();
void itemChanged(QTreeWidgetItem*,int);
void deleteItem(MenuItem *);
void deleteSubItem(MenuItem *menuitem);
void editItem(MenuItem *);
void itemLeft(MenuItem *);
void itemRight(MenuItem *);
void itemUp(MenuItem *);
void itemDown(MenuItem *);
void canUndoChanged(bool can);
void canRedoChanged(bool can);
void undoTextChanged(QString text);
void redoTextChanged(QString text);
void undo();
void redo();
void iconClicked(ImageSelector*, Qt::MouseButton);
private:
QMainWindow *m_win;
Menu *m_menu;
FlatButton *m_close;
FlatButton *m_undo;
FlatButton *m_redo;
QLineEdit *m_name;
QTreeWidget *m_tree;
QTreeWidgetItem *m_root;
QUndoStack *m_undoStack;
Site *m_site;
void addTreeItem(MenuItem *item);
int getRow(MenuItem *menuitem);
void updateButtonStates();
void resort();
void addTableCellButtons(MenuItem *item, QTreeWidgetItem *twi);
void menuUpdated(QString text);
QString getUndoRedoText(MenuItem *item, QString action);
};
#endif // MENUEDITOR_H