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
25 #include "ui_collapsiblewidget_ui.h"
27 #include "abstractcollapsiblewidget.h"
29 #include "keyframeedit.h"
31 #include <QDomElement>
32 #include <QToolButton>
38 struct EffectMetaInfo {
39 MltVideoProfile profile;
46 enum WIPE_DIRECTON { UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, CENTER = 4 };
51 int startTransparency;
55 class MySpinBox : public QSpinBox
60 MySpinBox(QWidget * parent = 0);
63 virtual void focusInEvent(QFocusEvent*);
64 virtual void focusOutEvent(QFocusEvent*);
67 class ParameterContainer : public QObject
72 ParameterContainer(QDomElement effect, ItemInfo info, EffectMetaInfo *metaInfo, QWidget * parent = 0);
73 ~ParameterContainer();
74 void updateTimecodeFormat();
75 void updateProjectFormat(MltVideoProfile profile, Timecode t);
78 void slotCollectAllParameters();
79 void slotStartFilterJobAction();
82 /** @brief Updates parameter @param name according to new value of dependency.
83 * @param name Name of the parameter which will be updated
84 * @param type Type of the parameter which will be updated
85 * @param value Value of the dependency parameter */
86 void meetDependency(const QString& name, QString type, QString value);
87 wipeInfo getWipeInfo(QString value);
88 QString getWipeString(wipeInfo info);
92 QList<QWidget*> m_uiItems;
93 QMap<QString, QWidget*> m_valueItems;
95 KeyframeEdit *m_keyframeEditor;
96 GeometryWidget *m_geometryWidget;
97 EffectMetaInfo *m_metaInfo;
102 void parameterChanged(const QDomElement, const QDomElement, int);
103 void syncEffectsPos(int);
104 void effectStateChanged(bool);
105 void checkMonitorPosition(int);
106 void seekTimeline(int);
107 void showComments(bool);
108 /** @brief Start an MLT filter job on this clip. */
109 void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
114 * @class CollapsibleEffect
115 * @brief A dialog for editing markers and guides.
116 * @author Jean-Baptiste Mardelle
119 class CollapsibleEffect : public AbstractCollapsibleWidget, public Ui::CollapsibleWidget_UI
124 CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, EffectMetaInfo *metaInfo, bool lastEffect, QWidget * parent = 0);
125 ~CollapsibleEffect();
126 static QMap<QString, QImage> iconCache;
127 void setupWidget(ItemInfo info, EffectMetaInfo *metaInfo);
128 void updateTimecodeFormat();
129 void setActive(bool activate);
130 /** @brief Install event filter so that scrolling with mouse wheel does not change parameter value. */
131 virtual bool eventFilter( QObject * o, QEvent * e );
132 /** @brief Update effect GUI to reflect parameted changes. */
133 void updateWidget(ItemInfo info, QDomElement effect, EffectMetaInfo *metaInfo);
134 QDomElement effect() const;
135 int groupIndex() const;
136 bool isGroup() const;
137 int effectIndex() const;
138 void setGroupIndex(int ix);
139 void setGroupName(const QString &groupName);
140 /** @brief Remove this effect from its group. */
141 void removeFromGroup();
142 QString infoString() const;
143 bool isActive() const;
144 /** @brief Should the wheel event be sent to parent widget for scrolling. */
145 bool filterWheelEvent;
147 /** @brief Return the stylesheet required for effect parameters. */
148 static const QString getStyleSheet();
151 void slotSyncEffectsPos(int pos);
152 void slotEnable(bool enable, bool updateMainStatus = true);
153 void slotResetEffect();
157 void slotShow(bool show);
158 void slotDeleteEffect();
160 void slotEffectDown();
161 void slotSaveEffect();
162 void slotCreateGroup();
166 ParameterContainer *m_paramWidget;
167 QList <CollapsibleEffect *> m_subParamWidgets;
168 QDomElement m_effect;
169 QDomElement m_original_effect;
170 QList <QDomElement> m_subEffects;
179 virtual void mouseDoubleClickEvent ( QMouseEvent * event );
180 virtual void mouseReleaseEvent( QMouseEvent *event );
181 virtual void dragEnterEvent(QDragEnterEvent *event);
182 virtual void dragLeaveEvent(QDragLeaveEvent *event);
183 virtual void dropEvent(QDropEvent *event);
186 void parameterChanged(const QDomElement, const QDomElement, int);
187 void syncEffectsPos(int);
188 void effectStateChanged(bool, int ix = -1, bool updateMainStatus = true);
189 void deleteEffect(const QDomElement);
190 void changeEffectPosition(int, bool);
191 void activateEffect(int);
192 void checkMonitorPosition(int);
193 void seekTimeline(int);
194 /** @brief Start an MLT filter job on this clip. */
195 void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
196 /** @brief An effect was saved, trigger effect list reload. */
197 void reloadEffects();
198 /** @brief An effect was reset, trigger param reload. */
199 void resetEffect(int ix);
200 /** @brief Ask for creation of a group. */
201 void createGroup(int ix);
202 void moveEffect(int current_pos, int new_pos, int groupIndex, QString groupName);
203 void unGroup(CollapsibleEffect *);
204 void addEffect(QDomElement e);