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