]> git.sesse.net Git - kdenlive/commitdiff
Fix DVD chapters broken when using an intro movie, show chapters in monitor ruler
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 10 Feb 2013 00:52:17 +0000 (01:52 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 10 Feb 2013 00:52:50 +0000 (01:52 +0100)
src/dvdwizardchapters.cpp
src/dvdwizardchapters.h
src/dvdwizardvob.cpp
src/monitor.cpp
src/monitor.h

index d95da170b8bae5f7061e9f8554752e52c72244bb..b289445f3aece719691def037aef5cf63246fe9d 100644 (file)
@@ -82,6 +82,7 @@ void DvdWizardChapters::slotUpdateChaptersList()
     }
     m_view.chapters_list->clear();
     m_view.chapters_list->addItems(chaptersString);
+    updateMonitorMarkers();
 
     //bool modified = m_view.vob_list->itemData(m_view.vob_list->currentIndex(), Qt::UserRole + 2).toInt();
 }
@@ -110,6 +111,17 @@ void DvdWizardChapters::slotAddChapter()
     m_view.vob_list->setItemData(m_view.vob_list->currentIndex(), 1, Qt::UserRole + 2);
     m_view.chapters_list->clear();
     m_view.chapters_list->addItems(chaptersString);
+    updateMonitorMarkers();
+}
+
+void DvdWizardChapters::updateMonitorMarkers()
+{
+    QStringList chapters = m_view.vob_list->itemData(m_view.vob_list->currentIndex(), Qt::UserRole + 1).toStringList();
+    QList <CommentedTime> markers;
+    foreach(const QString &frame, chapters) {
+       markers << CommentedTime(GenTime(frame.toInt(), m_tc.fps()), QString());
+    }
+    m_monitor->setMarkers(markers);
 }
 
 void DvdWizardChapters::slotRemoveChapter()
@@ -130,6 +142,7 @@ void DvdWizardChapters::slotRemoveChapter()
     }
     m_view.chapters_list->clear();
     m_view.chapters_list->addItems(chaptersString);
+    updateMonitorMarkers();
 }
 
 void DvdWizardChapters::slotGoToChapter()
index adc4cc3e6c455b4eac07884da45dc4ed276e86dd..32238426f8512049f0a4359f28f98b0bced730a7 100644 (file)
@@ -56,7 +56,7 @@ private:
     Monitor *m_monitor;
     MonitorManager *m_manager;
     Timecode m_tc;
-
+    void updateMonitorMarkers();
 
 private slots:
     void slotUpdateChaptersList();
index 655d086ed511506e12a328ac6c271901bdac8df8..06b9c6dc0cc688b4a81bf573f15be8f60c5187b9 100644 (file)
@@ -333,7 +333,12 @@ QStringList DvdWizardVob::durations() const
     QStringList result;
     QString path;
     int max = m_vobList->topLevelItemCount();
-    for (int i = 0; i < max; i++) {
+    int i = 0;
+    if (m_view.use_intro->isChecked()) {
+       // First movie is only for intro
+       i = 1;
+    }
+    for (; i < max; i++) {
         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
         if (item) result.append(QString::number(item->data(1, Qt::UserRole).toInt()));
     }
@@ -345,7 +350,12 @@ QStringList DvdWizardVob::chapters() const
     QStringList result;
     QString path;
     int max = m_vobList->topLevelItemCount();
-    for (int i = 0; i < max; i++) {
+    int i = 0;
+    if (m_view.use_intro->isChecked()) {
+       // First movie is only for intro
+       i = 1;
+    }
+    for (; i < max; i++) {
         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
         if (item) {
             result.append(item->data(1, Qt::UserRole + 1).toString());
@@ -357,7 +367,12 @@ QStringList DvdWizardVob::chapters() const
 void DvdWizardVob::updateChapters(QMap <QString, QString> chaptersdata)
 {
     int max = m_vobList->topLevelItemCount();
-    for (int i = 0; i < max; i++) {
+    int i = 0;
+    if (m_view.use_intro->isChecked()) {
+       // First movie is only for intro
+       i = 1;
+    }
+    for (; i < max; i++) {
         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
         if (chaptersdata.contains(item->text(0))) item->setData(1, Qt::UserRole + 1, chaptersdata.value(item->text(0)));
     }
index 9b118b273d992a44e5118c5e3884661dad436a93..f98551903f8bcc73dab0aeb58a206d2a9fb03e1e 100644 (file)
@@ -385,6 +385,11 @@ void Monitor::updateMarkers(DocClipBase *source)
     }
 }
 
+void Monitor::setMarkers(QList <CommentedTime> markers)
+{
+    m_ruler->setMarkers(markers);
+}
+
 void Monitor::slotSeekToPreviousSnap()
 {
     if (m_currentClip) slotSeek(getSnapForPos(true).frames(m_monitorManager->timecode().fps()));
index d6bc5b6004bf36fc0a98adfcff161c4af1b2a860..4f11dc58541178f2a70d9f3257c998c9b0ca19b4 100644 (file)
@@ -86,6 +86,7 @@ public:
     void checkOverlay();
     void updateTimecodeFormat();
     void updateMarkers(DocClipBase *source);
+    void setMarkers(QList <CommentedTime> markers);
     MonitorEditWidget *getEffectEdit();
     QWidget *container();
     void reloadProducer(const QString &id);