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"
29 #include "effectstackedit.h"
31 #include <QDomElement>
32 #include <QToolButton>
38 struct EffectMetaInfo {
39 MltVideoProfile profile;
46 class MySpinBox : public QSpinBox
51 MySpinBox(QWidget * parent = 0);
54 virtual void focusInEvent(QFocusEvent*);
55 virtual void focusOutEvent(QFocusEvent*);
58 class ParameterContainer : public QObject
63 ParameterContainer(QDomElement effect, ItemInfo info, EffectMetaInfo *metaInfo, int index, QWidget * parent = 0);
64 ~ParameterContainer();
65 void updateTimecodeFormat();
66 void updateProjectFormat(MltVideoProfile profile, Timecode t);
70 void slotCollectAllParameters();
71 void slotStartFilterJobAction();
74 /** @brief Updates parameter @param name according to new value of dependency.
75 * @param name Name of the parameter which will be updated
76 * @param type Type of the parameter which will be updated
77 * @param value Value of the dependency parameter */
78 void meetDependency(const QString& name, QString type, QString value);
79 wipeInfo getWipeInfo(QString value);
80 QString getWipeString(wipeInfo info);
85 QList<QWidget*> m_uiItems;
86 QMap<QString, QWidget*> m_valueItems;
88 KeyframeEdit *m_keyframeEditor;
89 GeometryWidget *m_geometryWidget;
90 EffectMetaInfo *m_metaInfo;
95 void parameterChanged(const QDomElement, const QDomElement, int);
96 void syncEffectsPos(int);
97 void effectStateChanged(bool);
98 void checkMonitorPosition(int);
99 void seekTimeline(int);
100 void showComments(bool);
101 /** @brief Start an MLT filter job on this clip. */
102 void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
107 * @class CollapsibleEffect
108 * @brief A dialog for editing markers and guides.
109 * @author Jean-Baptiste Mardelle
112 class CollapsibleEffect : public QWidget, public Ui::CollapsibleWidget_UI
117 CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, int ix, EffectMetaInfo *metaInfo, bool lastEffect, bool isGroup = false, QWidget * parent = 0);
118 ~CollapsibleEffect();
119 static QMap<QString, QImage> iconCache;
120 void setupWidget(ItemInfo info, int index, EffectMetaInfo *metaInfo);
121 void updateTimecodeFormat();
122 void setActive(bool activate, bool focused = false);
123 virtual bool eventFilter( QObject * o, QEvent * e );
124 /** @brief Update effect GUI to reflect parameted changes. */
125 void updateWidget(ItemInfo info, int index, QDomElement effect, EffectMetaInfo *metaInfo);
126 QDomElement effect() const;
127 void addGroupEffect(CollapsibleEffect *effect);
129 int groupIndex() const;
130 bool isGroup() const;
131 int effectIndex() const;
132 void setGroupIndex(int ix);
133 void removeGroup(int ix, QVBoxLayout *layout);
134 QString infoString() const;
135 bool isActive() const;
136 /** @brief Should the wheel event be sent to parent widget for scrolling. */
137 bool filterWheelEvent;
140 void slotSyncEffectsPos(int pos);
141 void slotEnable(bool enable);
145 void slotShow(bool show);
146 void slotDeleteEffect();
148 void slotEffectDown();
149 void slotSaveEffect();
150 void slotResetEffect();
151 void slotCreateGroup();
155 ParameterContainer *m_paramWidget;
156 QList <CollapsibleEffect *> m_subParamWidgets;
157 QDomElement m_effect;
158 QDomElement m_original_effect;
159 QList <QDomElement> m_subEffects;
170 void updateGroupIndex(int groupIndex);
173 virtual void mouseDoubleClickEvent ( QMouseEvent * event );
174 virtual void mousePressEvent ( QMouseEvent * event );
175 virtual void enterEvent( QEvent * event );
176 virtual void leaveEvent( QEvent * event );
177 virtual void dragEnterEvent(QDragEnterEvent *event);
178 virtual void dragLeaveEvent(QDragLeaveEvent *event);
179 virtual void dropEvent(QDropEvent *event);
182 void parameterChanged(const QDomElement, const QDomElement, int);
183 void syncEffectsPos(int);
184 void effectStateChanged(bool, int ix = -1);
185 void deleteEffect(const QDomElement);
186 void changeEffectPosition(int, bool);
187 void activateEffect(int);
188 void checkMonitorPosition(int);
189 void seekTimeline(int);
190 /** @brief Start an MLT filter job on this clip. */
191 void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
192 /** @brief An effect was saved, trigger effect list reload. */
193 void reloadEffects();
194 /** @brief An effect was reset, trigger param reload. */
195 void resetEffect(int ix);
196 /** @brief Ask for creation of a group. */
197 void createGroup(int ix);
198 void moveEffect(int current_pos, int new_pos, CollapsibleEffect *target);
199 void unGroup(CollapsibleEffect *);
200 void addEffect(QDomElement e);