]> git.sesse.net Git - kdenlive/commitdiff
Make project folders have a smaller icon, disable titles if the MLT kdenlivetitle...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 2 Nov 2009 13:00:59 +0000 (13:00 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 2 Nov 2009 13:00:59 +0000 (13:00 +0000)
http://kdenlive.org/mantis/view.php?id=1201

svn path=/trunk/kdenlive/; revision=4087

16 files changed:
src/CMakeLists.txt
src/definitions.h
src/folderprojectitem.cpp [new file with mode: 0644]
src/folderprojectitem.h [new file with mode: 0644]
src/kdenlivesettings.kcfg
src/mainwindow.cpp
src/projectitem.cpp
src/projectitem.h
src/projectlist.cpp
src/projectlist.h
src/projectlistview.cpp
src/projectsettings.cpp
src/renderwidget.cpp
src/subprojectitem.cpp
src/titlewidget.cpp
src/wizard.cpp

index a0ecc3e2771fbe64444ff005a1a4126ac190e5e5..24376e7ecca9b345666a4433327f6927b2ecf043 100644 (file)
@@ -174,6 +174,7 @@ set(kdenlive_SRCS
   positionedit.cpp
   trackdialog.cpp
   subprojectitem.cpp
+  folderprojectitem.cpp
   addclipcutcommand.cpp
 )
 
index 7b72a88adc108083b6aee7bb74c9ba85f6b4ef02..1a35aa7af4b22d59c879dd093b5316a64100349b 100644 (file)
 
 #include "gentime.h"
 
+#include <QTreeWidgetItem>
 #include <KLocale>
 
 const int FRAME_SIZE = 90;
 const int MAXCLIPDURATION = 15000;
 
 enum OPERATIONTYPE { NONE = 0, MOVE = 1, RESIZESTART = 2, RESIZEEND = 3, FADEIN = 4, FADEOUT = 5, TRANSITIONSTART = 6, TRANSITIONEND = 7, MOVEGUIDE = 8, KEYFRAME = 9, SEEK = 10, SPACER = 11, RUBBERSELECTION = 12};
-enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9, FOLDER = 10};
+enum CLIPTYPE { UNKNOWN = 0, AUDIO = 1, VIDEO = 2, AV = 3, COLOR = 4, IMAGE = 5, TEXT = 6, SLIDESHOW = 7, VIRTUAL = 8, PLAYLIST = 9 };
+
+enum PROJECTITEMTYPE { PROJECTCLIPTYPE = QTreeWidgetItem::UserType, PROJECTFOLDERTYPE, PROJECTSUBCLIPTYPE };
+
 enum GRAPHICSRECTITEM { AVWIDGET = 70000 , LABELWIDGET , TRANSITIONWIDGET  , GROUPWIDGET};
 
 enum PROJECTTOOL { SELECTTOOL = 0 , RAZORTOOL = 1 , SPACERTOOL = 2 };
diff --git a/src/folderprojectitem.cpp b/src/folderprojectitem.cpp
new file mode 100644 (file)
index 0000000..d1b1ce7
--- /dev/null
@@ -0,0 +1,64 @@
+/***************************************************************************
+ *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+
+#include "folderprojectitem.h"
+#include "definitions.h"
+
+#include <KDebug>
+#include <KLocale>
+#include <KIcon>
+
+
+FolderProjectItem::FolderProjectItem(QTreeWidget * parent, const QStringList & strings, const QString &clipId) :
+        QTreeWidgetItem(parent, strings, PROJECTFOLDERTYPE),
+        m_groupName(strings.at(1)),
+        m_clipId(clipId)
+{
+    setSizeHint(0, QSize(65, QFontInfo(font(1)).pixelSize() * 2));
+    setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
+    setIcon(0, KIcon("folder").pixmap(sizeHint(0)));
+    setToolTip(1, "<b>" + i18n("Folder"));
+    //setFlags(Qt::NoItemFlags);
+    //kDebug() << "Constructed with clipId: " << m_clipId;
+}
+
+
+FolderProjectItem::~FolderProjectItem()
+{
+}
+
+QString FolderProjectItem::clipId() const
+{
+    return m_clipId;
+}
+
+const QString FolderProjectItem::groupName() const
+{
+    return m_groupName;
+}
+
+void FolderProjectItem::setGroupName(const QString name)
+{
+    m_groupName = name;
+    setText(1, name);
+}
+
+
+
diff --git a/src/folderprojectitem.h b/src/folderprojectitem.h
new file mode 100644 (file)
index 0000000..2ed0631
--- /dev/null
@@ -0,0 +1,45 @@
+/***************************************************************************
+ *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ *   This program is distributed in the hope that it will be useful,       *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
+ *   GNU General Public License for more details.                          *
+ *                                                                         *
+ *   You should have received a copy of the GNU General Public License     *
+ *   along with this program; if not, write to the                         *
+ *   Free Software Foundation, Inc.,                                       *
+ *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
+ ***************************************************************************/
+
+
+#ifndef FOLDERPROJECTITEM_H
+#define FOLDERPROJECTITEM_H
+
+#include <QTreeWidgetItem>
+#include <QTreeWidget>
+
+
+/** \brief Represents a clip or a folder in the projecttree
+ *
+ * This class represents a clip or folder in the projecttree and in the document(?) */
+class FolderProjectItem : public QTreeWidgetItem
+{
+public:
+    FolderProjectItem(QTreeWidget* parent, const QStringList & strings, const QString &clipId);
+    virtual ~FolderProjectItem();
+    QString clipId() const;
+    const QString groupName() const;
+    void setGroupName(const QString name);
+
+private:
+    QString m_groupName;
+    QString m_clipId;
+};
+
+#endif
index b3dc35bd9fab77c46ee591753bf90ff24242205a..d705cbe1e5bfe53e70d7ef49be436c75fb3b17c2 100644 (file)
       <default></default>
     </entry>
 
+    <entry name="hastitleproducer" type="Bool">
+      <label>Is MLT compiled with Qt4 Kdenlive title support.</label>
+      <default>true</default>
+    </entry>
+
     <entry name="producerslist" type="StringList">
       <label>List of available MLT producers.</label>
       <default></default>
index 2947de71e0d174b9a0bf9540a0196597ae87b0c0..7505bc0eb6d7b1952939ef0679cf6a942a13d9b9 100644 (file)
@@ -997,7 +997,7 @@ void MainWindow::setupActions()
     switchMon->setText(i18n("Switch monitor"));
     switchMon->setShortcut(Qt::Key_T);
     connect(switchMon, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMonitors()));
-    
+
     KAction *resizeStart =  new KAction(KIcon(), i18n("Resize Item Start"), this);
     collection->addAction("resize_timeline_clip_start", resizeStart);
     resizeStart->setShortcut(Qt::Key_1);
@@ -1423,7 +1423,7 @@ void MainWindow::newFile(bool showProjectSettings)
         ProjectSettings *w = new ProjectSettings(NULL, QStringList(), projectTracks.x(), projectTracks.y(), KdenliveSettings::defaultprojectfolder(), false, true, this);
         if (w->exec() != QDialog::Accepted) return;
         if (!KdenliveSettings::activatetabs()) closeCurrentDocument();
-       if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
+        if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
         if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
         profileName = w->selectedProfile();
         projectFolder = w->selectedFolder();
@@ -1791,7 +1791,7 @@ void MainWindow::slotEditProjectSettings()
         QString profile = w->selectedProfile();
         m_activeDocument->setProjectFolder(w->selectedFolder());
         if (m_renderWidget) m_renderWidget->setDocumentPath(w->selectedFolder().path(KUrl::AddTrailingSlash));
-       if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
+        if (KdenliveSettings::videothumbnails() != w->enableVideoThumbs()) slotSwitchVideoThumbs();
         if (KdenliveSettings::audiothumbnails() != w->enableAudioThumbs()) slotSwitchAudioThumbs();
         if (m_activeDocument->profilePath() != profile) {
             // Profile was changed
index 7252867e780e1dc20369b4ee388476cee96f0607..b0c525e49e9d0b9064e34c72a96bd42806021372 100644 (file)
 
 const int DurationRole = Qt::UserRole + 1;
 
-// folder
-ProjectItem::ProjectItem(QTreeWidget * parent, const QStringList & strings, const QString &clipId) :
-        QTreeWidgetItem(parent, strings),
-        m_groupname(strings.at(1)),
-        m_clipType(FOLDER),
-        m_clipId(clipId),
-        m_clip(NULL)
-{
-    setSizeHint(0, QSize(65, 45));
-    setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
-    setIcon(0, KIcon("folder"));
-    setToolTip(1, "<b>" + i18n("Folder"));
-    //kDebug() << "Constructed as folder, with clipId: " << m_clipId << ", and groupname: " << m_groupname;
-}
-
 ProjectItem::ProjectItem(QTreeWidget * parent, DocClipBase *clip) :
-        QTreeWidgetItem(parent)
+        QTreeWidgetItem(parent, PROJECTCLIPTYPE)
 {
     setSizeHint(0, QSize(65, 45));
     setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
@@ -65,7 +50,7 @@ ProjectItem::ProjectItem(QTreeWidget * parent, DocClipBase *clip) :
 }
 
 ProjectItem::ProjectItem(QTreeWidgetItem * parent, DocClipBase *clip) :
-        QTreeWidgetItem(parent)
+        QTreeWidgetItem(parent, PROJECTCLIPTYPE)
 {
     setSizeHint(0, QSize(65, 45));
     setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
@@ -109,11 +94,6 @@ int ProjectItem::clipMaxDuration() const
     return m_clip->getProperty("duration").toInt();
 }
 
-bool ProjectItem::isGroup() const
-{
-    return m_clipType == FOLDER;
-}
-
 QStringList ProjectItem::names() const
 {
     QStringList result;
@@ -130,7 +110,7 @@ QDomElement ProjectItem::toXml() const
 
 const KUrl ProjectItem::clipUrl() const
 {
-    if (m_clipType != COLOR && m_clipType != VIRTUAL && m_clipType != UNKNOWN && m_clipType != FOLDER)
+    if (m_clipType != COLOR && m_clipType != VIRTUAL && m_clipType != UNKNOWN)
         return KUrl(m_clip->getProperty("resource"));
     else return KUrl();
 }
@@ -164,17 +144,6 @@ void ProjectItem::clearProperty(const QString &key)
     m_clip->clearProperty(key);
 }
 
-const QString ProjectItem::groupName() const
-{
-    return m_groupname;
-}
-
-void ProjectItem::setGroupName(const QString name)
-{
-    m_groupname = name;
-    setText(1, name);
-}
-
 DocClipBase *ProjectItem::referencedClip()
 {
     return m_clip;
index 2087ee17a796393eae985fb4d6c776c3c86450bd..9817cd1fcfa2ffc994a26d7b3069764b62ac9281 100644 (file)
@@ -38,8 +38,6 @@ class DocClipBase;
 class ProjectItem : public QTreeWidgetItem
 {
 public:
-    /** Create folder item */
-    ProjectItem(QTreeWidget * parent, const QStringList & strings, const QString &clipId);
     ProjectItem(QTreeWidget * parent, DocClipBase *clip);
     ProjectItem(QTreeWidgetItem * parent, DocClipBase *clip);
     virtual ~ProjectItem();
@@ -53,7 +51,6 @@ public:
      * The clipId is used both to identify clips and folders (groups) */
     const QString &clipId() const;
     QStringList names() const;
-    bool isGroup() const;
     const KUrl clipUrl() const;
     int clipMaxDuration() const;
     CLIPTYPE clipType() const;
@@ -62,12 +59,9 @@ public:
     void setProperties(QMap <QString, QString> props);
     void setProperty(const QString &key, const QString &value);
     void clearProperty(const QString &key);
-    const QString groupName() const;
-    void setGroupName(const QString name);
     QString getClipHash() const;
 
 private:
-    QString m_groupname;
     CLIPTYPE m_clipType;
     QString m_clipId;
     void slotSetToolTip();
index 588b275c77af9c5bd5b1c461b0df01c10bab1390..fe7bd46d8058ddc9727a12291d578a530ee49694 100644 (file)
@@ -201,11 +201,12 @@ void ProjectList::setHeaderInfo(const QByteArray &state)
 void ProjectList::slotEditClip()
 {
     ProjectItem *item;
-    if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
+    if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE) return;
+    if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
         item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
     } else item = static_cast <ProjectItem*>(m_listView->currentItem());
     if (!(item->flags() & Qt::ItemIsDragEnabled)) return;
-    if (item && !item->isGroup()) {
+    if (item) {
         emit clipSelected(item->referencedClip());
         emit showClipProperties(item->referencedClip());
     }
@@ -214,10 +215,11 @@ void ProjectList::slotEditClip()
 void ProjectList::slotOpenClip()
 {
     ProjectItem *item;
+    if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE) return;
     if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
         item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
     } else item = static_cast <ProjectItem*>(m_listView->currentItem());
-    if (item && !item->isGroup()) {
+    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"));
             else QProcess::startDetached(KdenliveSettings::defaultimageapp(), QStringList() << item->clipUrl().path());
@@ -235,12 +237,12 @@ void ProjectList::cleanup()
     QTreeWidgetItemIterator it(m_listView);
     ProjectItem *item;
     while (*it) {
-        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+        if ((*it)->type() != PROJECTCLIPTYPE) {
             it++;
             continue;
         }
         item = static_cast <ProjectItem *>(*it);
-        if (!item->isGroup() && item->numReferences() == 0) item->setSelected(true);
+        if (item->numReferences() == 0) item->setSelected(true);
         it++;
     }
     slotRemoveClip();
@@ -253,12 +255,12 @@ void ProjectList::trashUnusedClips()
     QStringList ids;
     QStringList urls;
     while (*it) {
-        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+        if ((*it)->type() != PROJECTCLIPTYPE) {
             it++;
             continue;
         }
         item = static_cast <ProjectItem *>(*it);
-        if (!item->isGroup() && item->numReferences() == 0) {
+        if (item->numReferences() == 0) {
             ids << item->clipId();
             KUrl url = item->clipUrl();
             if (!url.isEmpty() && !urls.contains(url.path())) urls << url.path();
@@ -269,7 +271,7 @@ void ProjectList::trashUnusedClips()
     // Check that we don't use the URL in another clip
     QTreeWidgetItemIterator it2(m_listView);
     while (*it2) {
-        if ((*it2)->type() == QTreeWidgetItem::UserType + 1) {
+        if ((*it2)->type() != PROJECTCLIPTYPE) {
             it2++;
             continue;
         }
@@ -294,9 +296,9 @@ void ProjectList::slotReloadClip(const QString &id)
     else selected.append(getItemById(id));
     ProjectItem *item;
     for (int i = 0; i < selected.count(); i++) {
-        if (selected.at(i)->type() == QTreeWidgetItem::UserType + 1) continue;
+        if (selected.at(i)->type() != PROJECTCLIPTYPE) continue;
         item = static_cast <ProjectItem *>(selected.at(i));
-        if (item && !item->isGroup()) {
+        if (item) {
             if (item->clipType() == IMAGE) {
                 item->referencedClip()->producer()->set("force_reload", 1);
             } else if (item->clipType() == TEXT) {
@@ -317,9 +319,9 @@ void ProjectList::setRenderer(Render *projectRender)
 
 void ProjectList::slotClipSelected()
 {
-    if (m_listView->currentItem()) {
+    if (m_listView->currentItem() && m_listView->currentItem()->type() != PROJECTFOLDERTYPE) {
         ProjectItem *clip;
-        if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
+        if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
             // this is a sub item, use base clip
             clip = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
             if (clip == NULL) kDebug() << "-----------ERROR";
@@ -328,9 +330,7 @@ void ProjectList::slotClipSelected()
             return;
         }
         clip = static_cast <ProjectItem*>(m_listView->currentItem());
-        if (!clip->isGroup()) {
-            emit clipSelected(clip->referencedClip());
-        }
+        emit clipSelected(clip->referencedClip());
         m_editAction->setEnabled(true);
         m_deleteAction->setEnabled(true);
         m_reloadAction->setEnabled(true);
@@ -374,7 +374,7 @@ void ProjectList::slotUpdateClipProperties(const QString &id, QMap <QString, QSt
 void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QString> properties)
 {
     if (!clip) return;
-    if (!clip->isGroup()) clip->setProperties(properties);
+    clip->setProperties(properties);
     if (properties.contains("name")) {
         m_listView->blockSignals(true);
         clip->setText(1, properties.value("name"));
@@ -397,10 +397,23 @@ void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QSt
 
 void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column)
 {
-    if (item->type() == QTreeWidgetItem::UserType + 1) {
+    if (item->type() == PROJECTSUBCLIPTYPE) {
         // this is a sub-item
         return;
     }
+    if (item->type() == PROJECTFOLDERTYPE) {
+        if (column != 1) return;
+        FolderProjectItem *folder = static_cast <FolderProjectItem*>(item);
+        editFolder(item->text(1), folder->groupName(), folder->clipId());
+        folder->setGroupName(item->text(1));
+        m_doc->clipManager()->addFolder(folder->clipId(), item->text(1));
+        const int children = item->childCount();
+        for (int i = 0; i < children; i++) {
+            ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
+            child->setProperty("groupname", item->text(1));
+        }
+        return;
+    }
 
     ProjectItem *clip = static_cast <ProjectItem*>(item);
     if (column == 2) {
@@ -422,26 +435,15 @@ void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column)
             m_commandStack->push(command);
         }
     } else if (column == 1) {
-        if (clip->isGroup()) {
-            editFolder(item->text(1), clip->groupName(), clip->clipId());
-            clip->setGroupName(item->text(1));
-            m_doc->clipManager()->addFolder(clip->clipId(), item->text(1));
-            const int children = item->childCount();
-            for (int i = 0; i < children; i++) {
-                ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
-                child->setProperty("groupname", item->text(1));
-            }
-        } else {
-            if (clip->referencedClip()) {
-                QMap <QString, QString> oldprops;
-                QMap <QString, QString> newprops;
-                oldprops["name"] = clip->referencedClip()->getProperty("name");
-                newprops["name"] = item->text(1);
-                slotUpdateClipProperties(clip, newprops);
-                emit projectModified();
-                EditClipCommand *command = new EditClipCommand(this, clip->clipId(), oldprops, newprops, false);
-                m_commandStack->push(command);
-            }
+        if (clip->referencedClip()) {
+            QMap <QString, QString> oldprops;
+            QMap <QString, QString> newprops;
+            oldprops["name"] = clip->referencedClip()->getProperty("name");
+            newprops["name"] = item->text(1);
+            slotUpdateClipProperties(clip, newprops);
+            emit projectModified();
+            EditClipCommand *command = new EditClipCommand(this, clip->clipId(), oldprops, newprops, false);
+            m_commandStack->push(command);
         }
     }
 }
@@ -457,14 +459,14 @@ void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item)
     m_reloadAction->setEnabled(enable);
     m_transcodeAction->setEnabled(enable);
     if (enable) {
-        ProjectItem *clip;
-        if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
+        ProjectItem *clip = NULL;
+        if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
             clip = static_cast <ProjectItem*>(item->parent());
-        } else clip = static_cast <ProjectItem*>(item);
-        if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
+        } else if (m_listView->currentItem()->type() == PROJECTCLIPTYPE) clip = static_cast <ProjectItem*>(item);
+        if (clip && clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
             m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
             m_openAction->setEnabled(true);
-        } else if (clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
+        } else if (clip && clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
             m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
             m_openAction->setEnabled(true);
         } else m_openAction->setEnabled(false);
@@ -483,25 +485,32 @@ void ProjectList::slotRemoveClip()
     delCommand->setText(i18n("Delete Clip Zone"));
 
     for (int i = 0; i < selected.count(); i++) {
-        if (selected.at(i)->type() == QTreeWidgetItem::UserType + 1) {
+        if (selected.at(i)->type() == PROJECTSUBCLIPTYPE) {
             // subitem
             SubProjectItem *sub = static_cast <SubProjectItem *>(selected.at(i));
             ProjectItem *item = static_cast <ProjectItem *>(sub->parent());
             new AddClipCutCommand(this, item->clipId(), sub->zone().x(), sub->zone().y(), true, delCommand);
             continue;
         }
-        ProjectItem *item = static_cast <ProjectItem *>(selected.at(i));
-        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;
-        } else if (item->isGroup() && item->childCount() > 0) {
-            int children = item->childCount();
-            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;
+
+        if (selected.at(i)->type() == PROJECTFOLDERTYPE) {
+            // folder
+            FolderProjectItem *folder = static_cast <FolderProjectItem *>(selected.at(i));
+            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) return;
             for (int i = 0; i < children; ++i) {
-                ProjectItem *child = static_cast <ProjectItem *>(item->child(i));
+                ProjectItem *child = static_cast <ProjectItem *>(folder->child(i));
                 ids << child->clipId();
             }
+            continue;
+        }
+
+        ProjectItem *item = static_cast <ProjectItem *>(selected.at(i));
+        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 (delCommand->childCount() == 0) delete delCommand;
@@ -555,14 +564,14 @@ void ProjectList::slotAddFolder()
 void ProjectList::slotAddFolder(const QString foldername, const QString &clipId, bool remove, bool edit)
 {
     if (remove) {
-        ProjectItem *item = getFolderItemById(clipId);
+        FolderProjectItem *item = getFolderItemById(clipId);
         if (item) {
             m_doc->clipManager()->deleteFolder(clipId);
             delete item;
         }
     } else {
         if (edit) {
-            ProjectItem *item = getFolderItemById(clipId);
+            FolderProjectItem *item = getFolderItemById(clipId);
             if (item) {
                 m_listView->blockSignals(true);
                 item->setGroupName(foldername);
@@ -578,7 +587,7 @@ void ProjectList::slotAddFolder(const QString foldername, const QString &clipId,
             QStringList text;
             text << QString() << foldername;
             m_listView->blockSignals(true);
-            m_listView->setCurrentItem(new ProjectItem(m_listView, text, clipId));
+            m_listView->setCurrentItem(new FolderProjectItem(m_listView, text, clipId));
             m_doc->clipManager()->addFolder(clipId, foldername);
             m_listView->blockSignals(false);
         }
@@ -615,14 +624,14 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
     const QString parent = clip->getProperty("groupid");
     ProjectItem *item = NULL;
     if (!parent.isEmpty()) {
-        ProjectItem *parentitem = getFolderItemById(parent);
+        FolderProjectItem *parentitem = getFolderItemById(parent);
         if (!parentitem) {
             QStringList text;
             QString groupName = clip->getProperty("groupname");
             //kDebug() << "Adding clip to new group: " << groupName;
             if (groupName.isEmpty()) groupName = i18n("Folder");
             text << QString() << groupName;
-            parentitem = new ProjectItem(m_listView, text, parent);
+            parentitem = new FolderProjectItem(m_listView, text, parent);
         } else {
             //kDebug() << "Adding clip to existing group: " << parentitem->groupName();
         }
@@ -713,7 +722,7 @@ void ProjectList::updateAllClips()
     ProjectItem *item;
     m_listView->blockSignals(true);
     while (*it) {
-        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+        if ((*it)->type() == PROJECTSUBCLIPTYPE) {
             // subitem
             SubProjectItem *sub = static_cast <SubProjectItem *>(*it);
             if (sub->icon(0).isNull()) {
@@ -722,25 +731,27 @@ void ProjectList::updateAllClips()
             }
             ++it;
             continue;
+        } else if ((*it)->type() == PROJECTFOLDERTYPE) {
+            // folder
+            ++it;
+            continue;
         }
         item = static_cast <ProjectItem *>(*it);
-        if (!item->isGroup()) {
-            clip = item->referencedClip();
-            if (item->referencedClip()->producer() == NULL) {
-                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()) {
-                    item->changeDuration(item->referencedClip()->producer()->get_playtime());
-                }
+        clip = item->referencedClip();
+        if (item->referencedClip()->producer() == NULL) {
+            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()) {
+                item->changeDuration(item->referencedClip()->producer()->get_playtime());
             }
-            item->setData(1, UsageRole, QString::number(item->numReferences()));
-            //qApp->processEvents();
         }
+        item->setData(1, UsageRole, QString::number(item->numReferences()));
+        //qApp->processEvents();
         ++it;
     }
     qApp->processEvents();
@@ -878,20 +889,15 @@ void ProjectList::slotAddTitleTemplateClip()
 QStringList ProjectList::getGroup() const
 {
     QStringList result;
-    ProjectItem *item = NULL;
-    if (m_listView->currentItem() && m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
-        // sub item selected
-        item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
-    } else item = static_cast <ProjectItem*>(m_listView->currentItem());
-    if (item && !item->isGroup()) {
-        while (item->parent()) {
-            item = static_cast <ProjectItem*>(item->parent());
-            if (item->isGroup()) break;
-        }
+    QTreeWidgetItem *item = m_listView->currentItem();
+    while (item && item->type() != PROJECTFOLDERTYPE) {
+        item = item->parent();
     }
-    if (item && item->isGroup()) {
-        result << item->groupName();
-        result << item->clipId();
+
+    if (item) {
+        FolderProjectItem *folder = static_cast <FolderProjectItem *>(item);
+        result << folder->groupName();
+        result << folder->clipId();
     } else result << QString() << QString();
     return result;
 }
@@ -914,7 +920,7 @@ void ProjectList::setDocument(KdenliveDoc *doc)
     QMapIterator<QString, QString> f(flist);
     while (f.hasNext()) {
         f.next();
-        (void) new ProjectItem(m_listView, QStringList() << QString() << f.value(), f.key());
+        (void) new FolderProjectItem(m_listView, QStringList() << QString() << f.value(), f.key());
     }
 
     QList <DocClipBase*> list = doc->clipManager()->documentClipList();
@@ -942,13 +948,12 @@ QDomElement ProjectList::producersList()
     kDebug() << "////////////  PRO LISTĀ BUILD PRDSLIST ";
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
-        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+        if ((*it)->type() != PROJECTCLIPTYPE) {
             // subitem
             ++it;
             continue;
         }
-        if (!((ProjectItem *)(*it))->isGroup())
-            prods.appendChild(doc.importNode(((ProjectItem *)(*it))->toXml(), true));
+        prods.appendChild(doc.importNode(((ProjectItem *)(*it))->toXml(), true));
         ++it;
     }
     return prods;
@@ -971,13 +976,12 @@ void ProjectList::reloadClipThumbnails()
     m_thumbnailQueue.clear();
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
-        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+        if ((*it)->type() != PROJECTCLIPTYPE) {
             // subitem
             ++it;
             continue;
         }
-        if (!((ProjectItem *)(*it))->isGroup())
-            m_thumbnailQueue << ((ProjectItem *)(*it))->clipId();
+        m_thumbnailQueue << ((ProjectItem *)(*it))->clipId();
         ++it;
     }
     QTimer::singleShot(300, this, SLOT(slotProcessNextThumbnail()));
@@ -1018,7 +1022,8 @@ void ProjectList::slotRefreshClipThumbnail(QTreeWidgetItem *it, bool update)
     ProjectItem *item = NULL;
     bool isSubItem = false;
     int frame;
-    if (it->type() == QTreeWidgetItem::UserType + 1) {
+    if (it->type() == PROJECTFOLDERTYPE) return;
+    if (it->type() == PROJECTSUBCLIPTYPE) {
         item = static_cast <ProjectItem *>(it->parent());
         frame = static_cast <SubProjectItem *>(it)->zone().x();
         isSubItem = true;
@@ -1058,7 +1063,7 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
     if (item && producer) {
         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());
+        //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 (m_listView->isEnabled() && replace) {
@@ -1107,19 +1112,19 @@ QTreeWidgetItem *ProjectList::getAnyItemById(const QString &id)
 
     ProjectItem *result = NULL;
     while (*it) {
-        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+        if ((*it)->type() != PROJECTCLIPTYPE) {
             // subitem
             ++it;
             continue;
         }
         ProjectItem *item = static_cast<ProjectItem *>(*it);
-        if (item->clipId() == lookId && item->clipType() != FOLDER) {
+        if (item->clipId() == lookId) {
             result = item;
             break;
         }
         ++it;
     }
-    if (!id.contains('#')) return result;
+    if (result == NULL || !id.contains('#')) return result;
     else for (int i = 0; i < result->childCount(); i++) {
             SubProjectItem *sub = static_cast <SubProjectItem *>(result->child(i));
             if (sub && sub->zone().x() == id.section('#', 1, 1).toInt()) {
@@ -1136,27 +1141,28 @@ ProjectItem *ProjectList::getItemById(const QString &id)
     ProjectItem *item;
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
-        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+        if ((*it)->type() != PROJECTCLIPTYPE) {
             // subitem
             ++it;
             continue;
         }
         item = static_cast<ProjectItem *>(*it);
-        if (item->clipId() == id && item->clipType() != FOLDER)
+        if (item->clipId() == id)
             return item;
         ++it;
     }
     return NULL;
 }
 
-ProjectItem *ProjectList::getFolderItemById(const QString &id)
+FolderProjectItem *ProjectList::getFolderItemById(const QString &id)
 {
-    ProjectItem *item;
+    FolderProjectItem *item;
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
-        item = static_cast<ProjectItem *>(*it);
-        if (item->clipId() == id && item->clipType() == FOLDER)
+        if ((*it)->type() == PROJECTFOLDERTYPE) {
+            item = static_cast<FolderProjectItem *>(*it);
             return item;
+        }
         ++it;
     }
     return NULL;
@@ -1185,7 +1191,8 @@ void ProjectList::slotSelectClip(const QString &ix)
 QString ProjectList::currentClipUrl() const
 {
     ProjectItem *item;
-    if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
+    if (!m_listView->currentItem() || m_listView->currentItem()->type() == PROJECTFOLDERTYPE) return QString();
+    if (m_listView->currentItem()->type() == PROJECTSUBCLIPTYPE) {
         // subitem
         item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
     } else item = static_cast <ProjectItem*>(m_listView->currentItem());
@@ -1262,7 +1269,7 @@ void ProjectList::removeClipCut(const QString &id, int in, int out)
         base->removeCutZone(in, out);
         for (int i = 0; i < clip->childCount(); i++) {
             QTreeWidgetItem *it = clip->child(i);
-            if (it->type() != QTreeWidgetItem::UserType + 1) continue;
+            if (it->type() != PROJECTSUBCLIPTYPE) continue;
             SubProjectItem *sub = static_cast <SubProjectItem*>(it);
             if (sub->zone() == QPoint(in, out)) {
                 m_listView->blockSignals(true);
index 79469dc1eb4ba9c65e202b6bda77207d4a1d9a20..5972100c3e3c1aac2779324c44b1e6a54be50bea 100644 (file)
@@ -38,6 +38,7 @@
 #include "definitions.h"
 #include "timecode.h"
 #include "kdenlivesettings.h"
+#include "folderprojectitem.h"
 
 namespace Mlt
 {
@@ -75,7 +76,7 @@ public:
     }
 
     void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
-        if (index.column() == 1) {
+        if (index.column() == 1 && !index.data(DurationRole).isNull()) {
             QRect r1 = option.rect;
             painter->save();
             if (option.state & (QStyle::State_Selected)) {
@@ -174,7 +175,7 @@ private:
     void selectItemById(const QString &clipId);
     ProjectItem *getItemById(const QString &id);
     QTreeWidgetItem *getAnyItemById(const QString &id);
-    ProjectItem *getFolderItemById(const QString &id);
+    FolderProjectItem *getFolderItemById(const QString &id);
     QAction *m_editAction;
     QAction *m_deleteAction;
     QAction *m_openAction;
index 8fc3252de1e6f1ce9e91c81bbaf0d4b535854d5e..7ed3fa546b87dfa90c6b519650fa06b1ba093434 100644 (file)
@@ -21,6 +21,7 @@
 #include "projectlistview.h"
 #include "projectitem.h"
 #include "subprojectitem.h"
+#include "folderprojectitem.h"
 #include "kdenlivesettings.h"
 
 #include <KDebug>
@@ -117,23 +118,23 @@ void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event)
 {
     QTreeWidgetItem *it = itemAt(event->pos());
     if (!it) {
-       emit addClip();
-       return;
+        emit addClip();
+        return;
     }
     ProjectItem *item;
-    if (it->type() == QTreeWidgetItem::UserType + 1) {
+    if (it->type() == PROJECTFOLDERTYPE) {
+        if ((columnAt(event->pos().x()) == 1)) QTreeWidget::mouseDoubleClickEvent(event);
+        return;
+    }
+    if (it->type() == PROJECTSUBCLIPTYPE) {
         // subitem
         item = static_cast <ProjectItem *>(it->parent());
     } else item = static_cast <ProjectItem *>(it);
 
     if (!(item->flags() & Qt::ItemIsDragEnabled)) return;
-    if (item->isGroup()) {
-        if ((columnAt(event->pos().x()) == 1)) QTreeWidget::mouseDoubleClickEvent(event);
-    } else {
-        if ((columnAt(event->pos().x()) == 1) && (item->clipType() == SLIDESHOW || item->clipType() == TEXT || item->clipType() == COLOR)) QTreeWidget::mouseDoubleClickEvent(event);
-        else if ((columnAt(event->pos().x()) == 2) && it->type() != QTreeWidgetItem::UserType + 1) QTreeWidget::mouseDoubleClickEvent(event);
-        else emit showProperties(item->referencedClip());
-    }
+    if ((columnAt(event->pos().x()) == 1) && (item->clipType() == SLIDESHOW || item->clipType() == TEXT || item->clipType() == COLOR)) QTreeWidget::mouseDoubleClickEvent(event);
+    else if ((columnAt(event->pos().x()) == 2) && it->type() != PROJECTSUBCLIPTYPE) QTreeWidget::mouseDoubleClickEvent(event);
+    else emit showProperties(item->referencedClip());
 }
 
 // virtual
@@ -148,24 +149,18 @@ void ProjectListView::dragEnterEvent(QDragEnterEvent *event)
 // virtual
 void ProjectListView::dropEvent(QDropEvent *event)
 {
-    ProjectItem *item = NULL;
+    FolderProjectItem *item = NULL;
     QTreeWidgetItem *it = itemAt(event->pos());
-    if (it) {
-        if (it->type() == QTreeWidgetItem::UserType + 1) {
-            // subitem
-            item = static_cast <ProjectItem *>(it->parent());
-        } else item = static_cast <ProjectItem *>(it);
+    while (it && it->type() != PROJECTFOLDERTYPE) {
+        it = it->parent();
     }
-
+    if (it) item = static_cast <FolderProjectItem *>(it);
     if (event->mimeData()->hasUrls()) {
         QString groupName;
         QString groupId;
         if (item) {
-            if (item->parent()) item = static_cast <ProjectItem *>(item->parent());
-            if (item->isGroup()) {
-                groupName = item->groupName();
-                groupId = item->clipId();
-            }
+            groupName = item->groupName();
+            groupId = item->clipId();
         }
         emit addClip(event->mimeData()->urls(), groupName, groupId);
         event->setDropAction(Qt::CopyAction);
@@ -173,29 +168,25 @@ void ProjectListView::dropEvent(QDropEvent *event)
         return;
     } else if (event->mimeData()->hasFormat("kdenlive/producerslist")) {
         if (item) {
-            if (item->parent()) item = static_cast <ProjectItem *>(item->parent());
-            if (item->isGroup()) {
-                //emit addClip(event->mimeData->text());
-                const QList <QTreeWidgetItem *> list = selectedItems();
-                ProjectItem *clone;
-                QString parentId = item->clipId();
-                foreach(QTreeWidgetItem *it, list) {
-                    // TODO allow dragging of folders ?
-                    if (!((ProjectItem *) it)->isGroup()/* && ((ProjectItem *) it)->clipId() < 10000*/) {
-                        if (it->parent()) clone = (ProjectItem*) it->parent()->takeChild(it->parent()->indexOfChild(it));
-                        else clone = (ProjectItem*) takeTopLevelItem(indexOfTopLevelItem(it));
-                        if (clone) {
-                            item->addChild(clone);
-                            QMap <QString, QString> props;
-                            props.insert("groupname", item->groupName());
-                            props.insert("groupid", parentId);
-                            clone->setProperties(props);
-                        }
+            //emit addClip(event->mimeData->text());
+            const QList <QTreeWidgetItem *> list = selectedItems();
+            ProjectItem *clone;
+            QString parentId = item->clipId();
+            foreach(QTreeWidgetItem *it, list) {
+                // TODO allow dragging of folders ?
+                if (it->type() == PROJECTCLIPTYPE) {
+                    if (it->parent()) clone = (ProjectItem*) it->parent()->takeChild(it->parent()->indexOfChild(it));
+                    else clone = (ProjectItem*) takeTopLevelItem(indexOfTopLevelItem(it));
+                    if (clone) {
+                        item->addChild(clone);
+                        QMap <QString, QString> props;
+                        props.insert("groupname", item->groupName());
+                        props.insert("groupid", parentId);
+                        clone->setProperties(props);
                     }
-                }
-            } else item = NULL;
-        }
-        if (!item) {
+                } else item = NULL;
+            }
+        } else {
             // item dropped in empty zone, move it to top level
             const QList <QTreeWidgetItem *> list = selectedItems();
             ProjectItem *clone;
@@ -251,7 +242,7 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event)
 
     QTreeWidgetItem *it = itemAt(m_DragStartPosition);
     if (!it) return;
-    if (it->type() == QTreeWidgetItem::UserType + 1) {
+    if (it->type() == PROJECTSUBCLIPTYPE) {
         // subitem
         SubProjectItem *clickItem = static_cast <SubProjectItem *>(it);
         if (clickItem && (clickItem->flags() & Qt::ItemIsDragEnabled)) {
@@ -273,20 +264,20 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event)
             drag->exec();
         }
     } else {
-        ProjectItem *clickItem = static_cast <ProjectItem *>(it);
-        if (clickItem && (clickItem->flags() & Qt::ItemIsDragEnabled)) {
+        if (it && (it->flags() & Qt::ItemIsDragEnabled)) {
             QDrag *drag = new QDrag(this);
             QMimeData *mimeData = new QMimeData;
             const QList <QTreeWidgetItem *> list = selectedItems();
             QStringList ids;
             foreach(const QTreeWidgetItem *item, list) {
-                const ProjectItem *clip = static_cast <const ProjectItem *>(item);
-                if (!clip->isGroup()) ids.append(clip->clipId());
-                else {
+                if (item->type() == PROJECTFOLDERTYPE) {
                     const int children = item->childCount();
                     for (int i = 0; i < children; i++) {
                         ids.append(static_cast <ProjectItem *>(item->child(i))->clipId());
                     }
+                } else {
+                    const ProjectItem *clip = static_cast <const ProjectItem *>(item);
+                    ids.append(clip->clipId());
                 }
             }
             if (ids.isEmpty()) return;
@@ -296,7 +287,7 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event)
             //mimeData->setText(ids.join(";")); //doc.toString());
             //mimeData->setImageData(image);
             drag->setMimeData(mimeData);
-            drag->setPixmap(clickItem->icon(0).pixmap(iconSize()));
+            drag->setPixmap(it->icon(0).pixmap(iconSize()));
             drag->setHotSpot(QPoint(0, 50));
             drag->exec();
         }
index c4e7c817b45b9a5e771b5e4af3ea8356fb89032b..941594afe0f6c1719db1ce136010458f81245985 100644 (file)
@@ -163,7 +163,7 @@ void ProjectSettings::slotUpdateFiles(bool cacheOnly)
             usedSize += clip->fileSize();
         }
     }
-#if QT_VERSION >= 0x040500    
+#if QT_VERSION >= 0x040500
     allFiles.removeDuplicates();
 #endif
     files_count->setText(QString::number(allFiles.count()));
index 2a4ce736286564d8032e1d2b26e29ec18d67f720..fc011e23d67c43bdc009aa35380665ead8983159 100644 (file)
@@ -294,10 +294,10 @@ void RenderWidget::slotUpdateButtons(KUrl url)
     }
     if (url != 0) {
         QListWidgetItem *item = m_view.size_list->currentItem();
-       if (!item) {
-           m_view.buttonStart->setEnabled(false);
-           return;
-       }  
+        if (!item) {
+            m_view.buttonStart->setEnabled(false);
+            return;
+        }
         QString extension = item->data(ExtensionRole).toString();
         url = filenameWithExtension(url, extension);
         m_view.out_file->setUrl(url);
index 110ceca75b463174641a1b6f8bc92a52bb821150..27894af788fa6e63da4bb1340d349ee5a52c791c 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "subprojectitem.h"
 #include "timecode.h"
+#include "definitions.h"
 #include "kdenlivesettings.h"
 #include "docclipbase.h"
 
@@ -30,7 +31,7 @@
 const int DurationRole = Qt::UserRole + 1;
 
 SubProjectItem::SubProjectItem(QTreeWidgetItem * parent, int in, int out) :
-        QTreeWidgetItem(parent, QTreeWidgetItem::UserType + 1), m_in(in), m_out(out)
+        QTreeWidgetItem(parent, PROJECTSUBCLIPTYPE), m_in(in), m_out(out)
 {
     setSizeHint(0, QSize(65, 30));
     setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
index 803c65de4de58fbab8b2ea2eae60e1ed36dfebce..677991e9030cfe0c6e20311434e32e6185819184 100644 (file)
@@ -296,6 +296,8 @@ TitleWidget::TitleWidget(KUrl url, Timecode tc, QString projectTitlePath, Render
     initAnimation();
     connect(anim_start, SIGNAL(toggled(bool)), this, SLOT(slotAnimStart(bool)));
     connect(anim_end, SIGNAL(toggled(bool)), this, SLOT(slotAnimEnd(bool)));
+
+    buttonBox->button(QDialogButtonBox::Ok)->setEnabled(KdenliveSettings::hastitleproducer());
 }
 
 TitleWidget::~TitleWidget()
index 00940509fd61ca3b2266838149d8bbe107e96a10..146a94ab01fe347f5735c5b350b3a6d69c30a2a1 100644 (file)
@@ -299,6 +299,18 @@ void Wizard::checkMltComponents()
         } else {
             imageItem->setIcon(0, m_okIcon);
         }
+
+        // Check MLT title module
+        QTreeWidgetItem *titleItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Title module"));
+        titleItem->setData(1, Qt::UserRole, i18n("Required to work with titles"));
+        titleItem->setSizeHint(0, itemSize);
+        if (!result.contains("- kdenlivetitle")) {
+            KdenliveSettings::setHastitleproducer(false);
+            titleItem->setIcon(0, m_badIcon);
+        } else {
+            titleItem->setIcon(0, m_okIcon);
+            KdenliveSettings::setHastitleproducer(true);
+        }
     }
 }