1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
21 #include "recmonitor.h"
23 #include "kdenlivesettings.h"
24 #include "managecapturesdialog.h"
29 #include <KStandardDirs>
31 #include <KIO/NetAccess>
34 #if KDE_IS_VERSION(4,2,0)
35 #include <KDiskFreeSpaceInfo>
38 #include <QMouseEvent>
40 #include <QToolButton>
45 RecMonitor::RecMonitor(QString name, QWidget *parent) :
55 video_frame->setAttribute(Qt::WA_PaintOnScreen);
56 device_selector->setCurrentIndex(KdenliveSettings::defaultcapture());
57 connect(device_selector, SIGNAL(currentIndexChanged(int)), this, SLOT(slotVideoDeviceChanged(int)));
61 QToolBar *toolbar = new QToolBar(name, this);
62 QHBoxLayout *layout = new QHBoxLayout;
63 layout->setContentsMargins(0, 0, 0, 0);
64 m_playIcon = KIcon("media-playback-start");
65 m_pauseIcon = KIcon("media-playback-pause");
67 m_discAction = toolbar->addAction(KIcon("network-connect"), i18n("Connect"));
68 connect(m_discAction, SIGNAL(triggered()), this, SLOT(slotDisconnect()));
70 m_rewAction = toolbar->addAction(KIcon("media-seek-backward"), i18n("Rewind"));
71 connect(m_rewAction, SIGNAL(triggered()), this, SLOT(slotRewind()));
73 m_playAction = toolbar->addAction(m_playIcon, i18n("Play"));
74 connect(m_playAction, SIGNAL(triggered()), this, SLOT(slotStartCapture()));
76 m_stopAction = toolbar->addAction(KIcon("media-playback-stop"), i18n("Stop"));
77 connect(m_stopAction, SIGNAL(triggered()), this, SLOT(slotStopCapture()));
78 m_stopAction->setEnabled(false);
79 m_fwdAction = toolbar->addAction(KIcon("media-seek-forward"), i18n("Forward"));
80 connect(m_fwdAction, SIGNAL(triggered()), this, SLOT(slotForward()));
82 m_recAction = toolbar->addAction(KIcon("media-record"), i18n("Record"));
83 connect(m_recAction, SIGNAL(triggered()), this, SLOT(slotRecord()));
84 m_recAction->setCheckable(true);
86 toolbar->addSeparator();
88 QAction *configAction = toolbar->addAction(KIcon("configure"), i18n("Configure"));
89 connect(configAction, SIGNAL(triggered()), this, SLOT(slotConfigure()));
90 configAction->setCheckable(false);
92 layout->addWidget(toolbar);
94 layout->addWidget(&m_dvinfo);
96 #if KDE_IS_VERSION(4,2,0)
97 m_freeSpace = new KCapacityBar(KCapacityBar::DrawTextInline, this);
98 m_freeSpace->setMaximumWidth(150);
99 QFontMetricsF fontMetrics(font());
100 m_freeSpace->setMaximumHeight(fontMetrics.height() * 1.2);
101 slotUpdateFreeSpace();
102 layout->addWidget(m_freeSpace);
103 connect(&m_spaceTimer, SIGNAL(timeout()), this, SLOT(slotUpdateFreeSpace()));
104 m_spaceTimer.setInterval(30000);
105 m_spaceTimer.setSingleShot(false);
108 control_frame_firewire->setLayout(layout);
110 slotVideoDeviceChanged(device_selector->currentIndex());
111 m_displayProcess = new QProcess;
112 m_captureProcess = new QProcess;
114 connect(m_captureProcess, SIGNAL(stateChanged(QProcess::ProcessState)), this, SLOT(slotProcessStatus(QProcess::ProcessState)));
116 QStringList env = QProcess::systemEnvironment();
117 env << "SDL_WINDOWID=" + QString::number(video_frame->winId());
119 QString videoDriver = KdenliveSettings::videodrivername();
120 if (!videoDriver.isEmpty()) {
121 if (videoDriver == "x11_noaccel") {
122 env << "SDL_VIDEO_YUV_HWACCEL=0";
123 env << "SDL_VIDEODRIVER=x11";
124 } else env << "SDL_VIDEODRIVER=" + videoDriver;
126 setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 1);
128 m_displayProcess->setEnvironment(env);
130 if (KdenliveSettings::video4capture().isEmpty()) {
131 QString captureCommand;
132 if (!KdenliveSettings::video4adevice().isEmpty()) captureCommand = "-f " + KdenliveSettings::video4aformat() + " -i " + KdenliveSettings::video4adevice();
134 captureCommand += " -f " + KdenliveSettings::video4vformat() + " -s " + KdenliveSettings::video4size() + " -r " + QString::number(KdenliveSettings::video4rate()) + " -i " + KdenliveSettings::video4vdevice();
135 KdenliveSettings::setVideo4capture(captureCommand);
138 kDebug() << "/////// BUILDING MONITOR, ID: " << video_frame->winId();
141 RecMonitor::~RecMonitor()
144 delete m_captureProcess;
145 delete m_displayProcess;
148 QString RecMonitor::name() const
153 void RecMonitor::slotConfigure()
155 emit showConfigDialog(4, device_selector->currentIndex());
158 void RecMonitor::slotUpdateCaptureFolder()
160 if (m_captureProcess) m_captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder());
161 slotVideoDeviceChanged(device_selector->currentIndex());
162 kDebug() << "// UPDATE CAPT FOLD: " << KdenliveSettings::capturefolder();
164 #if KDE_IS_VERSION(4,2,0)
165 // update free space info
166 slotUpdateFreeSpace();
170 void RecMonitor::slotVideoDeviceChanged(int ix)
174 m_discAction->setEnabled(false);
175 m_rewAction->setEnabled(false);
176 m_fwdAction->setEnabled(false);
177 m_recAction->setEnabled(true);
178 m_stopAction->setEnabled(false);
179 m_playAction->setEnabled(false);
180 if (KdenliveSettings::rmd_path().isEmpty()) {
181 QString rmdpath = KStandardDirs::findExe("recordmydesktop");
182 if (rmdpath.isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), i18n("Recordmydesktop utility not found,\n please install it for screen grabs")));
183 else KdenliveSettings::setRmd_path(rmdpath);
185 if (!KdenliveSettings::rmd_path().isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", KdenliveSettings::capturefolder())));
186 //video_frame->setText(i18n("Press record button\nto start screen capture"));
189 m_discAction->setEnabled(false);
190 m_rewAction->setEnabled(false);
191 m_fwdAction->setEnabled(false);
192 m_recAction->setEnabled(true);
193 m_stopAction->setEnabled(false);
194 m_playAction->setEnabled(true);
195 checkDeviceAvailability();
198 m_discAction->setEnabled(true);
199 m_recAction->setEnabled(false);
200 m_stopAction->setEnabled(false);
201 m_playAction->setEnabled(false);
202 m_rewAction->setEnabled(false);
203 m_fwdAction->setEnabled(false);
205 // Check that dvgab is available
206 if (KdenliveSettings::dvgrab_path().isEmpty()) {
207 QString dvgrabpath = KStandardDirs::findExe("dvgrab");
208 if (dvgrabpath.isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), i18n("dvgrab utility not found,\n please install it for firewire capture")));
209 else KdenliveSettings::setDvgrab_path(dvgrabpath);
212 QString capturefile = KdenliveSettings::capturefolder();
213 if (!capturefile.endsWith("/")) capturefile.append("/");
214 QString capturename = KdenliveSettings::dvgrabfilename();
215 if (capturename.isEmpty()) capturename = "capture";
217 switch (KdenliveSettings::firewireformat()) {
229 capturename.append("xxx" + extension);
230 capturefile.append(capturename);
231 video_frame->setPixmap(mergeSideBySide(KIcon("network-connect").pixmap(QSize(50, 50)), i18n("Plug your camcorder and\npress connect button\nto initialize connection\nFiles will be saved in:\n%1", capturefile)));
237 QPixmap RecMonitor::mergeSideBySide(const QPixmap& pix, const QString txt)
240 QRect r = QApplication::fontMetrics().boundingRect(QRect(0, 0, video_frame->width(), video_frame->height()), Qt::AlignLeft, txt);
241 int strWidth = r.width();
242 int strHeight = r.height();
243 int pixWidth = pix.width();
244 int pixHeight = pix.height();
245 QPixmap res(strWidth + 8 + pixWidth, qMax(strHeight, pixHeight));
246 res.fill(Qt::transparent);
248 p.drawPixmap(0, 0, pix);
249 p.drawText(QRect(pixWidth + 8, 0, strWidth, strHeight), 0, txt);
255 void RecMonitor::checkDeviceAvailability()
257 if (!KIO::NetAccess::exists(KUrl(KdenliveSettings::video4vdevice()), KIO::NetAccess::SourceSide , this)) {
258 m_playAction->setEnabled(false);
259 m_recAction->setEnabled(false);
260 video_frame->setPixmap(mergeSideBySide(KIcon("camera-web").pixmap(QSize(50, 50)), i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice())));
261 //video_frame->setText(i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice()));
262 } else //video_frame->setText(i18n("Press play or record button\nto start video capture"));
263 video_frame->setPixmap(mergeSideBySide(KIcon("camera-web").pixmap(QSize(50, 50)), i18n("Press play or record button\nto start video capture\nFiles will be saved in:\n%1", KdenliveSettings::capturefolder())));
266 void RecMonitor::slotDisconnect()
268 if (m_captureProcess->state() == QProcess::NotRunning) {
269 m_captureTime = KDateTime::currentLocalDateTime();
270 kDebug() << "CURRENT TIME: " << m_captureTime.toString();
271 m_didCapture = false;
272 slotStartCapture(false);
273 m_discAction->setIcon(KIcon("network-disconnect"));
274 m_discAction->setText(i18n("Disonnect"));
275 m_recAction->setEnabled(true);
276 m_stopAction->setEnabled(true);
277 m_playAction->setEnabled(true);
278 m_rewAction->setEnabled(true);
279 m_fwdAction->setEnabled(true);
281 m_captureProcess->write("q", 1);
282 QTimer::singleShot(1000, m_captureProcess, SLOT(kill()));
283 if (m_didCapture) manageCapturedFiles();
284 m_didCapture = false;
288 void RecMonitor::slotRewind()
290 m_captureProcess->write("a", 1);
293 void RecMonitor::slotForward()
295 m_captureProcess->write("z", 1);
298 void RecMonitor::slotStopCapture()
301 switch (device_selector->currentIndex()) {
303 m_captureProcess->write("\e", 2);
304 m_playAction->setIcon(m_playIcon);
308 m_captureProcess->write("q\n", 3);
309 QTimer::singleShot(1000, m_captureProcess, SLOT(kill()));
313 m_captureProcess->write("q\n", 3);
314 QTimer::singleShot(1000, m_captureProcess, SLOT(kill()));
321 void RecMonitor::slotStartCapture(bool play)
323 if (m_captureProcess->state() != QProcess::NotRunning) {
324 if (device_selector->currentIndex() == FIREWIRE) {
326 m_captureProcess->write("k", 1);
327 //captureProcess->write("\e", 2);
328 m_playAction->setIcon(m_playIcon);
331 m_captureProcess->write("p", 1);
332 m_playAction->setIcon(m_pauseIcon);
338 m_captureArgs.clear();
339 m_displayArgs.clear();
341 QString capturename = KdenliveSettings::dvgrabfilename();
342 QStringList dvargs = KdenliveSettings::dvgrabextra().simplified().split(" ", QString::SkipEmptyParts);
344 switch (device_selector->currentIndex()) {
346 switch (KdenliveSettings::firewireformat()) {
349 m_captureArgs << "--format" << "raw";
350 m_displayArgs << "-f" << "dv";
354 m_captureArgs << "--format" << "dv1";
355 m_displayArgs << "-f" << "dv";
359 m_captureArgs << "--format" << "dv2";
360 m_displayArgs << "-f" << "dv";
364 m_captureArgs << "--format" << "hdv";
365 m_displayArgs << "-f" << "mpegts";
368 if (KdenliveSettings::firewireautosplit()) m_captureArgs << "--autosplit";
369 if (KdenliveSettings::firewiretimestamp()) m_captureArgs << "--timestamp";
370 if (!dvargs.isEmpty()) {
371 m_captureArgs << dvargs;
373 m_captureArgs << "-i";
374 if (capturename.isEmpty()) capturename = "capture";
375 m_captureArgs << capturename << "-";
377 m_displayArgs << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-";
379 m_captureProcess->setStandardOutputProcess(m_displayProcess);
380 m_captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder());
381 kDebug() << "Capture: Running dvgrab " << m_captureArgs.join(" ");
382 connect(m_captureProcess, SIGNAL(readyReadStandardError()), this, SLOT(slotReadDvgrabInfo()));
383 m_captureProcess->start(KdenliveSettings::dvgrab_path(), m_captureArgs);
384 if (play) m_captureProcess->write(" ", 1);
385 m_discAction->setEnabled(true);
388 m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-f" << "mpegts" << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-";
389 m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-";
390 m_captureProcess->setStandardOutputProcess(m_displayProcess);
391 kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" ");
392 m_captureProcess->start("ffmpeg", m_captureArgs);
398 if (device_selector->currentIndex() != SCREENGRAB) {
399 kDebug() << "Capture: Running ffplay " << m_displayArgs.join(" ");
400 m_displayProcess->start("ffplay", m_displayArgs);
401 video_frame->setText(i18n("Initialising..."));
403 // do something when starting screen grab
407 void RecMonitor::slotRecord()
409 if (m_captureProcess->state() == QProcess::NotRunning && device_selector->currentIndex() == FIREWIRE) {
413 switch (device_selector->currentIndex()) {
415 m_captureProcess->write("\e", 2);
416 m_playAction->setIcon(m_playIcon);
417 m_isCapturing = false;
419 m_recAction->setChecked(false);
422 m_captureProcess->terminate();
424 //m_isCapturing = false;
425 QTimer::singleShot(1000, this, SLOT(slotStartCapture()));
428 //captureProcess->write("q\n", 3);
429 m_captureProcess->terminate();
430 video_frame->setText(i18n("Encoding captured video..."));
431 // in case ffmpeg doesn't exit with the 'q' command, kill it one second later
432 //QTimer::singleShot(1000, captureProcess, SLOT(kill()));
436 } else if (device_selector->currentIndex() == FIREWIRE) {
437 m_isCapturing = true;
439 m_captureProcess->write("c\n", 3);
440 m_spaceTimer.start();
443 if (m_captureProcess->state() == QProcess::NotRunning) {
444 m_recAction->setChecked(true);
445 QString extension = "mp4";
446 if (device_selector->currentIndex() == SCREENGRAB) extension = "ogv"; //KdenliveSettings::screengrabextension();
447 QString path = KdenliveSettings::capturefolder() + "/capture0000." + extension;
449 while (QFile::exists(path)) {
450 QString num = QString::number(i).rightJustified(4, '0', false);
451 path = KdenliveSettings::capturefolder() + "/capture" + num + '.' + extension;
454 m_captureFile = KUrl(path);
456 m_captureArgs.clear();
457 m_displayArgs.clear();
459 QString capturename = KdenliveSettings::dvgrabfilename();
460 if (capturename.isEmpty()) capturename = "capture";
462 switch (device_selector->currentIndex()) {
464 m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-y" << m_captureFile.path() << "-f" << "mpegts" << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-";
465 m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-";
466 m_captureProcess->setStandardOutputProcess(m_displayProcess);
467 kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" ");
468 m_captureProcess->start("ffmpeg", m_captureArgs);
471 switch (KdenliveSettings::rmd_capture_type()) {
473 // Full screen capture, nothing special to do
477 m_captureArgs << "-width" << QString::number(KdenliveSettings::rmd_width()) << "-height" << QString::number(KdenliveSettings::rmd_height());
478 if (!KdenliveSettings::rmd_follow_mouse()) {
479 m_captureArgs << "-x" << QString::number(KdenliveSettings::rmd_offsetx()) << "-y" << QString::number(KdenliveSettings::rmd_offsety());
481 m_captureArgs << "--follow-mouse";
482 if (KdenliveSettings::rmd_hide_frame()) m_captureArgs << "--no-frame";
486 m_isCapturing = true;
487 if (KdenliveSettings::rmd_capture_audio()) {
488 m_captureArgs << "-freq" << KdenliveSettings::rmd_freq();
489 m_captureArgs << "-channels" << QString::number(KdenliveSettings::rmd_audio_channels());
490 if (KdenliveSettings::rmd_use_jack()) {
491 m_captureArgs << "-use-jack" << KdenliveSettings::rmd_jackports();
492 if (KdenliveSettings::rmd_jack_buffer() > 0.0)
493 m_captureArgs << "-ring-buffer-size" << QString::number(KdenliveSettings::rmd_jack_buffer());
495 if (!KdenliveSettings::rmd_alsadevicename().isEmpty())
496 m_captureArgs << "-device" << KdenliveSettings::rmd_alsadevicename();
497 if (KdenliveSettings::rmd_alsa_buffer() > 0)
498 m_captureArgs << "-buffer-size" << QString::number(KdenliveSettings::rmd_alsa_buffer());
500 } else m_captureArgs << "--no-sound";
502 if (KdenliveSettings::rmd_fullshots()) m_captureArgs << "--full-shots";
503 m_captureArgs << "-workdir" << KdenliveSettings::currenttmpfolder();
504 m_captureArgs << "-fps" << QString::number(KdenliveSettings::rmd_fps()) << "-o" << m_captureFile.path();
505 m_captureProcess->start(KdenliveSettings::rmd_path(), m_captureArgs);
506 kDebug() << "// RecordMyDesktop params: " << m_captureArgs;
513 if (device_selector->currentIndex() != SCREENGRAB) {
514 m_isCapturing = true;
515 kDebug() << "Capture: Running ffplay " << m_displayArgs.join(" ");
516 m_displayProcess->start("ffplay", m_displayArgs);
517 video_frame->setText(i18n("Initialising..."));
521 m_displayProcess->kill();
522 //captureProcess->kill();
523 QTimer::singleShot(1000, this, SLOT(slotRecord()));
528 void RecMonitor::slotStartGrab(const QRect &rect) {
529 rgnGrab->deleteLater();
530 QApplication::restoreOverrideCursor();
532 if (rect.isNull()) return;
533 int width = rect.width();
534 int height = rect.height();
535 if (width % 2 != 0) width--;
536 if (height % 2 != 0) height--;
537 QString args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(width) + "x" + QString::number(height)).replace("%offset", "+" + QString::number(rect.x()) + "," + QString::number(rect.y()));
538 if (KdenliveSettings::screengrabenableaudio()) {
539 // also capture audio
540 if (KdenliveSettings::useosscapture()) m_captureArgs << KdenliveSettings::screengrabosscapture().simplified().split(' ');
541 else m_captureArgs << KdenliveSettings::screengrabalsacapture2().simplified().split(' ');
543 m_captureArgs << args.simplified().split(' ') << KdenliveSettings::screengrabencoding().simplified().split(' ') << m_captureFile.path();
544 m_isCapturing = true;
545 video_frame->setText(i18n("Capturing..."));
546 if (KdenliveSettings::screengrabenableaudio() && !KdenliveSettings::useosscapture()) {
547 QStringList alsaArgs = KdenliveSettings::screengrabalsacapture().simplified().split(' ');
548 alsaProcess->setStandardOutputProcess(captureProcess);
549 kDebug() << "Capture: Running arecord " << alsaArgs.join(" ");
550 alsaProcess->start("arecord", alsaArgs);
552 kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" ");
553 captureProcess->start("ffmpeg", m_captureArgs);
556 void RecMonitor::slotProcessStatus(QProcess::ProcessState status)
558 if (status == QProcess::NotRunning) {
559 m_displayProcess->kill();
560 if (m_isCapturing && device_selector->currentIndex() != FIREWIRE)
561 if (autoaddbox->isChecked() && QFile::exists(m_captureFile.path())) emit addProjectClip(m_captureFile);
562 if (device_selector->currentIndex() == FIREWIRE) {
563 m_discAction->setIcon(KIcon("network-connect"));
564 m_discAction->setText(i18n("Connect"));
565 m_playAction->setEnabled(false);
566 m_rewAction->setEnabled(false);
567 m_fwdAction->setEnabled(false);
568 m_recAction->setEnabled(false);
571 m_playAction->setIcon(m_playIcon);
572 m_recAction->setChecked(false);
573 m_stopAction->setEnabled(false);
574 device_selector->setEnabled(true);
575 if (m_captureProcess && m_captureProcess->exitStatus() == QProcess::CrashExit) {
576 video_frame->setText(i18n("Capture crashed, please check your parameters"));
578 if (device_selector->currentIndex() != SCREENGRAB) video_frame->setText(i18n("Not connected"));
579 else video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", KdenliveSettings::capturefolder())));
581 m_isCapturing = false;
584 #if KDE_IS_VERSION(4,2,0)
585 // update free space info
586 slotUpdateFreeSpace();
590 if (device_selector->currentIndex() != SCREENGRAB) m_stopAction->setEnabled(true);
591 device_selector->setEnabled(false);
595 void RecMonitor::manageCapturedFiles()
598 switch (KdenliveSettings::firewireformat()) {
610 QDir dir(KdenliveSettings::capturefolder());
612 QString capturename = KdenliveSettings::dvgrabfilename();
613 if (capturename.isEmpty()) capturename = "capture";
614 filters << capturename + "*" + extension;
615 const QStringList result = dir.entryList(filters, QDir::Files, QDir::Time);
616 KUrl::List capturedFiles;
617 foreach(const QString &name, result) {
618 KUrl url = KUrl(dir.filePath(name));
619 if (KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, this)) {
620 KFileItem file(KFileItem::Unknown, KFileItem::Unknown, url, true);
621 if (file.time(KFileItem::ModificationTime) > m_captureTime) capturedFiles.append(url);
624 kDebug() << "Found : " << capturedFiles.count() << " new capture files";
625 kDebug() << capturedFiles;
627 if (capturedFiles.count() > 0) {
628 ManageCapturesDialog *d = new ManageCapturesDialog(capturedFiles, this);
629 if (d->exec() == QDialog::Accepted) {
630 capturedFiles = d->importFiles();
631 foreach(const KUrl &url, capturedFiles) {
632 emit addProjectClip(url);
640 void RecMonitor::mousePressEvent(QMouseEvent * /*event*/)
642 #if KDE_IS_VERSION(4,2,0)
643 if (m_freeSpace->underMouse()) slotUpdateFreeSpace();
647 void RecMonitor::slotUpdateFreeSpace()
649 #if KDE_IS_VERSION(4,2,0)
650 KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(KdenliveSettings::capturefolder());
651 if (info.isValid()) {
652 m_freeSpace->setValue(100 * info.used() / info.size());
653 m_freeSpace->setText(i18n("Free space: %1", KIO::convertSize(info.available())));
654 m_freeSpace->update();
659 void RecMonitor::activateRecMonitor()
661 //if (!m_isActive) m_monitorManager->activateRecMonitor(m_name);
664 void RecMonitor::stop()
670 void RecMonitor::start()
676 void RecMonitor::refreshRecMonitor(bool visible)
679 //if (!m_isActive) m_monitorManager->activateRecMonitor(m_name);
684 void RecMonitor::slotPlay()
687 //if (!m_isActive) m_monitorManager->activateRecMonitor(m_name);
691 void RecMonitor::slotReadDvgrabInfo()
693 QString data = m_captureProcess->readAllStandardError().simplified();
694 data = data.section('"', 2, 2).simplified();
695 m_dvinfo.setText(data.left(11));
696 m_dvinfo.updateGeometry();
699 #include "recmonitor.moc"