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 | explicit MySpinBox(QWidget * parent = 0); |
51 | |
52 | protected: |
53 | void focusInEvent(QFocusEvent*); |
54 | void focusOutEvent(QFocusEvent*); |
55 | }; |
56 | |
57 | class ParameterContainer : public QObject |
58 | { |
59 | Q_OBJECT |
60 | |
61 | public: |
62 | explicit ParameterContainer(const QDomElement &effect, const ItemInfo &info, EffectMetaInfo *metaInfo, QWidget * parent = 0); |
63 | ~ParameterContainer(); |
64 | void updateTimecodeFormat(); |
65 | void updateParameter(const QString &key, const QString &value); |
66 | /** @brief Returns true of this effect requires an on monitor adjustable effect scene. */ |
67 | bool needsMonitorEffectScene() const; |
68 | /** @brief Set keyframes for this param. */ |
69 | void setKeyframes(const QString &data, int maximum); |
70 | /** @brief Update the in / out for the clip. */ |
71 | void setRange(int inPoint, int outPoint); |
72 | |
73 | private slots: |
74 | void slotCollectAllParameters(); |
75 | void slotStartFilterJobAction(); |
76 | |
77 | private: |
78 | /** @brief Updates parameter @param name according to new value of dependency. |
79 | * @param name Name of the parameter which will be updated |
80 | * @param type Type of the parameter which will be updated |
81 | * @param value Value of the dependency parameter */ |
82 | void meetDependency(const QString& name, const QString &type, const QString &value); |
83 | wipeInfo getWipeInfo(QString value); |
84 | QString getWipeString(wipeInfo info); |
85 | /** @brief Delete all child widgets */ |
86 | void clearLayout(QLayout *layout); |
87 | |
88 | int m_in; |
89 | int m_out; |
90 | QList<QWidget*> m_uiItems; |
91 | QMap<QString, QWidget*> m_valueItems; |
92 | Timecode m_timecode; |
93 | KeyframeEdit *m_keyframeEditor; |
94 | GeometryWidget *m_geometryWidget; |
95 | EffectMetaInfo *m_metaInfo; |
96 | QDomElement m_effect; |
97 | QVBoxLayout *m_vbox; |
98 | bool m_needsMonitorEffectScene; |
99 | |
100 | signals: |
101 | void parameterChanged(const QDomElement &, const QDomElement&, int); |
102 | void syncEffectsPos(int); |
103 | void displayMessage(const QString&, int); |
104 | void disableCurrentFilter(bool); |
105 | void checkMonitorPosition(int); |
106 | void seekTimeline(int); |
107 | void (bool); |
108 | /** @brief Start an MLT filter job on this clip. */ |
109 | void startFilterJob(const QString &filterName, const QString &filterParams, const QString &consumer, const QString &consumerParams, const QMap <QString, QString> &); |
110 | /** @brief Request import of keyframes from clip data. */ |
111 | void importClipKeyframes(); |
112 | /** @brief Master clip was resized, update effect. */ |
113 | void updateRange(int inPoint, int outPoint); |
114 | }; |
115 | |
116 | #endif |
117 | |
118 | |