]> git.sesse.net Git - kdenlive/blob - src/effectstackedit.h
645672d62322c5d66574155cdaee6e26fb84b099
[kdenlive] / src / effectstackedit.h
1 /***************************************************************************
2                           effecstackedit.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 #ifndef EFFECTSTACKEDIT_H
19 #define EFFECTSTACKEDIT_H
20
21 #include "definitions.h"
22 #include "timecode.h"
23 #include "keyframeedit.h"
24
25 #include <QWidget>
26 #include <QDomElement>
27 #include <QVBoxLayout>
28 #include <QList>
29 #include <QMap>
30 #include <QScrollArea>
31
32 enum WIPE_DIRECTON { UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, CENTER = 4 };
33
34 struct wipeInfo {
35     WIPE_DIRECTON start;
36     WIPE_DIRECTON end;
37     int startTransparency;
38     int endTransparency;
39 };
40
41 class QFrame;
42 class Monitor;
43 class GeometryWidget;
44
45 class EffectStackEdit : public QScrollArea
46 {
47     Q_OBJECT
48 public:
49     EffectStackEdit(Monitor *monitor, QWidget *parent = 0);
50     ~EffectStackEdit();
51     void updateProjectFormat(MltVideoProfile profile, Timecode t);
52     static QMap<QString, QImage> iconCache;
53     /** @brief Sets attribute @param name to @param value.
54     *
55     * Used to disable the effect, by setting disabled="1" */
56     void updateParameter(const QString &name, const QString &value);
57     void setFrameSize(QPoint p);
58     /** @brief Tells the parameters to update their timecode format according to KdenliveSettings. */
59     void updateTimecodeFormat();
60     /** @brief Returns true if this effect wants to keep track of current position in clip. */
61     bool effectNeedsSyncPosition() const;
62
63 private:
64     /** @brief Deletes all parameter widgets. */
65     void clearAllItems();
66     wipeInfo getWipeInfo(QString value);
67     QString getWipeString(wipeInfo info);
68     /** @brief Updates parameter @param name according to new value of dependency.
69     * @param name Name of the parameter which will be updated
70     * @param type Type of the parameter which will be updated
71     * @param value Value of the dependency parameter */
72     void meetDependency(const QString& name, QString type, QString value);
73
74     QVBoxLayout *m_vbox;
75     QList<QWidget*> m_uiItems;
76     QWidget *m_baseWidget;
77     QDomElement m_params;
78     QMap<QString, QWidget*> m_valueItems;
79     MltVideoProfile m_profile;
80     Timecode m_timecode;
81     int m_in;
82     int m_out;
83     QPoint m_frameSize;
84     KeyframeEdit *m_keyframeEditor;
85     Monitor *m_monitor;
86     GeometryWidget *m_geometryWidget;
87
88 public slots:
89     /** @brief Called when an effect is selected, builds the UIĀ for this effect. */
90     void transferParamDesc(const QDomElement &d, ItemInfo info, bool isEffect = true);
91
92     /** @brief Called whenever(?) some parameter is changed in the gui.
93      *
94      * Transfers all Dynamic gui parameter settings into m_params(??) */
95     void collectAllParameters();
96
97     /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
98     void slotSyncEffectsPos(int pos);
99     
100 private slots:
101     void slotStartFilterJobAction();
102
103 signals:
104     void parameterChanged(const QDomElement &, const QDomElement &);
105     void seekTimeline(int);
106     void displayMessage(const QString&, int);
107     void checkMonitorPosition(int);
108     void syncEffectsPos(int pos);
109     void showComments(bool show);
110     void effectStateChanged(bool enabled);
111     /** @brief Start an MLT filter job on this clip. */
112     void startFilterJob(const QString &filterName, const QString &filterParams, const QString &consumer, const QString &consumerParams, const QString &properties);
113 };
114
115 #endif