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);
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 int effectIndex() const;
131 void setGroupIndex(int ix);
132 void removeGroup(int ix, QVBoxLayout *layout);
133 QString infoString() const;
136 void slotSyncEffectsPos(int pos);
140 void slotEnable(bool enable);
141 void slotShow(bool show);
142 void slotDeleteEffect();
144 void slotEffectDown();
145 void slotSaveEffect();
146 void slotResetEffect();
147 void slotCreateGroup();
151 ParameterContainer *m_paramWidget;
152 QList <CollapsibleEffect *> m_subParamWidgets;
153 QDomElement m_effect;
154 QDomElement m_original_effect;
155 QList <QDomElement> m_subEffects;
166 void updateGroupIndex(int groupIndex);
169 virtual void mouseDoubleClickEvent ( QMouseEvent * event );
170 virtual void mousePressEvent ( QMouseEvent * event );
171 virtual void enterEvent( QEvent * event );
172 virtual void leaveEvent( QEvent * event );
173 virtual void dragEnterEvent(QDragEnterEvent *event);
174 virtual void dropEvent(QDropEvent *event);
177 void parameterChanged(const QDomElement, const QDomElement, int);
178 void syncEffectsPos(int);
179 void effectStateChanged(bool, int ix = -1);
180 void deleteEffect(const QDomElement);
181 void changeEffectPosition(int, bool);
182 void activateEffect(int);
183 void checkMonitorPosition(int);
184 void seekTimeline(int);
185 /** @brief Start an MLT filter job on this clip. */
186 void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
187 /** @brief An effect was saved, trigger effect list reload. */
188 void reloadEffects();
189 /** @brief An effect was reset, trigger param reload. */
190 void resetEffect(int ix);
191 /** @brief Ask for creation of a group. */
192 void createGroup(int ix);
193 void moveEffect(int ix, CollapsibleEffect *group, int lastEffectIndex);
194 void unGroup(CollapsibleEffect *);