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 "effectstackedit.h"
29 #include "collapsibleeffect.h"
30 #include "collapsiblegroup.h"
34 class MltVideoProfile;
38 class EffectStackView2 : public QWidget
43 EffectStackView2(Monitor *monitor, QWidget *parent = 0);
44 virtual ~EffectStackView2();
46 /** @brief Raises @param dock if a clip is loaded. */
47 void raiseWindow(QWidget* dock);
49 /** @brief return the index of the track displayed in effect stack
50 ** @param ok set to true if we are looking at a track's effects, otherwise false. */
51 int isTrackMode(bool *ok) const;
53 /** @brief Clears the list of effects and updates the buttons accordingly. */
56 /** @brief Passes updates on @param profile and @param t on to the effect editor. */
57 void updateProjectFormat(MltVideoProfile profile, Timecode t);
59 /** @brief Tells the effect editor to update its timecode format. */
60 void updateTimecodeFormat();
62 /** @brief Used to trigger drag effects. */
63 virtual bool eventFilter( QObject * o, QEvent * e );
65 CollapsibleEffect *getEffectByIndex(int ix);
67 /** @brief Delete currently selected effect. */
68 void deleteCurrentEffect();
71 virtual void mouseMoveEvent(QMouseEvent * event);
72 virtual void mouseReleaseEvent(QMouseEvent * event);
73 virtual void resizeEvent ( QResizeEvent * event );
76 Ui::EffectStack2_UI m_ui;
78 QList <CollapsibleEffect*> m_effects;
79 EffectsList m_currentEffectList;
81 /** @brief Contains infos about effect like is it a track effect, which monitor displays it,... */
82 EffectMetaInfo m_effectMetaInfo;
84 /** @brief The last mouse click position, used to detect drag events. */
87 /** @brief The track index of currently edited track. */
90 /** If in track mode: Info of the edited track to be able to access its duration. */
91 TrackInfo m_trackInfo;
93 /** @brief The effect currently being dragged, NULL if no drag happening. */
94 CollapsibleEffect *m_draggedEffect;
96 /** @brief The effect currently being dragged, NULL if no drag happening. */
97 CollapsibleGroup *m_draggedGroup;
99 /** @brief The current number of groups. */
102 /** @brief Sets the list of effects according to the clip's effect list.
103 * @param ix Number of the effect to preselect */
104 void setupListView(int ix);
106 /** @brief Build the drag info and start it. */
110 /** @brief Sets the clip whose effect list should be managed.
111 * @param c Clip whose effect list should be managed
112 * @param ix Effect to preselect */
113 void slotClipItemSelected(ClipItem* c, int ix);
115 void slotTrackItemSelected(int ix, const TrackInfo info);
117 /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
118 void slotCheckWheelEventFilter();
122 /** @brief Emits seekTimeline with position = clipstart + @param pos. */
123 void slotSeekTimeline(int pos);
126 /* @brief Define the region filter for current effect.
127 void slotRegionChanged();*/
129 /** @brief Checks whether the monitor scene has to be displayed. */
130 void slotCheckMonitorPosition(int renderPos);
132 void slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix);
134 /** @brief Move an effect in the stack.
135 * @param index The effect index in the stack
136 * @param up true if we want to move effect up, false for down */
137 void slotMoveEffectUp(int index, bool up);
139 /** @brief Delete an effect in the stack. */
140 void slotDeleteEffect(const QDomElement effect);
142 /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
143 void slotRenderPos(int pos);
145 /** @brief Called whenever an effect is enabled / disabled by user. */
146 void slotUpdateEffectState(bool disable, int index);
148 void slotSetCurrentEffect(int ix);
150 /** @brief Triggers a filter job on this clip. */
151 void slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QString&properties);
153 /** @brief Reset an effect to its default values. */
154 void slotResetEffect(int ix);
156 /** @brief Create a group containing effect with ix index. */
157 void slotCreateGroup(int ix);
159 /** @brief Move an effect into a group.
160 ** @param ix the index of effect to move in stack layout
161 ** @param group the effect on which the effect was dropped
162 ** @param lastEffectIndex the last effect index in the group, effect will be inserted after that index
164 void slotMoveEffect(int currentIndex, int newIndex, int groupIndex, QString groupName = QString());
166 /** @brief Remove effects from a group */
167 void slotUnGroup(CollapsibleGroup* group);
169 /** @brief Add en effect to selected clip */
170 void slotAddEffect(QDomElement effect);
172 /** @brief Enable / disable all effects for the clip */
173 void slotCheckAll(int state);
175 /** @brief Update check all button status */
176 void slotUpdateCheckAllButton();
178 /** @brief Display additionnal effect info */
179 void slotShowComments();
181 /** @brief An effect group was renamed, update effects info */
182 void slotRenameGroup(CollapsibleGroup *group);
185 void removeEffect(ClipItem*, int, QDomElement);
186 /** Parameters for an effect changed, update the filter in playlist */
187 void updateEffect(ClipItem*, int, QDomElement, QDomElement, int);
188 /** An effect in stack was moved, we need to regenerate
189 all effects for this clip in the playlist */
190 void refreshEffectStack(ClipItem *);
191 /** Enable or disable an effect */
192 void changeEffectState(ClipItem*, int, int, bool);
193 /** An effect in stack was moved */
194 void changeEffectPosition(ClipItem*, int, int, int);
195 /** an effect was saved, reload list */
196 void reloadEffects();
197 /** An effect with position parameter was changed, seek */
198 void seekTimeline(int);
199 /** The region effect for current effect was changed */
200 void updateClipRegion(ClipItem*, int, QString);
201 void displayMessage(const QString&, int);
202 void showComments(bool show);
203 void startFilterJob(ItemInfo info, const QString &clipId, const QString &filterName, const QString &filterParams, const QString&finalFilterName, const QString &consumer, const QString &consumerParams, const QString &properties);
204 void addEffect(ClipItem*,QDomElement);