]> git.sesse.net Git - kdenlive/blob - src/effectstack/effectstackview2.h
90b4e9cc03f3dfdc31e1b39a2d40f95b798dd9c3
[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     /** @brief Update the clip range (in-out points)
132     * @param c Clip whose effect list should be managed */
133     void slotClipItemUpdate();
134
135     void slotTrackItemSelected(int ix, const TrackInfo info);
136    
137     /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
138     void slotCheckWheelEventFilter();
139
140 private slots:
141
142     /** @brief Emits seekTimeline with position = clipstart + @param pos. */
143     void slotSeekTimeline(int pos);
144
145
146     /* @brief Define the region filter for current effect.
147     void slotRegionChanged();*/
148
149     /** @brief Checks whether the monitor scene has to be displayed. */
150     void slotCheckMonitorPosition(int renderPos);
151
152     void slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix);
153
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);
158
159     /** @brief Delete an effect in the stack. */
160     void slotDeleteEffect(const QDomElement effect);
161     
162     /** @brief Delete all effect in a group. */
163     void slotDeleteGroup(QDomDocument doc);
164
165     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
166     void slotRenderPos(int pos);
167
168     /** @brief Called whenever an effect is enabled / disabled by user. */
169     void slotUpdateEffectState(bool disable, int index, bool needsMonitorEffectScene);
170
171     void slotSetCurrentEffect(int ix);
172     
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);
175     
176     /** @brief Reset an effect to its default values. */
177     void slotResetEffect(int ix);
178     
179     /** @brief Create a group containing effect with ix index. */
180     void slotCreateGroup(int ix);
181     
182     /** @brief Create a region effect with ix index. */
183     void slotCreateRegion(int ix, KUrl url);
184     
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
190       */
191     void slotMoveEffect(QList <int> currentIndexes, int newIndex, int groupIndex, QString groupName = QString());
192     
193     /** @brief Remove effects from a group */
194     void slotUnGroup(CollapsibleGroup* group);
195     
196     /** @brief Add en effect to selected clip */
197     void slotAddEffect(QDomElement effect);
198     
199     /** @brief Enable / disable all effects for the clip */
200     void slotCheckAll(int state);
201     
202     /** @brief Update check all button status */
203     void slotUpdateCheckAllButton();
204     
205     /** @brief Display additionnal effect info */
206     void slotShowComments();
207     
208     /** @brief An effect group was renamed, update effects info */
209     void slotRenameGroup(CollapsibleGroup *group);
210
211 signals:
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);
233 };
234
235 #endif