]> git.sesse.net Git - kdenlive/blob - src/monitor.h
* Fix crash when using razor tool while playing
[kdenlive] / src / monitor.h
1 /***************************************************************************
2  *   Copyright (C) 2007 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 MONITOR_H
22 #define MONITOR_H
23
24 #include <KIcon>
25 #include <KAction>
26 #include <KRestrictedLine>
27 #include <QDomElement>
28
29 #include "ui_monitor_ui.h"
30
31 class MonitorManager;
32 class Render;
33 class SmallRuler;
34 class DocClipBase;
35
36 class MonitorRefresh : public QWidget {
37     Q_OBJECT
38 public:
39     MonitorRefresh(QWidget* parent);
40     virtual void paintEvent(QPaintEvent * event);
41     void setRenderer(Render* render);
42
43 private:
44     Render *m_renderer;
45 };
46
47 class Monitor : public QWidget {
48     Q_OBJECT
49
50 public:
51     Monitor(QString name, MonitorManager *manager, QWidget *parent = 0);
52     Render *render;
53     void resetProfile();
54     QString name() const;
55     void resetSize();
56     bool isActive() const;
57     void pause();
58
59 protected:
60     virtual void mousePressEvent(QMouseEvent * event);
61     virtual void mouseReleaseEvent(QMouseEvent * event);
62     virtual void wheelEvent(QWheelEvent * event);
63     virtual void mouseMoveEvent(QMouseEvent *event);
64     virtual QStringList mimeTypes() const;
65     /*    virtual void dragMoveEvent(QDragMoveEvent * event);
66         virtual Qt::DropActions supportedDropActions() const;*/
67
68 //    virtual void resizeEvent(QResizeEvent * event);
69 //    virtual void paintEvent(QPaintEvent * event);
70
71 private:
72     Ui::Monitor_UI ui;
73     MonitorManager *m_monitorManager;
74     MonitorRefresh *m_monitorRefresh;
75     QString m_name;
76     double m_scale;
77     int m_length;
78     int m_position;
79     SmallRuler *m_ruler;
80     KIcon m_playIcon;
81     KIcon m_pauseIcon;
82     bool m_isActive;
83     KRestrictedLine *m_timePos;
84     QAction *m_playAction;
85     QMenu *m_contextMenu;
86     DocClipBase *m_currentClip;
87     QPoint m_DragStartPosition;
88     bool m_dragStarted;
89
90 private slots:
91     void adjustRulerSize(int length);
92     void seekCursor(int pos);
93     void rendererStopped(int pos);
94     void slotExtractCurrentFrame();
95     void slotSetThumbFrame();
96     void slotSetSizeOneToOne();
97     void slotSetSizeOneToTwo();
98     void slotSaveZone();
99     void slotSeek();
100
101 public slots:
102     void slotOpenFile(const QString &);
103     void slotSetXml(DocClipBase *clip, const int position = -1);
104     void initMonitor();
105     void refreshMonitor(bool visible);
106     void slotSeek(int pos);
107     void stop();
108     void start();
109     void activateMonitor();
110     void slotPlay();
111     void slotPlayZone();
112     void slotLoopZone();
113     void slotForward(double speed = 0);
114     void slotRewind(double speed = 0);
115     void slotRewindOneFrame();
116     void slotForwardOneFrame();
117     void saveSceneList(QString path, QDomElement info = QDomElement());
118     void slotStart();
119     void slotEnd();
120     void slotSetZoneStart();
121     void slotSetZoneEnd();
122     void slotZoneStart();
123     void slotZoneEnd();
124     void slotZoneMoved(int start, int end);
125
126 signals:
127     void renderPosition(int);
128     void durationChanged(int);
129     void refreshClipThumbnail(const QString &);
130     void adjustMonitorSize();
131     void zoneUpdated(QPoint);
132     void saveZone(Render *, QPoint);
133 };
134
135 #endif