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;
78 void slotSyncEffectsPos(int pos);
79 void slotEnable(bool enable, bool emitInfo = true);
80 void slotResetEffect();
84 void slotShow(bool show);
85 void slotDeleteEffect();
87 void slotEffectDown();
88 void slotSaveEffect();
89 void slotCreateGroup();
90 void slotCreateRegion();
92 /** @brief A sub effect parameter was changed */
93 void slotUpdateRegionEffectParams(const QDomElement /*old*/, const QDomElement /*e*/, int /*ix*/);
96 ParameterContainer *m_paramWidget;
97 QList <CollapsibleEffect *> m_subParamWidgets;
99 QDomElement m_original_effect;
100 QList <QDomElement> m_subEffects;
107 /** @brief True if this is a region effect, which behaves in a special way, like a group. */
109 /** @brief The add group action. */
110 QAction *m_groupAction;
111 /** @brief Check if collapsed state changed and inform MLT. */
112 void updateCollapsedState();
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);
122 void parameterChanged(const QDomElement, const QDomElement, int);
123 void syncEffectsPos(int);
124 void effectStateChanged(bool, int ix, bool effectNeedsMonitorScene);
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);