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