]> git.sesse.net Git - kdenlive/commitdiff
Clip markers can now have a category that is shown as a color.
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 20 Oct 2012 14:15:44 +0000 (16:15 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 20 Oct 2012 14:15:44 +0000 (16:15 +0200)
18 files changed:
src/clipitem.cpp
src/clipproperties.cpp
src/clipproperties.h
src/commands/addmarkercommand.cpp
src/commands/addmarkercommand.h
src/customtrackview.cpp
src/customtrackview.h
src/definitions.h
src/docclipbase.cpp
src/docclipbase.h
src/kdenlivedoc.cpp
src/mainwindow.cpp
src/markerdialog.cpp
src/monitor.cpp
src/projectlist.cpp
src/smallruler.cpp
src/smallruler.h
src/widgets/markerdialog_ui.ui

index 5d73dc42241e73cb13d83c63d1093a1887ef86e8..091eee6af772bf12f0420d4524dd465e24b6eb5e 100644 (file)
@@ -941,10 +941,8 @@ void ClipItem::paint(QPainter *painter,
             QList < CommentedTime >::Iterator it = markers.begin();
             GenTime pos;
             double framepos;
-            QBrush markerBrush(QColor(120, 120, 0, 140));
+           QBrush markerBrush(QColor(120, 120, 0, 140));
             QPen pen = painter->pen();
-            pen.setColor(QColor(255, 255, 255, 200));
-            pen.setStyle(Qt::DotLine);
 
             for (; it != markers.end(); ++it) {
                 pos = GenTime((int)((*it).time().frames(m_fps) / qAbs(m_speed) + 0.5), m_fps) - cropStart();
@@ -952,6 +950,8 @@ void ClipItem::paint(QPainter *painter,
                     if (pos > cropDuration()) break;
                     QLineF l(rect().x() + pos.frames(m_fps), rect().y(), rect().x() + pos.frames(m_fps), rect().bottom());
                     QLineF l2 = painter->worldTransform().map(l);
+                   pen.setColor(CommentedTime::markerColor((*it).markerType()));
+                   pen.setStyle(Qt::DotLine);
                     painter->setPen(pen);
                     painter->drawLine(l2);
                     if (KdenliveSettings::showmarkers()) {
@@ -960,9 +960,10 @@ void ClipItem::paint(QPainter *painter,
                         const QRectF r2 = painter->worldTransform().mapRect(r1);
                         const QRectF txtBounding3 = painter->boundingRect(r2, Qt::AlignLeft | Qt::AlignTop, ' ' + (*it).comment() + ' ');
                         painter->setBrush(markerBrush);
-                        painter->setPen(Qt::NoPen);
-                        painter->drawRoundedRect(txtBounding3, 3, 3);
-                        painter->setBrush(QBrush(Qt::NoBrush));
+                       pen.setStyle(Qt::SolidLine);
+                        painter->setPen(pen);
+                        painter->drawRect(txtBounding3);
+                        painter->setBrush(Qt::NoBrush);
                         painter->setPen(Qt::white);
                         painter->drawText(txtBounding3, Qt::AlignCenter, (*it).comment());
                     }
@@ -1093,7 +1094,7 @@ QList <CommentedTime> ClipItem::commentedSnapMarkers() const
         pos = GenTime((int)(markers.at(i).time().frames(m_fps) / qAbs(m_speed) + 0.5), m_fps) - cropStart();
         if (pos > GenTime()) {
             if (pos > cropDuration()) break;
-            else snaps.append(CommentedTime(pos + startPos(), markers.at(i).comment()));
+            else snaps.append(CommentedTime(pos + startPos(), markers.at(i).comment(), markers.at(i).markerType()));
         }
     }
     return snaps;
index adb9ad44a982154b39eac0e3221e8f1ec54eb173..3fd5b351e4eca050e6bd5e3905f7879f5db89e31 100644 (file)
@@ -732,8 +732,9 @@ void ClipProperties::slotFillMarkersList(DocClipBase *clip)
     for (int count = 0; count < marks.count(); ++count) {
         QString time = m_tc.getTimecode(marks[count].time());
         QStringList itemtext;
-        itemtext << time << marks[count].comment();
-        (void) new QTreeWidgetItem(m_view.markers_list, itemtext);
+        itemtext << time << marks.at(count).comment();
+        QTreeWidgetItem *item = new QTreeWidgetItem(m_view.markers_list, itemtext);
+       item->setData(0, Qt::DecorationRole, CommentedTime::markerColor(marks.at(count).markerType()));
     }
 }
 
@@ -743,7 +744,7 @@ void ClipProperties::slotAddMarker()
     QPointer<MarkerDialog> d = new MarkerDialog(m_clip, marker,
                                           m_tc, i18n("Add Marker"), this);
     if (d->exec() == QDialog::Accepted) {
-        emit addMarker(m_clip->getId(), d->newMarker().time(), d->newMarker().comment());
+        emit addMarker(m_clip->getId(), d->newMarker());
     }
     delete d;
 }
@@ -765,7 +766,7 @@ void ClipProperties::slotEditMarker()
     if (pos < 0 || pos > marks.count() - 1) return;
     MarkerDialog d(m_clip, marks.at(pos), m_tc, i18n("Edit Marker"), this);
     if (d.exec() == QDialog::Accepted) {
-        emit addMarker(m_clip->getId(), d.newMarker().time(), d.newMarker().comment());
+        emit addMarker(m_clip->getId(), d.newMarker());
     }
 }
 
@@ -774,7 +775,9 @@ void ClipProperties::slotDeleteMarker()
     QList < CommentedTime > marks = m_clip->commentedSnapMarkers();
     int pos = m_view.markers_list->currentIndex().row();
     if (pos < 0 || pos > marks.count() - 1) return;
-    emit addMarker(m_clip->getId(), marks.at(pos).time(), QString());
+    CommentedTime marker = marks.at(pos);
+    marker.setMarkerType(-1);
+    emit addMarker(m_clip->getId(), marker);
 }
 
 const QString &ClipProperties::clipId() const
index 17f143ce3bad14dd32f1a36b9073028b2f0c3692..c321b20220d8d07a1911a00a76a25e41223073dd 100644 (file)
@@ -91,7 +91,7 @@ private:
     QFrame* m_proxyContainer;
 
 signals:
-    void addMarker(const QString &, GenTime, QString);
+    void addMarker(const QString &, CommentedTime);
     void deleteProxy(const QString);
     void applyNewClipProperties(const QString, QMap <QString, QString> , QMap <QString, QString> , bool, bool);
     void saveMarkers(const QString &);
index bc6d73207d874b55f167ede86b9f01a4b3b1a52c..376ff81e2521df324de65b228cb38259d4297f52 100644 (file)
 
 #include <KLocale>
 
-AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const QString &id, const GenTime &pos, QUndoCommand * parent) :
+AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const CommentedTime oldMarker, const CommentedTime newMarker, const QString &id, QUndoCommand * parent) :
         QUndoCommand(parent),
         m_view(view),
-        m_oldcomment(oldcomment),
-        m_comment(comment),
-        m_id(id),
-        m_pos(pos)
+        m_oldMarker(oldMarker),
+        m_newMarker(newMarker),
+        m_id(id)
 {
-    if (m_comment.isEmpty()) setText(i18n("Delete marker"));
-    else if (m_oldcomment.isEmpty()) setText(i18n("Add marker"));
+    if (m_newMarker.markerType() < 0) setText(i18n("Delete marker"));
+    else if (m_oldMarker.comment().isEmpty()) setText(i18n("Add marker"));
     else setText(i18n("Edit marker"));
 }
 
@@ -38,11 +37,11 @@ AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const QString &oldcomm
 // virtual
 void AddMarkerCommand::undo()
 {
-    m_view->addMarker(m_id, m_pos, m_oldcomment);
+    m_view->addMarker(m_id, m_oldMarker);
 }
 // virtual
 void AddMarkerCommand::redo()
 {
-    m_view->addMarker(m_id, m_pos, m_comment);
+    m_view->addMarker(m_id, m_newMarker);
 }
 
index c89d0c6748fac14a7d23b6f0dafe2e82f2b74131..12ef595d5625f9cc0ebd78356f9582314ad185ec 100644 (file)
@@ -32,16 +32,15 @@ class CustomTrackView;
 class AddMarkerCommand : public QUndoCommand
 {
 public:
-    AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const QString &id, const GenTime &pos, QUndoCommand * parent = 0);
+    AddMarkerCommand(CustomTrackView *view, const CommentedTime oldMarker, const CommentedTime newMarker, const QString &id, QUndoCommand * parent = 0);
     virtual void undo();
     virtual void redo();
 
 private:
     CustomTrackView *m_view;
-    QString m_oldcomment;
-    QString m_comment;
+    CommentedTime m_oldMarker;
+    CommentedTime m_newMarker;
     QString m_id;
-    GenTime m_pos;
 };
 
 #endif
index d312842ede1c5dd860bc7ea33ce084ee452628a7..a82b48bb7994de8b9ae289ed4f5c829d6555001a 100644 (file)
@@ -5251,16 +5251,23 @@ void CustomTrackView::clipEnd()
     }
 }
 
-void CustomTrackView::slotAddClipMarker(const QString &id, GenTime t, QString c, QUndoCommand *groupCommand)
+void CustomTrackView::slotAddClipMarker(const QString &id, CommentedTime newMarker, QUndoCommand *groupCommand)
 {
-    QString oldcomment = m_document->clipManager()->getClipById(id)->markerComment(t);
-    AddMarkerCommand *command = new AddMarkerCommand(this, oldcomment, c, id, t, groupCommand);
+    CommentedTime oldMarker = m_document->clipManager()->getClipById(id)->markerAt(newMarker.time());
+    if (oldMarker == CommentedTime()) {
+       oldMarker = newMarker;
+       oldMarker.setMarkerType(-1);
+    }
+    AddMarkerCommand *command = new AddMarkerCommand(this, oldMarker, newMarker, id, groupCommand);
     if (!groupCommand) m_commandStack->push(command);
 }
 
 void CustomTrackView::slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position)
 {
-    AddMarkerCommand *command = new AddMarkerCommand(this, comment, QString(), id, position);
+    CommentedTime oldmarker(position, comment);
+    CommentedTime marker = oldmarker;
+    marker.setMarkerType(-1);
+    AddMarkerCommand *command = new AddMarkerCommand(this, oldmarker, marker, id);
     m_commandStack->push(command);
 }
 
@@ -5277,7 +5284,10 @@ void CustomTrackView::slotDeleteAllClipMarkers(const QString &id)
     deleteMarkers->setText("Delete clip markers");
 
     for (int i = 0; i < markers.size(); i++) {
-        new AddMarkerCommand(this, markers.at(i).comment(), QString(), id, markers.at(i).time(), deleteMarkers);
+       CommentedTime oldMarker = markers.at(i);
+       CommentedTime marker = oldMarker;
+       marker.setMarkerType(-1);
+        new AddMarkerCommand(this, oldMarker, marker, id, deleteMarkers);
     }
     m_commandStack->push(deleteMarkers);
 }
@@ -5353,19 +5363,24 @@ void CustomTrackView::slotLoadClipMarkers(const QString &id)
        }
        if (!markerText.isEmpty()) {
            // Marker found, add it
-           slotAddClipMarker(id, GenTime(time1), markerText, command);
-           if (time2 > 0 && time2 != time1) slotAddClipMarker(id, GenTime(time2), markerText, command);
+           //TODO: allow user to set a marker category
+           CommentedTime marker1(GenTime(time1), markerText);
+           slotAddClipMarker(id, marker1, command);
+           if (time2 > 0 && time2 != time1) {
+               CommentedTime marker2(GenTime(time2), markerText);
+               slotAddClipMarker(id, marker2, command);
+           }
        }
     }
     if (command->childCount() > 0) m_commandStack->push(command);
     else delete command;
 }
 
-void CustomTrackView::addMarker(const QString &id, const GenTime &pos, const QString &comment)
+void CustomTrackView::addMarker(const QString &id, const CommentedTime marker)
 {
     DocClipBase *base = m_document->clipManager()->getClipById(id);
-    if (!comment.isEmpty()) base->addSnapMarker(pos, comment);
-    else base->deleteSnapMarker(pos);
+    if (marker.markerType() < 0) base->deleteSnapMarker(marker.time());
+    else base->addSnapMarker(marker);
     emit updateClipMarkers(base);
     setDocumentModified();
     viewport()->update();
index c223016abb54983092ed471ae62072a93de5215c..c4a84704cd5d9b058d7244fd62a0fe85f43e0358 100644 (file)
@@ -76,7 +76,7 @@ public:
     void deleteClip(ItemInfo info, bool refresh = true);
     void slotDeleteClipMarker(const QString &comment, const QString &id, const GenTime &position);
     void slotDeleteAllClipMarkers(const QString &id);
-    void addMarker(const QString &id, const GenTime &pos, const QString &comment);
+    void addMarker(const QString &id, const CommentedTime marker);
     void setScale(double scaleFactor, double verticalScale);
     void deleteClip(const QString &clipId);
     /** @brief Add effect to current clip */
@@ -231,7 +231,7 @@ public slots:
      * @param id Id of the marker's clip
      * @param t Position of the marker
      * @param c Comment of the marker */
-    void slotAddClipMarker(const QString &id, GenTime t, QString c, QUndoCommand *groupCommand = 0);
+    void slotAddClipMarker(const QString &id, CommentedTime newMarker, QUndoCommand *groupCommand = 0);
     void slotLoadClipMarkers(const QString &id);
     void slotSaveClipMarkers(const QString &id);
     bool addGuide(const GenTime &pos, const QString &comment);
index b663fc6b0c4261bfe3a82f8b7fc6fadcc0d1404a..74e79bc7172581beabbb5215f950342cfd788c8a 100644 (file)
@@ -262,9 +262,9 @@ public:
 class CommentedTime
 {
 public:
-    CommentedTime(): t(GenTime(0)) {}
-    CommentedTime(const GenTime &time, QString comment)
-        : t(time), c(comment) { }
+    CommentedTime(): t(GenTime(0)), type(0) {}
+    CommentedTime(const GenTime &time, QString comment, int markerType = 0)
+        : t(time), c(comment), type(markerType) { }
 
     QString comment()   const          {
         return (c.isEmpty() ? i18n("Marker") : c);
@@ -275,6 +275,31 @@ public:
     void    setComment(QString comm) {
         c = comm;
     }
+    void setMarkerType(int t) {
+       type = t;
+    }
+    int markerType() const {
+       return type;
+    }
+    static QColor markerColor(int type) {
+       switch (type) {
+         case 0:
+             return Qt::red;
+             break;
+         case 1:
+             return Qt::blue;
+             break;
+         case 2:
+             return Qt::green;
+             break;
+         case 3:
+             return Qt::yellow;
+             break;
+         default:
+             return Qt::cyan;
+             break;
+       }
+    };
 
     /* Implementation of > operator; Works identically as with basic types. */
     bool operator>(CommentedTime op) const {
@@ -304,6 +329,8 @@ public:
 private:
     GenTime t;
     QString c;
+    int type;
+
 
 
 };
index 09494c9e83944845e7cba057f2c08f22df7e25eb..13d1c40b02a78ad701f521d755eb4fa29f682d07 100644 (file)
@@ -290,22 +290,21 @@ QList < CommentedTime > DocClipBase::commentedSnapMarkers() const
 }
 
 
-void DocClipBase::addSnapMarker(const GenTime & time, QString comment)
+void DocClipBase::addSnapMarker(const CommentedTime marker)
 {
     QList < CommentedTime >::Iterator it = m_snapMarkers.begin();
     for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {
-        if ((*it).time() >= time)
+        if ((*it).time() >= marker.time())
             break;
     }
 
-    if ((it != m_snapMarkers.end()) && ((*it).time() == time)) {
-        (*it).setComment(comment);
+    if ((it != m_snapMarkers.end()) && ((*it).time() == marker.time())) {
+        (*it).setComment(marker.comment());
+       (*it).setMarkerType(marker.markerType());
         //kError() << "trying to add Snap Marker that already exists, this will cause inconsistancies with undo/redo";
     } else {
-        CommentedTime t(time, comment);
-        m_snapMarkers.insert(it, t);
+        m_snapMarkers.insert(it, marker);
     }
-
 }
 
 void DocClipBase::editSnapMarker(const GenTime & time, QString comment)
@@ -378,10 +377,9 @@ GenTime DocClipBase::findNextSnapMarker(const GenTime & currTime)
     return duration();
 }
 
-QString DocClipBase::markerComment(GenTime t)
+QString DocClipBase::markerComment(GenTime t) const
 {
-    QList < CommentedTime >::Iterator itt = m_snapMarkers.begin();
-
+    QList < CommentedTime >::ConstIterator itt = m_snapMarkers.begin();
     while (itt != m_snapMarkers.end()) {
         if ((*itt).time() == t)
             return (*itt).comment();
@@ -390,6 +388,17 @@ QString DocClipBase::markerComment(GenTime t)
     return QString();
 }
 
+CommentedTime DocClipBase::markerAt(GenTime t) const
+{
+    QList < CommentedTime >::ConstIterator itt = m_snapMarkers.begin();
+    while (itt != m_snapMarkers.end()) {
+        if ((*itt).time() == t)
+            return (*itt);
+        ++itt;
+    }
+    return CommentedTime();
+}
+
 void DocClipBase::clearThumbProducer()
 {
     if (m_thumbProd) m_thumbProd->clearProducer();
index fa363746de9081425d298039932d0360973276ab..352a1bd6393affa82344e6576845d4e04884560c 100644 (file)
@@ -263,9 +263,10 @@ public slots:
     GenTime hasSnapMarkers(const GenTime & time);
     QString deleteSnapMarker(const GenTime & time);
     void editSnapMarker(const GenTime & time, QString comment);
-    void addSnapMarker(const GenTime & time, QString comment);
+    void addSnapMarker(const CommentedTime marker);
     QList < GenTime > snapMarkers() const;
-    QString markerComment(GenTime t);
+    QString markerComment(GenTime t) const;
+    CommentedTime markerAt(GenTime t) const;
     void setClipThumbFrame(const uint &ix);
     uint getClipThumbFrame() const;
     void setProperties(QMap <QString, QString> properties);
index be19ccfd08d8890f4094980567a42ec696b576e6..dd1a10f9a619e42b40b5a8cdd6ca219c38d1a65f 100644 (file)
@@ -282,8 +282,10 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
                                     int maxchild = markerslist.count();
                                     for (int k = 0; k < maxchild; k++) {
                                         e = markerslist.at(k).toElement();
-                                        if (e.tagName() == "marker")
-                                            m_clipManager->getClipById(e.attribute("id"))->addSnapMarker(GenTime(e.attribute("time").toDouble()), e.attribute("comment"));
+                                        if (e.tagName() == "marker") {
+                                           CommentedTime marker(GenTime(e.attribute("time").toDouble()), e.attribute("comment"), e.attribute("type").toInt());
+                                            m_clipManager->getClipById(e.attribute("id"))->addSnapMarker(marker);
+                                       }
                                     }
                                     infoXml.removeChild(markers);
                                 }
@@ -725,6 +727,7 @@ QDomDocument KdenliveDoc::xmlSceneList(const QString &scene, const QStringList &
             marker.setAttribute("time", marks.at(j).time().ms() / 1000);
             marker.setAttribute("comment", marks.at(j).comment());
             marker.setAttribute("id", e.attribute("id"));
+           marker.setAttribute("type", marks.at(j).markerType());
             markers.appendChild(marker);
         }
     }
index 0a138bb1fc0f96f8f0ca968db60f2da4825be50f..9d6e64d0860d52981d47e3e480911d31d8a388dd 100644 (file)
@@ -2839,7 +2839,7 @@ void MainWindow::slotAddClipMarker()
     QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
                        m_activeDocument->timecode(), i18n("Add Marker"), this);
     if (d->exec() == QDialog::Accepted)
-        m_activeTimeline->projectView()->slotAddClipMarker(id, d->newMarker().time(), d->newMarker().comment());
+        m_activeTimeline->projectView()->slotAddClipMarker(id, d->newMarker());
     delete d;
 }
 
@@ -2915,20 +2915,20 @@ void MainWindow::slotEditClipMarker()
     }
 
     QString id = clip->getId();
-    QString oldcomment = clip->markerComment(pos);
-    if (oldcomment.isEmpty()) {
+    CommentedTime oldMarker = clip->markerAt(pos);
+    if (oldMarker == CommentedTime()) {
         m_messageLabel->setMessage(i18n("No marker found at cursor time"), ErrorMessage);
         return;
     }
 
-    CommentedTime marker(pos, oldcomment);
-    QPointer<MarkerDialog> d = new MarkerDialog(clip, marker,
+    QPointer<MarkerDialog> d = new MarkerDialog(clip, oldMarker,
                       m_activeDocument->timecode(), i18n("Edit Marker"), this);
     if (d->exec() == QDialog::Accepted) {
-        m_activeTimeline->projectView()->slotAddClipMarker(id, d->newMarker().time(), d->newMarker().comment());
+        m_activeTimeline->projectView()->slotAddClipMarker(id, d->newMarker());
         if (d->newMarker().time() != pos) {
             // remove old marker
-            m_activeTimeline->projectView()->slotAddClipMarker(id, pos, QString());
+            oldMarker.setMarkerType(-1);
+            m_activeTimeline->projectView()->slotAddClipMarker(id, oldMarker);
         }
     }
     delete d;
@@ -2947,8 +2947,9 @@ void MainWindow::slotAddMarkerGuideQuickly()
             m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
             return;
         }
-
-        m_activeTimeline->projectView()->slotAddClipMarker(clip->getId(), pos, m_activeDocument->timecode().getDisplayTimecode(pos, false));
+        //TODO: allow user to set default marker category
+       CommentedTime marker(pos, m_activeDocument->timecode().getDisplayTimecode(pos, false));
+        m_activeTimeline->projectView()->slotAddClipMarker(clip->getId(), marker);
     } else {
         m_activeTimeline->projectView()->slotAddGuide(false);
     }
@@ -3311,7 +3312,7 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip)
 
     // any type of clip but a title
     ClipProperties *dia = new ClipProperties(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
-    connect(dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
+    connect(dia, SIGNAL(addMarker(const QString &, CommentedTime)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, CommentedTime)));
     connect(m_activeTimeline->projectView(), SIGNAL(updateClipMarkers(DocClipBase *)), dia, SLOT(slotFillMarkersList(DocClipBase *)));
     connect(dia, SIGNAL(loadMarkers(const QString &)), m_activeTimeline->projectView(), SLOT(slotLoadClipMarkers(const QString &)));
     connect(dia, SIGNAL(saveMarkers(const QString &)), m_activeTimeline->projectView(), SLOT(slotSaveClipMarkers(const QString &)));
index a3935e5ad396d1d72224b465616c6caaa13f2b1b..5846662f56104bf8e62765a4779d4659516032a3 100644 (file)
@@ -36,6 +36,13 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, cons
     setupUi(this);
     setWindowTitle(caption);
 
+    // Set  up categories
+    for (int i = 0; i < 5; ++i) {
+         marker_type->insertItem(i, i18n("Category %1", i));
+         marker_type->setItemData(i, CommentedTime::markerColor(i), Qt::DecorationRole);
+     }
+    marker_type->setCurrentIndex(t.markerType());
+
     m_in = new TimecodeDisplay(tc, this);
     inputLayout->addWidget(m_in);
     m_in->setValue(t.time());
@@ -121,7 +128,7 @@ void MarkerDialog::slotUpdateThumb()
 
 CommentedTime MarkerDialog::newMarker()
 {
-    return CommentedTime(m_in->gentime(), marker_comment->text());
+    return CommentedTime(m_in->gentime(), marker_comment->text(), marker_type->currentIndex());
 }
 
 #include "markerdialog.moc"
index ccdce950d04d512769f24e3f0c57e74002c80f26..d7491dea4852b5191bdfede8636120384af17cd1 100644 (file)
@@ -226,6 +226,7 @@ QWidget *Monitor::container()
 bool Monitor::createOpenGlWidget(QWidget *parent, const QString profile)
 {
     render = new Render(id(), 0, profile, this);
+    kDebug()<<"+++++++++++++\nCREATED OPENGL WIDG\n++++++++++++++";
     m_glWidget = new VideoGLWidget(parent);
     if (m_glWidget == NULL) {
         // Creation failed, we are in trouble...
@@ -366,8 +367,8 @@ void Monitor::updateMarkers(DocClipBase *source)
                 QAction *go = m_markerMenu->addAction(position);
                 go->setData(pos);
             }
-            m_ruler->setMarkers(marks);
-        } else m_ruler->setMarkers(QList <int>());
+        }
+       m_ruler->setMarkers(markers);
         m_markerMenu->setEnabled(!m_markerMenu->isEmpty());
     }
 }
index 5880f4feba7fd8f9740f719a157022d3d8ec2583..5fe205165618e4775cfcb068b771b1f7ceb11847 100644 (file)
@@ -3460,11 +3460,11 @@ void ProjectList::startClipFilterJob(const QString &filterName, const QString &c
        // Producer params
        jobParams << QString();
        // Filter params, use a smaller region of the image to speed up operation
-       jobParams << filterName << "bounding=\"25%x25%:25%x25\" _scene_cuts=0";
+       jobParams << filterName << "bounding=\"25%x25%:25%x25\" shot_change_list=0";
        // Consumer
        jobParams << "null" << "all=1 terminate_on_pause=1 real_time=-1";
        // Keys
-       jobParams << "_scene_cuts";
+       jobParams << "shot_change_list";
        QStringList extraParams;
        extraParams << "projecttreefilter" << "project_profile";
        processClipJob(ids, QString(), false, jobParams, i18n("Auto split"), extraParams);
@@ -3576,12 +3576,13 @@ void ProjectList::slotGotFilterJobResults(QString id, int , int , QString filter
 {
     if (filter == "motion_est") {
        // Autosplit filter, add sub zones
-       QStringList cuts = results.value("_scene_cuts").split(':', QString::SkipEmptyParts);
+       QStringList cuts = results.value("shot_change_list").split(';', QString::SkipEmptyParts);
        int cutPos = 0;
        QUndoCommand *command = new QUndoCommand();
        command->setText(i18n("Auto Split Clip"));
-       foreach (const QString &pos, cuts) {
-           int newPos = pos.toInt();
+       foreach (QString pos, cuts) {
+           if (!pos.contains("=")) continue;
+           int newPos = pos.section("=", 0, 0).toInt();
            // Don't use scenes shorter than 1 second
            if (newPos - cutPos < 24) continue;
            (void) new AddClipCutCommand(this, id, cutPos, newPos, QString(), true, false, command);
index 1f0dcfe18b332071b0d21b70a59b5e003c9c6e3b..0cf185b05a76c7eaccb4d8128ac5db60f5c3b46c 100644 (file)
@@ -106,7 +106,7 @@ void SmallRuler::setZone(int start, int end)
     updatePixmap();
 }
 
-void SmallRuler::setMarkers(QList < int > list)
+void SmallRuler::setMarkers(QList < CommentedTime > list)
 {
     m_markers = list;
     updatePixmap();
@@ -213,9 +213,10 @@ void SmallRuler::updatePixmap()
     }
     // draw markers
     if (!m_markers.isEmpty()) {
-        p.setPen(Qt::red);
         for (int i = 0; i < m_markers.count(); i++) {
-            p.drawLine(m_markers.at(i) * m_scale, 0, m_markers.at(i) * m_scale, 9);
+           int pos = m_markers.at(i).time().frames(m_manager->timecode().fps()) * m_scale;
+           p.setPen(CommentedTime::markerColor(m_markers.at(i).markerType()));
+            p.drawLine(pos, 0, pos, 9);
         }
     }
     p.end();
index ec08b6d1350fdcd13a28b7c727cf4ac0ee02d4b1..6080ca2ec05344105dac5c1de26d1132ef747fac 100644 (file)
@@ -40,7 +40,7 @@ public:
     void setZoneStart();
     void setZoneEnd();
     QPoint zone();
-    void setMarkers(QList < int > list);
+    void setMarkers(QList < CommentedTime > list);
     void updatePalette();
     void refreshRuler();
 
@@ -58,7 +58,7 @@ private:
     int m_zoneStart;
     int m_zoneEnd;
     KStatefulBrush m_zoneBrush;
-    QList <int> m_markers;
+    QList <CommentedTime> m_markers;
     QPixmap m_pixmap;
     MonitorManager *m_manager;
     Render *m_render;
index cf09cf52d936af3d80a614886f96a7c5cbd78d46..4bdcbe138cd56961e47f4f963c35b8b6edf968d7 100644 (file)
@@ -6,31 +6,35 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>312</width>
-    <height>88</height>
+    <width>376</width>
+    <height>124</height>
    </rect>
   </property>
   <property name="windowTitle">
    <string>Marker</string>
   </property>
   <layout class="QGridLayout" name="gridLayout">
-   <item row="2" column="1" colspan="3">
-    <spacer name="verticalSpacer">
+   <item row="0" column="1">
+    <widget class="QLabel" name="clip_filesize_2">
+     <property name="text">
+      <string>Position</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="3">
+    <spacer name="horizontalSpacer">
      <property name="orientation">
-      <enum>Qt::Vertical</enum>
+      <enum>Qt::Horizontal</enum>
      </property>
      <property name="sizeHint" stdset="0">
       <size>
-       <width>218</width>
-       <height>2</height>
+       <width>40</width>
+       <height>20</height>
       </size>
      </property>
     </spacer>
    </item>
-   <item row="0" column="2">
-    <layout class="QHBoxLayout" name="inputLayout"/>
-   </item>
-   <item row="3" column="0" colspan="4">
+   <item row="6" column="0" colspan="4">
     <widget class="QDialogButtonBox" name="buttonBox">
      <property name="orientation">
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
+   <item row="0" column="2">
+    <layout class="QHBoxLayout" name="inputLayout"/>
+   </item>
+   <item row="1" column="2" colspan="2">
+    <widget class="KLineEdit" name="marker_comment"/>
+   </item>
    <item row="1" column="1">
     <widget class="QLabel" name="clip_filesize_3">
      <property name="text">
      </property>
     </widget>
    </item>
-   <item row="0" column="0" rowspan="3">
+   <item row="5" column="2">
+    <spacer name="verticalSpacer">
+     <property name="orientation">
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>218</width>
+       <height>2</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="4" column="1">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>Category</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="0" rowspan="5">
     <widget class="QLabel" name="clip_thumb">
      <property name="frameShape">
       <enum>QFrame::NoFrame</enum>
      </property>
     </widget>
    </item>
-   <item row="1" column="2" colspan="2">
-    <widget class="KLineEdit" name="marker_comment"/>
-   </item>
-   <item row="0" column="1">
-    <widget class="QLabel" name="clip_filesize_2">
-     <property name="text">
-      <string>Position</string>
-     </property>
-    </widget>
-   </item>
-   <item row="0" column="3">
-    <spacer name="horizontalSpacer">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>40</width>
-       <height>20</height>
-      </size>
-     </property>
-    </spacer>
+   <item row="4" column="2">
+    <widget class="QComboBox" name="marker_type"/>
    </item>
   </layout>
  </widget>