]> git.sesse.net Git - kdenlive/blob - src/monitor.h
* Clean up profiles handling
[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
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
86 public slots:
87     void slotOpenFile(const QString &);
88     void slotSetXml(DocClipBase *clip, const int position = -1);
89     void initMonitor();
90     void refreshMonitor(bool visible);
91     void slotSeek(int pos);
92     void stop();
93     void start();
94     void activateMonitor();
95     void slotPlay();
96     void slotForward(double speed = 0);
97     void slotRewind(double speed = 0);
98     void slotRewindOneFrame();
99     void slotForwardOneFrame();
100     void saveSceneList(QString path, QDomElement info = QDomElement());
101     void slotStart();
102     void slotEnd();
103
104 signals:
105     void renderPosition(int);
106     void durationChanged(int);
107     void refreshClipThumbnail(int);
108 };
109
110 #endif