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();
79 virtual void mouseMoveEvent(QMouseEvent * event);
80 virtual void mouseReleaseEvent(QMouseEvent * event);
81 virtual void resizeEvent ( QResizeEvent * event );
82 virtual void dragEnterEvent(QDragEnterEvent *event);
83 virtual void dropEvent(QDropEvent *event);
86 Ui::EffectStack2_UI m_ui;
88 QList <CollapsibleEffect*> m_effects;
89 EffectsList m_currentEffectList;
91 /** @brief Contains infos about effect like is it a track effect, which monitor displays it,... */
92 EffectMetaInfo m_effectMetaInfo;
94 /** @brief The last mouse click position, used to detect drag events. */
97 /** @brief The track index of currently edited track. */
100 /** If in track mode: Info of the edited track to be able to access its duration. */
101 TrackInfo m_trackInfo;
103 /** @brief The effect currently being dragged, NULL if no drag happening. */
104 CollapsibleEffect *m_draggedEffect;
106 /** @brief The effect currently being dragged, NULL if no drag happening. */
107 CollapsibleGroup *m_draggedGroup;
109 /** @brief The current number of groups. */
112 /** @brief The current effect may require an on monitor scene. */
113 bool m_monitorSceneWanted;
115 /** @brief Sets the list of effects according to the clip's effect list. */
116 void setupListView();
118 /** @brief Build the drag info and start it. */
121 /** @brief Connect an effect to its signals. */
122 void connectEffect(CollapsibleEffect *currentEffect);
123 /** @brief Connect a group to its signals. */
124 void connectGroup(CollapsibleGroup *group);
127 /** @brief Sets the clip whose effect list should be managed.
128 * @param c Clip whose effect list should be managed */
129 void slotClipItemSelected(ClipItem* c);
131 /** @brief Update the clip range (in-out points)
132 * @param c Clip whose effect list should be managed */
133 void slotClipItemUpdate();
135 void slotTrackItemSelected(int ix, const TrackInfo info);
137 /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
138 void slotCheckWheelEventFilter();
142 /** @brief Emits seekTimeline with position = clipstart + @param pos. */
143 void slotSeekTimeline(int pos);
146 /* @brief Define the region filter for current effect.
147 void slotRegionChanged();*/
149 /** @brief Checks whether the monitor scene has to be displayed. */
150 void slotCheckMonitorPosition(int renderPos);
152 void slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix);
154 /** @brief Move an effect in the stack.
155 * @param indexes The list of effect index in the stack
156 * @param up true if we want to move effect up, false for down */
157 void slotMoveEffectUp(QList <int> indexes, bool up);
159 /** @brief Delete an effect in the stack. */
160 void slotDeleteEffect(const QDomElement effect);
162 /** @brief Delete all effect in a group. */
163 void slotDeleteGroup(QDomDocument doc);
165 /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
166 void slotRenderPos(int pos);
168 /** @brief Called whenever an effect is enabled / disabled by user. */
169 void slotUpdateEffectState(bool disable, int index, bool needsMonitorEffectScene);
171 void slotSetCurrentEffect(int ix);
173 /** @brief Triggers a filter job on this clip. */
174 void slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&consumer, const QString&consumerParams, const QMap <QString, QString> &extraParams);
176 /** @brief Reset an effect to its default values. */
177 void slotResetEffect(int ix);
179 /** @brief Create a group containing effect with ix index. */
180 void slotCreateGroup(int ix);
182 /** @brief Create a region effect with ix index. */
183 void slotCreateRegion(int ix, KUrl url);
185 /** @brief Move an effect.
186 ** @param currentIndexes the list of effect indexes to move in stack layout
187 ** @param newIndex the position where the effects will be moved
188 ** @param groupIndex the index of the group if any (-1 if none)
189 ** @param groupName the name of the group to paste the effect
191 void slotMoveEffect(QList <int> currentIndexes, int newIndex, int groupIndex, QString groupName = QString());
193 /** @brief Remove effects from a group */
194 void slotUnGroup(CollapsibleGroup* group);
196 /** @brief Add en effect to selected clip */
197 void slotAddEffect(QDomElement effect);
199 /** @brief Enable / disable all effects for the clip */
200 void slotCheckAll(int state);
202 /** @brief Update check all button status */
203 void slotUpdateCheckAllButton();
205 /** @brief Display additionnal effect info */
206 void slotShowComments();
208 /** @brief An effect group was renamed, update effects info */
209 void slotRenameGroup(CollapsibleGroup *group);
212 void removeEffect(ClipItem*, int, QDomElement);
213 /** Parameters for an effect changed, update the filter in playlist */
214 void updateEffect(ClipItem*, int, QDomElement, QDomElement, int,bool);
215 /** An effect in stack was moved, we need to regenerate
216 all effects for this clip in the playlist */
217 void refreshEffectStack(ClipItem *);
218 /** Enable or disable an effect */
219 void changeEffectState(ClipItem*, int, QList <int>, bool);
220 /** An effect in stack was moved */
221 void changeEffectPosition(ClipItem*, int, QList <int>, int);
222 /** an effect was saved, reload list */
223 void reloadEffects();
224 /** An effect with position parameter was changed, seek */
225 void seekTimeline(int);
226 /** The region effect for current effect was changed */
227 void updateClipRegion(ClipItem*, int, QString);
228 void displayMessage(const QString&, int);
229 void showComments(bool show);
230 void startFilterJob(ItemInfo info, const QString &clipId, const QString &filterName, const QString &filterParams, const QString &consumer, const QString &consumerParams, const QMap<QString, QString> &extraParams);
231 void addEffect(ClipItem*,QDomElement);
232 void importClipKeyframes(GRAPHICSRECTITEM = AVWIDGET);