]> git.sesse.net Git - kdenlive/blob - src/effectstack/collapsiblegroup.h
Effect groups can now be dropped onto another clip
[kdenlive] / src / effectstack / collapsiblegroup.h
1 /***************************************************************************
2  *   Copyright (C) 2008 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 COLLAPSIBLEGROUP_H
22 #define COLLAPSIBLEGROUP_H
23
24
25 #include "ui_collapsiblegroup_ui.h"
26
27 #include "abstractcollapsiblewidget.h"
28 #include "collapsibleeffect.h"
29 #include "timecode.h"
30 #include "keyframeedit.h"
31
32 #include <QDomElement>
33 #include <QToolButton>
34 #include <QLineEdit>
35
36 class QFrame;
37
38 class MyEditableLabel : public QLineEdit
39 {
40     Q_OBJECT
41
42 public:
43     MyEditableLabel(QWidget * parent = 0);
44     
45 protected:
46     virtual void mouseDoubleClickEvent( QMouseEvent *e);
47 };
48
49
50 /**)
51  * @class CollapsibleEffect
52  * @brief A dialog for editing markers and guides.
53  * @author Jean-Baptiste Mardelle
54  */
55
56 class CollapsibleGroup : public AbstractCollapsibleWidget, public Ui::CollapsibleGroup_UI
57 {
58     Q_OBJECT
59
60 public:
61     CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, QString groupName = QString(), QWidget * parent = 0);
62     ~CollapsibleGroup();
63     void updateTimecodeFormat();
64     void setActive(bool activate);
65     int groupIndex() const;
66     bool isGroup() const;
67     QString infoString() const;
68     bool isActive() const;
69     void addGroupEffect(CollapsibleEffect *effect);
70     void removeGroup(int ix, QVBoxLayout *layout);
71     /** @brief Return all effects in group. */
72     QList <CollapsibleEffect*> effects();
73     /** @brief Return the editable title widget. */
74     QWidget *title() const;
75     /** @brief Return the XML data describing all effects in group. */
76     QDomDocument effectsData();
77
78 public slots:
79     void slotEnable(bool enable);
80
81 private slots:
82     void slotSwitch();
83     void slotShow(bool show);
84     void slotDeleteEffect();
85     void slotEffectUp();
86     void slotEffectDown();
87     void slotSaveEffect();
88     void slotResetEffect();
89     void slotUnGroup();
90     void slotRenameGroup();
91
92 private:
93     QList <CollapsibleEffect *> m_subWidgets;
94     QMenu *m_menu;
95     EffectInfo m_info;
96     int m_index;
97     MyEditableLabel *m_title;
98     
99 protected:
100     virtual void mouseDoubleClickEvent ( QMouseEvent * event );
101     virtual void dragEnterEvent(QDragEnterEvent *event);
102     virtual void dragLeaveEvent(QDragLeaveEvent *event);
103     virtual void dropEvent(QDropEvent *event);
104     
105 signals:
106     void syncEffectsPos(int);
107     void effectStateChanged(bool, int ix = -1);
108     void deleteGroup(int);
109     void changeGroupPosition(int, bool);
110     void activateEffect(int);
111     void moveEffect(int current_pos, int new_pos, int groupIndex, QString groupName);
112     void addEffect(QDomElement e);
113     void unGroup(CollapsibleGroup *);
114     void groupRenamed(CollapsibleGroup *);
115 };
116
117
118 #endif
119