X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fstopmotion%2Fstopmotion.cpp;h=120e208f8c697c39a23ebaabdbba84681bb69eb0;hb=8de0bdc9a16f0dd3b97d437a89e8217303947816;hp=572664a96dfd12541591b59f4401bcd400057da9;hpb=3d9ff40b713934e307b6ac7808bd8d56d0bd66f7;p=kdenlive diff --git a/src/stopmotion/stopmotion.cpp b/src/stopmotion/stopmotion.cpp index 572664a9..120e208f 100644 --- a/src/stopmotion/stopmotion.cpp +++ b/src/stopmotion/stopmotion.cpp @@ -58,8 +58,10 @@ void MyLabel::setImage(const QImage& img) //virtual void MyLabel::wheelEvent(QWheelEvent* event) { - if (event->delta() > 0) emit seek(true); - else emit seek(false); + if (event->delta() > 0) + emit seek(true); + else + emit seek(false); } //virtual @@ -91,7 +93,7 @@ void MyLabel::paintEvent(QPaintEvent* event) StopmotionMonitor::StopmotionMonitor(MonitorManager *manager, QWidget *parent) : - AbstractMonitor(Kdenlive::stopmotionMonitor, manager, parent), + AbstractMonitor(Kdenlive::StopMotionMonitor, manager, parent), m_captureDevice(NULL) { createVideoSurface(); @@ -115,9 +117,9 @@ AbstractRender *StopmotionMonitor::abstractRender() return m_captureDevice; } -Kdenlive::MONITORID StopmotionMonitor::id() const +Kdenlive::MonitorId StopmotionMonitor::id() const { - return Kdenlive::stopmotionMonitor; + return Kdenlive::StopMotionMonitor; } @@ -141,14 +143,14 @@ void StopmotionMonitor::slotMouseSeek(int /*eventDelta*/, bool /*fast*/) StopmotionWidget::StopmotionWidget(MonitorManager *manager, const KUrl &projectFolder, const QList &actions, QWidget* parent) : QDialog(parent) - , Ui::Stopmotion_UI() - , m_projectFolder(projectFolder) - , m_captureDevice(NULL) - , m_sequenceFrame(0) - , m_animatedIndex(-1) - , m_animate(false) - , m_manager(manager) - , m_monitor(new StopmotionMonitor(manager, this)) + , Ui::Stopmotion_UI() + , m_projectFolder(projectFolder) + , m_captureDevice(NULL) + , m_sequenceFrame(0) + , m_animatedIndex(-1) + , m_animate(false) + , m_manager(manager) + , m_monitor(new StopmotionMonitor(manager, this)) { //setAttribute(Qt::WA_DeleteOnClose); //HACK: the monitor widget is hidden, it is just used to control the capturedevice from monitormanager @@ -220,7 +222,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, const KUrl &projectF effectsMenu->addAction(invertEffect); effectsMenu->addAction(thresEffect); QList list = effectsMenu->actions(); - for (int i = 0; i < list.count(); i++) { + for (int i = 0; i < list.count(); ++i) { list.at(i)->setCheckable(true); if (list.at(i)->data().toInt() == m_effectIndex) { list.at(i)->setChecked(true); @@ -266,7 +268,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, const KUrl &projectF if (QFile::exists(KdenliveSettings::video4vdevice())) { #ifdef USE_V4L // Video 4 Linux device detection - for (int i = 0; i < 10; i++) { + for (int i = 0; i < 10; ++i) { QString path = "/dev/video" + QString::number(i); if (QFile::exists(path)) { QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path); @@ -345,7 +347,8 @@ StopmotionWidget::~StopmotionWidget() void StopmotionWidget::slotUpdateOverlayEffect(QAction* act) { - if (act) m_effectIndex = act->data().toInt(); + if (act) + m_effectIndex = act->data().toInt(); KdenliveSettings::setStopmotioneffect(m_effectIndex); slotUpdateOverlay(); } @@ -488,7 +491,7 @@ void StopmotionWidget::slotLive(bool isOn) connect(m_captureDevice, SIGNAL(frameSaved(QString)), this, SLOT(slotNewThumb(QString))); } - m_manager->activateMonitor(Kdenlive::stopmotionMonitor); + m_manager->activateMonitor(Kdenlive::StopMotionMonitor); QString producer = createProducer(profile, service, resource); if (m_captureDevice->slotStartPreview(producer, true)) { if (m_showOverlay->isChecked()) { @@ -550,7 +553,7 @@ void StopmotionWidget::slotShowOverlay(bool isOn) void StopmotionWidget::reloadOverlay() { - QString path = getPathForFrame(m_sequenceFrame - 1); + const QString path = getPathForFrame(m_sequenceFrame - 1); if (!QFile::exists(path)) { log_box->insertItem(-1, i18n("No previous frame found")); log_box->setCurrentIndex(0); @@ -649,10 +652,12 @@ void StopmotionWidget::slotCaptureFrame() m_sequenceFrame++; button_addsequence->setEnabled(true); if (capture_interval->isChecked()) { - if (KdenliveSettings::sm_prenotify()) QTimer::singleShot((KdenliveSettings::captureinterval() - KdenliveSettings::sm_notifytime()) * 1000, this, SLOT(slotPreNotify())); + if (KdenliveSettings::sm_prenotify()) + QTimer::singleShot((KdenliveSettings::captureinterval() - KdenliveSettings::sm_notifytime()) * 1000, this, SLOT(slotPreNotify())); m_intervalTimer.start(); } - else m_captureAction->setChecked(false); + else + m_captureAction->setChecked(false); } void StopmotionWidget::slotPreNotify() @@ -672,7 +677,8 @@ void StopmotionWidget::slotNewThumb(const QString &path) void StopmotionWidget::slotPrepareThumbs() { - if (m_filesList.isEmpty()) return; + if (m_filesList.isEmpty()) + return; QString path = m_filesList.takeFirst(); emit doCreateThumbs(QImage(path), SlideshowClip::getFrameNumberFromPath(path)); @@ -707,8 +713,9 @@ void StopmotionWidget::slotCreateThumbs(const QImage &img, int ix) QString StopmotionWidget::getPathForFrame(int ix, QString seqName) { - if (seqName.isEmpty()) seqName = m_sequenceName; - return m_projectFolder.path(KUrl::AddTrailingSlash) + seqName + '_' + QString::number(ix).rightJustified(4, '0', false) + ".png"; + if (seqName.isEmpty()) + seqName = m_sequenceName; + return m_projectFolder.path(KUrl::AddTrailingSlash) + seqName + QLatin1Char('_') + QString::number(ix).rightJustified(4, '0', false) + QLatin1String(".png"); } void StopmotionWidget::slotShowFrame(const QString& path) @@ -835,7 +842,8 @@ void StopmotionWidget::selectFrame(int ix) { frame_list->blockSignals(true); QListWidgetItem* item = getFrameFromIndex(ix); - if (!item) return; + if (!item) + return; frame_list->setCurrentItem(item); frame_list->blockSignals(false); } @@ -852,7 +860,9 @@ void StopmotionWidget::slotRemoveFrame() { if (frame_list->currentItem() == NULL) return; QString path = frame_list->currentItem()->toolTip(); - if (KMessageBox::questionYesNo(this, i18n("Delete frame %1 from disk?", path), i18n("Delete Frame")) != KMessageBox::Yes) return; + if (KMessageBox::questionYesNo(this, i18n("Delete frame %1 from disk?", path), i18n("Delete Frame")) != KMessageBox::Yes) + return; + QFile f(path); if (f.remove()) { QListWidgetItem* item = frame_list->takeItem(frame_list->currentRow()); @@ -875,11 +885,12 @@ void StopmotionWidget::slotSwitchAnalyse(bool isOn) void StopmotionWidget::slotSwitchMirror(bool isOn) { //KdenliveSettings::setAnalyse_stopmotion(isOn); - if (m_captureDevice) m_captureDevice->mirror(isOn); + if (m_captureDevice) + m_captureDevice->mirror(isOn); } -const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QString &service, const QString &resource) +const QString StopmotionWidget::createProducer(const MltVideoProfile &profile, const QString &service, const QString &resource) { Q_UNUSED(profile) @@ -902,3 +913,5 @@ const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QS + +#include "stopmotion.moc"