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 COLLAPSIBLEGROUP_H
22#define COLLAPSIBLEGROUP_H
23
24
25#include "abstractcollapsiblewidget.h"
26#include "collapsibleeffect.h"
27#include "timecode.h"
28#include "effectstack/keyframeedit.h"
29
30#include <QDomElement>
31#include <QToolButton>
32#include <KLineEdit>
33#include <QMutex>
34
35
36class MyEditableLabel : public KLineEdit
37{
38 Q_OBJECT
39public:
40 explicit MyEditableLabel(QWidget * parent = 0);
41
42protected:
43 void mouseDoubleClickEvent( QMouseEvent *e);
44};
45
46
47/**)
48 * @class CollapsibleEffect
49 * @brief A dialog for editing markers and guides.
50 * @author Jean-Baptiste Mardelle
51 */
52
53class CollapsibleGroup : public AbstractCollapsibleWidget
54{
55 Q_OBJECT
56
57public:
58 CollapsibleGroup(int ix, bool firstGroup, bool lastGroup, const EffectInfo &info, QWidget * parent = 0);
59 ~CollapsibleGroup();
60 void updateTimecodeFormat();
61 void setActive(bool activate);
62 int groupIndex() const;
63 bool isGroup() const;
64 QString infoString() const;
65 bool isActive() const;
66 void addGroupEffect(CollapsibleEffect *effect);
67 void removeGroup(int ix, QVBoxLayout *layout);
68 /** @brief Return all effects in group. */
69 QList <CollapsibleEffect*> effects();
70 /** @brief Return the editable title widget. */
71 QWidget *title() const;
72 /** @brief Return the XML data describing all effects in group. */
73 QDomDocument effectsData();
74 /** @brief Adjust sub effects buttons. */
75 void adjustEffects();
76
77public slots:
78 void slotEnable(bool enable, bool emitInfo = true);
79
80private slots:
81 void slotSwitch();
82 void slotShow(bool show);
83 void slotDeleteGroup();
84 void slotEffectUp();
85 void slotEffectDown();
86 void slotSaveGroup();
87 void slotResetGroup();
88 void slotUnGroup();
89 void slotRenameGroup();
90
91private:
92 QList <CollapsibleEffect *> m_subWidgets;
93 QMenu *m_menu;
94 EffectInfo m_info;
95 MyEditableLabel *m_title;
96 QMutex m_mutex;
97
98protected:
99 void mouseDoubleClickEvent ( QMouseEvent * event );
100 void dragEnterEvent(QDragEnterEvent *event);
101 void dragLeaveEvent(QDragLeaveEvent *event);
102 void dropEvent(QDropEvent *event);
103
104signals:
105 void deleteGroup(const QDomDocument&);
106 void unGroup(CollapsibleGroup *);
107 void groupRenamed(CollapsibleGroup *);
108
109};
110
111
112#endif
113
114