]> git.sesse.net Git - kdenlive/blob - src/monitor.h
* internal rework: switch clip id's from integer to string
[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 wheelEvent(QWheelEvent * event);
59 //    virtual void resizeEvent(QResizeEvent * event);
60 //    virtual void paintEvent(QPaintEvent * event);
61
62 private:
63     Ui::Monitor_UI ui;
64     MonitorManager *m_monitorManager;
65     MonitorRefresh *m_monitorRefresh;
66     QString m_name;
67     double m_scale;
68     int m_length;
69     int m_position;
70     SmallRuler *m_ruler;
71     KIcon m_playIcon;
72     KIcon m_pauseIcon;
73     bool m_isActive;
74     KRestrictedLine *m_timePos;
75     QAction *m_playAction;
76     QMenu *m_contextMenu;
77     DocClipBase *m_currentClip;
78
79 private slots:
80     void adjustRulerSize(int length);
81     void seekCursor(int pos);
82     void rendererStopped(int pos);
83     void slotExtractCurrentFrame();
84     void slotSetThumbFrame();
85     void slotSetSizeOneToOne();
86     void slotSetSizeOneToTwo();
87
88 public slots:
89     void slotOpenFile(const QString &);
90     void slotSetXml(DocClipBase *clip, const int position = -1);
91     void initMonitor();
92     void refreshMonitor(bool visible);
93     void slotSeek(int pos);
94     void stop();
95     void start();
96     void activateMonitor();
97     void slotPlay();
98     void slotForward(double speed = 0);
99     void slotRewind(double speed = 0);
100     void slotRewindOneFrame();
101     void slotForwardOneFrame();
102     void saveSceneList(QString path, QDomElement info = QDomElement());
103     void slotStart();
104     void slotEnd();
105
106 signals:
107     void renderPosition(int);
108     void durationChanged(int);
109     void refreshClipThumbnail(const QString &);
110     void adjustMonitorSize();
111 };
112
113 #endif