]> git.sesse.net Git - kdenlive/blobdiff - src/dvdwizardchapters.cpp
Try to fix timecode error:
[kdenlive] / src / dvdwizardchapters.cpp
index 4460ab818661f2760e564762f92df777cbb807e9..6105560832ba0ce92ed7ed857b71774e0301b91e 100644 (file)
@@ -25,7 +25,8 @@
 
 DvdWizardChapters::DvdWizardChapters(bool isPal, QWidget *parent) :
         QWizardPage(parent),
-        m_isPal(isPal)
+        m_isPal(isPal),
+        m_monitor(NULL)
 
 {
     m_view.setupUi(this);
@@ -37,23 +38,19 @@ DvdWizardChapters::DvdWizardChapters(bool isPal, QWidget *parent) :
     // Build monitor for chapters
 
     if (m_isPal) m_tc.setFormat(25);
-    else m_tc.setFormat(30, true);
+    else m_tc.setFormat(30000.0 / 1001);
 
     m_manager = new MonitorManager(this);
     m_manager->resetProfiles(m_tc);
-    m_monitor = new Monitor("chapter", m_manager, this);
-    m_monitor->start();
-
-    QVBoxLayout *vbox = new QVBoxLayout;
-    vbox->addWidget(m_monitor);
-    m_view.monitor_frame->setLayout(vbox);
-
-
+    //m_view.monitor_frame->setVisible(false);
 }
 
 DvdWizardChapters::~DvdWizardChapters()
 {
-    delete m_monitor;
+    if (m_monitor) {
+        m_monitor->stop();
+        delete m_monitor;
+    }
     delete m_manager;
 }
 
@@ -64,6 +61,11 @@ bool DvdWizardChapters::isComplete() const
     return true;
 }
 
+void DvdWizardChapters::stopMonitor()
+{
+    if (m_monitor) m_monitor->stop();
+}
+
 void DvdWizardChapters::slotUpdateChaptersList()
 {
     m_monitor->slotOpenFile(m_view.vob_list->currentText());
@@ -129,22 +131,39 @@ void DvdWizardChapters::slotRemoveChapter()
 
 void DvdWizardChapters::slotGoToChapter()
 {
-    m_monitor->setTimePos(m_view.chapters_list->currentItem()->text() + ":00");
+    m_monitor->setTimePos(m_tc.reformatSeparators(m_view.chapters_list->currentItem()->text() + ":00"));
 }
 
-void DvdWizardChapters::setVobFiles(bool isPal, const QStringList movies, const QStringList durations, const QStringList chapters)
+void DvdWizardChapters::setVobFiles(bool isPal, bool isWide, const QStringList movies, const QStringList durations, const QStringList chapters)
 {
     m_isPal = isPal;
-    if (m_isPal) m_tc.setFormat(25);
-    else m_tc.setFormat(30, true);
+    QString profile;
+    if (m_isPal) {
+        m_tc.setFormat(25);
+        profile = "dv_pal";
+    } else {
+        m_tc.setFormat(30000.0 / 1001);
+        profile = "dv_ntsc";
+    }
+    if (isWide) profile.append("_wide");
     m_manager->resetProfiles(m_tc);
-    m_monitor->resetProfile();
-
+    if (m_monitor == NULL) {
+        m_monitor = new Monitor("chapter", m_manager, profile, this);
+        //m_monitor->start();
+        QVBoxLayout *vbox = new QVBoxLayout;
+        vbox->addWidget(m_monitor);
+        m_view.monitor_frame->setLayout(vbox);
+        /*updateGeometry();
+        m_view.monitor_frame->adjustSize();*/
+    } else m_monitor->resetProfile(profile);
+
+    m_view.vob_list->blockSignals(true);
     m_view.vob_list->clear();
     for (int i = 0; i < movies.count(); i++) {
         m_view.vob_list->addItem(movies.at(i), durations.at(i));
         m_view.vob_list->setItemData(i, chapters.at(i).split(';'), Qt::UserRole + 1);
     }
+    m_view.vob_list->blockSignals(false);
     slotUpdateChaptersList();
 }