28#include <MltConsumer.h>
39class QSortFilterProxyModel;
45class PlaylistIconView;
47class ElementsDock :
public QDockWidget
60 explicit ElementsDock(QWidget *parent =
nullptr);
66 QMimeData *buildMimeData(
const QString &sourcePath,
67 const QString &categoryName,
69 bool isSoundEffect =
false,
70 bool makeUnique =
false,
71 QString *destPath =
nullptr,
72 bool *didCreate =
nullptr);
75 void resizeEvent(QResizeEvent *event)
override;
76 bool eventFilter(QObject *watched, QEvent *event)
override;
79 void onActivated(
const QModelIndex &proxyIndex, Page page);
86 ElementsModel *model{
nullptr};
87 QSortFilterProxyModel *proxyModel{
nullptr};
88 PlaylistIconView *view{
nullptr};
91 void setupCategoryPage(
92 Page page,
const QString &name,
const QIcon &icon,
bool autoFilter,
const QDir &dir);
93 void updateToolbarStyle();
94 void stopHoverPreview();
95 void stopAudioPreview();
96 void startAudioPreview(
const QString &filePath);
97 void startHoverAnimation(
const QModelIndex &sourceIndex,
const QString &webpPath);
98 QString destPath(
const QString &sourcePath,
const QString &categoryName)
const;
99 Mlt::Producer *copyAndCreateProducer(
const QString &sourcePath,
100 const QString &categoryName,
102 bool isSoundEffect =
false,
103 bool makeUnique =
false,
104 QString *destPath =
nullptr,
105 bool *didCreate =
nullptr);
106 static void attachSizeFilter(Mlt::Producer *producer, QSize fixedSize = QSize());
107 static QIcon makeTextIcon(
const QString &text,
const QColor &color = QColor());
109 QWidget *m_categoryToolbar{
nullptr};
110 QActionGroup *m_categoryGroup{
nullptr};
111 QStackedWidget *m_stack{
nullptr};
112 QList<CategoryPage> m_pages;
114 QMovie *m_activeMovie{
nullptr};
115 QTimer *m_previewTimer{
nullptr};
116 QString m_previewFilePath;
117 QPersistentModelIndex m_hoveredProxyIndex;
118 QPersistentModelIndex m_hoveredSourceIndex;
119 int m_hoveredPageIndex{-1};
120 QPoint m_dragStartPos;
121 int m_dragPageIndex{-1};
122 std::unique_ptr<Mlt::Consumer> m_audioConsumer;