]> git.sesse.net Git - kdenlive/commitdiff
Add subclips (dragging a zone from clip monitor to project tree)
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 29 Oct 2009 21:51:27 +0000 (21:51 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 29 Oct 2009 21:51:27 +0000 (21:51 +0000)
svn path=/trunk/kdenlive/; revision=4075

21 files changed:
src/CMakeLists.txt
src/abstractclipitem.cpp
src/abstractclipitem.h
src/addclipcutcommand.cpp [new file with mode: 0644]
src/addclipcutcommand.h [new file with mode: 0644]
src/clipitem.cpp
src/clipmanager.cpp
src/customtrackview.cpp
src/docclipbase.cpp
src/docclipbase.h
src/kdenlivedoc.cpp
src/mainwindow.cpp
src/monitor.cpp
src/monitor.h
src/projectlist.cpp
src/projectlist.h
src/projectlistview.cpp
src/projectlistview.h
src/subprojectitem.cpp [new file with mode: 0644]
src/subprojectitem.h [new file with mode: 0644]
src/transition.h

index cd99888d007a797a670293ad4862eb53cf8b12c8..a0ecc3e2771fbe64444ff005a1a4126ac190e5e5 100644 (file)
@@ -173,6 +173,8 @@ set(kdenlive_SRCS
   keyframeedit.cpp
   positionedit.cpp
   trackdialog.cpp
+  subprojectitem.cpp
+  addclipcutcommand.cpp
 )
 
 add_definitions( ${KDE4_DEFINITIONS} )
index 7e7e329d18d528858824486bac0d7883974be4c3..9c191d36e9dddb3b05e5f4ad91705ecec5ffa9d9 100644 (file)
@@ -37,8 +37,8 @@ AbstractClipItem::AbstractClipItem(const ItemInfo info, const QRectF& rect, doub
         m_selectedKeyframe(0),
         m_keyframeFactor(1),
         m_fps(fps)
-#if QT_VERSION >= 0x040600     
-       , m_closeAnimation(NULL)
+#if QT_VERSION >= 0x040600
+        , m_closeAnimation(NULL)
 #endif
 {
     setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
@@ -51,9 +51,9 @@ AbstractClipItem::~AbstractClipItem()
 {
 #if QT_VERSION >= 0x040600
     if (m_closeAnimation) delete m_closeAnimation;
-#endif  
-}  
+#endif
+}
+
 void AbstractClipItem::closeAnimation()
 {
 #if QT_VERSION >= 0x040600
index 7cf0d5fa23f5aff2dc98c4459f555de890b410ee..e49d0db7e456b95087479611761ec5e2748a2e47 100644 (file)
@@ -58,7 +58,7 @@ public:
     void setItemLocked(bool locked);
     bool isItemLocked() const;
     void closeAnimation();
-    
+
     virtual  OPERATIONTYPE operationMode(QPointF pos) = 0;
     virtual GenTime startPos() const ;
     virtual void setTrack(int track);
@@ -91,7 +91,7 @@ protected:
     void drawKeyFrames(QPainter *painter, QRectF exposedRect);
     int mouseOverKeyFrames(QPointF pos, double maxOffset);
     virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
-    
+
 private:
 #if QT_VERSION >= 0x040600
     QPropertyAnimation *m_closeAnimation;
diff --git a/src/addclipcutcommand.cpp b/src/addclipcutcommand.cpp
new file mode 100644 (file)
index 0000000..717a9c5
--- /dev/null
@@ -0,0 +1,49 @@
+/***************************************************************************
+ *   Copyright (C) 2008 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 "addclipcutcommand.h"
+#include "projectlist.h"
+
+#include <KLocale>
+
+AddClipCutCommand::AddClipCutCommand(ProjectList *list, const QString &id, int in, int out, bool remove, QUndoCommand * parent) :
+        QUndoCommand(parent),
+        m_list(list),
+        m_id(id),
+        m_in(in),
+        m_out(out),
+        m_remove(remove)
+{
+    setText(i18n("Add clip cut"));
+}
+
+
+// virtual
+void AddClipCutCommand::undo()
+{
+    if (m_remove) m_list->addClipCut(m_id, m_in, m_out);
+    else m_list->removeClipCut(m_id, m_in, m_out);
+}
+// virtual
+void AddClipCutCommand::redo()
+{
+    if (m_remove) m_list->removeClipCut(m_id, m_in, m_out);
+    else m_list->addClipCut(m_id, m_in, m_out);
+}
+
diff --git a/src/addclipcutcommand.h b/src/addclipcutcommand.h
new file mode 100644 (file)
index 0000000..7351d04
--- /dev/null
@@ -0,0 +1,46 @@
+/***************************************************************************
+ *   Copyright (C) 2008 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 ADDCLIPCUTCOMMAND_H
+#define ADDCLIPCUTCOMMAND_H
+
+#include <QUndoCommand>
+#include <KDebug>
+
+class ProjectList;
+
+class AddClipCutCommand : public QUndoCommand
+{
+public:
+    AddClipCutCommand(ProjectList *list, const QString &id, int in, int out, bool remove, QUndoCommand * parent = 0);
+
+    virtual void undo();
+    virtual void redo();
+
+private:
+    ProjectList *m_list;
+    QString m_id;
+    int m_in;
+    int m_out;
+    bool m_remove;
+};
+
+#endif
+
index 5c21201cd7d53c272272db9d2477175cbc167d6f..0b657927c2b1b20d56bbf8382a52525430115bea 100644 (file)
@@ -1568,7 +1568,7 @@ void ClipItem::setAudioOnly(bool force)
             colour = colour.replace(0, 2, "#");
             m_baseColor = QColor(colour.left(7));
         } else if (m_clipType == AUDIO) m_baseColor = QColor(141, 215, 166);
-       else m_baseColor = QColor(141, 166, 215);
+        else m_baseColor = QColor(141, 166, 215);
     }
     m_audioThumbCachePic.clear();
 }
index 5a7109699f50893d5661bd0d0309baaf9e433789..cf7a540d2e32a813d12863f043cde07307a3ed51 100644 (file)
@@ -335,6 +335,7 @@ void ClipManager::slotAddClipFile(const KUrl url, const QString group, const QSt
     m_doc->commandStack()->push(command);
 }
 
+
 void ClipManager::slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId)
 {
     QDomDocument doc;
index a97b314c96a878f191979df265f16d8d733a4b1e..54b6f66a290cba2a8775f3093ff0cd6e176ef464 100644 (file)
@@ -3300,7 +3300,7 @@ void CustomTrackView::deleteClip(ItemInfo info, bool refresh)
     delete item;
     item = NULL;
 #endif
-    
+
     setDocumentModified();
     if (refresh) m_document->renderer()->doRefresh();
 }
index 2669a878673f0f6db43592e300599f5d09f4b3cc..6a72de10498b2e7273fc650b4bfa1c89b417d4b2 100644 (file)
@@ -58,6 +58,14 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
         m_properties.insert(attributes.item(i).nodeName(), attributes.item(i).nodeValue());
     }
 
+    if (xml.hasAttribute("cutzones")) {
+        QStringList cuts = xml.attribute("cutzones").split(";", QString::SkipEmptyParts);
+        for (int i = 0; i < cuts.count(); i++) {
+            QString z = cuts.at(i);
+            addCutZone(z.section('-', 0, 0).toInt(), z.section('-', 1, 1).toInt());
+        }
+    }
+
     KUrl url = KUrl(xml.attribute("resource"));
     if (!m_properties.contains("file_hash") && !url.isEmpty()) getFileHash(url.path());
 
@@ -262,6 +270,13 @@ QDomElement DocClipBase::toXML() const
         if (!i.value().isEmpty()) clip.setAttribute(i.key(), i.value());
     }
     doc.appendChild(clip);
+    if (!m_cutZones.isEmpty()) {
+        QStringList cuts;
+        for (int i = 0; i < m_cutZones.size(); i++) {
+            cuts << QString::number(m_cutZones.at(i).x()) + "-" + QString::number(m_cutZones.at(i).y());
+        }
+        clip.setAttribute("cutzones", cuts.join(";"));
+    }
     //kDebug() << "/// CLIP XML: " << doc.toString();
     return doc.documentElement();
 }
@@ -841,3 +856,37 @@ bool DocClipBase::isPlaceHolder() const
     return m_placeHolder;
 }
 
+void DocClipBase::addCutZone(int in, int out)
+{
+    if (!m_cutZones.contains(QPoint(in, out))) {
+        m_cutZones.append(QPoint(in, out));
+    }
+}
+
+bool DocClipBase::hasCutZone(QPoint p) const
+{
+    return m_cutZones.contains(p);
+}
+
+
+void DocClipBase::removeCutZone(int in, int out)
+{
+    m_cutZones.removeAll(QPoint(in, out));
+}
+
+void DocClipBase::updateCutZone(int oldin, int oldout, int in, int out)
+{
+    QPoint old(oldin, oldout);
+    for (int i = 0; i < m_cutZones.size(); ++i) {
+        if (m_cutZones.at(i) == old) {
+            m_cutZones.replace(i, QPoint(in, out));
+            break;
+        }
+    }
+}
+
+QList <QPoint> DocClipBase::cutZones() const
+{
+    return m_cutZones;
+}
+
index 907af5330462cfd7384e0dca01fb85b5c656bcc8..288b3d453a6697133f34be271da0471303b1b4d9 100644 (file)
@@ -185,6 +185,12 @@ Q_OBJECT public:
     bool isPlaceHolder() const;
     static QString getHash(const QString &path);
 
+    void addCutZone(int in, int out);
+    bool hasCutZone(QPoint p) const;
+    void removeCutZone(int in, int out);
+    QList <QPoint> cutZones() const;
+    void updateCutZone(int oldin, int oldout, int in, int out);
+
 private:   // Private attributes
 
     /** The number of times this clip is used in the project - the number of references to this clip
@@ -212,6 +218,8 @@ private:   // Private attributes
     /** Wheter the clip is a placeholder (clip missing but user wants to see it) */
     bool m_placeHolder;
 
+    QList <QPoint> m_cutZones;
+
     void setAudioThumbCreated(bool isDone);
     /** Holds clip infos like fps, size,... */
     QMap <QString, QString> m_properties;
index 0b3f05abef19e69ba4bed4adec4d03eeba27264b..4df0fcf2d2d23e8a0b93f7f115d334b320ea3704 100644 (file)
@@ -921,7 +921,6 @@ void KdenliveDoc::addClip(QDomElement elem, QString clipId, bool createClipItem)
     }
 }
 
-
 void KdenliveDoc::setNewClipResource(const QString &id, const QString &path)
 {
     QDomNodeList prods = m_document.elementsByTagName("producer");
@@ -1031,7 +1030,7 @@ void KdenliveDoc::deleteClip(const QString &clipId)
 void KdenliveDoc::slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId)
 {
     m_clipManager->slotAddClipList(urls, group, groupId);
-    emit selectLastAddedClip(QString::number(m_clipManager->lastClipId()));
+    //emit selectLastAddedClip(QString::number(m_clipManager->lastClipId()));
     setModified(true);
 }
 
index 4fc03234f1c14e3db03610ffc1396de821276614..62243db0b02cdab59f34e21508e6c446e97ec8ab 100644 (file)
@@ -1790,7 +1790,7 @@ void MainWindow::slotEditProjectSettings()
             // Deselect current effect / transition
             m_effectStack->slotClipItemSelected(NULL, 0);
             m_transitionConfig->slotTransitionItemSelected(NULL, 0, QPoint(), false);
-            m_clipMonitor->slotSetXml(NULL, 0);
+            m_clipMonitor->slotSetXml(NULL);
             bool updateFps = m_activeDocument->setProfilePath(profile);
             KdenliveSettings::setCurrent_profile(profile);
             KdenliveSettings::setProject_fps(m_activeDocument->fps());
@@ -1949,7 +1949,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     m_projectList->setDocument(doc);
     m_transitionConfig->updateProjectFormat(doc->mltProfile(), doc->timecode(), doc->tracksList());
     m_effectStack->updateProjectFormat(doc->mltProfile(), doc->timecode());
-    connect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
+    connect(m_projectList, SIGNAL(clipSelected(DocClipBase *, QPoint)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint)));
     connect(m_projectList, SIGNAL(refreshClip()), m_clipMonitor, SLOT(refreshMonitor()));
     connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified()));
     connect(m_projectList, SIGNAL(clipNameChanged(const QString, const QString)), trackView->projectView(), SLOT(clipNameChanged(const QString, const QString)));
@@ -2076,7 +2076,7 @@ void MainWindow::slotPreferences(int page, int option)
 void MainWindow::slotUpdatePreviewSettings()
 {
     if (m_activeDocument) {
-        m_clipMonitor->slotSetXml(NULL, 0);
+        m_clipMonitor->slotSetXml(NULL);
         m_activeDocument->updatePreviewSettings();
     }
 }
index 9c6217d20409a2477f386479299d546fdfb64e01..1a17c5f1ae29703e122d1f37cfec6e4a1d3aea94 100644 (file)
@@ -420,7 +420,6 @@ void Monitor::mouseMoveEvent(QMouseEvent *event)
         mimeData->setData("kdenlive/clip", data);
         drag->setMimeData(mimeData);
         QPixmap pix = m_currentClip->thumbnail();
-        kDebug() << "/ / / /CLIP DRAGGED PIXMAP: " << pix.width() << "x" << pix.height();
         drag->setPixmap(pix);
         drag->setHotSpot(QPoint(0, 50));
         drag->start(Qt::MoveAction);
@@ -742,11 +741,11 @@ void Monitor::slotLoopZone()
     m_playAction->setIcon(m_pauseIcon);
 }
 
-void Monitor::slotSetXml(DocClipBase *clip, const int position)
+void Monitor::slotSetXml(DocClipBase *clip, QPoint zone, const int position)
 {
     if (render == NULL) return;
     activateMonitor();
-    if (!clip && m_currentClip != NULL) {
+    if (clip == NULL && m_currentClip != NULL) {
         m_currentClip = NULL;
         render->setProducer(NULL, -1);
         return;
@@ -759,6 +758,10 @@ void Monitor::slotSetXml(DocClipBase *clip, const int position)
             emit blockMonitors();
         }
     } else if (position != -1) render->seek(GenTime(position, m_monitorManager->timecode().fps()));
+    if (!zone.isNull()) {
+        m_ruler->setZone(zone.x(), zone.y());
+        render->seek(GenTime(zone.x(), m_monitorManager->timecode().fps()));
+    }
 }
 
 void Monitor::slotOpenFile(const QString &file)
index 978e080d01d9ec944d5b3cf37d22b919ef97a75b..1fb41d9ec9a98cce19e04b6fe3293575be337e2e 100644 (file)
@@ -139,7 +139,7 @@ private slots:
 
 public slots:
     void slotOpenFile(const QString &);
-    void slotSetXml(DocClipBase *clip, const int position = -1);
+    void slotSetXml(DocClipBase *clip, QPoint zone = QPoint(), const int position = -1);
     void initMonitor();
     void refreshMonitor(bool visible = true);
     void slotSeek(int pos);
index 9f02425b13bbaf829d0ed411ca346ec86b346860..5247e978cdcc04a208957d58e9fbeb7f374b3b84 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "projectlist.h"
 #include "projectitem.h"
+#include "subprojectitem.h"
 #include "addfoldercommand.h"
 #include "kdenlivesettings.h"
 #include "slideshowclip.h"
@@ -33,6 +34,8 @@
 #include "projectlistview.h"
 #include "editclipcommand.h"
 #include "editfoldercommand.h"
+#include "addclipcutcommand.h"
+
 #include "ui_templateclip_ui.h"
 
 #include <KDebug>
@@ -67,7 +70,6 @@ ProjectList::ProjectList(QWidget *parent) :
         m_reloadAction(NULL),
         m_transcodeAction(NULL),
         m_doc(NULL),
-        m_selectedItem(NULL),
         m_refreshed(false),
         m_infoQueue(),
         m_thumbnailQueue()
@@ -103,6 +105,7 @@ ProjectList::ProjectList(QWidget *parent) :
     connect(m_listView, SIGNAL(requestMenu(const QPoint &, QTreeWidgetItem *)), this, SLOT(slotContextMenu(const QPoint &, QTreeWidgetItem *)));
     connect(m_listView, SIGNAL(addClip()), this, SLOT(slotAddClip()));
     connect(m_listView, SIGNAL(addClip(const QList <QUrl>, const QString &, const QString &)), this, SLOT(slotAddClip(const QList <QUrl>, const QString &, const QString &)));
+    connect(m_listView, SIGNAL(addClipCut(const QString &, int, int)), this, SLOT(slotAddClipCut(const QString &, int, int)));
     connect(m_listView, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(slotItemEdited(QTreeWidgetItem *, int)));
     connect(m_listView, SIGNAL(showProperties(DocClipBase *)), this, SIGNAL(showClipProperties(DocClipBase *)));
 
@@ -192,7 +195,10 @@ void ProjectList::setHeaderInfo(const QByteArray &state)
 
 void ProjectList::slotEditClip()
 {
-    ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
+    ProjectItem *item;
+    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->flags() & Qt::ItemIsDragEnabled)) return;
     if (item && !item->isGroup()) {
         emit clipSelected(item->referencedClip());
@@ -202,7 +208,10 @@ void ProjectList::slotEditClip()
 
 void ProjectList::slotOpenClip()
 {
-    ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
+    ProjectItem *item;
+    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->clipType() == IMAGE) {
             if (KdenliveSettings::defaultimageapp().isEmpty()) KMessageBox::sorry(this, i18n("Please set a default application to open images in the Settings dialog"));
@@ -221,6 +230,10 @@ void ProjectList::cleanup()
     QTreeWidgetItemIterator it(m_listView);
     ProjectItem *item;
     while (*it) {
+        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+            it++;
+            continue;
+        }
         item = static_cast <ProjectItem *>(*it);
         if (!item->isGroup() && item->numReferences() == 0) item->setSelected(true);
         it++;
@@ -235,6 +248,10 @@ void ProjectList::trashUnusedClips()
     QStringList ids;
     QStringList urls;
     while (*it) {
+        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+            it++;
+            continue;
+        }
         item = static_cast <ProjectItem *>(*it);
         if (!item->isGroup() && item->numReferences() == 0) {
             ids << item->clipId();
@@ -247,6 +264,10 @@ 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) {
+            it2++;
+            continue;
+        }
         item = static_cast <ProjectItem *>(*it2);
         if (item->numReferences() > 0) {
             KUrl url = item->clipUrl();
@@ -268,6 +289,7 @@ 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;
         item = static_cast <ProjectItem *>(selected.at(i));
         if (item && !item->isGroup()) {
             if (item->clipType() == IMAGE) {
@@ -291,9 +313,17 @@ void ProjectList::setRenderer(Render *projectRender)
 void ProjectList::slotClipSelected()
 {
     if (m_listView->currentItem()) {
-        ProjectItem *clip = static_cast <ProjectItem*>(m_listView->currentItem());
+        ProjectItem *clip;
+        if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
+            // this is a sub item, use base clip
+            clip = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
+            if (clip == NULL) kDebug() << "-----------ERROR";
+            SubProjectItem *sub = static_cast <SubProjectItem*>(m_listView->currentItem());
+            emit clipSelected(clip->referencedClip(), sub->zone());
+            return;
+        }
+        clip = static_cast <ProjectItem*>(m_listView->currentItem());
         if (!clip->isGroup()) {
-            m_selectedItem = clip;
             emit clipSelected(clip->referencedClip());
         }
         m_editAction->setEnabled(true);
@@ -362,6 +392,11 @@ void ProjectList::slotUpdateClipProperties(ProjectItem *clip, QMap <QString, QSt
 
 void ProjectList::slotItemEdited(QTreeWidgetItem *item, int column)
 {
+    if (item->type() == QTreeWidgetItem::UserType + 1) {
+        // this is a sub-item
+        return;
+    }
+
     ProjectItem *clip = static_cast <ProjectItem*>(item);
     if (column == 2) {
         if (clip->referencedClip()) {
@@ -417,7 +452,10 @@ void ProjectList::slotContextMenu(const QPoint &pos, QTreeWidgetItem *item)
     m_reloadAction->setEnabled(enable);
     m_transcodeAction->setEnabled(enable);
     if (enable) {
-        ProjectItem *clip = static_cast <ProjectItem*>(item);
+        ProjectItem *clip;
+        if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
+            clip = static_cast <ProjectItem*>(item->parent());
+        } else clip = static_cast <ProjectItem*>(item);
         if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
             m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
             m_openAction->setEnabled(true);
@@ -435,9 +473,19 @@ void ProjectList::slotRemoveClip()
     QStringList ids;
     QMap <QString, QString> folderids;
     QList<QTreeWidgetItem *> selected = m_listView->selectedItems();
-    ProjectItem *item;
+
+    QUndoCommand *delCommand = new QUndoCommand();
+    delCommand->setText(i18n("Delete Clip Zone"));
+
     for (int i = 0; i < selected.count(); i++) {
-        item = static_cast <ProjectItem *>(selected.at(i));
+        if (selected.at(i)->type() == QTreeWidgetItem::UserType + 1) {
+            // 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) {
@@ -451,6 +499,8 @@ void ProjectList::slotRemoveClip()
             }
         }
     }
+    if (delCommand->childCount() == 0) delete delCommand;
+    else m_commandStack->push(delCommand);
     if (!ids.isEmpty()) m_doc->deleteProjectClip(ids);
     if (!folderids.isEmpty()) deleteProjectFolder(folderids);
     if (m_listView->topLevelItemCount() == 0) {
@@ -590,6 +640,23 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties)
         if (!annotation.isEmpty()) item->setText(2, annotation);
         item->setText(3, QString::number(f.rating()));
     }
+
+    // Add cut zones
+    QList <QPoint> cuts = clip->cutZones();
+    if (!cuts.isEmpty()) {
+        m_listView->blockSignals(true);
+        for (int i = 0; i < cuts.count(); i++) {
+            SubProjectItem *sub = new SubProjectItem(item, cuts.at(i).x(), cuts.at(i).y());
+            if (!clip->getClipHash().isEmpty()) {
+                QString cachedPixmap = m_doc->projectFolder().path(KUrl::AddTrailingSlash) + "thumbs/" + clip->getClipHash() + '#' + QString::number(cuts.at(i).x()) + ".png";
+                if (QFile::exists(cachedPixmap)) {
+                    sub->setIcon(0, QPixmap(cachedPixmap));
+                }
+            }
+        }
+        m_listView->blockSignals(false);
+    }
+
     if (getProperties && m_listView->isEnabled()) m_listView->blockSignals(false);
     if (getProperties && !m_queueTimer.isActive()) m_queueTimer.start();
 }
@@ -624,7 +691,6 @@ void ProjectList::slotProcessNextClipInQueue()
         m_infoQueue.remove(j.key());
         emit getFileProperties(dom, id, false);
     }
-    //if (!m_infoQueue.isEmpty() && !m_queueTimer.isActive()) m_queueTimer.start();
 }
 
 void ProjectList::slotUpdateClip(const QString &id)
@@ -644,6 +710,16 @@ void ProjectList::updateAllClips()
     ProjectItem *item;
     m_listView->blockSignals(true);
     while (*it) {
+        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+            // subitem
+            SubProjectItem *sub = static_cast <SubProjectItem *>(*it);
+            if (sub->icon(0).isNull()) {
+                item = static_cast <ProjectItem *>((*it)->parent());
+                requestClipThumbnail(item->clipId() + '#' + QString::number(sub->zone().x()));
+            }
+            ++it;
+            continue;
+        }
         item = static_cast <ProjectItem *>(*it);
         if (!item->isGroup()) {
             clip = item->referencedClip();
@@ -799,7 +875,11 @@ void ProjectList::slotAddTitleTemplateClip()
 QStringList ProjectList::getGroup() const
 {
     QStringList result;
-    ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
+    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());
@@ -859,6 +939,11 @@ QDomElement ProjectList::producersList()
     kDebug() << "////////////  PRO LIST BUILD PRDSLIST ";
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
+        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+            // subitem
+            ++it;
+            continue;
+        }
         if (!((ProjectItem *)(*it))->isGroup())
             prods.appendChild(doc.importNode(((ProjectItem *)(*it))->toXml(), true));
         ++it;
@@ -883,6 +968,11 @@ void ProjectList::reloadClipThumbnails()
     m_thumbnailQueue.clear();
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
+        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+            // subitem
+            ++it;
+            continue;
+        }
         if (!((ProjectItem *)(*it))->isGroup())
             m_thumbnailQueue << ((ProjectItem *)(*it))->clipId();
         ++it;
@@ -914,13 +1004,26 @@ void ProjectList::slotProcessNextThumbnail()
 
 void ProjectList::slotRefreshClipThumbnail(const QString &clipId, bool update)
 {
-    ProjectItem *item = getItemById(clipId);
+    QTreeWidgetItem *item = getAnyItemById(clipId);
     if (item) slotRefreshClipThumbnail(item, update);
     else slotProcessNextThumbnail();
 }
 
-void ProjectList::slotRefreshClipThumbnail(ProjectItem *item, bool update)
+void ProjectList::slotRefreshClipThumbnail(QTreeWidgetItem *it, bool update)
 {
+    if (it == NULL) return;
+    ProjectItem *item = NULL;
+    bool isSubItem = false;
+    int frame;
+    if (it->type() == QTreeWidgetItem::UserType + 1) {
+        item = static_cast <ProjectItem *>(it->parent());
+        frame = static_cast <SubProjectItem *>(it)->zone().x();
+        isSubItem = true;
+    } else {
+        item = static_cast <ProjectItem *>(it);
+        frame = item->referencedClip()->getClipThumbFrame();
+    }
+
     if (item) {
         DocClipBase *clip = item->referencedClip();
         if (!clip) {
@@ -928,16 +1031,18 @@ void ProjectList::slotRefreshClipThumbnail(ProjectItem *item, bool update)
             return;
         }
         QPixmap pix;
-        int height = 50;
+        int height = it->sizeHint(0).height();
         int width = (int)(height  * m_render->dar());
         if (clip->clipType() == AUDIO) pix = KIcon("audio-x-generic").pixmap(QSize(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);
+        else pix = item->referencedClip()->thumbProducer()->extractImage(frame, width, height);
+
         if (!pix.isNull()) {
             m_listView->blockSignals(true);
-            item->setIcon(0, pix);
+            it->setIcon(0, pix);
             if (m_listView->isEnabled()) m_listView->blockSignals(false);
-            m_doc->cachePixmap(item->getClipHash(), pix);
+            if (!isSubItem) m_doc->cachePixmap(item->getClipHash(), pix);
+            else m_doc->cachePixmap(item->getClipHash() + '#' + QString::number(frame), pix);
         }
         if (update) emit projectModified();
         QTimer::singleShot(30, this, SLOT(slotProcessNextThumbnail()));
@@ -971,6 +1076,10 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce
     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
+    if (item && m_infoQueue.isEmpty() && m_thumbnailQueue.isEmpty()) {
+        m_listView->setCurrentItem(item);
+        emit clipSelected(item->referencedClip());
+    }
     QTimer::singleShot(30, this, SLOT(slotProcessNextClipInQueue()));
 }
 
@@ -985,11 +1094,50 @@ void ProjectList::slotReplyGetImage(const QString &clipId, const QPixmap &pix)
     }
 }
 
+QTreeWidgetItem *ProjectList::getAnyItemById(const QString &id)
+{
+    QTreeWidgetItemIterator it(m_listView);
+    QString lookId = id;
+    if (id.contains('#')) {
+        lookId = id.section('#', 0, 0);
+    }
+
+    ProjectItem *result = NULL;
+    while (*it) {
+        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+            // subitem
+            ++it;
+            continue;
+        }
+        ProjectItem *item = static_cast<ProjectItem *>(*it);
+        if (item->clipId() == lookId && item->clipType() != FOLDER) {
+            result = item;
+            break;
+        }
+        ++it;
+    }
+    if (!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()) {
+                return sub;
+            }
+        }
+
+    return NULL;
+}
+
+
 ProjectItem *ProjectList::getItemById(const QString &id)
 {
     ProjectItem *item;
     QTreeWidgetItemIterator it(m_listView);
     while (*it) {
+        if ((*it)->type() == QTreeWidgetItem::UserType + 1) {
+            // subitem
+            ++it;
+            continue;
+        }
         item = static_cast<ProjectItem *>(*it);
         if (item->clipId() == id && item->clipType() != FOLDER)
             return item;
@@ -1033,7 +1181,11 @@ void ProjectList::slotSelectClip(const QString &ix)
 
 QString ProjectList::currentClipUrl() const
 {
-    ProjectItem *item = static_cast <ProjectItem*>(m_listView->currentItem());
+    ProjectItem *item;
+    if (m_listView->currentItem()->type() == QTreeWidgetItem::UserType + 1) {
+        // subitem
+        item = static_cast <ProjectItem*>(m_listView->currentItem()->parent());
+    } else item = static_cast <ProjectItem*>(m_listView->currentItem());
     if (item == NULL) return QString();
     return item->clipUrl().path();
 }
@@ -1073,4 +1225,52 @@ QDomDocument ProjectList::generateTemplateXml(QString path, const QString &repla
     return doc;
 }
 
+
+void ProjectList::slotAddClipCut(const QString &id, int in, int out)
+{
+    ProjectItem *clip = getItemById(id);
+    if (clip == NULL) return;
+    if (clip->referencedClip()->hasCutZone(QPoint(in, out))) return;
+    AddClipCutCommand *command = new AddClipCutCommand(this, id, in, out, false);
+    m_commandStack->push(command);
+}
+
+void ProjectList::addClipCut(const QString &id, int in, int out)
+{
+    //m_doc->slotAddClipCut(id, in, out, groupName, groupId);
+    ProjectItem *clip = getItemById(id);
+    if (clip) {
+        DocClipBase *base = clip->referencedClip();
+        base->addCutZone(in, out);
+        m_listView->blockSignals(true);
+        SubProjectItem *sub = new SubProjectItem(clip, in, out);
+
+        QPixmap p = clip->referencedClip()->thumbProducer()->extractImage(in, (int)(sub->sizeHint(0).height()  * m_render->dar()), sub->sizeHint(0).height());
+        sub->setIcon(0, p);
+        m_doc->cachePixmap(clip->getClipHash() + '#' + QString::number(in), p);
+        m_listView->blockSignals(false);
+    }
+}
+
+void ProjectList::removeClipCut(const QString &id, int in, int out)
+{
+    //m_doc->slotAddClipCut(id, in, out, groupName, groupId);
+    ProjectItem *clip = getItemById(id);
+    if (clip) {
+        DocClipBase *base = clip->referencedClip();
+        base->removeCutZone(in, out);
+        for (int i = 0; i < clip->childCount(); i++) {
+            QTreeWidgetItem *it = clip->child(i);
+            if (it->type() != QTreeWidgetItem::UserType + 1) continue;
+            SubProjectItem *sub = static_cast <SubProjectItem*>(it);
+            if (sub->zone() == QPoint(in, out)) {
+                m_listView->blockSignals(true);
+                delete it;
+                m_listView->blockSignals(false);
+                break;
+            }
+        }
+    }
+}
+
 #include "projectlist.moc"
index 852904098bd2948ef722c259f8291250314cf129..6c86843964a9b3c98b000117d8dbc7a129f6d91c 100644 (file)
@@ -136,6 +136,8 @@ public:
     void cleanup();
     void trashUnusedClips();
     QList <DocClipBase*> documentClipList() const;
+    void addClipCut(const QString &id, int in, int out);
+    void removeClipCut(const QString &id, int in, int out);
 
 public slots:
     void setDocument(KdenliveDoc *doc);
@@ -146,7 +148,7 @@ public slots:
     void slotDeleteClip(const QString &clipId);
     void slotUpdateClip(const QString &id);
     void slotRefreshClipThumbnail(const QString &clipId, bool update = true);
-    void slotRefreshClipThumbnail(ProjectItem *item, bool update = true);
+    void slotRefreshClipThumbnail(QTreeWidgetItem *item, bool update = true);
     void slotRemoveInvalidClip(const QString &id, bool replace);
     void slotSelectClip(const QString &ix);
     void slotRemoveClip();
@@ -170,6 +172,7 @@ private:
     QUndoStack *m_commandStack;
     void selectItemById(const QString &clipId);
     ProjectItem *getItemById(const QString &id);
+    QTreeWidgetItem *getAnyItemById(const QString &id);
     ProjectItem *getFolderItemById(const QString &id);
     QAction *m_editAction;
     QAction *m_deleteAction;
@@ -177,7 +180,6 @@ private:
     QAction *m_reloadAction;
     QMenu *m_transcodeAction;
     KdenliveDoc *m_doc;
-    ProjectItem *m_selectedItem;
     ItemDelegate *m_listViewDelegate;
     bool m_refreshed;
     QToolButton *m_addButton;
@@ -205,10 +207,11 @@ private slots:
     void slotProcessNextThumbnail();
     void slotCheckForEmptyQueue();
     void slotPauseMonitor();
+    void slotAddClipCut(const QString &id, int in, int out);
     //void slotShowMenu(const QPoint &pos);
 
 signals:
-    void clipSelected(DocClipBase *);
+    void clipSelected(DocClipBase *, QPoint zone = QPoint());
     void getFileProperties(const QDomElement, const QString &, bool);
     void receivedClipDuration(const QString &);
     void showClipProperties(DocClipBase *);
index d96f6a7b2145246144432a7617ce42af35689e5a..17f71189febc59d9f7fe2b85fb745474f31e9384 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "projectlistview.h"
 #include "projectitem.h"
+#include "subprojectitem.h"
 #include "kdenlivesettings.h"
 
 #include <KDebug>
@@ -114,7 +115,13 @@ void ProjectListView::contextMenuEvent(QContextMenuEvent * event)
 // virtual
 void ProjectListView::mouseDoubleClickEvent(QMouseEvent * event)
 {
-    ProjectItem *item = static_cast <ProjectItem *>(itemAt(event->pos()));
+    QTreeWidgetItem *it = itemAt(event->pos());
+    if (!it) return;
+    ProjectItem *item;
+    if (it->type() == QTreeWidgetItem::UserType + 1) {
+        // subitem
+        item = static_cast <ProjectItem *>(it->parent());
+    } else item = static_cast <ProjectItem *>(it);
     if (!item) {
         emit addClip();
         return;
@@ -141,9 +148,16 @@ void ProjectListView::dragEnterEvent(QDragEnterEvent *event)
 // virtual
 void ProjectListView::dropEvent(QDropEvent *event)
 {
-    kDebug() << "////////////////  DROPPED EVENT";
+    ProjectItem *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);
+    }
+
     if (event->mimeData()->hasUrls()) {
-        ProjectItem *item = static_cast <ProjectItem *>(itemAt(event->pos()));
         QString groupName;
         QString groupId;
         if (item) {
@@ -158,12 +172,10 @@ void ProjectListView::dropEvent(QDropEvent *event)
         event->accept();
         return;
     } else if (event->mimeData()->hasFormat("kdenlive/producerslist")) {
-        ProjectItem *item = static_cast <ProjectItem *>(itemAt(event->pos()));
         if (item) {
             if (item->parent()) item = static_cast <ProjectItem *>(item->parent());
             if (item->isGroup()) {
                 //emit addClip(event->mimeData->text());
-                kDebug() << "////////////////  DROPPED RIGHT 1 ";
                 const QList <QTreeWidgetItem *> list = selectedItems();
                 ProjectItem *clone;
                 QString parentId = item->clipId();
@@ -184,7 +196,6 @@ void ProjectListView::dropEvent(QDropEvent *event)
             } else item = NULL;
         }
         if (!item) {
-            kDebug() << "////////////////  DROPPED ON EMPTY ZONE";
             // item dropped in empty zone, move it to top level
             const QList <QTreeWidgetItem *> list = selectedItems();
             ProjectItem *clone;
@@ -201,6 +212,9 @@ void ProjectListView::dropEvent(QDropEvent *event)
                 }
             }
         }
+    } else if (event->mimeData()->hasFormat("kdenlive/clip")) {
+        QStringList list = QString(event->mimeData()->data("kdenlive/clip")).split(';');
+        emit addClipCut(list.at(0), list.at(1).toInt(), list.at(2).toInt());
     }
     event->acceptProposedAction();
 }
@@ -235,8 +249,31 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event)
             < QApplication::startDragDistance())
         return;
 
-    {
-        ProjectItem *clickItem = static_cast <ProjectItem *>(itemAt(m_DragStartPosition));
+    QTreeWidgetItem *it = itemAt(m_DragStartPosition);
+    if (!it) return;
+    if (it->type() == QTreeWidgetItem::UserType + 1) {
+        // subitem
+        SubProjectItem *clickItem = static_cast <SubProjectItem *>(it);
+        if (clickItem && (clickItem->flags() & Qt::ItemIsDragEnabled)) {
+            ProjectItem *clip = static_cast <ProjectItem *>(it->parent());
+            QDrag *drag = new QDrag(this);
+            QMimeData *mimeData = new QMimeData;
+
+            QStringList list;
+            list.append(clip->clipId());
+            QPoint p = clickItem->zone();
+            list.append(QString::number(p.x()));
+            list.append(QString::number(p.y()));
+            QByteArray data;
+            data.append(list.join(";").toUtf8());
+            mimeData->setData("kdenlive/clip", data);
+            drag->setMimeData(mimeData);
+            drag->setPixmap(clickItem->icon(0).pixmap(iconSize()));
+            drag->setHotSpot(QPoint(0, 50));
+            drag->exec();
+        }
+    } else {
+        ProjectItem *clickItem = static_cast <ProjectItem *>(it);
         if (clickItem && (clickItem->flags() & Qt::ItemIsDragEnabled)) {
             QDrag *drag = new QDrag(this);
             QMimeData *mimeData = new QMimeData;
@@ -286,6 +323,7 @@ QStringList ProjectListView::mimeTypes() const
     qstrList.append("text/uri-list");
     qstrList.append("text/plain");
     qstrList.append("kdenlive/producerslist");
+    qstrList.append("kdenlive/clip");
     return qstrList;
 }
 
index bd7b42939d72189d32cf068505faa0d9257b3c11..fe1d1aae330481dd0bc907ac90b79e2129e558ff 100644 (file)
@@ -66,6 +66,7 @@ signals:
     void showProperties(DocClipBase *);
     void focusMonitor();
     void pauseMonitor();
+    void addClipCut(const QString&, int, int);
 };
 
 #endif
diff --git a/src/subprojectitem.cpp b/src/subprojectitem.cpp
new file mode 100644 (file)
index 0000000..110ceca
--- /dev/null
@@ -0,0 +1,72 @@
+/***************************************************************************
+ *   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 "subprojectitem.h"
+#include "timecode.h"
+#include "kdenlivesettings.h"
+#include "docclipbase.h"
+
+#include <KDebug>
+#include <KLocale>
+#include <KIcon>
+
+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)
+{
+    setSizeHint(0, QSize(65, 30));
+    setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemIsEditable);
+    QString name = Timecode::getStringTimecode(in, KdenliveSettings::project_fps());
+    setText(1, name);
+    GenTime duration = GenTime(out - in, KdenliveSettings::project_fps());
+    if (duration != GenTime()) setData(1, DurationRole, Timecode::getEasyTimecode(duration, KdenliveSettings::project_fps()));
+    //setFlags(Qt::NoItemFlags);
+    //kDebug() << "Constructed with clipId: " << m_clipId;
+}
+
+
+SubProjectItem::~SubProjectItem()
+{
+}
+
+int SubProjectItem::numReferences() const
+{
+    return 0;
+}
+
+QDomElement SubProjectItem::toXml() const
+{
+    //return m_clip->toXML();
+    return QDomElement();
+}
+
+QPoint SubProjectItem::zone() const
+{
+    QPoint z(m_in, m_out);
+    return z;
+}
+
+DocClipBase *SubProjectItem::referencedClip()
+{
+    return NULL; //m_clip;
+}
+
+
diff --git a/src/subprojectitem.h b/src/subprojectitem.h
new file mode 100644 (file)
index 0000000..fc8e4a4
--- /dev/null
@@ -0,0 +1,53 @@
+/***************************************************************************
+ *   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 SUBPROJECTITEM_H
+#define SUBPROJECTITEM_H
+
+#include <QTreeWidgetItem>
+#include <QTreeWidget>
+#include <QDomElement>
+
+#include <KUrl>
+
+#include "gentime.h"
+#include "definitions.h"
+
+class DocClipBase;
+
+/** \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 SubProjectItem : public QTreeWidgetItem
+{
+public:
+    SubProjectItem(QTreeWidgetItem * parent, int in, int out);
+    virtual ~SubProjectItem();
+    QDomElement toXml() const;
+    int numReferences() const;
+    DocClipBase *referencedClip();
+    QPoint zone() const;
+
+private:
+    int m_in;
+    int m_out;
+};
+
+#endif
index 69ac44e2756d13904d9051a33af1a1e64aa63010..8960519bfd1d63d558c761f65044ef6eb8d8924f 100644 (file)
@@ -97,7 +97,7 @@ private:
 
     /** Return the transition type for a given name */
     TRANSITIONTYPE getTransitionForName(const QString & type);
-    
+
 #if QT_VERSION >= 0x040600
     QPropertyAnimation *m_startAnimation;
 #endif