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