]> git.sesse.net Git - kdenlive/blob - src/effectstack/collapsibleeffect.h
Effect stack: do not change parameter value on mousewheel when scrolling.
[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
71 private:
72         /** @brief Updates parameter @param name according to new value of dependency.
73     * @param name Name of the parameter which will be updated
74     * @param type Type of the parameter which will be updated
75     * @param value Value of the dependency parameter */
76     void meetDependency(const QString& name, QString type, QString value);
77     wipeInfo getWipeInfo(QString value);
78     QString getWipeString(wipeInfo info);
79     
80     int m_in;
81     int m_out;
82     int m_index;
83     QList<QWidget*> m_uiItems;
84     QMap<QString, QWidget*> m_valueItems;
85     Timecode m_timecode;
86     KeyframeEdit *m_keyframeEditor;
87     GeometryWidget *m_geometryWidget;
88     EffectMetaInfo *m_metaInfo;
89     QDomElement m_effect;
90     QVBoxLayout *m_vbox;
91
92 signals:
93     void parameterChanged(const QDomElement, const QDomElement, int);
94     void syncEffectsPos(int);
95     void effectStateChanged(bool);
96     void checkMonitorPosition(int);
97     void seekTimeline(int);
98     void showComments(bool);
99     
100 };
101
102 /**)
103  * @class CollapsibleEffect
104  * @brief A dialog for editing markers and guides.
105  * @author Jean-Baptiste Mardelle
106  */
107
108 class CollapsibleEffect : public QWidget, public Ui::CollapsibleWidget_UI
109 {
110     Q_OBJECT
111
112 public:
113     CollapsibleEffect(QDomElement effect, QDomElement original_effect, ItemInfo info, int ix, EffectMetaInfo *metaInfo, bool lastEffect, QWidget * parent = 0);
114     ~CollapsibleEffect();
115     static QMap<QString, QImage> iconCache;
116     void setupWidget(ItemInfo info, int index, EffectMetaInfo *metaInfo);
117     void updateTimecodeFormat();
118     void setActive(bool activate);
119     virtual bool eventFilter( QObject * o, QEvent * e );
120
121 public slots:
122     void slotSyncEffectsPos(int pos);
123
124 private slots:
125     void slotSwitch();
126     void slotEnable(bool enable);
127     void slotShow(bool show);
128     void slotDeleteEffect();
129     void slotEffectUp();
130     void slotEffectDown();
131
132 private:
133     ParameterContainer *m_paramWidget;
134     QList <CollapsibleEffect *> m_subParamWidgets;
135     QDomElement m_effect;
136     QDomElement m_original_effect;
137     QList <QDomElement> m_subEffects;
138     bool m_lastEffect;
139     int m_in;
140     int m_out;
141     bool m_active;
142     
143 protected:
144     virtual void mouseDoubleClickEvent ( QMouseEvent * event );
145     virtual void mousePressEvent ( QMouseEvent * event );
146     virtual void enterEvent( QEvent * event );
147     virtual void leaveEvent( QEvent * event );
148     
149 signals:
150     void parameterChanged(const QDomElement, const QDomElement, int);
151     void syncEffectsPos(int);
152     void effectStateChanged(bool, int ix = -1);
153     void deleteEffect(const QDomElement, int);
154     void changeEffectPosition(int, bool);
155     void activateEffect(int);
156     void checkMonitorPosition(int);
157     void seekTimeline(int);
158 };
159
160
161 #endif
162