1 #pragma once 2 3 #ifndef INSERTFXPOPUP_H 4 #define INSERTFXPOPUP_H 5 6 #include <QTreeWidget> 7 #include "toonzqt/dvdialog.h" 8 #include "tfilepath.h" 9 #include "tstream.h" 10 11 // forward declaration 12 class QTreeWidget; 13 class QTreeWidgetItem; 14 class TFx; 15 16 #include <QIcon> 17 18 //============================================================================= 19 // FxTree 20 //----------------------------------------------------------------------------- 21 22 class FxTree final : public QTreeWidget { 23 Q_OBJECT 24 25 public: 26 void searchItems(const QString &searchWord = QString()); 27 28 private: 29 void displayAll(QTreeWidgetItem *item); 30 void hideAll(QTreeWidgetItem *item); 31 }; 32 33 //============================================================================= 34 // InsertFxPopup 35 //----------------------------------------------------------------------------- 36 37 class InsertFxPopup final : public DVGui::Dialog { 38 Q_OBJECT 39 40 FxTree *m_fxTree; 41 42 TIStream *m_is; 43 TFilePath m_presetFolder; 44 45 QIcon m_folderIcon; 46 QIcon m_presetIcon; 47 QIcon m_fxIcon; 48 49 public: 50 InsertFxPopup(); 51 52 private: 53 TFx *createFx(); 54 55 void makeItem(QTreeWidgetItem *parent, std::string fxid); 56 57 void loadFolder(QTreeWidgetItem *parent); 58 /*!Return true if preset is loaded.*/ 59 bool loadPreset(QTreeWidgetItem *item); 60 61 bool loadFx(TFilePath fp); 62 void loadMacro(); 63 64 public slots: 65 void onItemDoubleClicked(QTreeWidgetItem *w, int c); 66 void onInsert(); 67 void onReplace(); 68 void onAdd(); 69 70 protected: 71 void showEvent(QShowEvent *) override; 72 void hideEvent(QHideEvent *) override; 73 void contextMenuEvent(QContextMenuEvent *) override; 74 75 protected slots: 76 void updatePresets(); 77 void removePreset(); 78 void onSearchTextChanged(const QString &text); 79 }; 80 81 #endif // INSERTFXPOPUP_H 82