]> git.sesse.net Git - kdenlive/blob - src/simplekeyframes/simpletimelinewidget.h
4311145367293c7c924941e775f7100a868fbbf0
[kdenlive] / src / simplekeyframes / simpletimelinewidget.h
1 /***************************************************************************
2  *   Copyright (C) 2011 by Till Theato (root@ttill.de)                     *
3  *   This file is part of Kdenlive (www.kdenlive.org).                     *
4  *                                                                         *
5  *   Kdenlive is free software: you can redistribute it and/or modify      *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation, either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   Kdenlive is distributed in the hope that it will be useful,           *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with Kdenlive.  If not, see <http://www.gnu.org/licenses/>.     *
17  ***************************************************************************/
18
19 #ifndef SIMPLETIMELINEWIDGET_H
20 #define SIMPLETIMELINEWIDGET_H
21
22 #include <QtCore>
23 #include <QWidget>
24
25 class SimpleTimelineWidget : public QWidget
26 {
27     Q_OBJECT
28
29 public:
30     explicit SimpleTimelineWidget(QWidget* parent = 0);
31     void setKeyframes(const QList <int>& keyframes);
32     void setDuration(int dur);
33
34 public slots:
35     void slotSetPosition(int pos);
36     void slotRemoveKeyframe(int pos);
37     void slotAddKeyframe(int pos = - 1, int select = false);
38     void slotAddRemove();
39     void slotGoToNext();
40     void slotGoToPrev();
41
42 protected:
43     virtual void paintEvent(QPaintEvent *event);
44     virtual void mousePressEvent(QMouseEvent *event);
45     virtual void mouseReleaseEvent(QMouseEvent *event);
46     virtual void mouseMoveEvent(QMouseEvent *event);
47     virtual void mouseDoubleClickEvent(QMouseEvent *event);
48     virtual void wheelEvent(QWheelEvent *event);
49
50 private:
51     int m_duration;
52     int m_position;
53     int m_currentKeyframe;
54     int m_currentKeyframeOriginal;
55     int m_hoverKeyframe;
56     QList <int> m_keyframes;
57     int m_lineHeight;
58     double m_scale;
59
60     QColor m_colSelected;
61     QColor m_colKeyframe;
62     QColor m_colKeyframeBg;
63
64 signals:
65     void positionChanged(int pos);
66     void atKeyframe(bool);
67
68     void keyframeSelected();
69     void keyframeMoving(int oldPos, int currentPos);
70     void keyframeMoved(int oldPos, int newPos);
71     void keyframeAdded(int pos);
72     void keyframeRemoved(int pos);
73 };
74
75 #endif