]> git.sesse.net Git - kdenlive/blobdiff - src/dvdwizardchapters.cpp
Fix possible crash in DVD wizard chapters:
[kdenlive] / src / dvdwizardchapters.cpp
index e0749817a1d0474e893c8debc2be6116465bd796..0804f5cb5d30005367f2c8d4b6994d5603159db2 100644 (file)
@@ -38,7 +38,7 @@ DvdWizardChapters::DvdWizardChapters(bool isPal, QWidget *parent) :
     // Build monitor for chapters
 
     if (m_isPal) m_tc.setFormat(25);
-    else m_tc.setFormat(30000.0 / 1001, true);
+    else m_tc.setFormat(30000.0 / 1001);
 
     m_manager = new MonitorManager(this);
     m_manager->resetProfiles(m_tc);
@@ -131,7 +131,7 @@ void DvdWizardChapters::slotRemoveChapter()
 
 void DvdWizardChapters::slotGoToChapter()
 {
-    m_monitor->setTimePos(m_view.chapters_list->currentItem()->text() + ":00");
+    if (m_view.chapters_list->currentItem()) m_monitor->setTimePos(m_tc.reformatSeparators(m_view.chapters_list->currentItem()->text() + ":00"));
 }
 
 void DvdWizardChapters::setVobFiles(bool isPal, bool isWide, const QStringList movies, const QStringList durations, const QStringList chapters)
@@ -142,7 +142,7 @@ void DvdWizardChapters::setVobFiles(bool isPal, bool isWide, const QStringList m
         m_tc.setFormat(25);
         profile = "dv_pal";
     } else {
-        m_tc.setFormat(30000.0 / 1001, true);
+        m_tc.setFormat(30000.0 / 1001);
         profile = "dv_ntsc";
     }
     if (isWide) profile.append("_wide");
@@ -207,10 +207,11 @@ QStringList DvdWizardChapters::selectedTargets() const
     QStringList result;
     int max = m_view.vob_list->count();
     for (int i = 0; i < max; i++) {
-        result.append("jump title " + QString::number(i + 1));
+        // rightJustified: fill with 0s to make menus with more than 9 buttons work (now up to 99 buttons possible)
+        result.append("jump title " + QString::number(i + 1).rightJustified(2, '0'));
         QStringList chapters = m_view.vob_list->itemData(i, Qt::UserRole + 1).toStringList();
         for (int j = 0; j < chapters.count(); j++) {
-            result.append("jump title " + QString::number(i + 1) + " chapter " + QString::number(j + 1));
+            result.append("jump title " + QString::number(i + 1).rightJustified(2, '0') + " chapter " + QString::number(j + 1).rightJustified(2, '0'));
         }
     }
     return result;