]> git.sesse.net Git - kdenlive/blob - src/effectslistwidget.h
Effects context menu: use submenu structure similar to effects list widget folders
[kdenlive] / src / effectslistwidget.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20
21 #ifndef EFFECTSLISTWIDGET_H
22 #define EFFECTSLISTWIDGET_H
23
24 #include <QTreeWidget>
25 #include <QDomElement>
26
27 #include <KActionCategory>
28
29 class EffectsList;
30 class KIcon;
31
32 class EffectsListWidget : public QTreeWidget
33 {
34     Q_OBJECT
35
36 public:
37     explicit EffectsListWidget(QMenu *contextMenu, QWidget *parent = 0);
38     virtual ~EffectsListWidget();
39     const QDomElement currentEffect() const;
40     QString currentInfo();
41     const QDomElement itemEffect(QTreeWidgetItem *item) const;
42     void initList(QMenu *effectsMenu, KActionCategory *effectActions);
43
44 protected:
45     virtual void dragMoveEvent(QDragMoveEvent *event);
46     virtual void contextMenuEvent(QContextMenuEvent * event);
47     virtual QMimeData *mimeData(const QList<QTreeWidgetItem *> list) const;
48
49 private:
50     QMenu *m_menu;
51     /** @brief Returns the folder item whose name == @param name. */
52     QTreeWidgetItem *findFolder(const QString name);
53
54     /** @brief Loads the effects from the given effectlist as item of this widget.
55      * @param effectlist effectlist containing the effects that should be loaded
56      * @param icon the icon to be used for the QTreeWidgetItems
57      * @param defaultFolder parent item which will be used by default 
58      * @param folders list of folders which might be used instead for specific effects
59      * @param type type of the effects
60      * @param current name of selected effect before reload; if an effect name matches this one it will become selected
61      * @param found will be set to true if an effect name matches current
62      */
63     void loadEffects(const EffectsList *effectlist, KIcon icon, QTreeWidgetItem *defaultFolder, const QList<QTreeWidgetItem *> *folders, const QString type, const QString current, bool *found);
64
65 private slots:
66     void slotExpandItem(const QModelIndex & index);
67 };
68
69 #endif