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