]> git.sesse.net Git - kdenlive/blob - src/effectstack/effectstackview2.h
4ce9580f8a9137bba7e35f94f5f2b888df9595ad
[kdenlive] / src / effectstack / effectstackview2.h
1 /***************************************************************************
2                           effecstackview2.h  -  description
3                              -------------------
4     begin                : Feb 15 2008
5     copyright            : (C) 2008 by Marco Gittler (g.marco@freenet.de)
6     copyright            : (C) 2012 by Jean-Baptiste Mardelle (jb@kdenlive.org) 
7  ***************************************************************************/
8
9 /***************************************************************************
10  *                                                                         *
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.                                   *
15  *                                                                         *
16  ***************************************************************************/
17
18 /**
19  * @class EffectStackView2
20  * @brief View part of the EffectStack
21  * @author Marco Gittler
22  */
23
24 #ifndef EFFECTSTACKVIEW2_H
25 #define EFFECTSTACKVIEW2_H
26
27 #include "ui_effectstack2_ui.h"
28 #include "collapsibleeffect.h"
29 #include "collapsiblegroup.h"
30
31 class EffectsList;
32 class ClipItem;
33 class MltVideoProfile;
34 class Monitor;
35
36
37 class EffectStackView2 : public QWidget
38 {
39     Q_OBJECT
40
41 public:
42     explicit EffectStackView2(Monitor *monitor, QWidget *parent = 0);
43     virtual ~EffectStackView2();
44
45     /** @brief Raises @param dock if a clip is loaded. */
46     void raiseWindow(QWidget* dock);
47
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;
51
52     /** @brief Clears the list of effects and updates the buttons accordingly. */
53     void clear();
54
55     /** @brief Passes updates on @param profile and @param t on to the effect editor. */
56     void updateProjectFormat(MltVideoProfile profile, Timecode t);
57
58     /** @brief Tells the effect editor to update its timecode format. */
59     void updateTimecodeFormat();
60     
61     /** @brief Used to trigger drag effects. */
62     virtual bool eventFilter( QObject * o, QEvent * e );
63     
64     CollapsibleEffect *getEffectByIndex(int ix);
65     
66     /** @brief Delete currently selected effect. */
67     void deleteCurrentEffect();
68     
69     /** @brief Palette was changed, update style. */
70     void updatePalette();
71     
72     /** @brief Process dropped xml effect. */
73     void processDroppedEffect(QDomElement e, QDropEvent *event);
74     
75     /** @brief Return the stylesheet required for effect parameters. */
76     static const QString getStyleSheet();
77
78 protected:
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);
84   
85 private:
86     Ui::EffectStack2_UI m_ui;
87     ClipItem* m_clipref;
88     QList <CollapsibleEffect*> m_effects;
89     EffectsList m_currentEffectList;
90     
91     /** @brief Contains infos about effect like is it a track effect, which monitor displays it,... */
92     EffectMetaInfo m_effectMetaInfo;
93     
94     /** @brief The last mouse click position, used to detect drag events. */
95     QPoint m_clickPoint;
96
97     /** @brief The track index of currently edited track. */
98     int m_trackindex;
99
100     /** If in track mode: Info of the edited track to be able to access its duration. */
101     TrackInfo m_trackInfo;
102     
103     /** @brief The effect currently being dragged, NULL if no drag happening. */
104     CollapsibleEffect *m_draggedEffect;
105     
106     /** @brief The effect currently being dragged, NULL if no drag happening. */
107     CollapsibleGroup *m_draggedGroup;
108     
109     /** @brief The current number of groups. */
110     int m_groupIndex;
111     
112     /** @brief The current effect may require an on monitor scene. */
113     bool m_monitorSceneWanted;
114
115     /** @brief Sets the list of effects according to the clip's effect list. */
116     void setupListView();
117     
118     /** @brief Build the drag info and start it. */
119     void startDrag();
120     
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);
125
126 public slots:
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);
130
131     void slotTrackItemSelected(int ix, const TrackInfo info);
132    
133     /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
134     void slotCheckWheelEventFilter();
135
136 private slots:
137
138     /** @brief Emits seekTimeline with position = clipstart + @param pos. */
139     void slotSeekTimeline(int pos);
140
141
142     /* @brief Define the region filter for current effect.
143     void slotRegionChanged();*/
144
145     /** @brief Checks whether the monitor scene has to be displayed. */
146     void slotCheckMonitorPosition(int renderPos);
147
148     void slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix);
149
150     /** @brief Move an effect in the stack.
151      * @param indexes The list of effect index in the stack
152      * @param up true if we want to move effect up, false for down */
153     void slotMoveEffectUp(QList <int> indexes, bool up);
154
155     /** @brief Delete an effect in the stack. */
156     void slotDeleteEffect(const QDomElement effect);
157     
158     /** @brief Delete all effect in a group. */
159     void slotDeleteGroup(QDomDocument doc);
160
161     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
162     void slotRenderPos(int pos);
163
164     /** @brief Called whenever an effect is enabled / disabled by user. */
165     void slotUpdateEffectState(bool disable, int index, bool needsMonitorEffectScene);
166
167     void slotSetCurrentEffect(int ix);
168     
169     /** @brief Triggers a filter job on this clip. */
170     void slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QStringList &extraParams);
171     
172     /** @brief Reset an effect to its default values. */
173     void slotResetEffect(int ix);
174     
175     /** @brief Create a group containing effect with ix index. */
176     void slotCreateGroup(int ix);
177     
178     /** @brief Create a region effect with ix index. */
179     void slotCreateRegion(int ix, KUrl url);
180     
181     /** @brief Move an effect.
182       ** @param currentIndexes the list of effect indexes to move in stack layout
183       ** @param newIndex the position where the effects will be moved
184       ** @param groupIndex the index of the group if any (-1 if none)
185       ** @param groupName the name of the group to paste the effect
186       */
187     void slotMoveEffect(QList <int> currentIndexes, int newIndex, int groupIndex, QString groupName = QString());
188     
189     /** @brief Remove effects from a group */
190     void slotUnGroup(CollapsibleGroup* group);
191     
192     /** @brief Add en effect to selected clip */
193     void slotAddEffect(QDomElement effect);
194     
195     /** @brief Enable / disable all effects for the clip */
196     void slotCheckAll(int state);
197     
198     /** @brief Update check all button status */
199     void slotUpdateCheckAllButton();
200     
201     /** @brief Display additionnal effect info */
202     void slotShowComments();
203     
204     /** @brief An effect group was renamed, update effects info */
205     void slotRenameGroup(CollapsibleGroup *group);
206
207 signals:
208     void removeEffect(ClipItem*, int, QDomElement);
209     /**  Parameters for an effect changed, update the filter in playlist */
210     void updateEffect(ClipItem*, int, QDomElement, QDomElement, int,bool);
211     /** An effect in stack was moved, we need to regenerate
212         all effects for this clip in the playlist */
213     void refreshEffectStack(ClipItem *);
214     /** Enable or disable an effect */
215     void changeEffectState(ClipItem*, int, QList <int>, bool);
216     /** An effect in stack was moved */
217     void changeEffectPosition(ClipItem*, int, QList <int>, int);
218     /** an effect was saved, reload list */
219     void reloadEffects();
220     /** An effect with position parameter was changed, seek */
221     void seekTimeline(int);
222     /** The region effect for current effect was changed */
223     void updateClipRegion(ClipItem*, int, QString);
224     void displayMessage(const QString&, int);
225     void showComments(bool show);
226     void startFilterJob(ItemInfo info, const QString &clipId, const QString &filterName, const QString &filterParams, const QString&finalFilterName, const QString &consumer, const QString &consumerParams, const QStringList &extraParams);
227     void addEffect(ClipItem*,QDomElement);
228 };
229
230 #endif