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"
28 #include "keyframeedit.h"
30 #include <QDomElement>
31 #include <QToolButton>
37 struct EffectMetaInfo {
38 MltVideoProfile profile;
45 enum WIPE_DIRECTON { UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, CENTER = 4 };
50 int startTransparency;
54 class MySpinBox : public QSpinBox
59 MySpinBox(QWidget * parent = 0);
62 virtual void focusInEvent(QFocusEvent*);
63 virtual void focusOutEvent(QFocusEvent*);
66 class ParameterContainer : public QObject
71 ParameterContainer(QDomElement effect, ItemInfo info, EffectMetaInfo *metaInfo, int index, QWidget * parent = 0);
72 ~ParameterContainer();
73 void updateTimecodeFormat();
74 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);
93 QList<QWidget*> m_uiItems;
94 QMap<QString, QWidget*> m_valueItems;
96 KeyframeEdit *m_keyframeEditor;
97 GeometryWidget *m_geometryWidget;
98 EffectMetaInfo *m_metaInfo;
103 void parameterChanged(const QDomElement, const QDomElement, int);
104 void syncEffectsPos(int);
105 void effectStateChanged(bool);
106 void checkMonitorPosition(int);
107 void seekTimeline(int);
108 void showComments(bool);
109 /** @brief Start an MLT filter job on this clip. */
110 void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
115 * @class CollapsibleEffect
116 * @brief A dialog for editing markers and guides.
117 * @author Jean-Baptiste Mardelle
120 class CollapsibleEffect : public QWidget, public Ui::CollapsibleWidget_UI
125 CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, int ix, EffectMetaInfo *metaInfo, bool lastEffect, bool isGroup = false, QWidget * parent = 0);
126 ~CollapsibleEffect();
127 static QMap<QString, QImage> iconCache;
128 void setupWidget(ItemInfo info, int index, EffectMetaInfo *metaInfo);
129 void updateTimecodeFormat();
130 void setActive(bool activate, bool focused = false);
131 virtual bool eventFilter( QObject * o, QEvent * e );
132 /** @brief Update effect GUI to reflect parameted changes. */
133 void updateWidget(ItemInfo info, int index, QDomElement effect, EffectMetaInfo *metaInfo);
134 QDomElement effect() const;
135 void addGroupEffect(CollapsibleEffect *effect);
137 int groupIndex() const;
138 bool isGroup() const;
139 int effectIndex() const;
140 void setGroupIndex(int ix);
141 void removeGroup(int ix, QVBoxLayout *layout);
142 QString infoString() const;
143 bool isActive() const;
144 /** @brief Should the wheel event be sent to parent widget for scrolling. */
145 bool filterWheelEvent;
148 void slotSyncEffectsPos(int pos);
149 void slotEnable(bool enable);
153 void slotShow(bool show);
154 void slotDeleteEffect();
156 void slotEffectDown();
157 void slotSaveEffect();
158 void slotResetEffect();
159 void slotCreateGroup();
163 ParameterContainer *m_paramWidget;
164 QList <CollapsibleEffect *> m_subParamWidgets;
165 QDomElement m_effect;
166 QDomElement m_original_effect;
167 QList <QDomElement> m_subEffects;
178 void updateGroupIndex(int groupIndex);
181 virtual void mouseDoubleClickEvent ( QMouseEvent * event );
182 virtual void mousePressEvent ( QMouseEvent * event );
183 virtual void enterEvent( QEvent * event );
184 virtual void leaveEvent( QEvent * event );
185 virtual void dragEnterEvent(QDragEnterEvent *event);
186 virtual void dragLeaveEvent(QDragLeaveEvent *event);
187 virtual void dropEvent(QDropEvent *event);
190 void parameterChanged(const QDomElement, const QDomElement, int);
191 void syncEffectsPos(int);
192 void effectStateChanged(bool, int ix = -1);
193 void deleteEffect(const QDomElement);
194 void changeEffectPosition(int, bool);
195 void activateEffect(int);
196 void checkMonitorPosition(int);
197 void seekTimeline(int);
198 /** @brief Start an MLT filter job on this clip. */
199 void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
200 /** @brief An effect was saved, trigger effect list reload. */
201 void reloadEffects();
202 /** @brief An effect was reset, trigger param reload. */
203 void resetEffect(int ix);
204 /** @brief Ask for creation of a group. */
205 void createGroup(int ix);
206 void moveEffect(int current_pos, int new_pos, CollapsibleEffect *target);
207 void unGroup(CollapsibleEffect *);
208 void addEffect(QDomElement e);