]> git.sesse.net Git - kdenlive/blobdiff - src/dvdwizardvob.cpp
When opening project, do not load unused producers at startup, only on demand (when...
[kdenlive] / src / dvdwizardvob.cpp
index 4f058e2bae874700f4e18acd3cefb29c394fbc3b..24921e4116ec89c035526b8d94ce1504d6fb74c5 100644 (file)
@@ -34,6 +34,7 @@
 #include <QDomDocument>
 #include <QTreeWidgetItem>
 #include <QHeaderView>
+#include <unistd.h>
 
 DvdTreeWidget::DvdTreeWidget(QWidget *parent) :
         QTreeWidget(parent)
@@ -69,8 +70,6 @@ DvdWizardVob::DvdWizardVob(QWidget *parent) :
         m_installCheck(true)
 {
     m_view.setupUi(this);
-    m_view.intro_vob->setEnabled(false);
-    m_view.intro_vob->setFilter("video/mpeg");
     m_view.button_add->setIcon(KIcon("list-add"));
     m_view.button_delete->setIcon(KIcon("list-remove"));
     m_view.button_up->setIcon(KIcon("go-up"));
@@ -84,8 +83,6 @@ DvdWizardVob::DvdWizardVob(QWidget *parent) :
 
     connect(m_vobList, SIGNAL(addClips(QList<QUrl>)), this, SLOT(slotAddVobList(QList<QUrl>)));
     connect(m_vobList, SIGNAL(addNewClip()), this, SLOT(slotAddVobFile()));
-    
-    connect(m_view.use_intro, SIGNAL(toggled(bool)), m_view.intro_vob, SLOT(setEnabled(bool)));
     connect(m_view.button_add, SIGNAL(clicked()), this, SLOT(slotAddVobFile()));
     connect(m_view.button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteVobFile()));
     connect(m_view.button_up, SIGNAL(clicked()), this, SLOT(slotItemUp()));
@@ -126,7 +123,7 @@ DvdWizardVob::DvdWizardVob(QWidget *parent) :
     m_warnMessage->setCloseButtonVisible(false);
     m_warnMessage->addAction(m_transcodeAction);
     QGridLayout *s =  static_cast <QGridLayout*> (layout());
-    s->addWidget(m_warnMessage, 3, 0, 1, -1);
+    s->addWidget(m_warnMessage, 2, 0, 1, -1);
     m_warnMessage->hide();
     m_view.button_transcode->setHidden(true);
 #else
@@ -205,11 +202,11 @@ void DvdWizardVob::slotAddVobFile(KUrl url, const QString &chapters, bool checkF
         item->setData(1, Qt::UserRole, playTime);
        int standard = -1;
        int aspect = profile.dar() * 100;
-       if (profile.height() == 576) {
+       if (profile.height() == 576 && profile.fps() == 25.0) {
            if (aspect > 150) standard = 1;
            else standard = 0;
        }
-       else if (profile.height() == 480) {
+       else if (profile.height() == 480 && qAbs(profile.fps() - 30000.0 / 1001) < 0.2) {
            if (aspect > 150) standard = 3;
            else standard = 2;
        }
@@ -230,6 +227,7 @@ void DvdWizardVob::slotAddVobFile(KUrl url, const QString &chapters, bool checkF
          default:
              standardName = i18n("Unknown");
        }
+       standardName.append(QString(" | %1x%2, %3fps").arg(profile.width()).arg(profile.height()).arg(profile.fps()));
        item->setData(0, Qt::UserRole, standardName);
        item->setData(0, Qt::UserRole + 1, standard);
        item->setData(0, Qt::UserRole + 2, QSize(profile.dar() * profile.height(), profile.height()));
@@ -306,7 +304,12 @@ QStringList DvdWizardVob::selectedUrls() 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->text(0));
     }
@@ -359,20 +362,18 @@ int DvdWizardVob::duration(int ix) const
     return result;
 }
 
-
-QString DvdWizardVob::introMovie() const
+const QString DvdWizardVob::introMovie() const
 {
-    if (!m_view.use_intro->isChecked()) return QString();
-    return m_view.intro_vob->url().path();
+    QString url;
+    if (m_view.use_intro->isChecked() && m_vobList->topLevelItemCount() > 0) url = m_vobList->topLevelItem(0)->text(0);
+    return url;
 }
 
-void DvdWizardVob::setIntroMovie(const QString& path)
+void DvdWizardVob::setUseIntroMovie(bool use)
 {
-    m_view.intro_vob->setUrl(KUrl(path));
-    m_view.use_intro->setChecked(path.isEmpty() == false);
+    m_view.use_intro->setChecked(use);
 }
 
-
 void DvdWizardVob::slotCheckVobList()
 {
     emit completeChanged();
@@ -476,7 +477,7 @@ void DvdWizardVob::clear()
 void DvdWizardVob::slotTranscodeFiles()
 {
     // Find transcoding infos related to selected DVD profile
-    KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
+    KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc", KConfig::CascadeConfig);
     KConfigGroup transConfig(config, "Transcoding");
     // read the entries
     QString profileEasyName;
@@ -531,13 +532,20 @@ void DvdWizardVob::slotTranscodeFiles()
            }
            ClipTranscode *d = new ClipTranscode(KUrl::List () << KUrl(item->text(0)), params.section(';', 0, 0), postParams, i18n("Transcoding to DVD format"), true, this);
            connect(d, SIGNAL(transcodedClip(KUrl,KUrl)), this, SLOT(slotTranscodedClip(KUrl, KUrl)));
+           d->slotStartTransCode();
            d->show();
+           
        }
     }
 }
 
 void DvdWizardVob::slotTranscodedClip(KUrl src, KUrl transcoded)
 {
+    if (transcoded.isEmpty()) {
+       // Transcoding canceled or failed
+       m_transcodeAction->setEnabled(true);
+       return;
+    }
     int max = m_vobList->topLevelItemCount();
     for (int i = 0; i < max; i++) {
         QTreeWidgetItem *item = m_vobList->topLevelItem(i);