]> git.sesse.net Git - kdenlive/blob - src/effectstack/collapsibleeffect.h
Effect stack update: enable / disable several effects now triggers only one refresh
[kdenlive] / src / effectstack / collapsibleeffect.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 COLLAPSIBLEEFFECT_H
22 #define COLLAPSIBLEEFFECT_H
23
24 #include "parametercontainer.h"
25 #include "abstractcollapsiblewidget.h"
26 #include "timecode.h"
27
28
29 #include <QDomElement>
30 #include <QToolButton>
31
32 class QFrame;
33 class QLabel;
34
35
36 /**)
37  * @class CollapsibleEffect
38  * @brief A dialog for editing markers and guides.
39  * @author Jean-Baptiste Mardelle
40  */
41
42 class CollapsibleEffect : public AbstractCollapsibleWidget
43 {
44     Q_OBJECT
45
46 public:
47     CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, EffectMetaInfo *metaInfo, bool lastEffect, QWidget * parent = 0);
48     ~CollapsibleEffect();
49     QLabel *title;
50         
51     void setupWidget(ItemInfo info, EffectMetaInfo *metaInfo);
52     void updateTimecodeFormat();
53     void setActive(bool activate);
54     /** @brief Install event filter so that scrolling with mouse wheel does not change parameter value. */
55     virtual bool eventFilter( QObject * o, QEvent * e );
56     /** @brief Update effect GUI to reflect parameted changes. */
57     void updateWidget(ItemInfo info, QDomElement effect, EffectMetaInfo *metaInfo);
58     QDomElement effect() const;
59     int groupIndex() const;
60     bool isGroup() const;
61     int effectIndex() const;
62     void setGroupIndex(int ix);
63     void setGroupName(const QString &groupName);
64     /** @brief Remove this effect from its group. */
65     void removeFromGroup();
66     QString infoString() const;
67     bool isActive() const;
68     /** @brief Should the wheel event be sent to parent widget for scrolling. */
69     bool filterWheelEvent;
70     /** @brief Parent group was collapsed, update. */
71     void groupStateChanged(bool collapsed);
72     /** @brief Show / hide up / down buttons. */
73     void adjustButtons(int ix, int max);
74     /** @brief Returns true of this effect requires an on monitor adjustable effect scene. */
75     bool needsMonitorEffectScene() const;
76
77 public slots:
78     void slotSyncEffectsPos(int pos);
79     void slotEnable(bool enable, bool emitInfo = true);
80     void slotResetEffect();
81
82 private slots:
83     void slotSwitch();
84     void slotShow(bool show);
85     void slotDeleteEffect();
86     void slotEffectUp();
87     void slotEffectDown();
88     void slotSaveEffect();
89     void slotCreateGroup();
90     void slotCreateRegion();
91     void slotUnGroup();
92     /** @brief A sub effect parameter was changed */
93     void slotUpdateRegionEffectParams(const QDomElement /*old*/, const QDomElement /*e*/, int /*ix*/);
94
95 private:
96     ParameterContainer *m_paramWidget;
97     QList <CollapsibleEffect *> m_subParamWidgets;
98     QDomElement m_effect;
99     QDomElement m_original_effect;
100     QList <QDomElement> m_subEffects;
101     bool m_lastEffect;
102     int m_in;
103     int m_out;
104     QMenu *m_menu;
105     QPoint m_clickPoint;
106     EffectInfo m_info;
107     /** @brief True if this is a region effect, which behaves in a special way, like a group. */
108     bool m_regionEffect;
109     /** @brief The add group action. */
110     QAction *m_groupAction;
111     /** @brief Check if collapsed state changed and inform MLT. */
112     void updateCollapsedState();
113     
114 protected:
115     virtual void mouseDoubleClickEvent ( QMouseEvent * event );
116     virtual void mouseReleaseEvent( QMouseEvent *event );
117     virtual void dragEnterEvent(QDragEnterEvent *event);
118     virtual void dragLeaveEvent(QDragLeaveEvent *event);
119     virtual void dropEvent(QDropEvent *event);
120     
121 signals:
122     void parameterChanged(const QDomElement, const QDomElement, int);
123     void syncEffectsPos(int);
124     void effectStateChanged(bool, int ix = -1, bool updateMainStatus = true);
125     void deleteEffect(const QDomElement);
126     void activateEffect(int);
127     void checkMonitorPosition(int);
128     void seekTimeline(int);
129     /** @brief Start an MLT filter job on this clip. */
130     void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
131     /** @brief An effect was reset, trigger param reload. */
132     void resetEffect(int ix);
133     /** @brief Ask for creation of a group. */
134     void createGroup(int ix);
135     void unGroup(CollapsibleEffect *);
136     void createRegion(int, KUrl);
137     void deleteGroup(QDomDocument);
138 };
139
140
141 #endif
142