]> git.sesse.net Git - kdenlive/blob - src/recmonitor.h
Work on firewire capture: dv should work, you now get a captured file dialog when...
[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 <QToolBar>
25 #include <QTimer>
26 #include <QProcess>
27 #include <QImage>
28
29 #include <KIcon>
30 #include <KAction>
31 #include <KRestrictedLine>
32 #include <KDateTime>
33
34 #include "ui_recmonitor_ui.h"
35 #include "smallruler.h"
36 #include "regiongrabber.h"
37
38 class RecMonitor : public QWidget {
39     Q_OBJECT
40
41 public:
42     RecMonitor(QString name, QWidget *parent = 0);
43     QString name() const;
44
45     enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2};
46
47 protected:
48     virtual void mousePressEvent(QMouseEvent * event);
49
50 private:
51     Ui::RecMonitor_UI ui;
52     QString m_tmpFolder;
53     QString m_name;
54     RegionGrabber *rgnGrab;
55     bool m_isActive;
56     KDateTime m_captureTime;
57
58     KUrl m_captureFile;
59     KIcon m_playIcon;
60     KIcon m_pauseIcon;
61
62     QProcess *captureProcess;
63     QProcess *displayProcess;
64     QTimer *m_initTimer;
65     bool m_isCapturing;
66     /** did the user capture something ? */
67     bool m_didCapture;
68     bool m_isPlaying;
69     QStringList m_captureArgs;
70     QStringList m_displayArgs;
71     QAction *m_recAction;
72     QAction *m_playAction;
73     QAction *m_fwdAction;
74     QAction *m_rewAction;
75     QAction *m_stopAction;
76     QAction *m_discAction;
77     void checkDeviceAvailability();
78     QPixmap mergeSideBySide(const QPixmap& pix, const QString txt);
79     void manageCapturedFiles();
80
81 private slots:
82     void slotStartCapture(bool play = true);
83     void slotStopCapture();
84     void slotRecord();
85     void slotProcessStatus(QProcess::ProcessState status);
86     void slotVideoDeviceChanged(int ix);
87     void slotRewind();
88     void slotForward();
89     void slotDisconnect();
90     void slotStartGrab(const QRect &rect);
91     void slotConfigure();
92
93 public slots:
94     void refreshRecMonitor(bool visible);
95     void stop();
96     void start();
97     void activateRecMonitor();
98     void slotPlay();
99
100 signals:
101     void renderPosition(int);
102     void durationChanged(int);
103     void addProjectClip(KUrl);
104     void showConfigDialog(int, int);
105 };
106
107 #endif