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