]> git.sesse.net Git - kdenlive/blobdiff - src/projectlist.cpp
Title Widget: Icon for align:none and Unicode Insert added
[kdenlive] / src / projectlist.cpp
index 28869c87b2ffb2b88b3c620ae37b77091df802e2..ccb1599af834305bbda924710927bfd9d11d6d47 100644 (file)
@@ -86,7 +86,7 @@ ProjectList::ProjectList(QWidget *parent) :
     layout->addWidget(m_toolbar);
     layout->addWidget(m_listView);
     setLayout(layout);
-    
+
 
 
     connect(m_listView, SIGNAL(itemSelectionChanged()), this, SLOT(slotClipSelected()));
@@ -149,7 +149,7 @@ void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction)
     m_menu->addActions(addMenu->actions());
 }
 
-void ProjectList::setupGeneratorMenu(QMenu *addMenu)
+void ProjectList::setupGeneratorMenu(QMenu *addMenu, QMenu *transcodeMenu)
 {
     if (!addMenu) return;
     QMenu *menu = m_addButton->menu();
@@ -158,6 +158,8 @@ void ProjectList::setupGeneratorMenu(QMenu *addMenu)
 
     m_menu->addMenu(addMenu);
     if (addMenu->isEmpty()) addMenu->setEnabled(false);
+    m_menu->addMenu(transcodeMenu);
+    if (transcodeMenu->isEmpty()) transcodeMenu->setEnabled(false);
     m_menu->addAction(m_reloadAction);
     m_menu->addAction(m_editAction);
     m_menu->addAction(m_openAction);
@@ -166,7 +168,7 @@ void ProjectList::setupGeneratorMenu(QMenu *addMenu)
 }
 
 
-QByteArray ProjectList::headerInfo()
+QByteArray ProjectList::headerInfo() const
 {
     return m_listView->header()->saveState();
 }
@@ -208,7 +210,7 @@ void ProjectList::slotReloadClip()
         if (item->clipType() == IMAGE) {
             item->referencedClip()->producer()->set("force_reload", 1);
         }
-        emit getFileProperties(item->toXml(), item->clipId(), false);
+        emit getFileProperties(item->toXml(), item->clipId(), true);
     }
 }
 
@@ -255,7 +257,7 @@ 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")) slotRefreshClipThumbnail(item);
+        if (properties.contains("colour") || properties.contains("resource") || properties.contains("xmldata") || properties.contains("force_aspect_ratio")) slotRefreshClipThumbnail(item);
         if (properties.contains("out")) item->changeDuration(properties.value("out").toInt());
     }
 }
@@ -356,10 +358,10 @@ void ProjectList::slotRemoveClip()
         if (item->isGroup()) folderids[item->groupName()] = item->clipId();
         else ids << item->clipId();
         if (item->numReferences() > 0) {
-            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;
+            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, 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;
             for (int i = 0; i < children; ++i) {
                 ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
                 ids << child->clipId();
@@ -518,7 +520,7 @@ void ProjectList::slotProcessNextClipInQueue()
         const QDomElement dom = i.value();
         const QString id = i.key();
         m_infoQueue.remove(i.key());
-        emit getFileProperties(dom, id, true);
+        emit getFileProperties(dom, id, false);
     }
     if (m_infoQueue.isEmpty()) m_listView->setEnabled(true);
 }
@@ -582,7 +584,7 @@ void ProjectList::slotAddClip(const QList <QUrl> givenList, QString group)
     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/mpeg" << "video/x-ms-wmv" << "audio/mpeg" << "audio/x-mp3" << "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" << "video/mlt-playlist" << "audio/x-flac" << "audio/mp4" << "video/x-matroska" << "audio/x-matroska";
+        QStringList mimeTypes = QStringList() << "application/x-kdenlive" << "video/x-flv" << "application/vnd.rn-realmedia" << "video/x-dv" << "video/dv" << "video/x-msvideo" << "video/mpeg" << "video/x-ms-wmv" << "audio/mpeg" << "audio/x-mp3" << "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" << "video/mlt-playlist" << "audio/x-flac" << "audio/mp4" << "video/x-matroska" << "audio/x-matroska" << "video/ogg" << "audio/ogg";
 
         QString allExtensions;
         foreach(const QString& mimeType, mimeTypes) {
@@ -619,15 +621,20 @@ void ProjectList::slotAddClip(const QList <QUrl> givenList, QString group)
     m_doc->slotAddClipList(list, group, groupId);
 }
 
-void ProjectList::slotRemoveInvalidClip(const QString &id)
+void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace)
 {
     ProjectItem *item = getItemById(id);
     if (item) {
         const QString path = item->referencedClip()->fileURL().path();
-        if (!path.isEmpty()) KMessageBox::sorry(this, i18n("Clip <b>%1</b><br>is invalid, will be removed from project.", path));
+        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) replace = true;
+            }
+        }
         QList <QString> ids;
         ids << id;
-        m_doc->deleteProjectClip(ids);
+        if (replace) m_doc->deleteProjectClip(ids);
     }
     if (!m_infoQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
     else m_listView->setEnabled(true);
@@ -670,7 +677,7 @@ void ProjectList::slotAddColorClip()
 void ProjectList::slotAddSlideshowClip()
 {
     if (!m_commandStack) kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
-    SlideshowClip *dia = new SlideshowClip(this);
+    SlideshowClip *dia = new SlideshowClip(m_timecode, this);
 
     if (dia->exec() == QDialog::Accepted) {
 
@@ -766,6 +773,18 @@ void ProjectList::slotCheckForEmptyQueue()
     } else QTimer::singleShot(500, this, SLOT(slotCheckForEmptyQueue()));
 }
 
+void ProjectList::reloadClipThumbnails()
+{
+    m_thumbnailQueue.clear();
+    QTreeWidgetItemIterator it(m_listView);
+    while (*it) {
+        if (!((ProjectItem *)(*it))->isGroup())
+            m_thumbnailQueue << ((ProjectItem *)(*it))->clipId();
+        ++it;
+    }
+    QTimer::singleShot(300, this, SLOT(slotProcessNextThumbnail()));
+}
+
 void ProjectList::requestClipThumbnail(const QString &id)
 {
     m_thumbnailQueue.append(id);
@@ -814,12 +833,18 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
         m_listView->blockSignals(true);
         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());
-        if (replace) item->referencedClip()->setProducer(producer);
-        else {
+        item->referencedClip()->setProducer(producer, replace);
+        emit receivedClipDuration(clipId);
+        if (replace) {
+            // update clip in clip monitor
+            emit clipSelected(NULL);
+            emit clipSelected(item->referencedClip());
+        }
+        /*else {
             // Check if duration changed.
             emit receivedClipDuration(clipId);
             delete producer;
-        }
+        }*/
         m_listView->blockSignals(false);
     } else kDebug() << "////////  COULD NOT FIND CLIP TO UPDATE PRPS...";
     if (!m_infoQueue.isEmpty()) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
@@ -882,4 +907,11 @@ void ProjectList::slotSelectClip(const QString &ix)
     }
 }
 
+QString ProjectList::currentClipUrl() const
+{
+    ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
+    if (item == NULL) return QString();
+    return item->clipUrl().path();
+}
+
 #include "projectlist.moc"