]> git.sesse.net Git - kdenlive/blobdiff - src/slideshowclip.cpp
Merge branch 'master' into audioAlign
[kdenlive] / src / slideshowclip.cpp
index 336b3c92467d03827ebbfa264338187fa5131081..db30cfc0e4ec54b8ff77d1cfd5e6a321246b4d8c 100644 (file)
@@ -23,6 +23,7 @@
 #include <KStandardDirs>
 #include <KDebug>
 #include <KFileItem>
+#include <kdeversion.h>
 
 #include <QDir>
 
@@ -30,6 +31,7 @@
 SlideshowClip::SlideshowClip(Timecode tc, QWidget * parent) :
     QDialog(parent),
     m_count(0),
+    m_patternBegin(0),
     m_timecode(tc),
     m_thumbJob(NULL)
 {
@@ -67,10 +69,8 @@ SlideshowClip::SlideshowClip(Timecode tc, QWidget * parent) :
     m_view.animation->addItem(i18n("Zoom"), "Zoom");
     m_view.animation->addItem(i18n("Zoom, low-pass"), "Zoom, low-pass");
 
-    m_view.clip_duration->setInputMask("");
-    m_view.clip_duration->setValidator(m_timecode.validator());
-    m_view.luma_duration->setInputMask("");
-    m_view.luma_duration->setValidator(m_timecode.validator());
+    m_view.clip_duration->setInputMask(m_timecode.mask());
+    m_view.luma_duration->setInputMask(m_timecode.mask());
     m_view.luma_duration->setText(m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))));
     m_view.folder_url->setUrl(QDir::homePath());
 
@@ -158,6 +158,7 @@ void SlideshowClip::slotEnableLumaFile(int state)
 }
 
 // static
+//TODO: sequence begin
 int SlideshowClip::sequenceCount(KUrl file)
 {
     // find pattern
@@ -221,9 +222,10 @@ void SlideshowClip::parseFolder()
             filter.remove(filter.size() - 1, 1);
         }
         int precision = fullSize - filter.size();
+        m_patternBegin = m_view.pattern_url->url().fileName().section('.', 0, -2).right(precision).toInt();
         QString path;
         int gap = 0;
-        for (int i = 0; gap < 100; i++) {
+        for (int i = m_patternBegin; gap < 100; i++) {
             path = filter + QString::number(i).rightJustified(precision, '0', false) + ext;
             if (dir.exists(path)) {
                 result.append(path);
@@ -262,7 +264,13 @@ void SlideshowClip::slotGenerateThumbs()
             }
         }
     }
-    m_thumbJob = new KIO::PreviewJob(fileList, 50, 0, 0, 0, true, true, 0);
+#if KDE_IS_VERSION(4,7,0)
+    m_thumbJob = new KIO::PreviewJob(fileList, QSize(50, 50));
+    m_thumbJob->setScaleType(KIO::PreviewJob::Scaled);
+#else
+    m_thumbJob = new KIO::PreviewJob(fileList, 50, 0, 0, 0, true, false, 0);
+#endif
+
     m_thumbJob->setAutoDelete(false);
     connect(m_thumbJob, SIGNAL(gotPreview(const KFileItem &, const QPixmap &)), this, SLOT(slotSetPixmap(const KFileItem &, const QPixmap &)));
     m_thumbJob->start();
@@ -416,11 +424,7 @@ void SlideshowClip::slotUpdateDurationFormat(int ix)
         m_view.luma_duration_frames->setValue(m_timecode.getFrameCount(m_view.luma_duration->text()));
     } else {
         // switching to timecode format
-        m_view.clip_duration->setInputMask("");
-        m_view.clip_duration->setValidator(m_timecode.validator());
         m_view.clip_duration->setText(m_timecode.getTimecodeFromFrames(m_view.clip_duration_frames->value()));
-        m_view.luma_duration->setInputMask("");
-        m_view.luma_duration->setValidator(m_timecode.validator());
         m_view.luma_duration->setText(m_timecode.getTimecodeFromFrames(m_view.luma_duration_frames->value()));
     }
     m_view.clip_duration_frames->setHidden(!framesFormat);
@@ -433,16 +437,12 @@ void SlideshowClip::slotMethodChanged(bool active)
 {
     if (active) {
         // User wants mimetype image sequence
-        if (m_view.clip_duration->text().isEmpty()) {
-            m_view.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::image_duration()));
-        }
+        m_view.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::image_duration()));
         m_view.stackedWidget->setCurrentIndex(0);
         KdenliveSettings::setSlideshowbymime(true);
     } else {
         // User wants pattern image sequence
-        if (m_view.clip_duration->text().isEmpty()) {
-            m_view.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()));
-        }
+        m_view.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()));
         m_view.stackedWidget->setCurrentIndex(1);
         KdenliveSettings::setSlideshowbymime(false);
     }
@@ -454,19 +454,24 @@ QString SlideshowClip::animationToGeometry(const QString &animation, int &ttl)
 {
     QString geometry;
     if (animation.startsWith("Pan and zoom")) {
-        geometry = QString().sprintf("0=0,0:100%%x100%%;%d=-14%%,-14%%:120%%x120%%;%d=-5%%,-5%%:110%%x110%%;%d=0,0:110%%x110%%;%d=0,-5%%:110%%x110%%;%d=-5%%,0:110%%x110%%",
+        geometry = QString().sprintf("0=0/0:100%%x100%%;%d=-14%%/-14%%:120%%x120%%;%d=-5%%/-5%%:110%%x110%%;%d=0/0:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/0:110%%x110%%",
                                      ttl - 1, ttl, ttl * 2 - 1, ttl * 2, ttl * 3 - 1);
         ttl *= 3;
     } else if (animation.startsWith("Pan")) {
-        geometry = QString().sprintf("0=-5%%,-5%%:110%%x110%%;%d=0,0:110%%x110%%;%d=0,0:110%%x110%%;%d=0,-5%%:110%%x110%%;%d=0,-5%%:110%%x110%%;%d=-5%%,-5%%:110%%x110%%;%d=0,-5%%:110%%x110%%;%d=-5%%,0:110%%x110%%",
+        geometry = QString().sprintf("0=-5%%/-5%%:110%%x110%%;%d=0/0:110%%x110%%;%d=0/0:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/-5%%:110%%x110%%;%d=0/-5%%:110%%x110%%;%d=-5%%/0:110%%x110%%",
                                      ttl - 1, ttl, ttl * 2 - 1, ttl * 2, ttl * 3 - 1, ttl * 3, ttl * 4 - 1);
         ttl *= 4;
     } else if (animation.startsWith("Zoom")) {
-        geometry = QString().sprintf("0=0,0:100%%x100%%;%d=-14%%,-14%%:120%%x120%%", ttl - 1);
+        geometry = QString().sprintf("0=0/0:100%%x100%%;%d=-14%%/-14%%:120%%x120%%", ttl - 1);
     }
     return geometry;
 }
 
+int SlideshowClip::begin() const
+{
+   return m_patternBegin;
+}
+
 #include "slideshowclip.moc"