]> git.sesse.net Git - kdenlive/blob - src/effectslistwidget.h
Remove code duplication
[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 class EffectsList;
28 class KIcon;
29
30 class EffectsListWidget : public QTreeWidget
31 {
32     Q_OBJECT
33
34 public:
35     explicit EffectsListWidget(QMenu *menu, QWidget *parent = 0);
36     virtual ~EffectsListWidget();
37     const QDomElement currentEffect() const;
38     QString currentInfo();
39     const QDomElement itemEffect(QTreeWidgetItem *item) const;
40     void initList();
41
42 protected:
43     virtual void dragMoveEvent(QDragMoveEvent *event);
44     virtual void contextMenuEvent(QContextMenuEvent * event);
45     virtual QMimeData *mimeData(const QList<QTreeWidgetItem *> list) const;
46
47 private:
48     QMenu *m_menu;
49     /** @brief Returns the folder item whose name == @param name. */
50     QTreeWidgetItem *findFolder(const QString name);
51
52     /** @brief Loads the effects from the given effectlist as item of this widget.
53      * @param effectlist effectlist containing the effects that should be loaded
54      * @param icon the icon to be used for the QTreeWidgetItems
55      * @param defaultFolder parent item which will be used by default 
56      * @param folders list of folders which might be used instead for specific effects
57      * @param type type of the effects
58      * @param current name of selected effect before reload; if an effect name matches this one it will become selected
59      * @param found will be set to true if an effect name matches current
60      */
61     void loadEffects(const EffectsList *effectlist, KIcon icon, QTreeWidgetItem *defaultFolder, const QList<QTreeWidgetItem *> *folders, const QString type, const QString current, bool *found);
62
63 private slots:
64     void slotExpandItem(const QModelIndex & index);
65 };
66
67 #endif