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