]> git.sesse.net Git - kdenlive/blob - src/effectstack/effectstackview2.h
Effects can now be dragged from the effect stack to another clip
[kdenlive] / src / effectstack / effectstackview2.h
1 /***************************************************************************
2                           effecstackview2.h  -  description
3                              -------------------
4     begin                : Feb 15 2008
5     copyright            : (C) 2008 by Marco Gittler
6     email                : g.marco@freenet.de
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 "effectstackedit.h"
29 #include "collapsibleeffect.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 Sets the add effect button's menu to @param menu. */
49     void setMenu(QMenu *menu);
50
51
52     /** @brief return the index of the track displayed in effect stack
53      ** @param ok set to true if we are looking at a track's effects, otherwise false. */
54     int isTrackMode(bool *ok) const;
55
56     /** @brief Clears the list of effects and updates the buttons accordingly. */
57     void clear();
58
59     /** @brief Passes updates on @param profile and @param t on to the effect editor. */
60     void updateProjectFormat(MltVideoProfile profile, Timecode t);
61
62     /** @brief Tells the effect editor to update its timecode format. */
63     void updateTimecodeFormat();
64     
65     /** @brief Used to trigger drag effects. */
66     virtual bool eventFilter( QObject * o, QEvent * e );
67
68 protected:
69     virtual void mouseMoveEvent(QMouseEvent * event);
70     virtual void mouseReleaseEvent(QMouseEvent * event);
71   
72 private:
73     Ui::EffectStack2_UI m_ui;
74     ClipItem* m_clipref;
75     QList <CollapsibleEffect*> m_effects;
76     EffectsList m_currentEffectList;
77     
78     /** @brief Contains infos about effect like is it a track effect, which monitor displays it,... */
79     EffectMetaInfo m_effectMetaInfo;
80     
81     /** @brief The last mouse click position, used to detect drag events. */
82     QPoint m_clickPoint;
83
84     /** @brief The track index of currently edited track. */
85     int m_trackindex;
86
87     /** If in track mode: Info of the edited track to be able to access its duration. */
88     TrackInfo m_trackInfo;
89     
90     /** @brief The effect currently being dragged, NULL if no drag happening. */
91     CollapsibleEffect *m_draggedEffect;
92
93     /** @brief Sets the list of effects according to the clip's effect list.
94     * @param ix Number of the effect to preselect */
95     void setupListView(int ix);
96     
97     /** @brief Build the drag info and start it. */
98     void startDrag();
99
100 public slots:
101     /** @brief Sets the clip whose effect list should be managed.
102     * @param c Clip whose effect list should be managed
103     * @param ix Effect to preselect */
104     void slotClipItemSelected(ClipItem* c, int ix);
105
106     void slotTrackItemSelected(int ix, const TrackInfo info);
107
108     /** @brief Removes the selected effect. */
109     void slotItemDel();
110
111 private slots:
112
113     /** @brief Emits seekTimeline with position = clipstart + @param pos. */
114     void slotSeekTimeline(int pos);
115
116
117     /* @brief Define the region filter for current effect.
118     void slotRegionChanged();*/
119
120     /** @brief Checks whether the monitor scene has to be displayed. */
121     void slotCheckMonitorPosition(int renderPos);
122
123     void slotUpdateEffectParams(const QDomElement old, const QDomElement e, int ix);
124
125     /** @brief Move an effect in the stack.
126      * @param index The effect index in the stack
127      * @param up true if we want to move effect up, false for down */
128     void slotMoveEffect(int index, bool up);
129
130     /** @brief Delete an effect in the stack. */
131     void slotDeleteEffect(const QDomElement effect, int index);
132
133     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
134     void slotRenderPos(int pos);
135
136     /** @brief Called whenever an effect is enabled / disabled by user. */
137     void slotUpdateEffectState(bool disable, int index);
138
139     void slotSetCurrentEffect(int ix);
140     
141     /** @brief Triggers a filter job on this clip. */
142     void slotStartFilterJob(const QString&filterName, const QString&filterParams, const QString&finalFilterName, const QString&consumer, const QString&consumerParams, const QString&properties);
143     
144     /** @brief Reset an effect to its default values. */
145     void slotResetEffect(int ix);
146
147
148 signals:
149     void removeEffect(ClipItem*, int, QDomElement);
150     /**  Parameters for an effect changed, update the filter in playlist */
151     void updateEffect(ClipItem*, int, QDomElement, QDomElement, int);
152     /** An effect in stack was moved, we need to regenerate
153         all effects for this clip in the playlist */
154     void refreshEffectStack(ClipItem *);
155     /** Enable or disable an effect */
156     void changeEffectState(ClipItem*, int, int, bool);
157     /** An effect in stack was moved */
158     void changeEffectPosition(ClipItem*, int, int, int);
159     /** an effect was saved, reload list */
160     void reloadEffects();
161     /** An effect with position parameter was changed, seek */
162     void seekTimeline(int);
163     /** The region effect for current effect was changed */
164     void updateClipRegion(ClipItem*, int, QString);
165     void displayMessage(const QString&, int);
166     void showComments(bool show);
167     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);
168 };
169
170 #endif