]> git.sesse.net Git - kdenlive/blob - src/effectstack/effectstackview2.h
1166fa8d48769d46aac770d78954ca98584c7954
[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     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 Sets the list of effects according to the clip's effect list. */
113     void setupListView();
114     
115     /** @brief Build the drag info and start it. */
116     void startDrag();
117     
118     /** @brief Connect an effect to its signals. */
119     void connectEffect(CollapsibleEffect *currentEffect);
120     /** @brief Connect a group to its signals. */
121     void connectGroup(CollapsibleGroup *group);
122     /** @brief Returns the currentl active effect. */
123     CollapsibleEffect *currentEffect() const;
124
125 public slots:
126     /** @brief Sets the clip whose effect list should be managed.
127     * @param c Clip whose effect list should be managed */
128     void slotClipItemSelected(ClipItem* c);
129
130     void slotTrackItemSelected(int ix, const TrackInfo info);
131    
132     /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
133     void slotCheckWheelEventFilter();
134
135 private slots:
136
137     /** @brief Emits seekTimeline with position = clipstart + @param pos. */
138     void slotSeekTimeline(int pos);
139
140
141     /* @brief Define the region filter for current effect.
142     void slotRegionChanged();*/
143
144     /** @brief Checks whether the monitor scene has to be displayed. */
145     void slotCheckMonitorPosition(int renderPos);
146
147     void slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix);
148
149     /** @brief Move an effect in the stack.
150      * @param indexes The list of effect index in the stack
151      * @param up true if we want to move effect up, false for down */
152     void slotMoveEffectUp(QList <int> indexes, bool up);
153
154     /** @brief Delete an effect in the stack. */
155     void slotDeleteEffect(const QDomElement effect);
156     
157     /** @brief Delete all effect in a group. */
158     void slotDeleteGroup(QDomDocument doc);
159
160     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
161     void slotRenderPos(int pos);
162
163     /** @brief Called whenever an effect is enabled / disabled by user. */
164     void slotUpdateEffectState(bool disable, int index, bool updateMainStatus);
165
166     void slotSetCurrentEffect(int ix);
167     
168     /** @brief Triggers a filter job on this clip. */
169     void slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QString&properties);
170     
171     /** @brief Reset an effect to its default values. */
172     void slotResetEffect(int ix);
173     
174     /** @brief Create a group containing effect with ix index. */
175     void slotCreateGroup(int ix);
176     
177     /** @brief Create a region effect with ix index. */
178     void slotCreateRegion(int ix, KUrl url);
179     
180     /** @brief Move an effect.
181       ** @param currentIndexes the list of effect indexes to move in stack layout
182       ** @param newIndex the position where the effects will be moved
183       ** @param groupIndex the index of the group if any (-1 if none)
184       ** @param groupName the name of the group to paste the effect
185       */
186     void slotMoveEffect(QList <int> currentIndexes, int newIndex, int groupIndex, QString groupName = QString());
187     
188     /** @brief Remove effects from a group */
189     void slotUnGroup(CollapsibleGroup* group);
190     
191     /** @brief Add en effect to selected clip */
192     void slotAddEffect(QDomElement effect);
193     
194     /** @brief Enable / disable all effects for the clip */
195     void slotCheckAll(int state);
196     
197     /** @brief Update check all button status */
198     void slotUpdateCheckAllButton();
199     
200     /** @brief Display additionnal effect info */
201     void slotShowComments();
202     
203     /** @brief An effect group was renamed, update effects info */
204     void slotRenameGroup(CollapsibleGroup *group);
205
206 signals:
207     void removeEffect(ClipItem*, int, QDomElement);
208     /**  Parameters for an effect changed, update the filter in playlist */
209     void updateEffect(ClipItem*, int, QDomElement, QDomElement, int,bool);
210     /** An effect in stack was moved, we need to regenerate
211         all effects for this clip in the playlist */
212     void refreshEffectStack(ClipItem *);
213     /** Enable or disable an effect */
214     void changeEffectState(ClipItem*, int, int, bool);
215     /** An effect in stack was moved */
216     void changeEffectPosition(ClipItem*, int, QList <int>, int);
217     /** an effect was saved, reload list */
218     void reloadEffects();
219     /** An effect with position parameter was changed, seek */
220     void seekTimeline(int);
221     /** The region effect for current effect was changed */
222     void updateClipRegion(ClipItem*, int, QString);
223     void displayMessage(const QString&, int);
224     void showComments(bool show);
225     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);
226     void addEffect(ClipItem*,QDomElement);
227 };
228
229 #endif