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 virtual bool eventFilter( QObject * o, QEvent * e );
131 /** @brief Update effect GUI to reflect parameted changes. */
132 void updateWidget(ItemInfo info, QDomElement effect, EffectMetaInfo *metaInfo);
133 QDomElement effect() const;
134 int groupIndex() const;
135 bool isGroup() const;
136 int effectIndex() const;
137 void setGroupIndex(int ix);
138 void setGroupName(const QString &groupName);
139 /** @brief Remove this effect from its group. */
140 void removeFromGroup();
141 QString infoString() const;
142 bool isActive() const;
143 /** @brief Should the wheel event be sent to parent widget for scrolling. */
144 bool filterWheelEvent;
146 /** @brief Return the stylesheet required for effect parameters. */
147 static const QString getStyleSheet(QPalette p);
150 void slotSyncEffectsPos(int pos);
151 void slotEnable(bool enable);
152 void slotResetEffect();
156 void slotShow(bool show);
157 void slotDeleteEffect();
159 void slotEffectDown();
160 void slotSaveEffect();
161 void slotCreateGroup();
165 ParameterContainer *m_paramWidget;
166 QList <CollapsibleEffect *> m_subParamWidgets;
167 QDomElement m_effect;
168 QDomElement m_original_effect;
169 QList <QDomElement> m_subEffects;
178 virtual void mouseDoubleClickEvent ( QMouseEvent * event );
179 virtual void mousePressEvent ( QMouseEvent * event );
180 virtual void dragEnterEvent(QDragEnterEvent *event);
181 virtual void dragLeaveEvent(QDragLeaveEvent *event);
182 virtual void dropEvent(QDropEvent *event);
185 void parameterChanged(const QDomElement, const QDomElement, int);
186 void syncEffectsPos(int);
187 void effectStateChanged(bool, int ix = -1);
188 void deleteEffect(const QDomElement);
189 void changeEffectPosition(int, bool);
190 void activateEffect(int);
191 void checkMonitorPosition(int);
192 void seekTimeline(int);
193 /** @brief Start an MLT filter job on this clip. */
194 void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
195 /** @brief An effect was saved, trigger effect list reload. */
196 void reloadEffects();
197 /** @brief An effect was reset, trigger param reload. */
198 void resetEffect(int ix);
199 /** @brief Ask for creation of a group. */
200 void createGroup(int ix);
201 void moveEffect(int current_pos, int new_pos, int groupIndex, QString groupName);
202 void unGroup(CollapsibleEffect *);
203 void addEffect(QDomElement e);