]> git.sesse.net Git - kdenlive/blob - src/recmonitor.h
Replace uppercase enums into camel into.
[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 "widgets/abstractmonitor.h"
30 #include "definitions.h"
31 #include "ui_recmonitor_ui.h"
32
33 #include <QToolBar>
34 #include <QTimer>
35 #include <QProcess>
36 #include <QImage>
37
38 #include <KIcon>
39 #include <KAction>
40 #include <KRestrictedLine>
41 #include <KDateTime>
42 #include <kdeversion.h>
43 #include <KComboBox>
44 #include <kcapacitybar.h>
45
46 #if KDE_IS_VERSION(4,7,0)
47 #include <KMessageWidget>
48 #endif
49
50 class MonitorManager;
51 class MltDeviceCapture;
52 class AbstractRender;
53
54 class RecMonitor : public AbstractMonitor, public Ui::RecMonitor_UI
55 {
56     Q_OBJECT
57
58 public:
59     explicit RecMonitor(Kdenlive::MonitorId name, MonitorManager *manager, QWidget *parent = 0);
60     ~RecMonitor();
61
62     AbstractRender *abstractRender();
63     void analyseFrames(bool analyse);
64     enum CaptureDevice {
65         Firewire = 0,
66         Video4Linux = 1,
67         ScreenBag = 2,
68         BlackMagic = 3
69     };
70
71 protected:
72     void mousePressEvent(QMouseEvent * event);
73     void mouseDoubleClickEvent(QMouseEvent * event);
74
75 private:
76     KDateTime m_captureTime;
77     /** @brief Provide feedback about dvgrab operations */
78     QLabel m_dvinfo;
79     
80     /** @brief Keeps a brief (max ten items) history of warning or error messages
81      *  (currently only used for BLACKMAGIC). */
82     KComboBox m_logger;
83     QString m_capturePath;
84
85     KCapacityBar *m_freeSpace;
86     QTimer m_spaceTimer;
87
88     KUrl m_captureFile;
89     KIcon m_playIcon;
90     KIcon m_pauseIcon;
91
92     QProcess *m_captureProcess;
93     QProcess *m_displayProcess;
94     bool m_isCapturing;
95     /** did the user capture something ? */
96     bool m_didCapture;
97     bool m_isPlaying;
98     QStringList m_captureArgs;
99     QStringList m_displayArgs;
100     QAction *m_recAction;
101     QAction *m_playAction;
102     QAction *m_fwdAction;
103     QAction *m_rewAction;
104     QAction *m_stopAction;
105     QAction *m_discAction;
106
107     MonitorManager *m_manager;
108     MltDeviceCapture *m_captureDevice;
109     VideoContainer *m_videoBox;
110     QAction *m_addCapturedClip;
111     QAction *m_previewSettings;
112     QString m_error;
113
114 #if KDE_IS_VERSION(4,7,0)
115     KMessageWidget *m_infoMessage;
116 #endif
117
118     bool m_analyse;
119     void checkDeviceAvailability();
120     QPixmap mergeSideBySide(const QPixmap& pix, const QString &txt);
121     void manageCapturedFiles();
122     /** @brief Build MLT producer for device, using path as profile. */
123     void buildMltDevice(const QString &path);
124     /** @brief Create string containing an XML playlist for v4l capture. */
125     const QString getV4lXmlPlaylist(const MltVideoProfile &profile, bool *isXml);
126     /** @brief Display an error message to user. */
127     void showWarningMessage(const QString &text, bool logAction = false);
128
129 private slots:
130     void slotStartPreview(bool play = true);
131     void slotRecord();
132     void slotProcessStatus(QProcess::ProcessState status);
133     void slotVideoDeviceChanged(int ix);
134     void slotRewind();
135     void slotForward();
136     void slotDisconnect();
137     //void slotStartGrab(const QRect &rect);
138     void slotConfigure();
139     void slotReadProcessInfo();
140     void slotUpdateFreeSpace();
141     void slotSetInfoMessage(const QString &message);
142     void slotDroppedFrames(int dropped);
143     /** @brief Change setting for preview while recording. */
144     void slotChangeRecordingPreview(bool enable);
145     /** @brief Show last jog error log. */
146     void slotShowLog();
147
148 public slots:
149     void refreshRecMonitor(bool visible);
150     void slotPlay();
151     void stop();
152     void start();
153     void slotStopCapture();
154     void slotUpdateCaptureFolder(const QString &currentProjectFolder);
155     void slotMouseSeek(int eventDelta, bool fast);
156     void slotSwitchFullScreen();
157
158 signals:
159     void renderPosition(int);
160     void durationChanged(int);
161     void addProjectClip(KUrl);
162     void addProjectClipList(KUrl::List);
163     void showConfigDialog(int, int);
164 };
165
166 #endif