]> git.sesse.net Git - kdenlive/blob - src/recmonitor.h
Cleanup timecode display
[kdenlive] / src / recmonitor.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 RECMONITOR_H
22 #define RECMONITOR_H
23
24 #include "ui_recmonitor_ui.h"
25
26 #include <QToolBar>
27 #include <QTimer>
28 #include <QProcess>
29 #include <QImage>
30
31 #include <KIcon>
32 #include <KAction>
33 #include <KRestrictedLine>
34 #include <KDateTime>
35 #include <kdeversion.h>
36
37 #if KDE_IS_VERSION(4,2,0)
38 #include <kcapacitybar.h>
39 #endif
40
41 class RecMonitor : public QWidget, public Ui::RecMonitor_UI
42 {
43     Q_OBJECT
44
45 public:
46     explicit RecMonitor(QString name, QWidget *parent = 0);
47     virtual ~RecMonitor();
48
49     QString name() const;
50
51     enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2};
52
53 protected:
54     virtual void mousePressEvent(QMouseEvent * event);
55
56 private:
57     QString m_name;
58     bool m_isActive;
59     KDateTime m_captureTime;
60     QLabel m_dvinfo;
61
62 #if KDE_IS_VERSION(4,2,0)
63     KCapacityBar *m_freeSpace;
64     QTimer m_spaceTimer;
65 #endif
66
67     KUrl m_captureFile;
68     KIcon m_playIcon;
69     KIcon m_pauseIcon;
70
71     QProcess *m_captureProcess;
72     QProcess *m_displayProcess;
73     bool m_isCapturing;
74     /** did the user capture something ? */
75     bool m_didCapture;
76     bool m_isPlaying;
77     QStringList m_captureArgs;
78     QStringList m_displayArgs;
79     QAction *m_recAction;
80     QAction *m_playAction;
81     QAction *m_fwdAction;
82     QAction *m_rewAction;
83     QAction *m_stopAction;
84     QAction *m_discAction;
85     void checkDeviceAvailability();
86     QPixmap mergeSideBySide(const QPixmap& pix, const QString txt);
87     void manageCapturedFiles();
88
89 private slots:
90     void slotStartCapture(bool play = true);
91     void slotStopCapture();
92     void slotRecord();
93     void slotProcessStatus(QProcess::ProcessState status);
94     void slotVideoDeviceChanged(int ix);
95     void slotRewind();
96     void slotForward();
97     void slotDisconnect();
98     //void slotStartGrab(const QRect &rect);
99     void slotConfigure();
100     void slotReadDvgrabInfo();
101     void slotUpdateFreeSpace();
102
103 public slots:
104     void refreshRecMonitor(bool visible);
105     void stop();
106     void start();
107     void activateRecMonitor();
108     void slotPlay();
109     void slotUpdateCaptureFolder();
110
111 signals:
112     void renderPosition(int);
113     void durationChanged(int);
114     void addProjectClip(KUrl);
115     void showConfigDialog(int, int);
116 };
117
118 #endif