]> git.sesse.net Git - kdenlive/blob - src/effectstack/collapsibleeffect.h
Implement reset effect in new effect stack
[kdenlive] / src / effectstack / collapsibleeffect.h
1 /***************************************************************************
2  *   Copyright (C) 2008 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
21 #ifndef COLLAPSIBLEEFFECT_H
22 #define COLLAPSIBLEEFFECT_H
23
24
25 #include "ui_collapsiblewidget_ui.h"
26
27 #include "timecode.h"
28 #include "keyframeedit.h"
29 #include "effectstackedit.h"
30
31 #include <QDomElement>
32
33 class QFrame;
34 class Monitor;
35 class GeometryWidget;
36
37 struct EffectMetaInfo {
38     MltVideoProfile profile;
39     Timecode timecode;
40     Monitor *monitor;
41     QPoint frameSize;
42     bool trackMode;
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, int index, QWidget * parent = 0);
63     ~ParameterContainer();
64     void updateTimecodeFormat();
65     void updateProjectFormat(MltVideoProfile profile, Timecode t);
66     int index();
67
68 private slots:
69     void slotCollectAllParameters();
70     void slotStartFilterJobAction();
71
72 private:
73         /** @brief Updates parameter @param name according to new value of dependency.
74     * @param name Name of the parameter which will be updated
75     * @param type Type of the parameter which will be updated
76     * @param value Value of the dependency parameter */
77     void meetDependency(const QString& name, QString type, QString value);
78     wipeInfo getWipeInfo(QString value);
79     QString getWipeString(wipeInfo info);
80     
81     int m_in;
82     int m_out;
83     int m_index;
84     QList<QWidget*> m_uiItems;
85     QMap<QString, QWidget*> m_valueItems;
86     Timecode m_timecode;
87     KeyframeEdit *m_keyframeEditor;
88     GeometryWidget *m_geometryWidget;
89     EffectMetaInfo *m_metaInfo;
90     QDomElement m_effect;
91     QVBoxLayout *m_vbox;
92
93 signals:
94     void parameterChanged(const QDomElement, const QDomElement, int);
95     void syncEffectsPos(int);
96     void effectStateChanged(bool);
97     void checkMonitorPosition(int);
98     void seekTimeline(int);
99     void showComments(bool);    
100     /** @brief Start an MLT filter job on this clip. */
101     void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
102     
103 };
104
105 /**)
106  * @class CollapsibleEffect
107  * @brief A dialog for editing markers and guides.
108  * @author Jean-Baptiste Mardelle
109  */
110
111 class CollapsibleEffect : public QWidget, public Ui::CollapsibleWidget_UI
112 {
113     Q_OBJECT
114
115 public:
116     CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, int ix, EffectMetaInfo *metaInfo, bool lastEffect, QWidget * parent = 0);
117     ~CollapsibleEffect();
118     static QMap<QString, QImage> iconCache;
119     void setupWidget(ItemInfo info, int index, EffectMetaInfo *metaInfo);
120     void updateTimecodeFormat();
121     void setActive(bool activate);
122     virtual bool eventFilter( QObject * o, QEvent * e );
123     /** @brief Update effect GUI to reflect parameted changes. */
124     void updateWidget(ItemInfo info, int index, QDomElement effect, EffectMetaInfo *metaInfo);
125
126 public slots:
127     void slotSyncEffectsPos(int pos);
128
129 private slots:
130     void slotSwitch();
131     void slotEnable(bool enable);
132     void slotShow(bool show);
133     void slotDeleteEffect();
134     void slotEffectUp();
135     void slotEffectDown();
136     void slotSaveEffect();
137     void slotResetEffect();
138
139 private:
140     ParameterContainer *m_paramWidget;
141     QList <CollapsibleEffect *> m_subParamWidgets;
142     QDomElement m_effect;
143     QDomElement m_original_effect;
144     QList <QDomElement> m_subEffects;
145     bool m_lastEffect;    int m_in;
146     int m_out;
147     bool m_active;
148     
149 protected:
150     virtual void mouseDoubleClickEvent ( QMouseEvent * event );
151     virtual void mousePressEvent ( QMouseEvent * event );
152     virtual void enterEvent( QEvent * event );
153     virtual void leaveEvent( QEvent * event );
154     
155 signals:
156     void parameterChanged(const QDomElement, const QDomElement, int);
157     void syncEffectsPos(int);
158     void effectStateChanged(bool, int ix = -1);
159     void deleteEffect(const QDomElement, int);
160     void changeEffectPosition(int, bool);
161     void activateEffect(int);
162     void checkMonitorPosition(int);
163     void seekTimeline(int);
164     /** @brief Start an MLT filter job on this clip. */
165     void startFilterJob(QString filterName, QString filterParams, QString finalFilterName, QString consumer, QString consumerParams, QString properties);
166     /** @brief An effect was saved, trigger effect list reload. */
167     void reloadEffects();
168     void resetEffect(int ix);
169 };
170
171
172 #endif
173