#include <KFileItem>
#include <KMessageBox>
#include <KApplication>
-
-#if KDE_IS_VERSION(4,2,0)
#include <KDiskFreeSpaceInfo>
-#endif
-
#include <QMouseEvent>
#include <QMenu>
#include <QToolButton>
m_logger.setFrame(false);
//m_logger.setInsertPolicy(QComboBox::InsertAtTop);
-#if KDE_IS_VERSION(4,2,0)
m_freeSpace = new KCapacityBar(KCapacityBar::DrawTextInline, this);
m_freeSpace->setMaximumWidth(150);
QFontMetricsF fontMetrics(font());
connect(&m_spaceTimer, SIGNAL(timeout()), this, SLOT(slotUpdateFreeSpace()));
m_spaceTimer.setInterval(30000);
m_spaceTimer.setSingleShot(false);
-#endif
control_frame_firewire->setLayout(layout);
m_displayProcess = new QProcess;
RecMonitor::~RecMonitor()
{
-#if KDE_IS_VERSION(4,2,0)
m_spaceTimer.stop();
-#endif
delete m_captureProcess;
delete m_displayProcess;
if (m_captureDevice) delete m_captureDevice;
else KMessageBox::information(this, i18n("You need to stop capture before your changes can be applied"), i18n("Capturing"));
} else slotVideoDeviceChanged(device_selector->currentIndex());
-#if KDE_IS_VERSION(4,2,0)
// update free space info
slotUpdateFreeSpace();
-#endif
}
void RecMonitor::slotVideoDeviceChanged(int ix)
m_isCapturing = true;
m_didCapture = true;
m_captureProcess->write("c\n", 3);
-#if KDE_IS_VERSION(4,2,0)
m_spaceTimer.start();
-#endif
return;
}
if (m_captureProcess->state() == QProcess::NotRunning) {
}
m_isCapturing = false;
-#if KDE_IS_VERSION(4,2,0)
m_spaceTimer.stop();
// update free space info
slotUpdateFreeSpace();
-#endif
-
} else {
if (device_selector->currentIndex() != SCREENGRAB) m_stopAction->setEnabled(true);
device_selector->setEnabled(false);
KUrl url = KUrl(dir.filePath(name));
if (KIO::NetAccess::exists(url, KIO::NetAccess::SourceSide, this)) {
KFileItem file(KFileItem::Unknown, KFileItem::Unknown, url, true);
- if (file.time(KFileItem::ModificationTime) > m_captureTime) capturedFiles.append(url);
+ if (file.time(KFileItem::ModificationTime) > m_captureTime) {
+ // The file was captured in the last batch
+ if (url.fileName().contains(':')) {
+ // Several dvgrab options (--timecode,...) use : in the file name, which is
+ // not supported by MLT, so rename them
+ QString newUrl = url.directory(KUrl::AppendTrailingSlash) + url.fileName().replace(':', '_');
+ if (QFile::rename(url.path(), newUrl)) {
+ url = KUrl(newUrl);
+ }
+
+ }
+ capturedFiles.append(url);
+ }
}
}
kDebug() << "Found : " << capturedFiles.count() << " new capture files";
if (capturedFiles.count() > 0) {
ManageCapturesDialog *d = new ManageCapturesDialog(capturedFiles, this);
if (d->exec() == QDialog::Accepted) {
- capturedFiles = d->importFiles();
- foreach(const KUrl & url, capturedFiles) {
- emit addProjectClip(url);
- }
+ emit addProjectClipList(d->importFiles());
}
delete d;
}
// virtual
void RecMonitor::mousePressEvent(QMouseEvent * /*event*/)
{
-#if KDE_IS_VERSION(4,2,0)
if (m_freeSpace->underMouse()) slotUpdateFreeSpace();
-#endif
}
void RecMonitor::slotUpdateFreeSpace()
{
-#if KDE_IS_VERSION(4,2,0)
KDiskFreeSpaceInfo info = KDiskFreeSpaceInfo::freeSpaceInfo(m_capturePath);
if (info.isValid() && info.size() > 0) {
m_freeSpace->setValue(100 * info.used() / info.size());
m_freeSpace->setText(i18n("Free space: %1", KIO::convertSize(info.available())));
m_freeSpace->update();
}
-#endif
}
void RecMonitor::refreshRecMonitor(bool visible)