X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Frecmonitor.cpp;h=e66a8f1572378476d6ca443285c4a25a2ef7b8ca;hb=c24658bd34221d735f0641c924b890e1a6be7101;hp=f2395efb87d2294b945cc356777843c12238bcea;hpb=c5e042e1e861fa7bec6d56cb61e80477e97569be;p=kdenlive diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index f2395efb..e66a8f15 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -28,7 +28,7 @@ #include "profilesdialog.h" #include -#include +#include #include #include #include @@ -45,7 +45,7 @@ #include -RecMonitor::RecMonitor(Kdenlive::MONITORID name, MonitorManager *manager, QWidget *parent) : +RecMonitor::RecMonitor(Kdenlive::MonitorId name, MonitorManager *manager, QWidget *parent) : AbstractMonitor(name, manager, parent), m_isCapturing(false), m_didCapture(false), @@ -181,7 +181,7 @@ RecMonitor::~RecMonitor() m_spaceTimer.stop(); delete m_captureProcess; delete m_displayProcess; - if (m_captureDevice) delete m_captureDevice; + delete m_captureDevice; } void RecMonitor::mouseDoubleClickEvent(QMouseEvent * event) @@ -233,7 +233,15 @@ void RecMonitor::slotVideoDeviceChanged(int ix) { QString capturefile; QString capturename; - m_infoMessage->animatedHide(); +#if KDE_IS_VERSION(4,7,0) + if (m_infoMessage->isVisible()) { +#if KDE_IS_VERSION(4,10,0) + m_infoMessage->animatedHide(); +#else + QTimer::singleShot(0, m_infoMessage, SLOT(animatedHide())); +#endif + } +#endif m_previewSettings->setEnabled(ix == VIDEO4LINUX || ix == BLACKMAGIC); control_frame->setVisible(ix == VIDEO4LINUX); m_playAction->setVisible(ix != SCREENGRAB); @@ -266,13 +274,13 @@ void RecMonitor::slotVideoDeviceChanged(int ix) // Check for libav version exepath = KStandardDirs::findExe("avconv"); } - if (exepath.isEmpty()) showMessage(i18n("ffmpeg or avconv not found,\n please install it for screen grabs"), "dialog-warning"); + if (exepath.isEmpty()) showWarningMessage(i18n("ffmpeg or avconv not found,\n please install it for screen grabs")); else KdenliveSettings::setFfmpegpath(exepath); } if (!KdenliveSettings::ffmpegpath().isEmpty()) { if (!Render::checkX11Grab()) { // FFmpeg does not support screen grab - showMessage("dialog-warning", i18n("Your FFmpeg / Libav installation\n does not support screen grab")); + showWarningMessage(i18n("Your FFmpeg / Libav installation\n does not support screen grab")); m_recAction->setEnabled(false); } 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", m_capturePath))); @@ -306,7 +314,7 @@ void RecMonitor::slotVideoDeviceChanged(int ix) if (KdenliveSettings::dvgrab_path().isEmpty()) { QString dvgrabpath = KStandardDirs::findExe("dvgrab"); if (dvgrabpath.isEmpty()) { - showMessage(i18n("dvgrab utility not found,\n please install it for firewire capture"), "dialog-warning"); + showWarningMessage(i18n("dvgrab utility not found,\n please install it for firewire capture")); } else KdenliveSettings::setDvgrab_path(dvgrabpath); } else { @@ -418,10 +426,8 @@ void RecMonitor::slotStopCapture() m_isPlaying = false; break; case SCREENGRAB: - m_captureProcess->write("q\n", 3); - m_captureProcess->terminate(); - //video_frame->setText(i18n("Encoding captured video...")); - QTimer::singleShot(1000, m_captureProcess, SLOT(kill())); + m_captureProcess->terminate(); + QTimer::singleShot(1500, m_captureProcess, SLOT(kill())); break; case VIDEO4LINUX: case BLACKMAGIC: @@ -606,7 +612,7 @@ void RecMonitor::slotRecord() while (QFile::exists(path)) { QString num = QString::number(i).rightJustified(4, '0', false); path = KUrl(m_capturePath).path(KUrl::AddTrailingSlash) + "capture" + num + '.' + extension; - i++; + ++i; } m_captureFile = KUrl(path); @@ -717,14 +723,14 @@ void RecMonitor::slotRecord() m_captureArgs << "-f" << "x11grab"; if (KdenliveSettings::grab_follow_mouse()) m_captureArgs << "-follow_mouse" << "centered"; if (!KdenliveSettings::grab_hide_frame()) m_captureArgs << "-show_region" << "1"; + captureSize = ":0.0"; if (KdenliveSettings::grab_capture_type() == 0) { // Full screen capture - captureSize = ":0.0"; m_captureArgs << "-s" << QString::number(screenSize.width()) + "x" + QString::number(screenSize.height()); } else { // Region capture m_captureArgs << "-s" << QString::number(KdenliveSettings::grab_width()) + "x" + QString::number(KdenliveSettings::grab_height()); - captureSize = ":" + QString::number(KdenliveSettings::grab_offsetx()) + "." + QString::number(KdenliveSettings::grab_offsetx()); + captureSize.append("+" + QString::number(KdenliveSettings::grab_offsetx()) + "." + QString::number(KdenliveSettings::grab_offsetx())); } // fps m_captureArgs << "-r" << QString::number(KdenliveSettings::grab_fps()); @@ -758,7 +764,7 @@ void RecMonitor::slotRecord() m_captureProcess->start(KdenliveSettings::ffmpegpath(), m_captureArgs); if (!m_captureProcess->waitForStarted()) { // Problem launching capture app - showMessage(i18n("Failed to start the capture application:\n%1", KdenliveSettings::ffmpegpath()), "dialog-warning"); + showWarningMessage(i18n("Failed to start the capture application:\n%1", KdenliveSettings::ffmpegpath())); } //kDebug() << "// Screen grab params: " << m_captureArgs; break; @@ -782,7 +788,7 @@ void RecMonitor::slotRecord() } -void RecMonitor::showMessage(const QString &text, const QString &icon, bool logAction) +void RecMonitor::showWarningMessage(const QString &text, bool logAction) { #if KDE_IS_VERSION(4,7,0) m_infoMessage->setText(text); @@ -792,20 +798,25 @@ void RecMonitor::showMessage(const QString &text, const QString &icon, bool logA connect(manualAction, SIGNAL(triggered()), this, SLOT(slotShowLog())); m_infoMessage->addAction(manualAction); } - m_infoMessage->animatedShow(); +#if KDE_IS_VERSION(4,10,0) + if (isVisible()) + m_infoMessage->animatedShow(); +#else + QTimer::singleShot(0, m_infoMessage, SLOT(animatedShow())); +#endif #else if (!logAction) { - video_frame->setPixmap(mergeSideBySide(KIcon(icon).pixmap(QSize(50, 50)), text)); + video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), text)); } else { video_frame->setText(QString("" + text + "
" + i18n("Show log") + "")); - connect(video_frame, SIGNAL(linkActivated (const QString &)), this, SLOT(slotShowLog())); + connect(video_frame, SIGNAL(linkActivated(QString)), this, SLOT(slotShowLog())); } #endif } -const QString RecMonitor::getV4lXmlPlaylist(MltVideoProfile profile, bool *isXml) +const QString RecMonitor::getV4lXmlPlaylist(const MltVideoProfile &profile, bool *isXml) { QString playlist; if (rec_video->isChecked() && rec_audio->isChecked()) { @@ -867,7 +878,6 @@ void RecMonitor::slotStartGrab(const QRect &rect) { void RecMonitor::slotProcessStatus(QProcess::ProcessState status) { - kDebug()<<"// STATUS CHANGED: "<kill(); if (m_isCapturing && device_selector->currentIndex() != FIREWIRE) @@ -892,14 +902,14 @@ void RecMonitor::slotProcessStatus(QProcess::ProcessState status) m_stopAction->setEnabled(false); device_selector->setEnabled(true); if (m_captureProcess && m_captureProcess->exitStatus() == QProcess::CrashExit) { - showMessage(i18n("Capture crashed, please check your parameters"), "dialog-warning", true); + showWarningMessage(i18n("Capture crashed, please check your parameters"), true); } else { if (device_selector->currentIndex() != SCREENGRAB) { video_frame->setText(i18n("Not connected")); } else { int code = m_captureProcess->exitCode(); if (code != 0 && code != 255) { - showMessage(i18n("Capture crashed, please check your parameters"), "dialog-warning", true); + showWarningMessage(i18n("Capture crashed, please check your parameters"), true); } 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", m_capturePath))); } @@ -960,7 +970,7 @@ void RecMonitor::manageCapturedFiles() kDebug() << "Found : " << capturedFiles.count() << " new capture files"; kDebug() << capturedFiles; - if (capturedFiles.count() > 0) { + if (!capturedFiles.isEmpty()) { QPointer d = new ManageCapturesDialog(capturedFiles, this); if (d->exec() == QDialog::Accepted) { emit addProjectClipList(d->importFiles());