]> git.sesse.net Git - kdenlive/blobdiff - src/projectlist.cpp
Correctly update monitor when changing a title clip duration
[kdenlive] / src / projectlist.cpp
index 8668a1b8038847a20f4e90c7f579d8a335da1021..af531d2565490be6ca812177ee7e0d9988c8f3ed 100644 (file)
@@ -41,6 +41,8 @@
 #include <KFileDialog>
 #include <KInputDialog>
 #include <KMessageBox>
+#include <KIO/NetAccess>
+#include <KFileItem>
 
 #include <nepomuk/global.h>
 #include <nepomuk/resourcemanager.h>
@@ -63,6 +65,7 @@ ProjectList::ProjectList(QWidget *parent) :
         m_deleteAction(NULL),
         m_openAction(NULL),
         m_reloadAction(NULL),
+        m_transcodeAction(NULL),
         m_selectedItem(NULL),
         m_refreshed(false),
         m_infoQueue(),
@@ -102,8 +105,8 @@ ProjectList::ProjectList(QWidget *parent) :
     connect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
     connect(m_listView, SIGNAL(showProperties(DocClipBase *)), this, SIGNAL(showClipProperties(DocClipBase *)));
 
-    ItemDelegate *listViewDelegate = new ItemDelegate(m_listView);
-    m_listView->setItemDelegate(listViewDelegate);
+    m_listViewDelegate = new ItemDelegate(m_listView);
+    m_listView->setItemDelegate(m_listViewDelegate);
 
     if (KdenliveSettings::activate_nepomuk()) {
         Nepomuk::ResourceManager::instance()->init();
@@ -118,6 +121,9 @@ ProjectList::~ProjectList()
 {
     delete m_menu;
     delete m_toolbar;
+    m_listView->blockSignals(true);
+    m_listView->clear();
+    delete m_listViewDelegate;
 }
 
 void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction)
@@ -164,6 +170,7 @@ void ProjectList::setupGeneratorMenu(QMenu *addMenu, QMenu *transcodeMenu)
     if (addMenu->isEmpty()) addMenu->setEnabled(false);
     m_menu->addMenu(transcodeMenu);
     if (transcodeMenu->isEmpty()) transcodeMenu->setEnabled(false);
+    m_transcodeAction = transcodeMenu;
     m_menu->addAction(m_reloadAction);
     m_menu->addAction(m_editAction);
     m_menu->addAction(m_openAction);
@@ -207,6 +214,40 @@ void ProjectList::slotOpenClip()
     }
 }
 
+void ProjectList::cleanup()
+{
+    m_listView->clearSelection();
+    QTreeWidgetItemIterator it(m_listView);
+    ProjectItem *item;
+    while (*it) {
+        item = static_cast <ProjectItem *>(*it);
+        if (item->numReferences() == 0) item->setSelected(true);
+        it++;
+    }
+    slotRemoveClip();
+}
+
+void ProjectList::trashUnusedClips()
+{
+    QTreeWidgetItemIterator it(m_listView);
+    ProjectItem *item;
+    QStringList ids;
+    KUrl::List urls;
+    while (*it) {
+        item = static_cast <ProjectItem *>(*it);
+        if (item->numReferences() == 0) {
+            ids << item->clipId();
+            KUrl url = item->clipUrl();
+            if (!url.isEmpty()) urls << url;
+        }
+        it++;
+    }
+    m_doc->deleteProjectClip(ids);
+    for (int i = 0; i < urls.count(); i++) {
+        KIO::NetAccess::del(urls.at(i), this);
+    }
+}
+
 void ProjectList::slotReloadClip(const QString &id)
 {
     QList<QTreeWidgetItem *> selected;
@@ -245,6 +286,7 @@ void ProjectList::slotClipSelected()
         m_editAction->setEnabled(true);
         m_deleteAction->setEnabled(true);
         m_reloadAction->setEnabled(true);
+        m_transcodeAction->setEnabled(true);
         if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
             m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
             m_openAction->setEnabled(true);
@@ -258,6 +300,7 @@ void ProjectList::slotClipSelected()
         m_deleteAction->setEnabled(false);
         m_openAction->setEnabled(false);
         m_reloadAction->setEnabled(false);
+        m_transcodeAction->setEnabled(false);
     }
 }
 
@@ -271,11 +314,14 @@ void ProjectList::slotUpdateClipProperties(const QString &id, QMap <QString, QSt
     ProjectItem *item = getItemById(id);
     if (item) {
         slotUpdateClipProperties(item, properties);
-        if (properties.contains("colour") || properties.contains("resource") || properties.contains("xmldata") || properties.contains("force_aspect_ratio")) {
+        if (properties.contains("out")) {
+            slotReloadClip(id);
+            //item->changeDuration(properties.value("out").toInt());
+        }
+        else if (properties.contains("colour") || properties.contains("resource") || properties.contains("xmldata") || properties.contains("force_aspect_ratio") || properties.contains("templatetext")) {
             slotRefreshClipThumbnail(item);
             emit refreshClip();
         }
-        if (properties.contains("out")) item->changeDuration(properties.value("out").toInt());
     }
 }
 
@@ -283,7 +329,6 @@ void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QSt
 {
     if (!clip) return;
     if (!clip->isGroup()) clip->setProperties(properties);
-    if (properties.contains("xmldata")) regenerateTemplateImage(clip);
     if (properties.contains("name")) {
         m_listView->blockSignals(true);
         clip->setText(1, properties.value("name"));
@@ -314,12 +359,13 @@ void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column)
             oldprops["description"] = clip->referencedClip()->getProperty("description");
             newprops["description"] = item->text(2);
 
-            if (clip->clipType() == TEXT && !clip->referencedClip()->getProperty("xmltemplate").isEmpty()) {
+            if (clip->clipType() == TEXT) {
                 // This is a text template clip, update the image
-                oldprops.insert("xmldata", clip->referencedClip()->getProperty("xmldata"));
-                newprops.insert("xmldata", generateTemplateXml(clip->referencedClip()->getProperty("xmltemplate"), item->text(2)).toString());
+                /*oldprops.insert("xmldata", clip->referencedClip()->getProperty("xmldata"));
+                newprops.insert("xmldata", generateTemplateXml(clip->referencedClip()->getProperty("xmltemplate"), item->text(2)).toString());*/
+                oldprops.insert("templatetext", clip->referencedClip()->getProperty("templatetext"));
+                newprops.insert("templatetext", item->text(2));
             }
-
             slotUpdateClipProperties(clip->clipId(), newprops);
             EditClipCommand *command = new EditClipCommand(this, clip->clipId(), oldprops, newprops, false);
             m_commandStack->push(command);
@@ -358,6 +404,7 @@ void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item)
     m_editAction->setEnabled(enable);
     m_deleteAction->setEnabled(enable);
     m_reloadAction->setEnabled(enable);
+    m_transcodeAction->setEnabled(enable);
     if (enable) {
         ProjectItem *clip = static_cast <ProjectItem*>(item);
         if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
@@ -374,7 +421,7 @@ void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item)
 void ProjectList::slotRemoveClip()
 {
     if (!m_listView->currentItem()) return;
-    QList <QString> ids;
+    QStringList ids;
     QMap <QString, QString> folderids;
     QList<QTreeWidgetItem *> selected = m_listView->selectedItems();
     ProjectItem *item;
@@ -386,7 +433,7 @@ void ProjectList::slotRemoveClip()
             if (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) return;
         } else if (item->isGroup() && item->childCount() > 0) {
             int children = item->childCount();
-            if (KMessageBox::questionYesNo(this, i18n("Delete folder <b>%2</b>?<br>This will also remove the %1 clips in that folder", children, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
+            if (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, item->names().at(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
             for (int i = 0; i < children; ++i) {
                 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
                 ids << child->clipId();
@@ -400,6 +447,7 @@ void ProjectList::slotRemoveClip()
         m_deleteAction->setEnabled(false);
         m_openAction->setEnabled(false);
         m_reloadAction->setEnabled(false);
+        m_transcodeAction->setEnabled(false);
     }
 }
 
@@ -449,7 +497,6 @@ void ProjectList::slotAddFolder(const QString foldername, const QString &clipId,
     } else {
         if (edit) {
             ProjectItem *item = getFolderItemById(clipId);
-            QTreeWidgetItemIterator it(m_listView);
             if (item) {
                 m_listView->blockSignals(true);
                 item->setGroupName(foldername);
@@ -489,10 +536,17 @@ void ProjectList::deleteProjectFolder(QMap <QString, QString> map)
 
 void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
 {
-    if (getProperties) m_listView->setEnabled(false);
-    m_listView->blockSignals(true);
+    m_listView->setEnabled(false);
+    if (getProperties) {
+        m_listView->blockSignals(true);
+        m_refreshed = false;
+        // remove file_hash so that we load all properties for the clip
+        QDomElement e = clip->toXML().cloneNode().toElement();
+        e.removeAttribute("file_hash");
+        m_infoQueue.insert(clip->getId(), e);
+        //m_render->getFileProperties(clip->toXML(), clip->getId(), true);
+    }
     const QString parent = clip->getProperty("groupid");
-    kDebug() << "Adding clip with groupid: " << parent;
     ProjectItem *item = NULL;
     if (!parent.isEmpty()) {
         ProjectItem *parentitem = getFolderItemById(parent);
@@ -525,7 +579,8 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
         if (!annotation.isEmpty()) item->setText(2, annotation);
         item->setText(3, QString::number(f.rating()));
     }
-    m_listView->blockSignals(false);
+    if (getProperties && m_listView->isEnabled()) m_listView->blockSignals(false);
+    if (getProperties && !m_queueTimer.isActive()) m_queueTimer.start();
 }
 
 void ProjectList::slotResetProjectList()
@@ -539,9 +594,8 @@ void ProjectList::slotResetProjectList()
 
 void ProjectList::requestClipInfo(const QDomElement xml, const QString id)
 {
+    m_refreshed = false;
     m_infoQueue.insert(id, xml);
-    m_listView->setEnabled(false);
-    if (!m_queueTimer.isActive()) m_queueTimer.start();
     //if (m_infoQueue.count() == 1 || ) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
 }
 
@@ -559,7 +613,7 @@ void ProjectList::slotProcessNextClipInQueue()
         m_infoQueue.remove(j.key());
         emit getFileProperties(dom, id, false);
     }
-    if (!m_infoQueue.isEmpty()) m_queueTimer.start();
+    //if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
 }
 
 void ProjectList::slotUpdateClip(const QString &id)
@@ -572,52 +626,50 @@ void ProjectList::slotUpdateClip(const QString &id)
 
 void ProjectList::updateAllClips()
 {
+    m_listView->setSortingEnabled(false);
+
     QTreeWidgetItemIterator it(m_listView);
+    DocClipBase *clip;
+    ProjectItem *item;
+    m_listView->blockSignals(true);
     while (*it) {
-        ProjectItem *item = static_cast <ProjectItem *>(*it);
+        item = static_cast <ProjectItem *>(*it);
         if (!item->isGroup()) {
-            DocClipBase *clip = item->referencedClip();
-            if (clip->clipType() == TEXT && !QFile::exists(clip->fileURL().path())) {
-                // regenerate text clip image if required
-                TitleWidget *dia_ui = new TitleWidget(KUrl(), QString(), m_render, this);
-                QDomDocument doc;
-                doc.setContent(clip->getProperty("xmldata"));
-                dia_ui->setXml(doc);
-                QImage pix = dia_ui->renderedPixmap();
-                pix.save(clip->fileURL().path());
-                delete dia_ui;
-            }
-
+            clip = item->referencedClip();
             if (item->referencedClip()->producer() == NULL) {
-                if (clip->isPlaceHolder() == false) requestClipInfo(clip->toXML(), clip->getId());
-                else item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+                if (clip->isPlaceHolder() == false) {
+                    requestClipInfo(clip->toXML(), clip->getId());
+                } else item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
             } else {
                 if (item->icon(0).isNull()) {
                     requestClipThumbnail(clip->getId());
                 }
                 if (item->data(1, DurationRole).toString().isEmpty()) {
-                    m_listView->blockSignals(true);
                     item->changeDuration(item->referencedClip()->producer()->get_playtime());
-                    m_listView->blockSignals(false);
                 }
             }
-            m_listView->blockSignals(true);
             item->setData(1, UsageRole, QString::number(item->numReferences()));
-            m_listView->blockSignals(false);
-            qApp->processEvents();
+            //qApp->processEvents();
         }
         ++it;
     }
+    qApp->processEvents();
+    if (!m_queueTimer.isActive()) m_queueTimer.start();
+
+    if (m_listView->isEnabled()) m_listView->blockSignals(false);
+    m_listView->setSortingEnabled(true);
     if (m_infoQueue.isEmpty()) slotProcessNextThumbnail();
 }
 
 void ProjectList::slotAddClip(const QList <QUrl> givenList, const QString &groupName, const QString &groupId)
 {
-    if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
+    if (!m_commandStack) {
+        kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
+    }
     KUrl::List list;
     if (givenList.isEmpty()) {
         // Build list of mime types
-        QStringList mimeTypes = QStringList() << "application/x-kdenlive" << "video/x-flv" << "application/vnd.rn-realmedia" << "video/x-dv" << "video/dv" << "video/x-msvideo" << "video/x-matroska" << "video/mlt-playlist" << "video/mpeg" << "video/ogg" << "video/x-ms-wmv" << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "application/ogg" << "video/mp4" << "video/quicktime" << "image/gif" << "image/jpeg" << "image/png" << "image/x-tga" << "image/x-bmp" << "image/svg+xml" << "image/tiff" << "image/x-xcf-gimp" << "image/x-vnd.adobe.photoshop" << "image/x-pcx" << "image/x-exr";
+        QStringList mimeTypes = QStringList() << "application/x-kdenlive" << "application/x-kdenlivetitle" << "video/x-flv" << "application/vnd.rn-realmedia" << "video/x-dv" << "video/dv" << "video/x-msvideo" << "video/x-matroska" << "video/mlt-playlist" << "video/mpeg" << "video/ogg" << "video/x-ms-wmv" << "audio/x-flac" << "audio/x-matroska" << "audio/mp4" << "audio/mpeg" << "audio/x-mp3" << "audio/ogg" << "audio/x-wav" << "application/ogg" << "video/mp4" << "video/quicktime" << "image/gif" << "image/jpeg" << "image/png" << "image/x-tga" << "image/x-bmp" << "image/svg+xml" << "image/tiff" << "image/x-xcf-gimp" << "image/x-vnd.adobe.photoshop" << "image/x-pcx" << "image/x-exr";
 
         QString allExtensions;
         foreach(const QString& mimeType, mimeTypes) {
@@ -627,8 +679,7 @@ void ProjectList::slotAddClip(const QList <QUrl> givenList, const QString &group
                 allExtensions.append(' ');
             }
         }
-        QString dialogFilter = allExtensions + ' ' + QLatin1Char('|') + i18n("All Supported Files");
-        dialogFilter.append("\n*" + QLatin1Char('|') + i18n("All Files"));
+        const QString dialogFilter = allExtensions.simplified() + ' ' + QLatin1Char('|') + i18n("All Supported Files") + "\n* " + QLatin1Char('|') + i18n("All Files");
         list = KFileDialog::getOpenUrls(KUrl("kfiledialog:///clipfolder"), dialogFilter, this);
 
     } else {
@@ -655,7 +706,7 @@ void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace)
                 if (KMessageBox::questionYesNo(this, i18n("Clip <b>%1</b><br>is missing or invalid. Remove it from project?", path), i18n("Invalid clip")) == KMessageBox::Yes) replace = true;
             }
         }
-        QList <QString> ids;
+        QStringList ids;
         ids << id;
         if (replace) m_doc->deleteProjectClip(ids);
     }
@@ -663,7 +714,9 @@ void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace)
 
 void ProjectList::slotAddColorClip()
 {
-    if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
+    if (!m_commandStack) {
+        kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
+    }
     QDialog *dia = new QDialog(this);
     Ui::ColorClip_UI dia_ui;
     dia_ui.setupUi(dia);
@@ -681,7 +734,9 @@ void ProjectList::slotAddColorClip()
 
 void ProjectList::slotAddSlideshowClip()
 {
-    if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
+    if (!m_commandStack) {
+        kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
+    }
     SlideshowClip *dia = new SlideshowClip(m_timecode, this);
 
     if (dia->exec() == QDialog::Accepted) {
@@ -700,7 +755,9 @@ void ProjectList::slotAddTitleClip()
 void ProjectList::slotAddTitleTemplateClip()
 {
     QStringList groupInfo = getGroup();
-    if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
+    if (!m_commandStack) {
+        kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
+    }
 
     // Get the list of existing templates
     QStringList filter;
@@ -718,17 +775,12 @@ void ProjectList::slotAddTitleTemplateClip()
     //warning: setting base directory doesn't work??
     KUrl startDir(path);
     dia_ui.template_list->fileDialog()->setUrl(startDir);
-    dia_ui.description->setHidden(true);
+    dia_ui.text_box->setHidden(true);
     if (dia->exec() == QDialog::Accepted) {
         QString textTemplate = dia_ui.template_list->comboBox()->itemData(dia_ui.template_list->comboBox()->currentIndex()).toString();
         if (textTemplate.isEmpty()) textTemplate = dia_ui.template_list->comboBox()->currentText();
-        if (dia_ui.normal_clip->isChecked()) {
-            // Create a normal title clip
-            m_doc->slotCreateTextClip(groupInfo.at(0), groupInfo.at(1), textTemplate);
-        } else {
-            // Create a cloned template clip
-            m_doc->slotCreateTextTemplateClip(groupInfo.at(0), groupInfo.at(1), KUrl(textTemplate));
-        }
+        // Create a cloned template clip
+        m_doc->slotCreateTextTemplateClip(groupInfo.at(0), groupInfo.at(1), KUrl(textTemplate));
     }
     delete dia;
 }
@@ -754,6 +806,7 @@ void ProjectList::setDocument(KdenliveDoc *doc)
 {
     m_listView->blockSignals(true);
     m_listView->clear();
+    m_listView->setSortingEnabled(false);
     emit clipSelected(NULL);
     m_thumbnailQueue.clear();
     m_infoQueue.clear();
@@ -763,8 +816,6 @@ void ProjectList::setDocument(KdenliveDoc *doc)
     m_commandStack = doc->commandStack();
     m_doc = doc;
 
-    connect(m_doc->clipManager(), SIGNAL(reloadClip(const QString &)), this, SLOT(slotReloadClip(const QString &)));
-
     QMap <QString, QString> flist = doc->clipManager()->documentFolderList();
     QMapIterator<QString, QString> f(flist);
     while (f.hasNext()) {
@@ -779,6 +830,8 @@ void ProjectList::setDocument(KdenliveDoc *doc)
 
     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(checkAllClips()), this, SLOT(updateAllClips()));
 }
 
 QDomElement ProjectList::producersList()
@@ -801,11 +854,15 @@ void ProjectList::slotCheckForEmptyQueue()
     if (!m_refreshed && m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
         m_refreshed = true;
         emit loadingIsOver();
-    } else QTimer::singleShot(300, this, SLOT(slotCheckForEmptyQueue()));
+        emit displayMessage(QString(), -1);
+        m_listView->blockSignals(false);
+        m_listView->setEnabled(true);
+    } else if (!m_refreshed) QTimer::singleShot(300, this, SLOT(slotCheckForEmptyQueue()));
 }
 
 void ProjectList::reloadClipThumbnails()
 {
+    kDebug() << "//////////////  RELOAD CLIPS THUMBNAILS!!!";
     m_thumbnailQueue.clear();
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
@@ -818,13 +875,12 @@ void ProjectList::reloadClipThumbnails()
 
 void ProjectList::requestClipThumbnail(const QString id)
 {
-    m_thumbnailQueue.append(id);
+    if (!m_thumbnailQueue.contains(id)) m_thumbnailQueue.append(id);
 }
 
 void ProjectList::slotProcessNextThumbnail()
 {
     if (m_thumbnailQueue.isEmpty() && m_infoQueue.isEmpty()) {
-        m_listView->setEnabled(true);
         slotCheckForEmptyQueue();
         return;
     }
@@ -832,6 +888,10 @@ void ProjectList::slotProcessNextThumbnail()
         //QTimer::singleShot(300, this, SLOT(slotProcessNextThumbnail()));
         return;
     }
+    if (m_thumbnailQueue.count() > 1) {
+        int max = m_doc->clipManager()->clipsCount();
+        emit displayMessage(i18n("Loading thumbnails"), (int)(100 * (max - m_thumbnailQueue.count()) / max));
+    }
     slotRefreshClipThumbnail(m_thumbnailQueue.takeFirst(), false);
 }
 
@@ -845,22 +905,25 @@ void ProjectList::slotRefreshClipThumbnail(const QString &clipId, bool update)
 void ProjectList::slotRefreshClipThumbnail(ProjectItem *item, bool update)
 {
     if (item) {
-        int height = 50;
-        int width = (int)(height  * m_render->dar());
         DocClipBase *clip = item->referencedClip();
-        if (!clip) slotProcessNextThumbnail();
+        if (!clip) {
+            slotProcessNextThumbnail();
+            return;
+        }
         QPixmap pix;
+        int height = 50;
+        int width = (int)(height  * m_render->dar());
         if (clip->clipType() == AUDIO) pix = KIcon("audio-x-generic").pixmap(QSize(width, height));
-        else if (clip->clipType() == TEXT || clip->clipType() == IMAGE) pix = KThumb::getFrame(item->referencedClip()->producer(), 0, width, height);
+        else if (clip->clipType() == IMAGE) pix = QPixmap::fromImage(KThumb::getFrame(item->referencedClip()->producer(), 0, width, height));
         else pix = item->referencedClip()->thumbProducer()->extractImage(item->referencedClip()->getClipThumbFrame(), width, height);
         if (!pix.isNull()) {
             m_listView->blockSignals(true);
             item->setIcon(0, pix);
-            m_listView->blockSignals(false);
+            if (m_listView->isEnabled()) m_listView->blockSignals(false);
             m_doc->cachePixmap(item->getClipHash(), pix);
         }
         if (update) emit projectModified();
-        QTimer::singleShot(100, this, SLOT(slotProcessNextThumbnail()));
+        QTimer::singleShot(30, this, SLOT(slotProcessNextThumbnail()));
     }
 }
 
@@ -872,8 +935,8 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
         item->setProperties(properties, metadata);
         Q_ASSERT_X(item->referencedClip(), "void ProjectList::slotReplyGetFileProperties", QString("Item with groupName %1 does not have a clip associated").arg(item->groupName()).toLatin1());
         item->referencedClip()->setProducer(producer, replace);
-        emit receivedClipDuration(clipId);
-        if (replace) {
+        //emit receivedClipDuration(clipId);
+        if (m_listView->isEnabled() && replace) {
             // update clip in clip monitor
             emit clipSelected(NULL);
             emit clipSelected(item->referencedClip());
@@ -883,13 +946,15 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
             emit receivedClipDuration(clipId);
             delete producer;
         }*/
-        m_listView->blockSignals(false);
+        if (m_listView->isEnabled()) m_listView->blockSignals(false);
         if (item->icon(0).isNull()) {
             requestClipThumbnail(clipId);
         }
     } else kDebug() << "////////  COULD NOT FIND CLIP TO UPDATE PRPS...";
-
-    slotProcessNextClipInQueue();
+    int max = m_doc->clipManager()->clipsCount();
+    emit displayMessage(i18n("Loading clips"), (int)(100 * (max - m_infoQueue.count()) / max));
+    // small delay so that the app can display the progress info
+    QTimer::singleShot(30, this, SLOT(slotProcessNextClipInQueue()));
 }
 
 void ProjectList::slotReplyGetImage(const QString &clipId, const QPixmap &pix)
@@ -899,7 +964,7 @@ void ProjectList::slotReplyGetImage(const QString &clipId, const QPixmap &pix)
         m_listView->blockSignals(true);
         item->setIcon(0, pix);
         m_doc->cachePixmap(item->getClipHash(), pix);
-        m_listView->blockSignals(false);
+        if (m_listView->isEnabled()) m_listView->blockSignals(false);
     }
 }
 
@@ -938,6 +1003,7 @@ void ProjectList::slotSelectClip(const QString &ix)
         m_editAction->setEnabled(true);
         m_deleteAction->setEnabled(true);
         m_reloadAction->setEnabled(true);
+        m_transcodeAction->setEnabled(true);
         if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
             m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
             m_openAction->setEnabled(true);
@@ -963,30 +1029,10 @@ void ProjectList::regenerateTemplate(const QString &id)
 
 void ProjectList::regenerateTemplate(ProjectItem *clip)
 {
-    // Generate image for template clip
-    const QString comment = clip->referencedClip()->getProperty("description");
-    const QString path = clip->referencedClip()->getProperty("xmltemplate");
-    QDomDocument doc = generateTemplateXml(path, comment);
-    TitleWidget *dia_ui = new TitleWidget(KUrl(), QString(), m_render, this);
-    dia_ui->setXml(doc);
-    QImage pix = dia_ui->renderedPixmap();
-    pix.save(clip->clipUrl().path());
-    delete dia_ui;
+    //TODO: remove this unused method, only force_reload is necessary
     clip->referencedClip()->producer()->set("force_reload", 1);
 }
 
-void ProjectList::regenerateTemplateImage(ProjectItem *clip)
-{
-    // Generate image for template clip
-    TitleWidget *dia_ui = new TitleWidget(KUrl(), QString(), m_render, this);
-    QDomDocument doc;
-    doc.setContent(clip->referencedClip()->getProperty("xmldata"));
-    dia_ui->setXml(doc);
-    QImage pix = dia_ui->renderedPixmap();
-    pix.save(clip->clipUrl().path());
-    delete dia_ui;
-}
-
 QDomDocument ProjectList::generateTemplateXml(QString path, const QString &replaceString)
 {
     QDomDocument doc;