]> git.sesse.net Git - kdenlive/blob - src/wizard.cpp
Fix possible confusion in variable name
[kdenlive] / src / wizard.cpp
1 /***************************************************************************
2  *   Copyright (C) 2007 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 "wizard.h"
21 #include "kdenlivesettings.h"
22 #include "profilesdialog.h"
23 #include "kdenlive-config.h"
24
25 #include <KStandardDirs>
26 #include <KLocale>
27 #include <KProcess>
28 #include <kmimetype.h>
29 #include <KRun>
30 #include <KService>
31 #include <KMimeTypeTrader>
32
33 #include <QLabel>
34 #include <QFile>
35 #include <QXmlStreamWriter>
36 #include <QTimer>
37
38 const double recommendedMltVersion = 50;
39 static const char kdenlive_version[] = VERSION;
40
41 Wizard::Wizard(bool upgrade, QWidget *parent) :
42         QWizard(parent)
43 {
44     setWindowTitle(i18n("Config Wizard"));
45     setPixmap(QWizard::WatermarkPixmap, QPixmap(KStandardDirs::locate("appdata", "banner.png")));
46
47     QWizardPage *page1 = new QWizardPage;
48     page1->setTitle(i18n("Welcome"));
49     QLabel *label;
50     if (upgrade)
51         label = new QLabel(i18n("Your Kdenlive version was upgraded to version %1. Please take some time to review the basic settings", QString(kdenlive_version).section(' ', 0, 0)));
52     else
53         label = new QLabel(i18n("This is the first time you run Kdenlive. This wizard will let you adjust some basic settings, you will be ready to edit your first movie in a few seconds..."));
54     label->setWordWrap(true);
55     m_startLayout = new QVBoxLayout;
56     m_startLayout->addWidget(label);
57     QPushButton *but = new QPushButton(KIcon("help-about"), i18n("Discover the features of this Kdenlive release"), this);
58     connect(but, SIGNAL(clicked()), this, SLOT(slotShowWebInfos()));
59     m_startLayout->addStretch();
60     m_startLayout->addWidget(but);
61
62
63     page1->setLayout(m_startLayout);
64     addPage(page1);
65
66     QWizardPage *page4 = new QWizardPage;
67     page4->setTitle(i18n("Checking MLT engine"));
68     m_mltCheck.setupUi(page4);
69     addPage(page4);
70
71     WizardDelegate *listViewDelegate = new WizardDelegate(m_mltCheck.programList);
72     m_mltCheck.programList->setItemDelegate(listViewDelegate);
73
74     QWizardPage *page2 = new QWizardPage;
75     page2->setTitle(i18n("Video Standard"));
76     m_standard.setupUi(page2);
77
78     m_okIcon = KIcon("dialog-ok");
79     m_badIcon = KIcon("dialog-close");
80
81     // build profiles lists
82     QMap<QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
83     QMap<QString, QString>::const_iterator i = profilesInfo.constBegin();
84     while (i != profilesInfo.constEnd()) {
85         QMap< QString, QString > profileData = ProfilesDialog::getSettingsFromFile(i.value());
86         if (profileData.value("width") == "720") m_dvProfiles.insert(i.key(), i.value());
87         else if (profileData.value("width").toInt() >= 1080) m_hdvProfiles.insert(i.key(), i.value());
88         else m_otherProfiles.insert(i.key(), i.value());
89         ++i;
90     }
91
92     m_standard.button_all->setChecked(true);
93     connect(m_standard.button_all, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
94     connect(m_standard.button_hdv, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
95     connect(m_standard.button_dv, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
96     slotCheckStandard();
97     connect(m_standard.profiles_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckSelectedItem()));
98
99     // select default profile
100     if (!KdenliveSettings::default_profile().isEmpty()) {
101         for (int i = 0; i < m_standard.profiles_list->count(); i++) {
102             if (m_standard.profiles_list->item(i)->data(Qt::UserRole).toString() == KdenliveSettings::default_profile()) {
103                 m_standard.profiles_list->setCurrentRow(i);
104                 m_standard.profiles_list->scrollToItem(m_standard.profiles_list->currentItem());
105                 break;
106             }
107         }
108     }
109
110     addPage(page2);
111
112     QWizardPage *page3 = new QWizardPage;
113     page3->setTitle(i18n("Additional Settings"));
114     m_extra.setupUi(page3);
115     m_extra.projectfolder->setMode(KFile::Directory);
116     m_extra.projectfolder->setUrl(KUrl(KdenliveSettings::defaultprojectfolder()));
117     m_extra.videothumbs->setChecked(KdenliveSettings::videothumbnails());
118     m_extra.audiothumbs->setChecked(KdenliveSettings::audiothumbnails());
119     m_extra.autosave->setChecked(KdenliveSettings::crashrecovery());
120     connect(m_extra.videothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
121     connect(m_extra.audiothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
122     slotCheckThumbs();
123     addPage(page3);
124
125
126     QWizardPage *page5 = new QWizardPage;
127     page5->setTitle(i18n("Checking system"));
128     m_check.setupUi(page5);
129     addPage(page5);
130
131     listViewDelegate = new WizardDelegate(m_check.programList);
132     m_check.programList->setItemDelegate(listViewDelegate);
133
134     QTimer::singleShot(500, this, SLOT(slotCheckMlt()));
135 }
136
137
138 void Wizard::checkMltComponents()
139 {
140     QSize itemSize(20, fontMetrics().height() * 2.5);
141     m_mltCheck.programList->setColumnWidth(0, 30);
142     m_mltCheck.programList->setIconSize(QSize(24, 24));
143
144
145     QTreeWidgetItem *mltitem = new QTreeWidgetItem(m_mltCheck.programList);
146
147     QTreeWidgetItem *meltitem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Melt") + " (" + KdenliveSettings::rendererpath() + ')');
148     meltitem->setData(1, Qt::UserRole, i18n("Required for rendering (part of MLT package)"));
149     meltitem->setSizeHint(0, itemSize);
150     meltitem->setIcon(0, m_okIcon);
151
152     // Check MLT's installed producers
153     QProcess checkProcess;
154     checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "producer");
155     if (!checkProcess.waitForStarted()) {
156         meltitem->setIcon(0, m_badIcon);
157         meltitem->setData(1, Qt::UserRole, i18n("Error starting MLT's command line player (melt)"));
158         button(QWizard::NextButton)->setEnabled(false);
159     } else {
160         checkProcess.waitForFinished();
161         QByteArray result = checkProcess.readAllStandardError();
162
163         // Check MLT avformat module
164         QTreeWidgetItem *avformatItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Avformat module (FFmpeg)"));
165         avformatItem->setData(1, Qt::UserRole, i18n("Required to work with various video formats (hdv, mpeg, flash, ...)"));
166         avformatItem->setSizeHint(0, itemSize);
167         if (!result.contains("- avformat")) {
168             avformatItem->setIcon(0, m_badIcon);
169             m_mltCheck.tabWidget->setTabEnabled(1, false);
170         } else {
171             avformatItem->setIcon(0, m_okIcon);
172             // Make sure we have MLT > 0.3.4
173             int version = 0;
174             QString mltVersion;
175             QString exepath = KStandardDirs::findExe("pkg-config");
176             if (!exepath.isEmpty()) {
177                 checkProcess.start(exepath, QStringList() << "--variable=version" << "mlt++");
178                 if (!checkProcess.waitForStarted()) {
179                     kDebug() << "// Error querying MLT's version";
180                 } else {
181                     checkProcess.waitForFinished();
182                     mltVersion = checkProcess.readAllStandardOutput();
183                     version = 100 * mltVersion.section('.', 0, 0).toInt() + 10 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt();
184                     kDebug() << "// FOUND MLT's pkgconfig version: " << version;
185                 }
186             }
187             if (version == 0) {
188                 checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "--version");
189                 if (!checkProcess.waitForStarted()) {
190                     kDebug() << "// Error querying MLT's version";
191                 } else {
192                     checkProcess.waitForFinished();
193                     mltVersion = checkProcess.readAllStandardError();
194                     mltVersion = mltVersion.section('\n', 0, 0).simplified();
195                     mltVersion = mltVersion.section(' ', -1).simplified();
196                     version = 100 * mltVersion.section('.', 0, 0).toInt() + 10 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt();
197                     kDebug() << "// FOUND MLT version: " << version;
198                 }
199             }
200
201             mltitem->setText(1, i18n("MLT version: %1", mltVersion.simplified()));
202             mltitem->setSizeHint(0, itemSize);
203             if (version < 40) {
204                 mltitem->setData(1, Qt::UserRole, i18n("Your MLT version is unsupported!!!"));
205                 mltitem->setIcon(0, m_badIcon);
206             } else {
207                 if (version < recommendedMltVersion) {
208                     mltitem->setData(1, Qt::UserRole, i18n("Please upgrade to the latest MLT version"));
209                     mltitem->setIcon(0, m_badIcon);
210                 } else {
211                     mltitem->setData(1, Qt::UserRole, i18n("MLT version is correct"));
212                     mltitem->setIcon(0, m_okIcon);
213                 }
214                 // Check installed audio codecs
215                 QProcess checkProcess2;
216                 checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "acodec=list");
217                 if (!checkProcess2.waitForStarted()) {
218                     m_mltCheck.tabWidget->setTabEnabled(1, false);
219                     kDebug() << "// Error parsing MLT's avformat codecs";
220                 } else {
221                     checkProcess2.waitForFinished();
222                     QByteArray codecList = checkProcess2.readAllStandardError();
223                     QString acodecList(codecList);
224                     QStringList result;
225                     QStringList alist = acodecList.split('\n', QString::SkipEmptyParts);
226                     for (int i = 0; i < alist.count(); i++) {
227                         if (alist.at(i).contains("- ")) result.append(alist.at(i).section("- ", 1).simplified().toLower());
228                     }
229                     m_mltCheck.acodecs_list->addItems(result);
230                     KdenliveSettings::setAudiocodecs(result);
231                     //kDebug()<<"// FOUND LIST:\n\n"<<m_audioCodecs<<"\n\n++++++++++++++++++++";
232                 }
233                 // Check video codecs
234                 checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "vcodec=list");
235                 if (!checkProcess2.waitForStarted()) {
236                     kDebug() << "// Error parsing MLT's avformat codecs";
237                 } else {
238                     checkProcess2.waitForFinished();
239                     QByteArray codecList = checkProcess2.readAllStandardError();
240                     QString vcodecList(codecList);
241                     QStringList result;
242                     QStringList vlist = vcodecList.split('\n', QString::SkipEmptyParts);
243                     for (int i = 0; i < vlist.count(); i++) {
244                         if (vlist.at(i).contains("- ")) result.append(vlist.at(i).section("- ", 1).simplified().toLower());
245                     }
246                     m_mltCheck.vcodecs_list->addItems(result);
247                     KdenliveSettings::setVideocodecs(result);
248                     //kDebug()<<"// FOUND LIST:\n\n"<<m_videoCodecs<<"\n\n++++++++++++++++++++";
249                 }
250                 // Check formats
251                 checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "f=list");
252                 if (!checkProcess2.waitForStarted()) {
253                     kDebug() << "// Error parsing MLT's avformat codecs";
254                 } else {
255                     checkProcess2.waitForFinished();
256                     QByteArray codecList = checkProcess2.readAllStandardError();
257                     QString vcodecList(codecList);
258                     QStringList result;
259                     QStringList vlist = vcodecList.split('\n', QString::SkipEmptyParts);
260                     for (int i = 0; i < vlist.count(); i++) {
261                         if (vlist.at(i).contains("- ")) {
262                             QString format = vlist.at(i).section("- ", 1).simplified().toLower();
263                             if (format.contains(',')) {
264                                 QStringList sub = format.split(',', QString::SkipEmptyParts);
265                                 for (int j = 0; j < sub.count(); j++)
266                                     result.append(sub.at(j));
267                             } else result.append(format);
268                         }
269                     }
270                     m_mltCheck.formats_list->addItems(result);
271                     KdenliveSettings::setSupportedformats(result);
272                     //kDebug()<<"// FOUND LIST:\n\n"<<m_videoCodecs<<"\n\n++++++++++++++++++++";
273                 }
274             }
275
276         }
277
278         // Check MLT dv module
279         QTreeWidgetItem *dvItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("DV module (libdv)"));
280         dvItem->setData(1, Qt::UserRole, i18n("Required to work with dv files if avformat module is not installed"));
281         dvItem->setSizeHint(0, itemSize);
282         if (!result.contains("- libdv")) {
283             dvItem->setIcon(0, m_badIcon);
284         } else {
285             dvItem->setIcon(0, m_okIcon);
286         }
287
288         // Check MLT image format module
289         QTreeWidgetItem *imageItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("QImage module"));
290         imageItem->setData(1, Qt::UserRole, i18n("Required to work with images"));
291         imageItem->setSizeHint(0, itemSize);
292         if (!result.contains("- qimage")) {
293             imageItem->setIcon(0, m_badIcon);
294             imageItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Pixbuf module"));
295             imageItem->setData(1, Qt::UserRole, i18n("Required to work with images"));
296             imageItem->setSizeHint(0, itemSize);
297             if (!result.contains("- pixbuf")) imageItem->setIcon(0, m_badIcon);
298             else imageItem->setIcon(0, m_okIcon);
299         } else {
300             imageItem->setIcon(0, m_okIcon);
301         }
302
303         // Check MLT title module
304         QTreeWidgetItem *titleItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Title module"));
305         titleItem->setData(1, Qt::UserRole, i18n("Required to work with titles"));
306         titleItem->setSizeHint(0, itemSize);
307         if (!result.contains("- kdenlivetitle")) {
308             KdenliveSettings::setHastitleproducer(false);
309             titleItem->setIcon(0, m_badIcon);
310         } else {
311             titleItem->setIcon(0, m_okIcon);
312             KdenliveSettings::setHastitleproducer(true);
313         }
314     }
315 }
316
317 void Wizard::slotCheckPrograms()
318 {
319     QSize itemSize(20, fontMetrics().height() * 2.5);
320     m_check.programList->setColumnWidth(0, 30);
321     m_check.programList->setIconSize(QSize(24, 24));
322
323     QTreeWidgetItem *item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("FFmpeg & ffplay"));
324     item->setData(1, Qt::UserRole, i18n("Required for webcam capture"));
325     item->setSizeHint(0, itemSize);
326     QString exepath = KStandardDirs::findExe("ffmpeg");
327     if (exepath.isEmpty()) item->setIcon(0, m_badIcon);
328     else if (KStandardDirs::findExe("ffplay").isEmpty()) item->setIcon(0, m_badIcon);
329     else item->setIcon(0, m_okIcon);
330
331 #ifndef Q_WS_MAC
332     item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("recordmydesktop"));
333     item->setData(1, Qt::UserRole, i18n("Required for screen capture"));
334     item->setSizeHint(0, itemSize);
335     if (KStandardDirs::findExe("recordmydesktop").isEmpty()) item->setIcon(0, m_badIcon);
336     else item->setIcon(0, m_okIcon);
337
338     item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("dvgrab"));
339     item->setData(1, Qt::UserRole, i18n("Required for firewire capture"));
340     item->setSizeHint(0, itemSize);
341     if (KStandardDirs::findExe("dvgrab").isEmpty()) item->setIcon(0, m_badIcon);
342     else item->setIcon(0, m_okIcon);
343 #endif
344
345     item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("dvdauthor"));
346     item->setData(1, Qt::UserRole, i18n("Required for creation of DVD"));
347     item->setSizeHint(0, itemSize);
348     if (KStandardDirs::findExe("dvdauthor").isEmpty()) item->setIcon(0, m_badIcon);
349     else item->setIcon(0, m_okIcon);
350
351
352     item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("genisoimage or mkisofs"));
353     item->setData(1, Qt::UserRole, i18n("Required for creation of DVD ISO images"));
354     item->setSizeHint(0, itemSize);
355     if (KStandardDirs::findExe("genisoimage").isEmpty()) {
356         // no GenIso, check for mkisofs
357         if (!KStandardDirs::findExe("mkisofs").isEmpty()) {
358             item->setIcon(0, m_okIcon);
359         } else item->setIcon(0, m_badIcon);
360     } else item->setIcon(0, m_okIcon);
361
362     // set up some default applications
363     QString program;
364     if (KdenliveSettings::defaultimageapp().isEmpty()) {
365         program = KStandardDirs::findExe("gimp");
366         if (program.isEmpty()) program = KStandardDirs::findExe("krita");
367         if (!program.isEmpty()) KdenliveSettings::setDefaultimageapp(program);
368     }
369     if (KdenliveSettings::defaultaudioapp().isEmpty()) {
370         program = KStandardDirs::findExe("audacity");
371         if (program.isEmpty()) program = KStandardDirs::findExe("traverso");
372         if (!program.isEmpty()) KdenliveSettings::setDefaultaudioapp(program);
373     }
374     if (KdenliveSettings::defaultplayerapp().isEmpty()) {
375         KService::Ptr offer = KMimeTypeTrader::self()->preferredService("video/mpeg");
376         if (offer)
377             KdenliveSettings::setDefaultplayerapp(KRun::binaryName(offer->exec(), true));
378     }
379 }
380
381 void Wizard::installExtraMimes(QString baseName, QStringList globs)
382 {
383     QString mimefile = baseName;
384     mimefile.replace('/', '-');
385     KMimeType::Ptr mime = KMimeType::mimeType(baseName);
386     if (!mime) {
387         kDebug() << "KMimeTypeTrader: mimeType " << baseName << " not found";
388     } else {
389         QStringList extensions = mime->patterns();
390         QString comment = mime->comment();
391         foreach(const QString &glob, globs) {
392             if (!extensions.contains(glob)) extensions << glob;
393         }
394         kDebug() << "EXTS: " << extensions;
395         QString packageFileName = KStandardDirs::locateLocal("xdgdata-mime", "packages/" + mimefile + ".xml");
396         kDebug() << "INSTALLING NEW MIME TO: " << packageFileName;
397         QFile packageFile(packageFileName);
398         if (!packageFile.open(QIODevice::WriteOnly)) {
399             kError() << "Couldn't open" << packageFileName << "for writing";
400             return;
401         }
402         QXmlStreamWriter writer(&packageFile);
403         writer.setAutoFormatting(true);
404         writer.writeStartDocument();
405
406         const QString nsUri = "http://www.freedesktop.org/standards/shared-mime-info";
407         writer.writeDefaultNamespace(nsUri);
408         writer.writeStartElement("mime-info");
409         writer.writeStartElement(nsUri, "mime-type");
410         writer.writeAttribute("type", baseName);
411
412         if (!comment.isEmpty()) {
413             writer.writeStartElement(nsUri, "comment");
414             writer.writeCharacters(comment);
415             writer.writeEndElement(); // comment
416         }
417
418         foreach(const QString& pattern, extensions) {
419             writer.writeStartElement(nsUri, "glob");
420             writer.writeAttribute("pattern", pattern);
421             writer.writeEndElement(); // glob
422         }
423
424         writer.writeEndElement(); // mime-info
425         writer.writeEndElement(); // mime-type
426         writer.writeEndDocument();
427     }
428 }
429
430 void Wizard::runUpdateMimeDatabase()
431 {
432     const QString localPackageDir = KStandardDirs::locateLocal("xdgdata-mime", QString());
433     //Q_ASSERT(!localPackageDir.isEmpty());
434     KProcess proc;
435     proc << "update-mime-database";
436     proc << localPackageDir;
437     const int exitCode = proc.execute();
438     if (exitCode) {
439         kWarning() << proc.program() << "exited with error code" << exitCode;
440     }
441 }
442
443 void Wizard::slotCheckThumbs()
444 {
445     QString pixname = "timeline_vthumbs.png";
446     if (!m_extra.audiothumbs->isChecked() && !m_extra.videothumbs->isChecked()) {
447         pixname = "timeline_nothumbs.png";
448     } else if (m_extra.audiothumbs->isChecked()) {
449         if (m_extra.videothumbs->isChecked())
450             pixname = "timeline_avthumbs.png";
451         else pixname = "timeline_athumbs.png";
452     }
453
454     m_extra.timeline_preview->setPixmap(QPixmap(KStandardDirs::locate("appdata", pixname)));
455 }
456
457 void Wizard::slotCheckStandard()
458 {
459     m_standard.profiles_list->clear();
460     QStringList profiles;
461     if (!m_standard.button_hdv->isChecked()) {
462         // DV standard
463         QMapIterator<QString, QString> i(m_dvProfiles);
464         while (i.hasNext()) {
465             i.next();
466             QListWidgetItem *item = new QListWidgetItem(i.key(), m_standard.profiles_list);
467             item->setData(Qt::UserRole, i.value());
468         }
469     }
470     if (!m_standard.button_dv->isChecked()) {
471         // HDV standard
472         QMapIterator<QString, QString> i(m_hdvProfiles);
473         while (i.hasNext()) {
474             i.next();
475             QListWidgetItem *item = new QListWidgetItem(i.key(), m_standard.profiles_list);
476             item->setData(Qt::UserRole, i.value());
477         }
478     }
479     if (m_standard.button_all->isChecked()) {
480         QMapIterator<QString, QString> i(m_otherProfiles);
481         while (i.hasNext()) {
482             i.next();
483             QListWidgetItem *item = new QListWidgetItem(i.key(), m_standard.profiles_list);
484             item->setData(Qt::UserRole, i.value());
485         }
486         //m_standard.profiles_list->sortItems();
487     }
488
489     for (int i = 0; i < m_standard.profiles_list->count(); i++) {
490         QListWidgetItem *item = m_standard.profiles_list->item(i);
491
492         QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(item->data(Qt::UserRole).toString());
493         const QString infoString = ("<strong>" + i18n("Frame size:") + " </strong>%1x%2<br /><strong>" + i18n("Frame rate:") + " </strong>%3/%4<br /><strong>" + i18n("Pixel aspect ratio:") + "</strong>%5/%6<br /><strong>" + i18n("Display aspect ratio:") + " </strong>%7/%8").arg(values.value("width"), values.value("height"), values.value("frame_rate_num"), values.value("frame_rate_den"), values.value("sample_aspect_num"), values.value("sample_aspect_den"), values.value("display_aspect_num"), values.value("display_aspect_den"));
494         item->setToolTip(infoString);
495     }
496
497     m_standard.profiles_list->setSortingEnabled(true);
498     m_standard.profiles_list->setCurrentRow(0);
499 }
500
501 void Wizard::slotCheckSelectedItem()
502 {
503     // Make sure we always have an item highlighted
504     m_standard.profiles_list->setCurrentRow(m_standard.profiles_list->currentRow());
505 }
506
507
508 void Wizard::adjustSettings()
509 {
510     if (m_extra.installmimes->isChecked()) {
511         QStringList globs;
512         globs << "*.mts" << "*.m2t" << "*.mod" << "*.ts" << "*.m2ts";
513         installExtraMimes("video/mpeg", globs);
514         globs.clear();
515         globs << "*.dv";
516         installExtraMimes("video/dv", globs);
517         runUpdateMimeDatabase();
518     }
519     KdenliveSettings::setAudiothumbnails(m_extra.audiothumbs->isChecked());
520     KdenliveSettings::setVideothumbnails(m_extra.videothumbs->isChecked());
521     KdenliveSettings::setCrashrecovery(m_extra.autosave->isChecked());
522     if (m_standard.profiles_list->currentItem()) {
523         QString selectedProfile = m_standard.profiles_list->currentItem()->data(Qt::UserRole).toString();
524         if (selectedProfile.isEmpty()) selectedProfile = "dv_pal";
525         KdenliveSettings::setDefault_profile(selectedProfile);
526     }
527     QString path = m_extra.projectfolder->url().path();
528     if (KStandardDirs::makeDir(path) == false) {
529         kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path;
530     } else KdenliveSettings::setDefaultprojectfolder(path);
531
532 }
533
534 void Wizard::slotCheckMlt()
535 {
536     QString errorMessage;
537     if (KdenliveSettings::rendererpath().isEmpty()) {
538         errorMessage.append(i18n("Your MLT installation cannot be found. Install MLT and restart Kdenlive.\n"));
539     }
540     /*QProcess checkProcess;
541     checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "producer");
542     if (!checkProcess.waitForStarted())
543         errorMessage.append(i18n("Error starting MLT's command line player (melt)") + ".\n");
544
545     checkProcess.waitForFinished();
546
547     QByteArray result = checkProcess.readAllStandardError();
548     if (!result.contains("- avformat")) errorMessage.append(i18n("MLT's avformat (FFMPEG) module not found. Please check your FFMPEG and MLT install. Kdenlive will not work until this issue is fixed.") + "\n");*/
549
550     QProcess checkProcess2;
551     checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "consumer");
552     if (!checkProcess2.waitForStarted())
553         errorMessage.append(i18n("Error starting MLT's command line player (melt).") + '\n');
554
555     checkProcess2.waitForFinished();
556
557     QByteArray result = checkProcess2.readAllStandardError();
558     if (!result.contains("sdl") || !result.contains("sdl_preview")) errorMessage.append(i18n("MLT's SDL module not found. Please check your MLT install. Kdenlive will not work until this issue is fixed.") + '\n');
559
560     if (!errorMessage.isEmpty()) {
561         errorMessage.prepend(QString("<b>%1</b><br>").arg(i18n("Fatal Error")));
562         QLabel *pix = new QLabel();
563         pix->setPixmap(KIcon("dialog-error").pixmap(30));
564         QLabel *label = new QLabel(errorMessage);
565         label->setWordWrap(true);
566         m_startLayout->addSpacing(40);
567         m_startLayout->addWidget(pix);
568         m_startLayout->addWidget(label);
569         m_systemCheckIsOk = false;
570         button(QWizard::NextButton)->setEnabled(false);
571     } else m_systemCheckIsOk = true;
572
573     if (m_systemCheckIsOk) checkMltComponents();
574     slotCheckPrograms();
575 }
576
577 bool Wizard::isOk() const
578 {
579     return m_systemCheckIsOk;
580 }
581
582 void Wizard::slotShowWebInfos()
583 {
584     KRun::runUrl(KUrl("http://kdenlive.org/discover/" + QString(kdenlive_version).section(' ', 0, 0)), "text/html", this);
585 }
586
587 #include "wizard.moc"