1 /***************************************************************************
2 effecstackview2.h - description
5 copyright : (C) 2008 by Marco Gittler (g.marco@freenet.de)
6 copyright : (C) 2012 by Jean-Baptiste Mardelle (jb@kdenlive.org)
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
19 * @class EffectStackView2
20 * @brief View part of the EffectStack
21 * @author Marco Gittler
24 #ifndef EFFECTSTACKVIEW2_H
25 #define EFFECTSTACKVIEW2_H
27 #include "ui_effectstack2_ui.h"
28 #include "collapsibleeffect.h"
29 #include "collapsiblegroup.h"
33 class MltVideoProfile;
37 class EffectStackView2 : public QWidget
42 explicit EffectStackView2(Monitor *monitor, QWidget *parent = 0);
43 virtual ~EffectStackView2();
45 /** @brief Raises @param dock if a clip is loaded. */
46 void raiseWindow(QWidget* dock);
48 /** @brief return the index of the track displayed in effect stack
49 ** @param ok set to true if we are looking at a track's effects, otherwise false. */
50 int isTrackMode(bool *ok) const;
52 /** @brief Clears the list of effects and updates the buttons accordingly. */
55 /** @brief Passes updates on @param profile and @param t on to the effect editor. */
56 void updateProjectFormat(MltVideoProfile profile, Timecode t);
58 /** @brief Tells the effect editor to update its timecode format. */
59 void updateTimecodeFormat();
61 /** @brief Used to trigger drag effects. */
62 virtual bool eventFilter( QObject * o, QEvent * e );
64 CollapsibleEffect *getEffectByIndex(int ix);
66 /** @brief Delete currently selected effect. */
67 void deleteCurrentEffect();
69 /** @brief Palette was changed, update style. */
72 /** @brief Process dropped xml effect. */
73 void processDroppedEffect(QDomElement e, QDropEvent *event);
75 /** @brief Return the stylesheet required for effect parameters. */
76 static const QString getStyleSheet();
78 /** @brief Import keyframes from the clip metadata */
79 void setKeyframes(const QString data, int maximum);
82 virtual void mouseMoveEvent(QMouseEvent * event);
83 virtual void mouseReleaseEvent(QMouseEvent * event);
84 virtual void resizeEvent ( QResizeEvent * event );
85 virtual void dragEnterEvent(QDragEnterEvent *event);
86 virtual void dropEvent(QDropEvent *event);
89 Ui::EffectStack2_UI m_ui;
91 QList <CollapsibleEffect*> m_effects;
92 EffectsList m_currentEffectList;
94 /** @brief Contains infos about effect like is it a track effect, which monitor displays it,... */
95 EffectMetaInfo m_effectMetaInfo;
97 /** @brief The last mouse click position, used to detect drag events. */
100 /** @brief The track index of currently edited track. */
103 /** If in track mode: Info of the edited track to be able to access its duration. */
104 TrackInfo m_trackInfo;
106 /** @brief The effect currently being dragged, NULL if no drag happening. */
107 CollapsibleEffect *m_draggedEffect;
109 /** @brief The effect currently being dragged, NULL if no drag happening. */
110 CollapsibleGroup *m_draggedGroup;
112 /** @brief The current number of groups. */
115 /** @brief The current effect may require an on monitor scene. */
116 bool m_monitorSceneWanted;
118 /** @brief Sets the list of effects according to the clip's effect list. */
119 void setupListView();
121 /** @brief Build the drag info and start it. */
124 /** @brief Connect an effect to its signals. */
125 void connectEffect(CollapsibleEffect *currentEffect);
126 /** @brief Connect a group to its signals. */
127 void connectGroup(CollapsibleGroup *group);
130 /** @brief Sets the clip whose effect list should be managed.
131 * @param c Clip whose effect list should be managed */
132 void slotClipItemSelected(ClipItem* c);
134 /** @brief Update the clip range (in-out points)
135 * @param c Clip whose effect list should be managed */
136 void slotClipItemUpdate();
138 void slotTrackItemSelected(int ix, const TrackInfo info);
140 /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
141 void slotCheckWheelEventFilter();
145 /** @brief Emits seekTimeline with position = clipstart + @param pos. */
146 void slotSeekTimeline(int pos);
149 /* @brief Define the region filter for current effect.
150 void slotRegionChanged();*/
152 /** @brief Checks whether the monitor scene has to be displayed. */
153 void slotCheckMonitorPosition(int renderPos);
155 void slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix);
157 /** @brief Move an effect in the stack.
158 * @param indexes The list of effect index in the stack
159 * @param up true if we want to move effect up, false for down */
160 void slotMoveEffectUp(QList <int> indexes, bool up);
162 /** @brief Delete an effect in the stack. */
163 void slotDeleteEffect(const QDomElement effect);
165 /** @brief Delete all effect in a group. */
166 void slotDeleteGroup(QDomDocument doc);
168 /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
169 void slotRenderPos(int pos);
171 /** @brief Called whenever an effect is enabled / disabled by user. */
172 void slotUpdateEffectState(bool disable, int index, bool needsMonitorEffectScene);
174 void slotSetCurrentEffect(int ix);
176 /** @brief Triggers a filter job on this clip. */
177 void slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&consumer, const QString&consumerParams, const QMap <QString, QString> &extraParams);
179 /** @brief Reset an effect to its default values. */
180 void slotResetEffect(int ix);
182 /** @brief Create a group containing effect with ix index. */
183 void slotCreateGroup(int ix);
185 /** @brief Create a region effect with ix index. */
186 void slotCreateRegion(int ix, KUrl url);
188 /** @brief Move an effect.
189 ** @param currentIndexes the list of effect indexes to move in stack layout
190 ** @param newIndex the position where the effects will be moved
191 ** @param groupIndex the index of the group if any (-1 if none)
192 ** @param groupName the name of the group to paste the effect
194 void slotMoveEffect(QList <int> currentIndexes, int newIndex, int groupIndex, QString groupName = QString());
196 /** @brief Remove effects from a group */
197 void slotUnGroup(CollapsibleGroup* group);
199 /** @brief Add en effect to selected clip */
200 void slotAddEffect(QDomElement effect);
202 /** @brief Enable / disable all effects for the clip */
203 void slotCheckAll(int state);
205 /** @brief Update check all button status */
206 void slotUpdateCheckAllButton();
208 /** @brief Display additionnal effect info */
209 void slotShowComments();
211 /** @brief An effect group was renamed, update effects info */
212 void slotRenameGroup(CollapsibleGroup *group);
215 void removeEffect(ClipItem*, int, QDomElement);
216 /** Parameters for an effect changed, update the filter in playlist */
217 void updateEffect(ClipItem*, int, QDomElement, QDomElement, int,bool);
218 /** An effect in stack was moved, we need to regenerate
219 all effects for this clip in the playlist */
220 void refreshEffectStack(ClipItem *);
221 /** Enable or disable an effect */
222 void changeEffectState(ClipItem*, int, QList <int>, bool);
223 /** An effect in stack was moved */
224 void changeEffectPosition(ClipItem*, int, QList <int>, int);
225 /** an effect was saved, reload list */
226 void reloadEffects();
227 /** An effect with position parameter was changed, seek */
228 void seekTimeline(int);
229 /** The region effect for current effect was changed */
230 void updateClipRegion(ClipItem*, int, QString);
231 void displayMessage(const QString&, int);
232 void showComments(bool show);
233 void startFilterJob(ItemInfo info, const QString &clipId, const QString &filterName, const QString &filterParams, const QString &consumer, const QString &consumerParams, const QMap<QString, QString> &extraParams);
234 void addEffect(ClipItem*,QDomElement);
235 void importClipKeyframes(GRAPHICSRECTITEM = AVWIDGET);