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