]> git.sesse.net Git - kdenlive/blob - src/effectslistwidget.h
Moving choosecolorwidget and colorpickerwidget in the widget folder.
[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() const;
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     virtual void keyPressEvent(QKeyEvent *e);
49
50 private:
51     QMenu *m_menu;
52     /** @brief Returns the folder item whose name == @param name. */
53     QTreeWidgetItem *findFolder(const QString &name);
54
55     /** @brief Loads the effects from the given effectlist as item of this widget.
56      * @param effectlist effectlist containing the effects that should be loaded
57      * @param icon the icon to be used for the QTreeWidgetItems
58      * @param defaultFolder parent item which will be used by default 
59      * @param folders list of folders which might be used instead for specific effects
60      * @param type type of the effects
61      * @param current name of selected effect before reload; if an effect name matches this one it will become selected
62      * @param found will be set to true if an effect name matches current
63      */
64     void loadEffects(const EffectsList *effectlist, KIcon icon, QTreeWidgetItem *defaultFolder, const QList<QTreeWidgetItem *> *folders, int type, const QString &current, bool *found);
65
66 private slots:
67     void slotExpandItem(const QModelIndex & index);
68     
69 signals:
70     void applyEffect(const QDomElement);
71 };
72
73 #endif