]> git.sesse.net Git - kdenlive/blob - src/effectstack/parametercontainer.h
Minor improvements to keyframe widget, allow resetting keyframes
[kdenlive] / src / effectstack / parametercontainer.h
1 /***************************************************************************
2  *   Copyright (C) 2012 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 #ifndef PARAMETERCONTAINER_H
21 #define PARAMETERCONTAINER_H
22
23 #include "keyframeedit.h"
24
25 class GeometryWidget;
26 class Monitor;
27
28 struct EffectMetaInfo {
29     MltVideoProfile profile;
30     Timecode timecode;
31     Monitor *monitor;
32     QPoint frameSize;
33     bool trackMode;
34 };
35
36 enum WIPE_DIRECTON { UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, CENTER = 4 };
37
38 struct wipeInfo {
39     WIPE_DIRECTON start;
40     WIPE_DIRECTON end;
41     int startTransparency;
42     int endTransparency;
43 };
44
45 class MySpinBox : public QSpinBox
46 {
47     Q_OBJECT
48
49 public:
50     MySpinBox(QWidget * parent = 0);
51     
52 protected:
53     virtual void focusInEvent(QFocusEvent*);
54     virtual void focusOutEvent(QFocusEvent*);
55 };
56
57 class ParameterContainer : public QObject
58 {
59     Q_OBJECT
60
61 public:
62     ParameterContainer(QDomElement effect, ItemInfo info, EffectMetaInfo *metaInfo, QWidget * parent = 0);
63     ~ParameterContainer();
64     void updateTimecodeFormat();
65     void updateProjectFormat(MltVideoProfile profile, Timecode t);
66     void updateParameter(const QString &key, const QString &value);
67     /** @brief Returns true of this effect requires an on monitor adjustable effect scene. */
68     bool needsMonitorEffectScene() const;
69     /** @brief Set keyframes for this param. */
70     void setKeyframes(const QString &data, int maximum);
71
72 private slots:
73     void slotCollectAllParameters();
74     void slotStartFilterJobAction();
75
76 private:
77         /** @brief Updates parameter @param name according to new value of dependency.
78     * @param name Name of the parameter which will be updated
79     * @param type Type of the parameter which will be updated
80     * @param value Value of the dependency parameter */
81     void meetDependency(const QString& name, QString type, QString value);
82     wipeInfo getWipeInfo(QString value);
83     QString getWipeString(wipeInfo info);
84     /** @brief Delete all child widgets */
85     void clearLayout(QLayout *layout);
86     
87     int m_in;
88     int m_out;
89     QList<QWidget*> m_uiItems;
90     QMap<QString, QWidget*> m_valueItems;
91     Timecode m_timecode;
92     KeyframeEdit *m_keyframeEditor;
93     GeometryWidget *m_geometryWidget;
94     EffectMetaInfo *m_metaInfo;
95     QDomElement m_effect;
96     QVBoxLayout *m_vbox;
97     bool m_needsMonitorEffectScene;
98
99 signals:
100     void parameterChanged(const QDomElement, const QDomElement, int);
101     void syncEffectsPos(int);
102     void disableCurrentFilter(bool);
103     void checkMonitorPosition(int);
104     void seekTimeline(int);
105     void showComments(bool);    
106     /** @brief Start an MLT filter job on this clip. */
107     void startFilterJob(QString filterName, QString filterParams, QString consumer, QString consumerParams, const QMap <QString, QString>extra);
108     /** @brief Request import of keyframes from clip data. */
109     void importClipKeyframes();
110 };
111
112 #endif
113