]> git.sesse.net Git - kdenlive/blobdiff - src/effectslistwidget.h
Const'ref
[kdenlive] / src / effectslistwidget.h
index 0635075e059af3b97a801c58be2d52dbef19a598..5df95d1a5de77c8c465e1c3eb660644c2cda76ee 100644 (file)
  ***************************************************************************/
 
 
-#ifndef EFFECTLISTWIDGET_H
-#define EFFECTLISTWIDGET_H
+#ifndef EFFECTSLISTWIDGET_H
+#define EFFECTSLISTWIDGET_H
 
-#include <KListWidget>
+#include <QTreeWidget>
 #include <QDomElement>
 
+#include <KActionCategory>
+
 class EffectsList;
+class KIcon;
 
-class EffectsListWidget : public KListWidget {
+class EffectsListWidget : public QTreeWidget
+{
     Q_OBJECT
 
 public:
-    EffectsListWidget(EffectsList *audioEffectList, EffectsList *videoEffectList, EffectsList *customEffectList, QWidget *parent = 0);
+    explicit EffectsListWidget(QMenu *contextMenu, QWidget *parent = 0);
     virtual ~EffectsListWidget();
-    QDomElement currentEffect();
-    QString currentInfo();
-    QDomElement itemEffect(QListWidgetItem *item);
+    const QDomElement currentEffect() const;
+    QString currentInfo() const;
+    const QDomElement itemEffect(QTreeWidgetItem *item) const;
+    void initList(QMenu *effectsMenu, KActionCategory *effectActions);
 
 protected:
-    virtual void mousePressEvent(QMouseEvent *event);
-    virtual void mouseMoveEvent(QMouseEvent *event);
     virtual void dragMoveEvent(QDragMoveEvent *event);
+    virtual void contextMenuEvent(QContextMenuEvent * event);
+    virtual QMimeData *mimeData(const QList<QTreeWidgetItem *> list) const;
+    virtual void keyPressEvent(QKeyEvent *e);
 
 private:
-    bool m_dragStarted;
-    QPoint m_DragStartPosition;
-    EffectsList *m_audioList;
-    EffectsList *m_videoList;
-    EffectsList *m_customList;
-    void initList();
+    QMenu *m_menu;
+    /** @brief Returns the folder item whose name == @param name. */
+    QTreeWidgetItem *findFolder(const QString &name);
+
+    /** @brief Loads the effects from the given effectlist as item of this widget.
+     * @param effectlist effectlist containing the effects that should be loaded
+     * @param icon the icon to be used for the QTreeWidgetItems
+     * @param defaultFolder parent item which will be used by default 
+     * @param folders list of folders which might be used instead for specific effects
+     * @param type type of the effects
+     * @param current name of selected effect before reload; if an effect name matches this one it will become selected
+     * @param found will be set to true if an effect name matches current
+     */
+    void loadEffects(const EffectsList *effectlist, KIcon icon, QTreeWidgetItem *defaultFolder, const QList<QTreeWidgetItem *> *folders, int type, const QString &current, bool *found);
 
+private slots:
+    void slotExpandItem(const QModelIndex & index);
+    
+signals:
+    void applyEffect(const QDomElement);
 };
 
 #endif