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)));
115 connect(m_captureProcess, SIGNAL(readyReadStandardError()), this, SLOT(slotReadDvgrabInfo()));
117 QStringList env = QProcess::systemEnvironment();
118 env << "SDL_WINDOWID=" + QString::number(video_frame->winId());
120 QString videoDriver = KdenliveSettings::videodrivername();
121 if (!videoDriver.isEmpty()) {
122 if (videoDriver == "x11_noaccel") {
123 env << "SDL_VIDEO_YUV_HWACCEL=0";
124 env << "SDL_VIDEODRIVER=x11";
125 } else env << "SDL_VIDEODRIVER=" + videoDriver;
127 setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 1);
129 m_displayProcess->setEnvironment(env);
131 if (KdenliveSettings::video4capture().isEmpty()) {
132 QString captureCommand;
133 if (!KdenliveSettings::video4adevice().isEmpty()) captureCommand = "-f " + KdenliveSettings::video4aformat() + " -i " + KdenliveSettings::video4adevice();
135 captureCommand += " -f " + KdenliveSettings::video4vformat() + " -s " + KdenliveSettings::video4size() + " -r " + QString::number(KdenliveSettings::video4rate()) + " -i " + KdenliveSettings::video4vdevice();
136 KdenliveSettings::setVideo4capture(captureCommand);
139 kDebug() << "/////// BUILDING MONITOR, ID: " << video_frame->winId();
142 RecMonitor::~RecMonitor()
145 delete m_captureProcess;
146 delete m_displayProcess;
149 QString RecMonitor::name() const
154 void RecMonitor::slotConfigure()
156 emit showConfigDialog(4, device_selector->currentIndex());
159 void RecMonitor::slotUpdateCaptureFolder()
161 if (m_captureProcess) m_captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder());
162 slotVideoDeviceChanged(device_selector->currentIndex());
163 kDebug() << "// UPDATE CAPT FOLD: " << KdenliveSettings::capturefolder();
165 #if KDE_IS_VERSION(4,2,0)
166 // update free space info
167 slotUpdateFreeSpace();
171 void RecMonitor::slotVideoDeviceChanged(int ix)
175 m_discAction->setEnabled(false);
176 m_rewAction->setEnabled(false);
177 m_fwdAction->setEnabled(false);
178 m_recAction->setEnabled(true);
179 m_stopAction->setEnabled(false);
180 m_playAction->setEnabled(false);
181 if (KdenliveSettings::rmd_path().isEmpty()) {
182 QString rmdpath = KStandardDirs::findExe("recordmydesktop");
183 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")));
184 else KdenliveSettings::setRmd_path(rmdpath);
186 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())));
187 //video_frame->setText(i18n("Press record button\nto start screen capture"));
190 m_discAction->setEnabled(false);
191 m_rewAction->setEnabled(false);
192 m_fwdAction->setEnabled(false);
193 m_recAction->setEnabled(true);
194 m_stopAction->setEnabled(false);
195 m_playAction->setEnabled(true);
196 checkDeviceAvailability();
199 m_discAction->setEnabled(true);
200 m_recAction->setEnabled(false);
201 m_stopAction->setEnabled(false);
202 m_playAction->setEnabled(false);
203 m_rewAction->setEnabled(false);
204 m_fwdAction->setEnabled(false);
206 // Check that dvgab is available
207 if (KdenliveSettings::dvgrab_path().isEmpty()) {
208 QString dvgrabpath = KStandardDirs::findExe("dvgrab");
209 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")));
210 else KdenliveSettings::setDvgrab_path(dvgrabpath);
213 QString capturefile = KdenliveSettings::capturefolder();
214 if (!capturefile.endsWith("/")) capturefile.append("/");
215 QString capturename = KdenliveSettings::dvgrabfilename();
216 if (capturename.isEmpty()) capturename = "capture";
218 switch (KdenliveSettings::firewireformat()) {
230 capturename.append("xxx" + extension);
231 capturefile.append(capturename);
232 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)));
238 QPixmap RecMonitor::mergeSideBySide(const QPixmap& pix, const QString txt)
241 QRect r = QApplication::fontMetrics().boundingRect(QRect(0, 0, video_frame->width(), video_frame->height()), Qt::AlignLeft, txt);
242 int strWidth = r.width();
243 int strHeight = r.height();
244 int pixWidth = pix.width();
245 int pixHeight = pix.height();
246 QPixmap res(strWidth + 8 + pixWidth, qMax(strHeight, pixHeight));
247 res.fill(Qt::transparent);
249 p.drawPixmap(0, 0, pix);
250 p.drawText(QRect(pixWidth + 8, 0, strWidth, strHeight), 0, txt);
256 void RecMonitor::checkDeviceAvailability()
258 if (!KIO::NetAccess::exists(KUrl(KdenliveSettings::video4vdevice()), KIO::NetAccess::SourceSide , this)) {
259 m_playAction->setEnabled(false);
260 m_recAction->setEnabled(false);
261 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())));
262 //video_frame->setText(i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice()));
263 } else //video_frame->setText(i18n("Press play or record button\nto start video capture"));
264 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())));
267 void RecMonitor::slotDisconnect()
269 if (m_captureProcess->state() == QProcess::NotRunning) {
270 m_captureTime = KDateTime::currentLocalDateTime();
271 kDebug() << "CURRENT TIME: " << m_captureTime.toString();
272 m_didCapture = false;
273 slotStartCapture(false);
274 m_discAction->setIcon(KIcon("network-disconnect"));
275 m_discAction->setText(i18n("Disonnect"));
276 m_recAction->setEnabled(true);
277 m_stopAction->setEnabled(true);
278 m_playAction->setEnabled(true);
279 m_rewAction->setEnabled(true);
280 m_fwdAction->setEnabled(true);
282 m_captureProcess->write("q", 1);
283 QTimer::singleShot(1000, m_captureProcess, SLOT(kill()));
284 if (m_didCapture) manageCapturedFiles();
285 m_didCapture = false;
289 void RecMonitor::slotRewind()
291 m_captureProcess->write("a", 1);
294 void RecMonitor::slotForward()
296 m_captureProcess->write("z", 1);
299 void RecMonitor::slotStopCapture()
302 switch (device_selector->currentIndex()) {
304 m_captureProcess->write("\e", 2);
305 m_playAction->setIcon(m_playIcon);
309 m_captureProcess->write("q\n", 3);
310 QTimer::singleShot(1000, m_captureProcess, SLOT(kill()));
314 m_captureProcess->write("q\n", 3);
315 QTimer::singleShot(1000, m_captureProcess, SLOT(kill()));
322 void RecMonitor::slotStartCapture(bool play)
324 if (m_captureProcess->state() != QProcess::NotRunning) {
325 if (device_selector->currentIndex() == FIREWIRE) {
327 m_captureProcess->write("k", 1);
328 //captureProcess->write("\e", 2);
329 m_playAction->setIcon(m_playIcon);
332 m_captureProcess->write("p", 1);
333 m_playAction->setIcon(m_pauseIcon);
339 m_captureArgs.clear();
340 m_displayArgs.clear();
342 QString capturename = KdenliveSettings::dvgrabfilename();
343 QStringList dvargs = KdenliveSettings::dvgrabextra().simplified().split(" ", QString::SkipEmptyParts);
345 switch (device_selector->currentIndex()) {
347 switch (KdenliveSettings::firewireformat()) {
350 m_captureArgs << "--format" << "raw";
351 m_displayArgs << "-f" << "dv";
355 m_captureArgs << "--format" << "dv1";
356 m_displayArgs << "-f" << "dv";
360 m_captureArgs << "--format" << "dv2";
361 m_displayArgs << "-f" << "dv";
365 m_captureArgs << "--format" << "hdv";
366 m_displayArgs << "-f" << "mpegts";
369 if (KdenliveSettings::firewireautosplit()) m_captureArgs << "--autosplit";
370 if (KdenliveSettings::firewiretimestamp()) m_captureArgs << "--timestamp";
371 if (!dvargs.isEmpty()) {
372 m_captureArgs << dvargs;
374 m_captureArgs << "-i";
375 if (capturename.isEmpty()) capturename = "capture";
376 m_captureArgs << capturename << "-";
378 m_displayArgs << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-";
380 m_captureProcess->setStandardOutputProcess(m_displayProcess);
381 m_captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder());
382 kDebug() << "Capture: Running dvgrab " << m_captureArgs.join(" ");
384 m_captureProcess->start(KdenliveSettings::dvgrab_path(), m_captureArgs);
385 if (play) m_captureProcess->write(" ", 1);
386 m_discAction->setEnabled(true);
389 m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-f" << "mpegts" << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-";
390 m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-";
391 m_captureProcess->setStandardOutputProcess(m_displayProcess);
392 kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" ");
393 m_captureProcess->start("ffmpeg", m_captureArgs);
399 if (device_selector->currentIndex() != SCREENGRAB) {
400 kDebug() << "Capture: Running ffplay " << m_displayArgs.join(" ");
401 m_displayProcess->start("ffplay", m_displayArgs);
402 video_frame->setText(i18n("Initialising..."));
404 // do something when starting screen grab
408 void RecMonitor::slotRecord()
410 if (m_captureProcess->state() == QProcess::NotRunning && device_selector->currentIndex() == FIREWIRE) {
414 switch (device_selector->currentIndex()) {
416 m_captureProcess->write("\e", 2);
417 m_playAction->setIcon(m_playIcon);
418 m_isCapturing = false;
420 m_recAction->setChecked(false);
423 m_captureProcess->terminate();
425 //m_isCapturing = false;
426 QTimer::singleShot(1000, this, SLOT(slotStartCapture()));
429 //captureProcess->write("q\n", 3);
430 m_captureProcess->terminate();
431 video_frame->setText(i18n("Encoding captured video..."));
432 // in case ffmpeg doesn't exit with the 'q' command, kill it one second later
433 //QTimer::singleShot(1000, captureProcess, SLOT(kill()));
437 } else if (device_selector->currentIndex() == FIREWIRE) {
438 m_isCapturing = true;
440 m_captureProcess->write("c\n", 3);
441 m_spaceTimer.start();
444 if (m_captureProcess->state() == QProcess::NotRunning) {
445 m_recAction->setChecked(true);
446 QString extension = "mp4";
447 if (device_selector->currentIndex() == SCREENGRAB) extension = "ogv"; //KdenliveSettings::screengrabextension();
448 QString path = KdenliveSettings::capturefolder() + "/capture0000." + extension;
450 while (QFile::exists(path)) {
451 QString num = QString::number(i).rightJustified(4, '0', false);
452 path = KdenliveSettings::capturefolder() + "/capture" + num + '.' + extension;
455 m_captureFile = KUrl(path);
457 m_captureArgs.clear();
458 m_displayArgs.clear();
460 QString capturename = KdenliveSettings::dvgrabfilename();
461 if (capturename.isEmpty()) capturename = "capture";
463 switch (device_selector->currentIndex()) {
465 m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << KdenliveSettings::video4encoding().simplified().split(' ') << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-y" << m_captureFile.path() << "-f" << "mpegts" << "-vcodec" << "mpeg4" << "-acodec" << "mp2" << "-";
466 m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(video_frame->width()) << "-y" << QString::number(video_frame->height()) << "-";
467 m_captureProcess->setStandardOutputProcess(m_displayProcess);
468 kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" ");
469 m_captureProcess->start("ffmpeg", m_captureArgs);
472 switch (KdenliveSettings::rmd_capture_type()) {
474 // Full screen capture, nothing special to do
478 m_captureArgs << "-width" << QString::number(KdenliveSettings::rmd_width()) << "-height" << QString::number(KdenliveSettings::rmd_height());
479 if (!KdenliveSettings::rmd_follow_mouse()) {
480 m_captureArgs << "-x" << QString::number(KdenliveSettings::rmd_offsetx()) << "-y" << QString::number(KdenliveSettings::rmd_offsety());
482 m_captureArgs << "--follow-mouse";
483 if (KdenliveSettings::rmd_hide_frame()) m_captureArgs << "--no-frame";
487 m_isCapturing = true;
488 if (KdenliveSettings::rmd_capture_audio()) {
489 m_captureArgs << "-freq" << KdenliveSettings::rmd_freq();
490 m_captureArgs << "-channels" << QString::number(KdenliveSettings::rmd_audio_channels());
491 if (KdenliveSettings::rmd_use_jack()) {
492 m_captureArgs << "-use-jack" << KdenliveSettings::rmd_jackports();
493 if (KdenliveSettings::rmd_jack_buffer() > 0.0)
494 m_captureArgs << "-ring-buffer-size" << QString::number(KdenliveSettings::rmd_jack_buffer());
496 if (!KdenliveSettings::rmd_alsadevicename().isEmpty())
497 m_captureArgs << "-device" << KdenliveSettings::rmd_alsadevicename();
498 if (KdenliveSettings::rmd_alsa_buffer() > 0)
499 m_captureArgs << "-buffer-size" << QString::number(KdenliveSettings::rmd_alsa_buffer());
501 } else m_captureArgs << "--no-sound";
503 if (KdenliveSettings::rmd_fullshots()) m_captureArgs << "--full-shots";
504 m_captureArgs << "-workdir" << KdenliveSettings::currenttmpfolder();
505 m_captureArgs << "-fps" << QString::number(KdenliveSettings::rmd_fps()) << "-o" << m_captureFile.path();
506 m_captureProcess->start(KdenliveSettings::rmd_path(), m_captureArgs);
507 kDebug() << "// RecordMyDesktop params: " << m_captureArgs;
514 if (device_selector->currentIndex() != SCREENGRAB) {
515 m_isCapturing = true;
516 kDebug() << "Capture: Running ffplay " << m_displayArgs.join(" ");
517 m_displayProcess->start("ffplay", m_displayArgs);
518 video_frame->setText(i18n("Initialising..."));
522 m_displayProcess->kill();
523 //captureProcess->kill();
524 QTimer::singleShot(1000, this, SLOT(slotRecord()));
529 void RecMonitor::slotStartGrab(const QRect &rect) {
530 rgnGrab->deleteLater();
531 QApplication::restoreOverrideCursor();
533 if (rect.isNull()) return;
534 int width = rect.width();
535 int height = rect.height();
536 if (width % 2 != 0) width--;
537 if (height % 2 != 0) height--;
538 QString args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(width) + "x" + QString::number(height)).replace("%offset", "+" + QString::number(rect.x()) + "," + QString::number(rect.y()));
539 if (KdenliveSettings::screengrabenableaudio()) {
540 // also capture audio
541 if (KdenliveSettings::useosscapture()) m_captureArgs << KdenliveSettings::screengrabosscapture().simplified().split(' ');
542 else m_captureArgs << KdenliveSettings::screengrabalsacapture2().simplified().split(' ');
544 m_captureArgs << args.simplified().split(' ') << KdenliveSettings::screengrabencoding().simplified().split(' ') << m_captureFile.path();
545 m_isCapturing = true;
546 video_frame->setText(i18n("Capturing..."));
547 if (KdenliveSettings::screengrabenableaudio() && !KdenliveSettings::useosscapture()) {
548 QStringList alsaArgs = KdenliveSettings::screengrabalsacapture().simplified().split(' ');
549 alsaProcess->setStandardOutputProcess(captureProcess);
550 kDebug() << "Capture: Running arecord " << alsaArgs.join(" ");
551 alsaProcess->start("arecord", alsaArgs);
553 kDebug() << "Capture: Running ffmpeg " << m_captureArgs.join(" ");
554 captureProcess->start("ffmpeg", m_captureArgs);
557 void RecMonitor::slotProcessStatus(QProcess::ProcessState status)
559 if (status == QProcess::NotRunning) {
560 m_displayProcess->kill();
561 if (m_isCapturing && device_selector->currentIndex() != FIREWIRE)
562 if (autoaddbox->isChecked() && QFile::exists(m_captureFile.path())) emit addProjectClip(m_captureFile);
563 if (device_selector->currentIndex() == FIREWIRE) {
564 m_discAction->setIcon(KIcon("network-connect"));
565 m_discAction->setText(i18n("Connect"));
566 m_playAction->setEnabled(false);
567 m_rewAction->setEnabled(false);
568 m_fwdAction->setEnabled(false);
569 m_recAction->setEnabled(false);
572 m_playAction->setIcon(m_playIcon);
573 m_recAction->setChecked(false);
574 m_stopAction->setEnabled(false);
575 device_selector->setEnabled(true);
576 if (m_captureProcess && m_captureProcess->exitStatus() == QProcess::CrashExit) {
577 video_frame->setText(i18n("Capture crashed, please check your parameters"));
579 if (device_selector->currentIndex() != SCREENGRAB) video_frame->setText(i18n("Not connected"));
580 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())));
582 m_isCapturing = false;
585 #if KDE_IS_VERSION(4,2,0)
586 // update free space info
587 slotUpdateFreeSpace();
591 if (device_selector->currentIndex() != SCREENGRAB) m_stopAction->setEnabled(true);
592 device_selector->setEnabled(false);
596 void RecMonitor::manageCapturedFiles()
599 switch (KdenliveSettings::firewireformat()) {
611 QDir dir(KdenliveSettings::capturefolder());
613 QString capturename = KdenliveSettings::dvgrabfilename();
614 if (capturename.isEmpty()) capturename = "capture";
615 filters << capturename + "*" + extension;
616 const QStringList result = dir.entryList(filters, QDir::Files, QDir::Time);
617 KUrl::List capturedFiles;
618 foreach(const QString &name, result) {
619 KUrl url = KUrl(dir.filePath(name));
620 if (KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, this)) {
621 KFileItem file(KFileItem::Unknown, KFileItem::Unknown, url, true);
622 if (file.time(KFileItem::ModificationTime) > m_captureTime) capturedFiles.append(url);
625 kDebug() << "Found : " << capturedFiles.count() << " new capture files";
626 kDebug() << capturedFiles;
628 if (capturedFiles.count() > 0) {
629 ManageCapturesDialog *d = new ManageCapturesDialog(capturedFiles, this);
630 if (d->exec() == QDialog::Accepted) {
631 capturedFiles = d->importFiles();
632 foreach(const KUrl &url, capturedFiles) {
633 emit addProjectClip(url);
641 void RecMonitor::mousePressEvent(QMouseEvent * /*event*/)
643 #if KDE_IS_VERSION(4,2,0)
644 if (m_freeSpace->underMouse()) slotUpdateFreeSpace();
648 void RecMonitor::slotUpdateFreeSpace()
650 #if KDE_IS_VERSION(4,2,0)
651 KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(KdenliveSettings::capturefolder());
652 if (info.isValid()) {
653 m_freeSpace->setValue(100 * info.used() / info.size());
654 m_freeSpace->setText(i18n("Free space: %1", KIO::convertSize(info.available())));
655 m_freeSpace->update();
660 void RecMonitor::activateRecMonitor()
662 //if (!m_isActive) m_monitorManager->activateRecMonitor(m_name);
665 void RecMonitor::stop()
671 void RecMonitor::start()
677 void RecMonitor::refreshRecMonitor(bool visible)
680 //if (!m_isActive) m_monitorManager->activateRecMonitor(m_name);
685 void RecMonitor::slotPlay()
688 //if (!m_isActive) m_monitorManager->activateRecMonitor(m_name);
692 void RecMonitor::slotReadDvgrabInfo()
694 QString data = m_captureProcess->readAllStandardError().simplified();
695 data = data.section('"', 2, 2).simplified();
696 m_dvinfo.setText(data.left(11));
697 m_dvinfo.updateGeometry();
700 #include "recmonitor.moc"