]> git.sesse.net Git - kdenlive/blobdiff - src/projectlist.cpp
* Add preliminary support for Blackmagic HDMI capture card
[kdenlive] / src / projectlist.cpp
index 8b2d0aa5d1dc7a9f69f083a0f1cc690abc469833..e422639ada7d709941ad863cec90dac706d7cb2b 100644 (file)
@@ -32,6 +32,7 @@
 #include "kthumb.h"
 #include "projectlistview.h"
 #include "timecodedisplay.h"
+#include "profilesdialog.h"
 #include "editclipcommand.h"
 #include "editclipcutcommand.h"
 #include "editfoldercommand.h"
@@ -47,6 +48,7 @@
 #include <KMessageBox>
 #include <KIO/NetAccess>
 #include <KFileItem>
+#include <KApplication>
 #ifdef NEPOMUK
 #include <nepomuk/global.h>
 #include <nepomuk/resourcemanager.h>
 #include <QInputDialog>
 
 ProjectList::ProjectList(QWidget *parent) :
-        QWidget(parent),
-        m_render(NULL),
-        m_fps(-1),
-        m_commandStack(NULL),
-        m_editAction(NULL),
-        m_deleteAction(NULL),
-        m_openAction(NULL),
-        m_reloadAction(NULL),
-        m_transcodeAction(NULL),
-        m_doc(NULL),
-        m_refreshed(false),
-        m_infoQueue(),
-        m_thumbnailQueue()
-{
-
-    m_listView = new ProjectListView(this);;
+    QWidget(parent),
+    m_render(NULL),
+    m_fps(-1),
+    m_commandStack(NULL),
+    m_openAction(NULL),
+    m_reloadAction(NULL),
+    m_transcodeAction(NULL),
+    m_doc(NULL),
+    m_refreshed(false),
+    m_infoQueue(),
+    m_thumbnailQueue()
+{
     QVBoxLayout *layout = new QVBoxLayout;
     layout->setContentsMargins(0, 0, 0, 0);
     layout->setSpacing(0);
 
     // setup toolbar
-    KTreeWidgetSearchLine *searchView = new KTreeWidgetSearchLine(this);
-    m_toolbar = new QToolBar("projectToolBar", this);
-    m_toolbar->addWidget(searchView);
-    int s = style()->pixelMetric(QStyle::PM_SmallIconSize);
-    m_toolbar->setIconSize(QSize(s, s));
-    searchView->setTreeWidget(m_listView);
+    QFrame *frame = new QFrame;
+    frame->setFrameStyle(QFrame::NoFrame);
+    QHBoxLayout *box = new QHBoxLayout;
+    KTreeWidgetSearchLine *searchView = new KTreeWidgetSearchLine;
+
+    box->addWidget(searchView);
+    //int s = style()->pixelMetric(QStyle::PM_SmallIconSize);
+    //m_toolbar->setIconSize(QSize(s, s));
 
-    m_addButton = new QToolButton(m_toolbar);
+    m_addButton = new QToolButton;
     m_addButton->setPopupMode(QToolButton::MenuButtonPopup);
-    m_toolbar->addWidget(m_addButton);
+    m_addButton->setAutoRaise(true);
+    box->addWidget(m_addButton);
+
+    m_editButton = new QToolButton;
+    m_editButton->setAutoRaise(true);
+    box->addWidget(m_editButton);
+
+    m_deleteButton = new QToolButton;
+    m_deleteButton->setAutoRaise(true);
+    box->addWidget(m_deleteButton);
+    frame->setLayout(box);
+    layout->addWidget(frame);
 
-    layout->addWidget(m_toolbar);
+    m_listView = new ProjectListView;
     layout->addWidget(m_listView);
     setLayout(layout);
+    searchView->setTreeWidget(m_listView);
 
     m_queueTimer.setInterval(100);
     connect(&m_queueTimer, SIGNAL(timeout()), this, SLOT(slotProcessNextClipInQueue()));
@@ -131,7 +143,6 @@ ProjectList::ProjectList(QWidget *parent) :
 ProjectList::~ProjectList()
 {
     delete m_menu;
-    delete m_toolbar;
     m_listView->blockSignals(true);
     m_listView->clear();
     delete m_listViewDelegate;
@@ -147,13 +158,11 @@ void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction)
     QList <QAction *> actions = addMenu->actions();
     for (int i = 0; i < actions.count(); i++) {
         if (actions.at(i)->data().toString() == "clip_properties") {
-            m_editAction = actions.at(i);
-            m_toolbar->addAction(m_editAction);
+            m_editButton->setDefaultAction(actions.at(i));
             actions.removeAt(i);
             i--;
         } else if (actions.at(i)->data().toString() == "delete_clip") {
-            m_deleteAction = actions.at(i);
-            m_toolbar->addAction(m_deleteAction);
+            m_deleteButton->setDefaultAction(actions.at(i));
             actions.removeAt(i);
             i--;
         } else if (actions.at(i)->data().toString() == "edit_clip") {
@@ -193,10 +202,10 @@ void ProjectList::setupGeneratorMenu(QMenu *addMenu, QMenu *transcodeMenu, QMenu
     m_menu->addAction(m_reloadAction);
     m_menu->addMenu(inTimelineMenu);
     inTimelineMenu->setEnabled(false);
-    m_menu->addAction(m_editAction);
+    m_menu->addAction(m_editButton->defaultAction());
     m_menu->addAction(m_openAction);
-    m_menu->addAction(m_deleteAction);
-    m_menu->insertSeparator(m_deleteAction);
+    m_menu->addAction(m_deleteButton->defaultAction());
+    m_menu->insertSeparator(m_deleteButton->defaultAction());
 }
 
 
@@ -311,13 +320,13 @@ void ProjectList::slotOpenClip()
     if (item) {
         if (item->clipType() == IMAGE) {
             if (KdenliveSettings::defaultimageapp().isEmpty())
-                KMessageBox::sorry(this, i18n("Please set a default application to open images in the Settings dialog"));
+                KMessageBox::sorry(kapp->activeWindow(), i18n("Please set a default application to open images in the Settings dialog"));
             else
                 QProcess::startDetached(KdenliveSettings::defaultimageapp(), QStringList() << item->clipUrl().path());
         }
         if (item->clipType() == AUDIO) {
             if (KdenliveSettings::defaultaudioapp().isEmpty())
-                KMessageBox::sorry(this, i18n("Please set a default application to open audio files in the Settings dialog"));
+                KMessageBox::sorry(kapp->activeWindow(), i18n("Please set a default application to open audio files in the Settings dialog"));
             else
                 QProcess::startDetached(KdenliveSettings::defaultaudioapp(), QStringList() << item->clipUrl().path());
         }
@@ -496,8 +505,8 @@ void ProjectList::slotClipSelected()
     if (m_listView->currentItem()) {
         if (m_listView->currentItem()->type() == PROJECTFOLDERTYPE) {
             emit clipSelected(NULL);
-            m_editAction->setEnabled(false);
-            m_deleteAction->setEnabled(true);
+            m_editButton->defaultAction()->setEnabled(false);
+            m_deleteButton->defaultAction()->setEnabled(true);
             m_openAction->setEnabled(false);
             m_reloadAction->setEnabled(false);
             m_transcodeAction->setEnabled(false);
@@ -505,7 +514,7 @@ void ProjectList::slotClipSelected()
             ProjectItem *clip;
             if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
                 // this is a sub item, use base clip
-                m_deleteAction->setEnabled(true);
+                m_deleteButton->defaultAction()->setEnabled(true);
                 clip = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
                 if (clip == NULL) kDebug() << "-----------ERROR";
                 SubProjectItem *sub = static_cast <SubProjectItem*>(m_listView->currentItem());
@@ -516,8 +525,8 @@ void ProjectList::slotClipSelected()
             clip = static_cast <ProjectItem*>(m_listView->currentItem());
             if (clip)
                 emit clipSelected(clip->referencedClip());
-            m_editAction->setEnabled(true);
-            m_deleteAction->setEnabled(true);
+            m_editButton->defaultAction()->setEnabled(true);
+            m_deleteButton->defaultAction()->setEnabled(true);
             m_reloadAction->setEnabled(true);
             m_transcodeAction->setEnabled(true);
             if (clip && clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
@@ -536,8 +545,8 @@ void ProjectList::slotClipSelected()
         }
     } else {
         emit clipSelected(NULL);
-        m_editAction->setEnabled(false);
-        m_deleteAction->setEnabled(false);
+        m_editButton->defaultAction()->setEnabled(false);
+        m_deleteButton->defaultAction()->setEnabled(false);
         m_openAction->setEnabled(false);
         m_reloadAction->setEnabled(false);
         m_transcodeAction->setEnabled(false);
@@ -559,9 +568,9 @@ void ProjectList::adjustTranscodeActions(ProjectItem *clip) const
         if (data.count() > 2) {
             condition = data.at(2);
             if (condition.startsWith("vcodec"))
-                transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section("=", 1, 1)));
+                transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section('=', 1, 1)));
             else if (condition.startsWith("acodec"))
-                transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section("=", 1, 1)));
+                transcodeActions.at(i)->setEnabled(clip->referencedClip()->hasVideoCodec(condition.section('=', 1, 1)));
         }
     }
 
@@ -679,8 +688,8 @@ void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column)
 void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item)
 {
     bool enable = item ? true : false;
-    m_editAction->setEnabled(enable);
-    m_deleteAction->setEnabled(enable);
+    m_editButton->defaultAction()->setEnabled(enable);
+    m_deleteButton->defaultAction()->setEnabled(enable);
     m_reloadAction->setEnabled(enable);
     m_transcodeAction->setEnabled(enable);
     if (enable) {
@@ -736,7 +745,7 @@ void ProjectList::slotRemoveClip()
             folderids[folder->groupName()] = folder->clipId();
             int children = folder->childCount();
 
-            if (children > 0 && KMessageBox::questionYesNo(this, i18np("Delete folder <b>%2</b>?<br />This will also remove the clip in that folder", "Delete folder <b>%2</b>?<br />This will also remove the %1 clips in that folder",  children, folder->text(1)), i18n("Delete Folder")) != KMessageBox::Yes)
+            if (children > 0 && KMessageBox::questionYesNo(kapp->activeWindow(), i18np("Delete folder <b>%2</b>?<br />This will also remove the clip in that folder", "Delete folder <b>%2</b>?<br />This will also remove the %1 clips in that folder",  children, folder->text(1)), i18n("Delete Folder")) != KMessageBox::Yes)
                 return;
             for (int i = 0; i < children; ++i) {
                 ProjectItem *child = static_cast <ProjectItem *>(folder->child(i));
@@ -745,7 +754,7 @@ void ProjectList::slotRemoveClip()
         } else {
             ProjectItem *item = static_cast <ProjectItem *>(selected.at(i));
             ids << item->clipId();
-            if (item->numReferences() > 0 && KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b>?<br />This will also remove the clip in timeline", "Delete clip <b>%2</b>?<br />This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes)
+            if (item->numReferences() > 0 && KMessageBox::questionYesNo(kapp->activeWindow(), i18np("Delete clip <b>%2</b>?<br />This will also remove the clip in timeline", "Delete clip <b>%2</b>?<br />This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes)
                 return;
         }
     }
@@ -760,14 +769,14 @@ void ProjectList::slotRemoveClip()
 void ProjectList::updateButtons() const
 {
     if (m_listView->topLevelItemCount() == 0) {
-        m_deleteAction->setEnabled(false);
+        m_deleteButton->defaultAction()->setEnabled(false);
     } else {
-        m_deleteAction->setEnabled(true);
+        m_deleteButton->defaultAction()->setEnabled(true);
         if (!m_listView->currentItem())
             m_listView->setCurrentItem(m_listView->topLevelItem(0));
         QTreeWidgetItem *item = m_listView->currentItem();
         if (item && item->type() == PROJECTCLIPTYPE) {
-            m_editAction->setEnabled(true);
+            m_editButton->defaultAction()->setEnabled(true);
             m_openAction->setEnabled(true);
             m_reloadAction->setEnabled(true);
             m_transcodeAction->setEnabled(true);
@@ -775,7 +784,7 @@ void ProjectList::updateButtons() const
         }
     }
 
-    m_editAction->setEnabled(false);
+    m_editButton->defaultAction()->setEnabled(false);
     m_openAction->setEnabled(false);
     m_reloadAction->setEnabled(false);
     m_transcodeAction->setEnabled(false);
@@ -1054,11 +1063,11 @@ QString ProjectList::getExtensions()
     // Build list of mime types
     QStringList mimeTypes = QStringList() << "application/x-kdenlive" << "application/x-kdenlivetitle" << "video/mlt-playlist" << "text/plain"
                             << "video/x-flv" << "application/vnd.rn-realmedia" << "video/x-dv" << "video/dv" << "video/x-msvideo" << "video/x-matroska" << "video/mpeg" << "video/ogg" << "video/x-ms-wmv" << "video/mp4" << "video/quicktime"
-                            << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "application/ogg"
+                            << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "application/ogg" << "application/mxf"
                             << "image/gif" << "image/jpeg" << "image/png" << "image/x-tga" << "image/x-bmp" << "image/svg+xml" << "image/tiff" << "image/x-xcf" << "image/x-xcf-gimp" << "image/x-vnd.adobe.photoshop" << "image/x-pcx" << "image/x-exr";
 
     QString allExtensions;
-    foreach(const QString& mimeType, mimeTypes) {
+    foreach(const QString & mimeType, mimeTypes) {
         KMimeType::Ptr mime(KMimeType::mimeType(mimeType));
         if (mime) {
             allExtensions.append(mime->patterns().join(" "));
@@ -1079,7 +1088,7 @@ void ProjectList::slotAddClip(const QList <QUrl> givenList, const QString &group
         const QString dialogFilter = allExtensions + ' ' + QLatin1Char('|') + i18n("All Supported Files") + "\n* " + QLatin1Char('|') + i18n("All Files");
         QCheckBox *b = new QCheckBox(i18n("Import image sequence"));
         b->setChecked(KdenliveSettings::autoimagesequence());
-        KFileDialog *d = new KFileDialog(KUrl("kfiledialog:///clipfolder"), dialogFilter, this, b);
+        KFileDialog *d = new KFileDialog(KUrl("kfiledialog:///clipfolder"), dialogFilter, kapp->activeWindow(), b);
         d->setOperationMode(KFileDialog::Opening);
         d->setMode(KFile::Files);
         d->exec();
@@ -1092,7 +1101,7 @@ void ProjectList::slotAddClip(const QList <QUrl> givenList, const QString &group
                 KFileItem item(KFileItem::Unknown, KFileItem::Unknown, url);
                 if (item.mimetype().startsWith("image")) {
                     int count = 0;
-                    // import as sequence if we found at least 5 images in the sequence
+                    // import as sequence if we found more than one image in the sequence
                     QString pattern = SlideshowClip::selectedPath(url.path(), false, QString(), &count);
                     if (count > 1) {
                         delete d;
@@ -1103,7 +1112,10 @@ void ProjectList::slotAddClip(const QList <QUrl> givenList, const QString &group
                             fileName.chop(1);
                         }
 
-                        m_doc->slotCreateSlideshowClipFile(fileName, pattern, count, m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()), false, false, false, m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))), QString(), 0, groupInfo.at(0), groupInfo.at(1));
+                        m_doc->slotCreateSlideshowClipFile(fileName, pattern, count, m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()),
+                                                           false, false, false,
+                                                           m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))), QString(), 0,
+                                                           QString(), groupInfo.at(0), groupInfo.at(1));
                         return;
                     }
                 }
@@ -1115,7 +1127,7 @@ void ProjectList::slotAddClip(const QList <QUrl> givenList, const QString &group
             list << givenList.at(i);
     }
 
-    foreach(const KUrl &file, list) {
+    foreach(const KUrl & file, list) {
         // Check there is no folder here
         KMimeType::Ptr type = KMimeType::findByUrl(file);
         if (type->is("inode/directory")) {
@@ -1144,8 +1156,8 @@ void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace)
         if (item->referencedClip()->isPlaceHolder()) replace = false;
         if (!path.isEmpty()) {
             if (replace)
-                KMessageBox::sorry(this, i18n("Clip <b>%1</b><br />is invalid, will be removed from project.", path));
-            else if (KMessageBox::questionYesNo(this, i18n("Clip <b>%1</b><br />is missing or invalid. Remove it from project?", path), i18n("Invalid clip")) == KMessageBox::Yes)
+                KMessageBox::sorry(kapp->activeWindow(), i18n("Clip <b>%1</b><br />is invalid, will be removed from project.", path));
+            else if (KMessageBox::questionYesNo(kapp->activeWindow(), i18n("Clip <b>%1</b><br />is missing or invalid. Remove it from project?", path), i18n("Invalid clip")) == KMessageBox::Yes)
                 replace = true;
         }
         if (replace)
@@ -1191,8 +1203,10 @@ void ProjectList::slotAddSlideshowClip()
 
     if (dia->exec() == QDialog::Accepted) {
         QStringList groupInfo = getGroup();
-        m_doc->slotCreateSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(), dia->loop(), dia->crop(), dia->fade(),
-                                           dia->lumaDuration(), dia->lumaFile(), dia->softness(), groupInfo.at(0), groupInfo.at(1));
+        m_doc->slotCreateSlideshowClipFile(dia->clipName(), dia->selectedPath(), dia->imageCount(), dia->clipDuration(),
+                                           dia->loop(), dia->crop(), dia->fade(),
+                                           dia->lumaDuration(), dia->lumaFile(), dia->softness(),
+                                           dia->animation(), groupInfo.at(0), groupInfo.at(1));
     }
     delete dia;
 }
@@ -1280,7 +1294,6 @@ void ProjectList::setDocument(KdenliveDoc *doc)
         slotAddClip(list.at(i), false);
 
     m_listView->blockSignals(false);
-    m_toolbar->setEnabled(true);
     connect(m_doc->clipManager(), SIGNAL(reloadClip(const QString &)), this, SLOT(slotReloadClip(const QString &)));
     connect(m_doc->clipManager(), SIGNAL(modifiedClip(const QString &)), this, SLOT(slotModifiedClip(const QString &)));
     connect(m_doc->clipManager(), SIGNAL(missingClip(const QString &)), this, SLOT(slotMissingClip(const QString &)));
@@ -1467,11 +1480,15 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
     int max = m_doc->clipManager()->clipsCount();
     if (item && m_infoQueue.isEmpty() && m_thumbnailQueue.isEmpty()) {
         m_listView->setCurrentItem(item);
+        bool updatedProfile = false;
         if (item->parent()) {
             if (item->parent()->type() == PROJECTFOLDERTYPE)
                 static_cast <FolderProjectItem *>(item->parent())->switchIcon();
+        } else if (KdenliveSettings::checkfirstprojectclip() &&  m_listView->topLevelItemCount() == 1) {
+            // this is the first clip loaded in project, check if we want to adjust project settings to the clip
+            updatedProfile = adjustProjectProfileToItem(item);
         }
-        emit clipSelected(item->referencedClip());
+        if (updatedProfile == false) emit clipSelected(item->referencedClip());
     } else {
         emit displayMessage(i18n("Loading clips"), (int)(100 *(max - m_infoQueue.count()) / max));
     }
@@ -1481,6 +1498,63 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
     QTimer::singleShot(30, this, SLOT(slotProcessNextClipInQueue()));
 }
 
+bool ProjectList::adjustProjectProfileToItem(ProjectItem *item)
+{
+    if (item == NULL) {
+        if (m_listView->currentItem() && m_listView->currentItem()->type() != PROJECTFOLDERTYPE)
+            item = static_cast <ProjectItem*>(m_listView->currentItem());
+    }
+    if (item == NULL || item->referencedClip() == NULL) {
+        KMessageBox::information(kapp->activeWindow(), i18n("Cannot find profile from current clip"));
+        return false;
+    }
+    bool profileUpdated = false;
+    QString size = item->referencedClip()->getProperty("frame_size");
+    int width = size.section('x', 0, 0).toInt();
+    int height = size.section('x', -1).toInt();
+    double fps = item->referencedClip()->getProperty("fps").toDouble();
+    double par = item->referencedClip()->getProperty("aspect_ratio").toDouble();
+    if (item->clipType() == IMAGE || item->clipType() == AV || item->clipType() == VIDEO) {
+        if (ProfilesDialog::matchProfile(width, height, fps, par, item->clipType() == IMAGE, m_doc->mltProfile()) == false) {
+            // get a list of compatible profiles
+            QMap <QString, QString> suggestedProfiles = ProfilesDialog::getProfilesFromProperties(width, height, fps, par, item->clipType() == IMAGE);
+            if (!suggestedProfiles.isEmpty()) {
+                KDialog *dialog = new KDialog(this);
+                dialog->setCaption(i18n("Change project profile"));
+                dialog->setButtons(KDialog::Ok | KDialog::Cancel);
+
+                QWidget container;
+                QVBoxLayout *l = new QVBoxLayout;
+                QLabel *label = new QLabel(i18n("Your clip does not match current project's profile.\nDo you want to change the project profile?\n\nThe following profiles match the clip (size: %1, fps: %2)", size, fps));
+                l->addWidget(label);
+                QListWidget *list = new QListWidget;
+                list->setAlternatingRowColors(true);
+                QMapIterator<QString, QString> i(suggestedProfiles);
+                while (i.hasNext()) {
+                    i.next();
+                    QListWidgetItem *item = new QListWidgetItem(i.value(), list);
+                    item->setData(Qt::UserRole, i.key());
+                    item->setToolTip(i.key());
+                }
+                list->setCurrentRow(0);
+                l->addWidget(list);
+                container.setLayout(l);
+                dialog->setButtonText(KDialog::Ok, i18n("Update profile"));
+                dialog->setMainWidget(&container);
+                if (dialog->exec() == QDialog::Accepted) {
+                    //Change project profile
+                    profileUpdated = true;
+                    if (list->currentItem())
+                        emit updateProfile(list->currentItem()->data(Qt::UserRole).toString());
+                }
+                delete list;
+                delete label;
+            } else KMessageBox::information(kapp->activeWindow(), i18n("Your clip does not match current project's profile.\nNo existing profile found to match the clip's properties.\nClip size: %1\nFps: %2\n", size, fps));
+        }
+    }
+    return profileUpdated;
+}
+
 void ProjectList::slotReplyGetImage(const QString &clipId, const QPixmap &pix)
 {
     ProjectItem *item = getItemById(clipId);
@@ -1567,8 +1641,8 @@ void ProjectList::slotSelectClip(const QString &ix)
     if (clip) {
         m_listView->setCurrentItem(clip);
         m_listView->scrollToItem(clip);
-        m_editAction->setEnabled(true);
-        m_deleteAction->setEnabled(true);
+        m_editButton->defaultAction()->setEnabled(true);
+        m_deleteButton->defaultAction()->setEnabled(true);
         m_reloadAction->setEnabled(true);
         m_transcodeAction->setEnabled(true);
         if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
@@ -1616,9 +1690,9 @@ KUrl::List ProjectList::getConditionalUrls(const QString &condition) const
             continue;
         DocClipBase *clip = item->referencedClip();
         if (!condition.isEmpty()) {
-            if (condition.startsWith("vcodec") && !clip->hasVideoCodec(condition.section("=", 1, 1)))
+            if (condition.startsWith("vcodec") && !clip->hasVideoCodec(condition.section('=', 1, 1)))
                 continue;
-            else if (condition.startsWith("acodec") && !clip->hasAudioCodec(condition.section("=", 1, 1)))
+            else if (condition.startsWith("acodec") && !clip->hasAudioCodec(condition.section('=', 1, 1)))
                 continue;
         }
         result.append(item->clipUrl());
@@ -1760,4 +1834,36 @@ void ProjectList::slotForceProcessing(const QString &id)
     }
 }
 
+void ProjectList::slotAddOrUpdateSequence(const QString frameName)
+{
+    QString fileName = KUrl(frameName).fileName().section('_', 0, -2);
+    int count;
+    QString pattern = SlideshowClip::selectedPath(frameName, false, QString(), &count);
+    if (count > 1) {
+         const QList <DocClipBase *> existing = m_doc->clipManager()->getClipByResource(pattern);
+       if (!existing.isEmpty()) {
+           // Sequence already exists, update
+           QString id = existing.at(0)->getId();
+           ProjectItem *item = getItemById(id);
+            QMap <QString, QString> oldprops;
+            QMap <QString, QString> newprops;
+           int ttl = existing.at(0)->getProperty("ttl").toInt();
+            oldprops["out"] = existing.at(0)->getProperty("out");
+            newprops["out"] = QString::number(ttl * count - 1);
+           slotUpdateClipProperties(id, newprops);
+            EditClipCommand *command = new EditClipCommand(this, id, oldprops, newprops, false);
+            m_commandStack->push(command);
+       }
+       else {
+           // Create sequence
+           QStringList groupInfo = getGroup();
+           m_doc->slotCreateSlideshowClipFile(fileName, pattern, count, m_timecode.reformatSeparators(KdenliveSettings::sequence_duration()),
+                                                           false, false, false,
+                                                           m_timecode.getTimecodeFromFrames(int(ceil(m_timecode.fps()))), QString(), 0,
+                                                           QString(), groupInfo.at(0), groupInfo.at(1));
+       }
+    }
+    else emit displayMessage(i18n("Sequence not found"), -2);
+}
+
 #include "projectlist.moc"