From 7cd7234fe261491efe2f9e55be980c326ee0a002 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Sat, 17 Mar 2012 11:27:50 +0100 Subject: [PATCH] Image sequences can now start at an arbitrary frame, just select the first one in slideshow dialog: http://kdenlive.org/mantis/view.php?id=2508 --- src/projectlist.cpp | 7 +------ src/slideshowclip.cpp | 22 +++++++++++----------- src/slideshowclip.h | 3 --- src/widgets/slideshowclip_ui.ui | 2 +- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/projectlist.cpp b/src/projectlist.cpp index ce01e828..3ebba4c6 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -1831,11 +1831,7 @@ void ProjectList::slotAddSlideshowClip() QMap properties; properties.insert("name", dia->clipName()); - int begin = dia->begin(); - if (begin > 0) - properties.insert("resource", dia->selectedPath() + "?" + QString::number(begin)); - else - properties.insert("resource", dia->selectedPath()); + properties.insert("resource", dia->selectedPath()); properties.insert("in", "0"); properties.insert("out", QString::number(m_doc->getFramePos(dia->clipDuration()) * dia->imageCount())); properties.insert("ttl", QString::number(m_doc->getFramePos(dia->clipDuration()))); @@ -1846,7 +1842,6 @@ void ProjectList::slotAddSlideshowClip() properties.insert("luma_file", dia->lumaFile()); properties.insert("softness", QString::number(dia->softness())); properties.insert("animation", dia->animation()); - properties.insert("begin", QString::number(dia->begin())); m_doc->slotCreateSlideshowClipFile(properties, groupInfo.at(0), groupInfo.at(1)); } diff --git a/src/slideshowclip.cpp b/src/slideshowclip.cpp index db30cfc0..848780b3 100644 --- a/src/slideshowclip.cpp +++ b/src/slideshowclip.cpp @@ -31,7 +31,6 @@ SlideshowClip::SlideshowClip(Timecode tc, QWidget * parent) : QDialog(parent), m_count(0), - m_patternBegin(0), m_timecode(tc), m_thumbJob(NULL) { @@ -177,12 +176,13 @@ int SlideshowClip::sequenceCount(KUrl file) // Find number of digits in sequence int precision = fullSize - filter.size(); + int firstFrame = file.fileName().section('.', 0, -2).right(precision).toInt(); QString folder = file.directory(KUrl::AppendTrailingSlash); // Check how many files we have QDir dir(folder); QString path; int gap = 0; - for (int i = 0; gap < 100; i++) { + for (int i = firstFrame; gap < 100; i++) { path = filter + QString::number(i).rightJustified(precision, '0', false) + ext; if (dir.exists(path)) { count ++; @@ -219,13 +219,13 @@ void SlideshowClip::parseFolder() filter = filter.section('.', 0, -2); int fullSize = filter.size(); while (filter.at(filter.size() - 1).isDigit()) { - filter.remove(filter.size() - 1, 1); + filter.chop(1); } int precision = fullSize - filter.size(); - m_patternBegin = m_view.pattern_url->url().fileName().section('.', 0, -2).right(precision).toInt(); + int firstFrame = m_view.pattern_url->url().fileName().section('.', 0, -2).right(precision).toInt(); QString path; int gap = 0; - for (int i = m_patternBegin; gap < 100; i++) { + for (int i = firstFrame; gap < 100; i++) { path = filter + QString::number(i).rightJustified(precision, '0', false) + ext; if (dir.exists(path)) { result.append(path); @@ -300,6 +300,7 @@ QString SlideshowClip::selectedPath() else url = m_view.pattern_url->url(); QString path = selectedPath(url, m_view.method_mime->isChecked(), ".all." + m_view.image_type->itemData(m_view.image_type->currentIndex()).toString(), &list); m_count = list.count(); + kDebug()<<"// SELECTED PATH: "< 0) extension = filter + "%" + QString::number(firstFrame).rightJustified(precision, '0', false) + "d" + ext; + else extension = filter + "%" + QString::number(precision) + "d" + ext; } kDebug() << "// FOUND " << (*list).count() << " items for " << url.path(); return folder + extension; @@ -467,10 +471,6 @@ QString SlideshowClip::animationToGeometry(const QString &animation, int &ttl) return geometry; } -int SlideshowClip::begin() const -{ - return m_patternBegin; -} #include "slideshowclip.moc" diff --git a/src/slideshowclip.h b/src/slideshowclip.h index 4189987b..69fc496f 100644 --- a/src/slideshowclip.h +++ b/src/slideshowclip.h @@ -48,8 +48,6 @@ public: QString lumaFile() const; int softness() const; QString animation() const; - /** @brief Return the first number for the sequence begining */ - int begin() const; /** @brief Check if there are several files with filename pattern, like: image_001.jpg, image_002.jpg,... */ static int sequenceCount(KUrl file); @@ -74,7 +72,6 @@ private slots: private: Ui::SlideshowClip_UI m_view; int m_count; - int m_patternBegin; Timecode m_timecode; KIO::PreviewJob *m_thumbJob; }; diff --git a/src/widgets/slideshowclip_ui.ui b/src/widgets/slideshowclip_ui.ui index 9fec467c..54a939f6 100644 --- a/src/widgets/slideshowclip_ui.ui +++ b/src/widgets/slideshowclip_ui.ui @@ -94,7 +94,7 @@ - Image name + First frame -- 2.39.2