]> git.sesse.net Git - kdenlive/blob - src/effectstack/effectstackview2.h
Cleaning code style of Definitions.
[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(const MltVideoProfile &profile, const 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     /** @brief Import keyframes from the clip metadata */
79     void setKeyframes(const QString &data, int maximum);
80
81 protected:
82     void mouseMoveEvent(QMouseEvent * event);
83     void mouseReleaseEvent(QMouseEvent * event);
84     void resizeEvent ( QResizeEvent * event );
85     void dragEnterEvent(QDragEnterEvent *event);
86     void dropEvent(QDropEvent *event);
87   
88 private:
89     Ui::EffectStack2_UI m_ui;
90     ClipItem* m_clipref;
91     QList <CollapsibleEffect*> m_effects;
92     EffectsList m_currentEffectList;
93     
94     /** @brief Contains infos about effect like is it a track effect, which monitor displays it,... */
95     EffectMetaInfo m_effectMetaInfo;
96     
97     /** @brief The last mouse click position, used to detect drag events. */
98     QPoint m_clickPoint;
99
100     /** @brief The track index of currently edited track. */
101     int m_trackindex;
102
103     /** If in track mode: Info of the edited track to be able to access its duration. */
104     TrackInfo m_trackInfo;
105     
106     /** @brief The effect currently being dragged, NULL if no drag happening. */
107     CollapsibleEffect *m_draggedEffect;
108     
109     /** @brief The effect currently being dragged, NULL if no drag happening. */
110     CollapsibleGroup *m_draggedGroup;
111     
112     /** @brief The current number of groups. */
113     int m_groupIndex;
114     
115     /** @brief The current effect may require an on monitor scene. */
116     bool m_monitorSceneWanted;
117
118     /** @brief Sets the list of effects according to the clip's effect list. */
119     void setupListView();
120     
121     /** @brief Build the drag info and start it. */
122     void startDrag();
123     
124     /** @brief Connect an effect to its signals. */
125     void connectEffect(CollapsibleEffect *currentEffect);
126     /** @brief Connect a group to its signals. */
127     void connectGroup(CollapsibleGroup *group);
128
129 public slots:
130     /** @brief Sets the clip whose effect list should be managed.
131     * @param c Clip whose effect list should be managed */
132     void slotClipItemSelected(ClipItem* c);
133
134     /** @brief Update the clip range (in-out points)
135     * @param c Clip whose effect list should be managed */
136     void slotClipItemUpdate();
137
138     void slotTrackItemSelected(int ix, const TrackInfo &info);
139    
140     /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
141     void slotCheckWheelEventFilter();
142
143 private slots:
144
145     /** @brief Emits seekTimeline with position = clipstart + @param pos. */
146     void slotSeekTimeline(int pos);
147
148
149     /* @brief Define the region filter for current effect.
150     void slotRegionChanged();*/
151
152     /** @brief Checks whether the monitor scene has to be displayed. */
153     void slotCheckMonitorPosition(int renderPos);
154
155     void slotUpdateEffectParams(const QDomElement &old, const QDomElement& e, int ix);
156
157     /** @brief Move an effect in the stack.
158      * @param indexes The list of effect index in the stack
159      * @param up true if we want to move effect up, false for down */
160     void slotMoveEffectUp(const QList <int> &indexes, bool up);
161
162     /** @brief Delete an effect in the stack. */
163     void slotDeleteEffect(const QDomElement &effect);
164     
165     /** @brief Delete all effect in a group. */
166     void slotDeleteGroup(QDomDocument doc);
167
168     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
169     void slotRenderPos(int pos);
170
171     /** @brief Called whenever an effect is enabled / disabled by user. */
172     void slotUpdateEffectState(bool disable, int index, bool needsMonitorEffectScene);
173
174     void slotSetCurrentEffect(int ix);
175     
176     /** @brief Triggers a filter job on this clip. */
177     void slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&consumer, const QString&consumerParams, const QMap <QString, QString> &extraParams);
178     
179     /** @brief Reset an effect to its default values. */
180     void slotResetEffect(int ix);
181     
182     /** @brief Create a group containing effect with ix index. */
183     void slotCreateGroup(int ix);
184     
185     /** @brief Create a region effect with ix index. */
186     void slotCreateRegion(int ix, KUrl url);
187     
188     /** @brief Move an effect.
189       ** @param currentIndexes the list of effect indexes to move in stack layout
190       ** @param newIndex the position where the effects will be moved
191       ** @param groupIndex the index of the group if any (-1 if none)
192       ** @param groupName the name of the group to paste the effect
193       */
194     void slotMoveEffect(QList <int> currentIndexes, int newIndex, int groupIndex, QString groupName = QString());
195     
196     /** @brief Remove effects from a group */
197     void slotUnGroup(CollapsibleGroup* group);
198     
199     /** @brief Add en effect to selected clip */
200     void slotAddEffect(const QDomElement &effect);
201     
202     /** @brief Enable / disable all effects for the clip */
203     void slotCheckAll(int state);
204     
205     /** @brief Update check all button status */
206     void slotUpdateCheckAllButton();
207     
208     /** @brief Display additionnal effect info */
209     void slotShowComments();
210     
211     /** @brief An effect group was renamed, update effects info */
212     void slotRenameGroup(CollapsibleGroup *group);
213
214 signals:
215     void removeEffect(ClipItem*, int, const QDomElement&);
216     /**  Parameters for an effect changed, update the filter in playlist */
217     void updateEffect(ClipItem*, int, const QDomElement&, const QDomElement &, int,bool);
218     /** An effect in stack was moved, we need to regenerate
219         all effects for this clip in the playlist */
220     void refreshEffectStack(ClipItem *);
221     /** Enable or disable an effect */
222     void changeEffectState(ClipItem*, int, const QList <int>&, bool);
223     /** An effect in stack was moved */
224     void changeEffectPosition(ClipItem*, int, const QList <int>&, int);
225     /** an effect was saved, reload list */
226     void reloadEffects();
227     /** An effect with position parameter was changed, seek */
228     void seekTimeline(int);
229     /** The region effect for current effect was changed */
230     void updateClipRegion(ClipItem*, int, const QString&);
231     void displayMessage(const QString&, int);
232     void showComments(bool show);
233     void startFilterJob(const ItemInfo &info, const QString &clipId, const QString &filterName, const QString &filterParams, const QString &consumer, const QString &consumerParams, const QMap<QString, QString> &extraParams);
234     void addEffect(ClipItem*,const QDomElement &);
235     void importClipKeyframes(GraphicsRectItem = AVWidget);
236 };
237
238 #endif