1 /***************************************************************************
2 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
21 #ifndef COLLAPSIBLEEFFECT_H
22 #define COLLAPSIBLEEFFECT_H
24 #include "parametercontainer.h"
25 #include "abstractcollapsiblewidget.h"
29 #include <QDomElement>
30 #include <QToolButton>
37 * @class CollapsibleEffect
38 * @brief A dialog for editing markers and guides.
39 * @author Jean-Baptiste Mardelle
42 class CollapsibleEffect : public AbstractCollapsibleWidget
47 CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, EffectMetaInfo *metaInfo, bool lastEffect, QWidget * parent = 0);
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;
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);
80 void slotSyncEffectsPos(int pos);
81 void slotDisable(bool disable, bool emitInfo = true);
82 void slotResetEffect();
86 void slotShow(bool show);
87 void slotDeleteEffect();
89 void slotEffectDown();
90 void slotSaveEffect();
91 void slotCreateGroup();
92 void slotCreateRegion();
94 /** @brief A sub effect parameter was changed */
95 void slotUpdateRegionEffectParams(const QDomElement /*old*/, const QDomElement /*e*/, int /*ix*/);
96 /** @brief Dis/enable effect before processing an operation (color picker) */
97 void slotDisableEffect(bool disable);
100 ParameterContainer *m_paramWidget;
101 QList <CollapsibleEffect *> m_subParamWidgets;
102 QDomElement m_effect;
103 QDomElement m_original_effect;
104 QList <QDomElement> m_subEffects;
111 /** @brief True if this is a region effect, which behaves in a special way, like a group. */
113 /** @brief The add group action. */
114 QAction *m_groupAction;
115 /** @brief Check if collapsed state changed and inform MLT. */
116 void updateCollapsedState();
119 virtual void mouseDoubleClickEvent ( QMouseEvent * event );
120 virtual void mouseReleaseEvent( QMouseEvent *event );
121 virtual void dragEnterEvent(QDragEnterEvent *event);
122 virtual void dragLeaveEvent(QDragLeaveEvent *event);
123 virtual void dropEvent(QDropEvent *event);
126 void parameterChanged(const QDomElement, const QDomElement, int);
127 void syncEffectsPos(int);
128 void effectStateChanged(bool, int ix, bool effectNeedsMonitorScene);
129 void deleteEffect(const QDomElement);
130 void activateEffect(int);
131 void checkMonitorPosition(int);
132 void seekTimeline(int);
133 /** @brief Start an MLT filter job on this clip. */
134 void startFilterJob(QString filterName, QString filterParams, QString consumer, QString consumerParams, const QMap <QString, QString>extraParams);
135 /** @brief An effect was reset, trigger param reload. */
136 void resetEffect(int ix);
137 /** @brief Ask for creation of a group. */
138 void createGroup(int ix);
139 void unGroup(CollapsibleEffect *);
140 void createRegion(int, KUrl);
141 void deleteGroup(QDomDocument);
142 void importClipKeyframes();