]> git.sesse.net Git - kdenlive/blob - src/dvdwizardvob.cpp
Final changes to the DVD wizard rewrite. Allow transcoding of non compliant files...
[kdenlive] / src / dvdwizardvob.cpp
1 /***************************************************************************
2  *   Copyright (C) 2009 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 #include "dvdwizardvob.h"
21 #include "kthumb.h"
22 #include "timecode.h"
23 #include "cliptranscode.h"
24
25 #include <mlt++/Mlt.h>
26
27 #include <KUrlRequester>
28 #include <KDebug>
29 #include <KStandardDirs>
30 #include <KFileItem>
31 #include <KFileDialog>
32
33 #include <QHBoxLayout>
34 #include <QDomDocument>
35 #include <QTreeWidgetItem>
36 #include <QHeaderView>
37
38 DvdTreeWidget::DvdTreeWidget(QWidget *parent) :
39         QTreeWidget(parent)
40 {
41     setAcceptDrops(true);
42 }
43
44 void DvdTreeWidget::dragEnterEvent(QDragEnterEvent * event ) {
45     if (event->mimeData()->hasUrls()) {
46         event->setDropAction(Qt::CopyAction);
47         event->setAccepted(true);
48     }
49     else QTreeWidget::dragEnterEvent(event);
50 }
51
52 void DvdTreeWidget::dragMoveEvent(QDragMoveEvent * event) {
53        event->acceptProposedAction();
54 }
55
56 void DvdTreeWidget::mouseDoubleClickEvent( QMouseEvent * )
57 {
58     emit addNewClip();
59 }
60
61 void DvdTreeWidget::dropEvent(QDropEvent * event ) {
62     QList<QUrl> clips = event->mimeData()->urls();
63     event->accept();
64     emit addClips(clips);
65 }
66
67 DvdWizardVob::DvdWizardVob(QWidget *parent) :
68         QWizardPage(parent),
69         m_installCheck(true)
70 {
71     m_view.setupUi(this);
72     m_view.intro_vob->setEnabled(false);
73     m_view.intro_vob->setFilter("video/mpeg");
74     m_view.button_add->setIcon(KIcon("list-add"));
75     m_view.button_delete->setIcon(KIcon("list-remove"));
76     m_view.button_up->setIcon(KIcon("go-up"));
77     m_view.button_down->setIcon(KIcon("go-down"));
78     m_vobList = new DvdTreeWidget(this);
79     QVBoxLayout *lay1 = new QVBoxLayout;
80     lay1->addWidget(m_vobList);
81     m_view.list_frame->setLayout(lay1);
82     m_vobList->setColumnCount(3);
83     m_vobList->setHeaderHidden(true);
84
85     connect(m_vobList, SIGNAL(addClips(QList<QUrl>)), this, SLOT(slotAddVobList(QList<QUrl>)));
86     connect(m_vobList, SIGNAL(addNewClip()), this, SLOT(slotAddVobFile()));
87     
88     connect(m_view.use_intro, SIGNAL(toggled(bool)), m_view.intro_vob, SLOT(setEnabled(bool)));
89     connect(m_view.button_add, SIGNAL(clicked()), this, SLOT(slotAddVobFile()));
90     connect(m_view.button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteVobFile()));
91     connect(m_view.button_up, SIGNAL(clicked()), this, SLOT(slotItemUp()));
92     connect(m_view.button_down, SIGNAL(clicked()), this, SLOT(slotItemDown()));
93     connect(m_vobList, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckVobList()));
94     
95     m_vobList->setIconSize(QSize(60, 45));
96
97     if (KStandardDirs::findExe("dvdauthor").isEmpty()) m_errorMessage.append(i18n("<strong>Program %1 is required for the DVD wizard.</strong>", i18n("dvdauthor")));
98     if (KStandardDirs::findExe("mkisofs").isEmpty() && KStandardDirs::findExe("genisoimage").isEmpty()) m_errorMessage.append(i18n("<strong>Program %1 or %2 is required for the DVD wizard.</strong>", i18n("mkisofs"), i18n("genisoimage")));
99     if (m_errorMessage.isEmpty()) m_view.error_message->setVisible(false);
100     else {
101         m_view.error_message->setText(m_errorMessage);
102         m_installCheck = false;
103     }
104
105     m_view.dvd_profile->addItems(QStringList() << i18n("PAL 4:3") << i18n("PAL 16:9") << i18n("NTSC 4:3") << i18n("NTSC 16:9"));
106
107     connect(m_view.dvd_profile, SIGNAL(activated(int)), this, SLOT(slotCheckProfiles()));
108     m_vobList->header()->setStretchLastSection(false);
109     m_vobList->header()->setResizeMode(0, QHeaderView::Stretch);
110     m_vobList->header()->setResizeMode(1, QHeaderView::Custom);
111     m_vobList->header()->setResizeMode(2, QHeaderView::Custom);
112
113     m_capacityBar = new KCapacityBar(KCapacityBar::DrawTextInline, this);
114     QHBoxLayout *lay = new QHBoxLayout;
115     lay->addWidget(m_capacityBar);
116     m_view.size_box->setLayout(lay);
117
118     m_vobList->setItemDelegate(new DvdViewDelegate(m_vobList));
119     m_transcodeAction = new QAction(i18n("Transcode"), this);
120     connect(m_transcodeAction, SIGNAL(triggered()), this, SLOT(slotTranscodeFiles()));
121
122 #if KDE_IS_VERSION(4,7,0)
123     m_warnMessage = new KMessageWidget;
124     m_warnMessage->setMessageType(KMessageWidget::Warning);
125     m_warnMessage->setText(i18n("Your clips do not match selected DVD format, transcoding required."));
126     m_warnMessage->setCloseButtonVisible(false);
127     m_warnMessage->addAction(m_transcodeAction);
128     QGridLayout *s =  static_cast <QGridLayout*> (layout());
129     s->addWidget(m_warnMessage, 3, 0, 1, -1);
130     m_warnMessage->hide();
131     m_view.button_transcode->setHidden(true);
132 #else
133     m_view.button_transcode->setDefaultAction(m_transcodeAction);
134     m_view.button_transcode->setEnabled(false);
135 #endif
136     
137     slotCheckVobList();
138 }
139
140 DvdWizardVob::~DvdWizardVob()
141 {
142     delete m_capacityBar;
143 }
144
145 void DvdWizardVob::slotCheckProfiles()
146 {
147     bool conflict = false;
148     int comboProfile = m_view.dvd_profile->currentIndex();
149     for (int i = 0; i < m_vobList->topLevelItemCount(); i++) {
150         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
151         if (item->data(0, Qt::UserRole + 1).toInt() != comboProfile) {
152             conflict = true;
153             break;
154         }
155     }
156     m_transcodeAction->setEnabled(conflict);
157     if (conflict) {
158         showProfileError();
159     }
160     else {
161 #if KDE_IS_VERSION(4,7,0)      
162         m_warnMessage->animatedHide();
163 #else
164         if (m_installCheck) m_view.error_message->setVisible(false);
165 #endif
166     }
167 }
168
169 void DvdWizardVob::slotAddVobList(QList <QUrl>list)
170 {
171     foreach (const QUrl url, list) {
172         slotAddVobFile(KUrl(url), QString(), false);
173     }
174     slotCheckVobList();
175     slotCheckProfiles();
176 }
177
178 void DvdWizardVob::slotAddVobFile(KUrl url, const QString &chapters, bool checkFormats)
179 {
180     if (url.isEmpty()) url = KFileDialog::getOpenUrl(KUrl("kfiledialog:///projectfolder"), "video/mpeg", this, i18n("Add new video file"));
181     if (url.isEmpty()) return;
182     QFile f(url.path());
183     qint64 fileSize = f.size();
184
185     Mlt::Profile profile;
186     profile.set_explicit(false);
187     QTreeWidgetItem *item = new QTreeWidgetItem(m_vobList, QStringList() << url.path() << QString() << KIO::convertSize(fileSize));
188     item->setData(2, Qt::UserRole, fileSize);
189     item->setData(0, Qt::DecorationRole, KIcon("video-x-generic").pixmap(60, 45));
190     item->setToolTip(0, url.path());
191
192     QString resource = url.path();
193     resource.prepend("avformat:");
194     Mlt::Producer *producer = new Mlt::Producer(profile, resource.toUtf8().data());
195     if (producer && producer->is_valid() && !producer->is_blank()) {
196         //Mlt::Frame *frame = producer->get_frame();
197         //delete frame;
198         profile.from_producer(*producer);
199         int width = 45.0 * profile.dar();
200         int swidth = 45.0 * profile.width() / profile.height();
201         if (width % 2 == 1) width++;
202         item->setData(0, Qt::DecorationRole, QPixmap::fromImage(KThumb::getFrame(producer, 0, swidth, width, 45)));
203         int playTime = producer->get_playtime();
204         item->setText(1, Timecode::getStringTimecode(playTime, profile.fps()));
205         item->setData(1, Qt::UserRole, playTime);
206         int standard = -1;
207         int aspect = profile.dar() * 100;
208         if (profile.height() == 576) {
209             if (aspect > 150) standard = 1;
210             else standard = 0;
211         }
212         else if (profile.height() == 480) {
213             if (aspect > 150) standard = 3;
214             else standard = 2;
215         }
216         QString standardName;
217         switch (standard) {
218           case 3:
219               standardName = i18n("NTSC 16:9");
220               break;
221           case 2:
222               standardName = i18n("NTSC 4:3");
223               break;
224           case 1:
225               standardName = i18n("PAL 16:9");
226               break;
227           case 0:
228               standardName = i18n("PAL 4:3");
229               break;
230           default:
231               standardName = i18n("Unknown");
232         }
233         item->setData(0, Qt::UserRole, standardName);
234         item->setData(0, Qt::UserRole + 1, standard);
235         item->setData(0, Qt::UserRole + 2, QSize(profile.dar() * profile.height(), profile.height()));
236         if (m_vobList->topLevelItemCount() == 1) {
237             // This is the first added movie, auto select DVD format
238             if (standard >= 0) {
239                 m_view.dvd_profile->blockSignals(true);
240                 m_view.dvd_profile->setCurrentIndex(standard);
241                 m_view.dvd_profile->blockSignals(false);
242             }
243         }
244         
245     }
246     else {
247         // Cannot load movie, reject
248         showError(i18n("The clip %1 is invalid.", url.fileName()));
249     }
250     if (producer) delete producer;
251
252     if (chapters.isEmpty() == false) {
253         item->setData(1, Qt::UserRole + 1, chapters);
254     }
255     else if (QFile::exists(url.path() + ".dvdchapter")) {
256         // insert chapters as children
257         QFile file(url.path() + ".dvdchapter");
258         if (file.open(QIODevice::ReadOnly)) {
259             QDomDocument doc;
260             if (doc.setContent(&file) == false) {
261                 file.close();
262                 return;
263             }
264             file.close();
265             QDomNodeList chapters = doc.elementsByTagName("chapter");
266             QStringList chaptersList;
267             for (int j = 0; j < chapters.count(); j++) {
268                 chaptersList.append(QString::number(chapters.at(j).toElement().attribute("time").toInt()));
269             }
270             item->setData(1, Qt::UserRole + 1, chaptersList.join(";"));
271         }
272     } else // Explicitly add a chapter at 00:00:00:00
273         item->setData(1, Qt::UserRole + 1, "0");
274
275     if (checkFormats) {
276         slotCheckVobList();
277         slotCheckProfiles();
278     }
279 }
280
281 void DvdWizardVob::slotDeleteVobFile()
282 {
283     QTreeWidgetItem *item = m_vobList->currentItem();
284     if (item == NULL) return;
285     delete item;
286     slotCheckVobList();
287     slotCheckProfiles();
288 }
289
290
291 // virtual
292 bool DvdWizardVob::isComplete() const
293 {
294     if (!m_installCheck) return false;
295     if (m_vobList->topLevelItemCount() == 0) return false;
296     return true;
297 }
298
299 void DvdWizardVob::setUrl(const QString &url)
300 {
301     slotAddVobFile(KUrl(url));
302 }
303
304 QStringList DvdWizardVob::selectedUrls() const
305 {
306     QStringList result;
307     QString path;
308     int max = m_vobList->topLevelItemCount();
309     for (int i = 0; i < max; i++) {
310         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
311         if (item) result.append(item->text(0));
312     }
313     return result;
314 }
315
316
317 QStringList DvdWizardVob::durations() const
318 {
319     QStringList result;
320     QString path;
321     int max = m_vobList->topLevelItemCount();
322     for (int i = 0; i < max; i++) {
323         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
324         if (item) result.append(QString::number(item->data(1, Qt::UserRole).toInt()));
325     }
326     return result;
327 }
328
329 QStringList DvdWizardVob::chapters() const
330 {
331     QStringList result;
332     QString path;
333     int max = m_vobList->topLevelItemCount();
334     for (int i = 0; i < max; i++) {
335         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
336         if (item) {
337             result.append(item->data(1, Qt::UserRole + 1).toString());
338         }
339     }
340     return result;
341 }
342
343 void DvdWizardVob::updateChapters(QMap <QString, QString> chaptersdata)
344 {
345     int max = m_vobList->topLevelItemCount();
346     for (int i = 0; i < max; i++) {
347         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
348         if (chaptersdata.contains(item->text(0))) item->setData(1, Qt::UserRole + 1, chaptersdata.value(item->text(0)));
349     }
350 }
351
352 int DvdWizardVob::duration(int ix) const
353 {
354     int result = -1;
355     QTreeWidgetItem *item = m_vobList->topLevelItem(ix);
356     if (item) {
357         result = item->data(1, Qt::UserRole).toInt();
358     }
359     return result;
360 }
361
362
363 QString DvdWizardVob::introMovie() const
364 {
365     if (!m_view.use_intro->isChecked()) return QString();
366     return m_view.intro_vob->url().path();
367 }
368
369 void DvdWizardVob::setIntroMovie(const QString& path)
370 {
371     m_view.intro_vob->setUrl(KUrl(path));
372     m_view.use_intro->setChecked(path.isEmpty() == false);
373 }
374
375
376 void DvdWizardVob::slotCheckVobList()
377 {
378     emit completeChanged();
379     int max = m_vobList->topLevelItemCount();
380     QTreeWidgetItem *item = m_vobList->currentItem();
381     bool hasItem = true;
382     if (item == NULL) hasItem = false;
383     m_view.button_delete->setEnabled(hasItem);
384     if (hasItem && m_vobList->indexOfTopLevelItem(item) == 0) m_view.button_up->setEnabled(false);
385     else m_view.button_up->setEnabled(hasItem);
386     if (hasItem && m_vobList->indexOfTopLevelItem(item) == max - 1) m_view.button_down->setEnabled(false);
387     else m_view.button_down->setEnabled(hasItem);
388
389     qint64 totalSize = 0;
390     for (int i = 0; i < max; i++) {
391         item = m_vobList->topLevelItem(i);
392         if (item) totalSize += (qint64) item->data(2, Qt::UserRole).toInt();
393     }
394
395     qint64 maxSize = (qint64) 47000 * 100000;
396     m_capacityBar->setValue(100 * totalSize / maxSize);
397     m_capacityBar->setText(KIO::convertSize(totalSize));
398 }
399
400 void DvdWizardVob::slotItemUp()
401 {
402     QTreeWidgetItem *item = m_vobList->currentItem();
403     if (item == NULL) return;
404     int index = m_vobList->indexOfTopLevelItem(item);
405     if (index == 0) return;
406     m_vobList->insertTopLevelItem(index - 1, m_vobList->takeTopLevelItem(index));
407 }
408
409 void DvdWizardVob::slotItemDown()
410 {
411     int max = m_vobList->topLevelItemCount();
412     QTreeWidgetItem *item = m_vobList->currentItem();
413     if (item == NULL) return;
414     int index = m_vobList->indexOfTopLevelItem(item);
415     if (index == max - 1) return;
416     m_vobList->insertTopLevelItem(index + 1, m_vobList->takeTopLevelItem(index));
417 }
418
419 DVDFORMAT DvdWizardVob::dvdFormat() const
420 {
421     return (DVDFORMAT) m_view.dvd_profile->currentIndex();
422 }
423
424 const QString DvdWizardVob::dvdProfile() const
425 {
426     QString profile;
427     switch (m_view.dvd_profile->currentIndex()) {
428         case PAL_WIDE:
429             profile = "dv_pal_wide";
430             break;
431         case NTSC:
432             profile = "dv_ntsc";
433             break;
434         case NTSC_WIDE:
435             profile = "dv_ntsc_wide";
436             break;
437         default:
438             profile = "dv_pal";
439     }
440     return profile;
441 }
442
443 //static
444 QString DvdWizardVob::getDvdProfile(DVDFORMAT format)
445 {
446     QString profile;
447     switch (format) {
448         case PAL_WIDE:
449             profile = "dv_pal_wide";
450             break;
451         case NTSC:
452             profile = "dv_ntsc";
453             break;
454         case NTSC_WIDE:
455             profile = "dv_ntsc_wide";
456             break;
457         default:
458             profile = "dv_pal";
459     }
460     return profile;
461 }
462
463 void DvdWizardVob::setProfile(const QString& profile)
464 {
465     if (profile == "dv_pal_wide") m_view.dvd_profile->setCurrentIndex(PAL_WIDE);
466     else if (profile == "dv_ntsc") m_view.dvd_profile->setCurrentIndex(NTSC);
467     else if (profile == "dv_ntsc_wide") m_view.dvd_profile->setCurrentIndex(NTSC_WIDE);
468     else m_view.dvd_profile->setCurrentIndex(PAL);
469 }
470
471 void DvdWizardVob::clear()
472 {
473     m_vobList->clear();
474 }
475
476 void DvdWizardVob::slotTranscodeFiles()
477 {
478     // Find transcoding infos related to selected DVD profile
479     KSharedConfigPtr config = KSharedConfig::openConfig("kdenlivetranscodingrc");
480     KConfigGroup transConfig(config, "Transcoding");
481     // read the entries
482     QString profileEasyName;
483     QSize destSize;
484     QSize finalSize;
485     switch (m_view.dvd_profile->currentIndex()) {
486         case PAL_WIDE:
487             profileEasyName = "DVD PAL 16:9";
488             destSize = QSize(1024, 576);
489             finalSize = QSize(720, 576);
490             break;
491         case NTSC:
492             profileEasyName = "DVD NTSC 4:3";
493             destSize = QSize(640, 480);
494             finalSize = QSize(720, 480);
495             break;
496         case NTSC_WIDE:
497             profileEasyName = "DVD NTSC 16:9";
498             destSize = QSize(853, 480);
499             finalSize = QSize(720, 480);
500             break;
501         default:
502             profileEasyName = "DVD PAL 4:3";
503             destSize = QSize(768, 576);
504             finalSize = QSize(720, 576);
505     }
506     QString params = transConfig.readEntry(profileEasyName);    
507   
508     // Transcode files that do not match selected profile
509     int max = m_vobList->topLevelItemCount();
510     int format = m_view.dvd_profile->currentIndex();
511     for (int i = 0; i < max; i++) {
512         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
513         if (item->data(0, Qt::UserRole + 1).toInt() != format) {
514             // File needs to be transcoded
515             m_transcodeAction->setEnabled(false);
516             QSize original = item->data(0, Qt::UserRole + 2).toSize();
517             double input_aspect= (double) original.width() / original.height();
518             QStringList postParams;
519             if (input_aspect > (double) destSize.width() / destSize.height()) {
520                 // letterboxing
521                 int conv_height = (int) (destSize.width() / input_aspect);
522                 int conv_pad = (int) (((double) (destSize.height() - conv_height)) / 2.0);
523                 if (conv_pad %2 == 1) conv_pad --;
524                 postParams << "-vf" << QString("scale=%1:%2,pad=%3:%4:0:%5,setdar=%6").arg(finalSize.width()).arg(destSize.height() - 2 * conv_pad).arg(finalSize.width()).arg(finalSize.height()).arg(conv_pad).arg(input_aspect);
525             } else {
526                 // pillarboxing
527                 int conv_width = (int) (destSize.height() * input_aspect);
528                 int conv_pad = (int) (((double) (destSize.width() - conv_width)) / destSize.width() * finalSize.width() / 2.0);
529                 if (conv_pad %2 == 1) conv_pad --;
530                 postParams << "-vf" << QString("scale=%1:%2,pad=%3:%4:%5:0,setdar=%6").arg(finalSize.width() - 2 * conv_pad).arg(destSize.height()).arg(finalSize.width()).arg(finalSize.height()).arg(conv_pad).arg(input_aspect);
531             }
532             ClipTranscode *d = new ClipTranscode(KUrl::List () << KUrl(item->text(0)), params.section(';', 0, 0), postParams, i18n("Transcoding to DVD format"), true, this);
533             connect(d, SIGNAL(transcodedClip(KUrl,KUrl)), this, SLOT(slotTranscodedClip(KUrl, KUrl)));
534             d->show();
535         }
536     }
537 }
538
539 void DvdWizardVob::slotTranscodedClip(KUrl src, KUrl transcoded)
540 {
541     int max = m_vobList->topLevelItemCount();
542     for (int i = 0; i < max; i++) {
543         QTreeWidgetItem *item = m_vobList->topLevelItem(i);
544         if (KUrl(item->text(0)).path() == src.path()) {
545             // Replace movie with transcoded version
546             item->setText(0, transcoded.path());
547
548             QFile f(transcoded.path());
549             qint64 fileSize = f.size();
550
551             Mlt::Profile profile;
552             profile.set_explicit(false);
553             item->setText(2, KIO::convertSize(fileSize));
554             item->setData(2, Qt::UserRole, fileSize);
555             item->setData(0, Qt::DecorationRole, KIcon("video-x-generic").pixmap(60, 45));
556             item->setToolTip(0, transcoded.path());
557
558             QString resource = transcoded.path();
559             resource.prepend("avformat:");
560             Mlt::Producer *producer = new Mlt::Producer(profile, resource.toUtf8().data());
561             if (producer && producer->is_valid() && !producer->is_blank()) {
562                 profile.from_producer(*producer);
563                 int width = 45.0 * profile.dar();
564                 int swidth = 45.0 * profile.width() / profile.height();
565                 if (width % 2 == 1) width++;
566                 item->setData(0, Qt::DecorationRole, QPixmap::fromImage(KThumb::getFrame(producer, 0, swidth, width, 45)));
567                 int playTime = producer->get_playtime();
568                 item->setText(1, Timecode::getStringTimecode(playTime, profile.fps()));
569                 item->setData(1, Qt::UserRole, playTime);
570                 int standard = -1;
571                 int aspect = profile.dar() * 100;
572                 if (profile.height() == 576) {
573                     if (aspect > 150) standard = 1;
574                     else standard = 0;
575                 }
576                 else if (profile.height() == 480) {
577                     if (aspect > 150) standard = 3;
578                     else standard = 2;
579                 }
580                 QString standardName;
581                 switch (standard) {
582                   case 3:
583                       standardName = i18n("NTSC 16:9");
584                       break;
585                   case 2:
586                       standardName = i18n("NTSC 4:3");
587                       break;
588                   case 1:
589                       standardName = i18n("PAL 16:9");
590                       break;
591                   case 0:
592                       standardName = i18n("PAL 4:3");
593                       break;
594                   default:
595                       standardName = i18n("Unknown");
596                 }
597                 item->setData(0, Qt::UserRole, standardName);
598                 item->setData(0, Qt::UserRole + 1, standard);
599                 item->setData(0, Qt::UserRole + 2, QSize(profile.dar() * profile.height(), profile.height()));
600             }
601             else {
602                 // Cannot load movie, reject
603                 showError(i18n("The clip %1 is invalid.", transcoded.fileName()));
604             }
605             if (producer) delete producer;
606             slotCheckVobList();
607             slotCheckProfiles();
608             break;
609         }
610     }
611 }
612
613 void DvdWizardVob::showProfileError()
614 {
615 #if KDE_IS_VERSION(4,7,0)
616     m_warnMessage->setText(i18n("Your clips do not match selected DVD format, transcoding required."));
617     m_warnMessage->setCloseButtonVisible(false);
618     m_warnMessage->addAction(m_transcodeAction);
619     m_warnMessage->animatedShow();
620 #else
621     m_view.error_message->setText(i18n("Your clips do not match selected DVD format, transcoding required."));
622     m_view.error_message->setVisible(true);
623 #endif
624 }
625
626 void DvdWizardVob::showError(const QString error)
627 {
628 #if KDE_IS_VERSION(4,7,0)
629     m_warnMessage->setText(error);
630     m_warnMessage->setCloseButtonVisible(true);
631     m_warnMessage->removeAction(m_transcodeAction);
632     m_warnMessage->animatedShow();
633 #else
634     m_view.error_message->setText(error);
635     m_view.error_message->setVisible(true);
636 #endif    
637 }