]> git.sesse.net Git - kdenlive/commitdiff
fix possible segfault and enbale proxy only for projectclips
authorMarco Gittler <marco@gitma.de>
Wed, 19 Jan 2011 08:46:35 +0000 (08:46 +0000)
committerMarco Gittler <marco@gitma.de>
Wed, 19 Jan 2011 08:46:35 +0000 (08:46 +0000)
svn path=/trunk/kdenlive/; revision=5336

src/projectlist.cpp

index 6a9a7959bc6ba801e316ddd37a9ae26e46f7fb95..e2411e9fade74c45b7fb3f0693185efec14ec7d4 100644 (file)
@@ -822,6 +822,7 @@ void ProjectList::updateButtons() const
             m_openAction->setEnabled(true);
             m_reloadAction->setEnabled(true);
             m_transcodeAction->setEnabled(true);
+            m_proxyAction->setEnabled(true);
             return;
         }
     }
@@ -830,6 +831,7 @@ void ProjectList::updateButtons() const
     m_openAction->setEnabled(false);
     m_reloadAction->setEnabled(false);
     m_transcodeAction->setEnabled(false);
+    m_proxyAction->setEnabled(false);
 }
 
 void ProjectList::selectItemById(const QString &clipId)
@@ -1740,6 +1742,7 @@ void ProjectList::slotSelectClip(const QString &ix)
         m_deleteButton->defaultAction()->setEnabled(true);
         m_reloadAction->setEnabled(true);
         m_transcodeAction->setEnabled(true);
+        m_proxyAction->setEnabled(true);
         if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
             m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
             m_openAction->setEnabled(true);
@@ -2014,25 +2017,27 @@ void ProjectList::updateProxyConfig()
 
 void ProjectList::slotProxyCurrentItem(bool doProxy)
 {
-    if (m_listView->currentItem()->type() == PROJECTCLIPTYPE) {
-        ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
-        if (item->referencedClip()) {
-            if (doProxy) {
-                DocClipBase *clip = item->referencedClip();
-                connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
-                item->setProxyStatus(1);
-                clip->generateProxy(m_doc->projectFolder());
-            }
-            else if (!item->referencedClip()->getProperty("proxy").isEmpty()) {
-                // remove proxy
-                item->referencedClip()->clearProperty("proxy");
-                QDomElement e = item->toXml().cloneNode().toElement();
-                e.removeAttribute("file_hash");
-                e.setAttribute("replace", 1);
-                m_infoQueue.insert(item->clipId(), e);
+    if (m_listView->currentItem()) {
+        if (m_listView->currentItem()->type() == PROJECTCLIPTYPE) {
+            ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
+            if (item->referencedClip()) {
+                if (doProxy) {
+                    DocClipBase *clip = item->referencedClip();
+                    connect(clip, SIGNAL(proxyReady(const QString, bool)), this, SLOT(slotGotProxy(const QString, bool)));
+                    item->setProxyStatus(1);
+                    clip->generateProxy(m_doc->projectFolder());
+                }
+                else if (!item->referencedClip()->getProperty("proxy").isEmpty()) {
+                    // remove proxy
+                    item->referencedClip()->clearProperty("proxy");
+                    QDomElement e = item->toXml().cloneNode().toElement();
+                    e.removeAttribute("file_hash");
+                    e.setAttribute("replace", 1);
+                    m_infoQueue.insert(item->clipId(), e);
+                }
             }
+            if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
         }
-        if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
     }
 }