]> git.sesse.net Git - kdenlive/blob - src/effectstackview.h
Initial support for keyframes in track effects (WIP)
[kdenlive] / src / effectstackview.h
1 /***************************************************************************
2                           effecstackview.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 EffectStackView
20  * @brief View part of the EffectStack
21  * @author Marco Gittler
22  */
23
24 #ifndef EFFECTSTACKVIEW_H
25 #define EFFECTSTACKVIEW_H
26
27 #include "ui_effectstack_ui.h"
28 #include "effectstackedit.h"
29
30 class EffectsList;
31 class ClipItem;
32 class MltVideoProfile;
33 class Monitor;
34
35 class EffectStackView : public QWidget
36 {
37     Q_OBJECT
38
39 public:
40     EffectStackView(Monitor *monitor, QWidget *parent = 0);
41     virtual ~EffectStackView();
42
43     /** @brief Raises @param dock if a clip is loaded. */
44     void raiseWindow(QWidget* dock);
45
46     /** @brief Clears the list of effects and updates the buttons accordingly. */
47     void clear();
48
49     /** @brief Sets the add effect button's menu to @param menu. */
50     void setMenu(QMenu *menu);
51
52     /** @brief Passes updates on @param profile and @param t on to the effect editor. */
53     void updateProjectFormat(MltVideoProfile profile, Timecode t);
54
55     /** @brief Tells the effect editor to update its timecode format. */
56     void updateTimecodeFormat();
57
58     /** @brief return the index of the track displayed in effect stack
59      ** @param ok set to true if we are looking at a track's effects, otherwise false. */
60     int isTrackMode(bool *ok) const;
61
62 private:
63     Ui::EffectStack_UI m_ui;
64     Monitor *m_monitor;
65     ClipItem* m_clipref;
66     QMap<QString, EffectsList*> m_effectLists;
67     EffectsList m_currentEffectList;
68     EffectStackEdit* m_effectedit;
69
70     /** @brief Effectstackview can show the effects of a clip or the effects of a track.
71      * true if showing track effects. */
72     bool m_trackMode;
73
74     /** @brief The track index of currently edited track. */
75     int m_trackindex;
76
77     /** If in track mode: Info of the edited track to be able to access its duration. */
78     TrackInfo m_trackInfo;
79
80     /** @brief Sets the list of effects according to the clip's effect list.
81     * @param ix Number of the effect to preselect */
82     void setupListView(int ix);
83
84 public slots:
85     /** @brief Sets the clip whose effect list should be managed.
86     * @param c Clip whose effect list should be managed
87     * @param ix Effect to preselect */
88     void slotClipItemSelected(ClipItem* c, int ix);
89
90     void slotTrackItemSelected(int ix, const TrackInfo info);
91
92     /** @brief Emits updateClipEffect.
93     * @param old Old effect information
94     * @param e New effect information
95     *
96     * Connected to a parameter change in the editor */
97     void slotUpdateEffectParams(const QDomElement old, const QDomElement e);
98
99     /** @brief Removes the selected effect. */
100     void slotItemDel();
101
102 private slots:
103     /** @brief Updates buttons and the editor according to selected effect.
104     * @param update (optional) Set the clip's selected effect (display keyframes in timeline) */
105     void slotItemSelectionChanged(bool update = true);
106
107     /** @brief Moves the selected effect upwards. */
108     void slotItemUp();
109
110     /** @brief Moves the selected effect downwards. */
111     void slotItemDown();
112
113     /** @brief Resets the selected effect to its default values. */
114     void slotResetEffect();
115
116     /** @brief Updates effect @param item if it was enabled or disabled. */
117     void slotItemChanged(QListWidgetItem *item);
118
119     /** @brief Saves the selected effect's values to a custom effect.
120     *
121     * TODO: save all effects into one custom effect */
122     void slotSaveEffect();
123
124     /** @brief Emits seekTimeline with position = clipstart + @param pos. */
125     void slotSeekTimeline(int pos);
126
127     /** @brief Makes the check all checkbox represent the check state of the effects. */
128     void slotUpdateCheckAllButton();
129
130     /** @brief Sets the check state of all effects according to @param state. */
131     void slotCheckAll(int state);
132
133     /* @brief Define the region filter for current effect.
134     void slotRegionChanged();*/
135
136     /** @brief Checks whether the monitor scene has to be displayed. */
137     void slotCheckMonitorPosition(int renderPos);
138
139     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
140     void slotRenderPos(int pos);
141
142 signals:
143     void removeEffect(ClipItem*, int, QDomElement);
144     /**  Parameters for an effect changed, update the filter in playlist */
145     void updateEffect(ClipItem*, int, QDomElement, QDomElement, int);
146     /** An effect in stack was moved, we need to regenerate
147         all effects for this clip in the playlist */
148     void refreshEffectStack(ClipItem *);
149     /** Enable or disable an effect */
150     void changeEffectState(ClipItem*, int, int, bool);
151     /** An effect in stack was moved */
152     void changeEffectPosition(ClipItem*, int, int, int);
153     /** an effect was saved, reload list */
154     void reloadEffects();
155     /** An effect with position parameter was changed, seek */
156     void seekTimeline(int);
157     /** The region effect for current effect was changed */
158     void updateClipRegion(ClipItem*, int, QString);
159     void displayMessage(const QString&, int);
160 };
161
162 #endif