]> git.sesse.net Git - kdenlive/blob - src/effectstack/collapsibleeffect.h
Fix importing clip analysis to effect
[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     /** @brief Set clip in / out points. */
77     void setRange(int inPoint , int outPoint);
78     /** @brief Import keyframes from a clip's data. */
79     void setKeyframes(const QString data, int maximum);
80
81 public slots:
82     void slotSyncEffectsPos(int pos);
83     void slotDisable(bool disable, bool emitInfo = true);
84     void slotResetEffect();
85
86 private slots:
87     void slotSwitch();
88     void slotShow(bool show);
89     void slotDeleteEffect();
90     void slotEffectUp();
91     void slotEffectDown();
92     void slotSaveEffect();
93     void slotCreateGroup();
94     void slotCreateRegion();
95     void slotUnGroup();
96     /** @brief A sub effect parameter was changed */
97     void slotUpdateRegionEffectParams(const QDomElement /*old*/, const QDomElement /*e*/, int /*ix*/);
98     /** @brief Dis/enable effect before processing an operation (color picker) */
99     void slotDisableEffect(bool disable);
100
101 private:
102     ParameterContainer *m_paramWidget;
103     QList <CollapsibleEffect *> m_subParamWidgets;
104     QDomElement m_effect;
105     QDomElement m_original_effect;
106     QList <QDomElement> m_subEffects;
107     bool m_lastEffect;
108     int m_in;
109     int m_out;
110     QMenu *m_menu;
111     QPoint m_clickPoint;
112     EffectInfo m_info;
113     /** @brief True if this is a region effect, which behaves in a special way, like a group. */
114     bool m_regionEffect;
115     /** @brief The add group action. */
116     QAction *m_groupAction;
117     /** @brief Check if collapsed state changed and inform MLT. */
118     void updateCollapsedState();
119     
120 protected:
121     virtual void mouseDoubleClickEvent ( QMouseEvent * event );
122     virtual void mouseReleaseEvent( QMouseEvent *event );
123     virtual void dragEnterEvent(QDragEnterEvent *event);
124     virtual void dragLeaveEvent(QDragLeaveEvent *event);
125     virtual void dropEvent(QDropEvent *event);
126     
127 signals:
128     void parameterChanged(const QDomElement, const QDomElement, int);
129     void syncEffectsPos(int);
130     void effectStateChanged(bool, int ix, bool effectNeedsMonitorScene);
131     void deleteEffect(const QDomElement);
132     void activateEffect(int);
133     void checkMonitorPosition(int);
134     void seekTimeline(int);
135     /** @brief Start an MLT filter job on this clip. */
136     void startFilterJob(QString filterName, QString filterParams, QString consumer, QString consumerParams, const QMap <QString, QString>extraParams);
137     /** @brief An effect was reset, trigger param reload. */
138     void resetEffect(int ix);
139     /** @brief Ask for creation of a group. */
140     void createGroup(int ix);
141     void unGroup(CollapsibleEffect *);
142     void createRegion(int, KUrl);
143     void deleteGroup(QDomDocument);
144     void importClipKeyframes();
145 };
146
147
148 #endif
149