1 #pragma once
2 
3 #ifndef COMMANDBARPOPUP_H
4 #define COMMANDBARPOPUP_H
5 
6 #include <QTreeWidget>
7 #include <QTreeWidgetItem>
8 #include <QAction>
9 
10 #include "toonzqt/dvdialog.h"
11 #include "tfilepath.h"
12 
13 class QXmlStreamReader;
14 class QXmlStreamWriter;
15 
16 //=============================================================================
17 // CommandBarTree
18 //-----------------------------------------------------------------------------
19 
20 class CommandBarTree final : public QTreeWidget {
21   Q_OBJECT
22 
23   void loadMenuTree(const TFilePath& fp);
24   void loadMenuRecursive(QXmlStreamReader& reader, QTreeWidgetItem* parentItem);
25   void saveMenuRecursive(QXmlStreamWriter& writer, QTreeWidgetItem* parentItem);
26 
27 public:
28   CommandBarTree(TFilePath& path, QWidget* parent = 0);
29   void saveMenuTree(TFilePath& path);
30 
31 protected:
32   bool dropMimeData(QTreeWidgetItem* parent, int index, const QMimeData* data,
33                     Qt::DropAction action) override;
34   QStringList mimeTypes() const override;
35   void contextMenuEvent(QContextMenuEvent* event) override;
36 protected slots:
37   void removeItem();
38 };
39 
40 //=============================================================================
41 // CommandBarListTree
42 //-----------------------------------------------------------------------------
43 
44 class CommandBarListTree final : public QTreeWidget {
45   Q_OBJECT
46 
47   void addFolder(const QString& title, int commandType,
48                  QTreeWidgetItem* parentFolder = 0);
49 
50 public:
51   CommandBarListTree(QWidget* parent = 0);
52 
53 protected:
54   void mousePressEvent(QMouseEvent*) override;
55 };
56 
57 //=============================================================================
58 // CommandBarPopup
59 //-----------------------------------------------------------------------------
60 
61 class CommandBarPopup final : public DVGui::Dialog {
62   Q_OBJECT
63   CommandBarListTree* m_commandListTree;
64   CommandBarTree* m_menuBarTree;
65   TFilePath m_path;
66 
67 public:
68   CommandBarPopup(bool isXsheetToolbar = false);
69 protected slots:
70   void onOkPressed();
71 };
72 
73 #endif