1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
21 #include "kdenlivesettings.h"
22 #include "profilesdialog.h"
23 #include "v4l/v4lcapture.h"
24 #include "kdenlive-config.h"
26 #include <KStandardDirs>
29 #include <kmimetype.h>
32 #include <KMimeTypeTrader>
36 #include <QXmlStreamWriter>
39 const double recommendedMltVersion = 510;
40 static const char kdenlive_version[] = VERSION;
42 Wizard::Wizard(bool upgrade, QWidget *parent) :
45 setWindowTitle(i18n("Config Wizard"));
46 setPixmap(QWizard::WatermarkPixmap, QPixmap(KStandardDirs::locate("appdata", "banner.png")));
48 QWizardPage *page1 = new QWizardPage;
49 page1->setTitle(i18n("Welcome"));
52 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)));
54 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..."));
55 label->setWordWrap(true);
56 m_startLayout = new QVBoxLayout;
57 m_startLayout->addWidget(label);
58 QPushButton *but = new QPushButton(KIcon("help-about"), i18n("Discover the features of this Kdenlive release"), this);
59 connect(but, SIGNAL(clicked()), this, SLOT(slotShowWebInfos()));
60 m_startLayout->addStretch();
61 m_startLayout->addWidget(but);
64 page1->setLayout(m_startLayout);
67 QWizardPage *page4 = new QWizardPage;
68 page4->setTitle(i18n("Checking MLT engine"));
69 m_mltCheck.setupUi(page4);
72 WizardDelegate *listViewDelegate = new WizardDelegate(m_mltCheck.programList);
73 m_mltCheck.programList->setItemDelegate(listViewDelegate);
75 QWizardPage *page2 = new QWizardPage;
76 page2->setTitle(i18n("Video Standard"));
77 m_standard.setupUi(page2);
79 m_okIcon = KIcon("dialog-ok");
80 m_badIcon = KIcon("dialog-close");
82 // build profiles lists
83 QMap<QString, QString> profilesInfo = ProfilesDialog::getProfilesInfo();
84 QMap<QString, QString>::const_iterator i = profilesInfo.constBegin();
85 while (i != profilesInfo.constEnd()) {
86 QMap< QString, QString > profileData = ProfilesDialog::getSettingsFromFile(i.value());
87 if (profileData.value("width") == "720") m_dvProfiles.insert(i.key(), i.value());
88 else if (profileData.value("width").toInt() >= 1080) m_hdvProfiles.insert(i.key(), i.value());
89 else m_otherProfiles.insert(i.key(), i.value());
93 m_standard.button_all->setChecked(true);
94 connect(m_standard.button_all, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
95 connect(m_standard.button_hdv, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
96 connect(m_standard.button_dv, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard()));
98 connect(m_standard.profiles_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckSelectedItem()));
100 // select default profile
101 if (!KdenliveSettings::default_profile().isEmpty()) {
102 for (int i = 0; i < m_standard.profiles_list->count(); i++) {
103 if (m_standard.profiles_list->item(i)->data(Qt::UserRole).toString() == KdenliveSettings::default_profile()) {
104 m_standard.profiles_list->setCurrentRow(i);
105 m_standard.profiles_list->scrollToItem(m_standard.profiles_list->currentItem());
113 QWizardPage *page3 = new QWizardPage;
114 page3->setTitle(i18n("Additional Settings"));
115 m_extra.setupUi(page3);
116 m_extra.projectfolder->setMode(KFile::Directory);
117 m_extra.projectfolder->setUrl(KUrl(KdenliveSettings::defaultprojectfolder()));
118 m_extra.videothumbs->setChecked(KdenliveSettings::videothumbnails());
119 m_extra.audiothumbs->setChecked(KdenliveSettings::audiothumbnails());
120 m_extra.autosave->setChecked(KdenliveSettings::crashrecovery());
121 connect(m_extra.videothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
122 connect(m_extra.audiothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
126 QWizardPage *page6 = new QWizardPage;
127 page6->setTitle(i18n("Webcam"));
128 m_capture.setupUi(page6);
129 connect(m_capture.button_reload, SIGNAL(clicked()), this, SLOT(slotDetectWebcam()));
130 connect(m_capture.device_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotUpdateCaptureParameters()));
131 m_capture.button_reload->setIcon(KIcon("view-refresh"));
136 QWizardPage *page5 = new QWizardPage;
137 page5->setTitle(i18n("Checking system"));
138 m_check.setupUi(page5);
141 listViewDelegate = new WizardDelegate(m_check.programList);
142 m_check.programList->setItemDelegate(listViewDelegate);
144 QTimer::singleShot(500, this, SLOT(slotCheckMlt()));
147 void Wizard::slotDetectWebcam()
149 m_capture.device_list->clear();
151 // Video 4 Linux device detection
152 V4lCaptureHandler v4l(NULL);
153 for (int i = 0; i < 10; i++) {
154 QString path = "/dev/video" + QString::number(i);
155 if (QFile::exists(path)) {
156 QStringList deviceInfo = v4l.getDeviceName(path.toUtf8().constData());
157 if (!deviceInfo.isEmpty()) {
158 QTreeWidgetItem *item = new QTreeWidgetItem(m_capture.device_list, QStringList() << deviceInfo.at(0) << "(" + deviceInfo.at(1) + ") " + deviceInfo.at(2));
159 item->setData(0, Qt::UserRole, path);
160 item->setData(0, Qt::UserRole + 1, deviceInfo.at(1));
164 if (m_capture.device_list->topLevelItemCount() > 0) {
165 m_capture.v4l_status->setText(i18n("Select your default video4linux device"));
166 // select default device
168 for (int i = 0; i < m_capture.device_list->topLevelItemCount(); i++) {
169 QTreeWidgetItem * item = m_capture.device_list->topLevelItem(i);
170 if (item && item->data(0, Qt::UserRole).toString() == KdenliveSettings::video4vdevice()) {
171 m_capture.device_list->setCurrentItem(item);
176 if (!found) m_capture.device_list->setCurrentItem(m_capture.device_list->topLevelItem(0));
177 } else m_capture.v4l_status->setText(i18n("No device found, plug your webcam and refresh."));
180 void Wizard::slotUpdateCaptureParameters()
182 QTreeWidgetItem * item = m_capture.device_list->currentItem();
184 QString device = item->data(0, Qt::UserRole).toString();
185 if (!device.isEmpty()) KdenliveSettings::setVideo4vdevice(device);
187 QString size = item->data(0, Qt::UserRole + 1).toString();
188 if (!size.isEmpty()) KdenliveSettings::setVideo4size(size);
191 void Wizard::checkMltComponents()
193 QSize itemSize(20, fontMetrics().height() * 2.5);
194 m_mltCheck.programList->setColumnWidth(0, 30);
195 m_mltCheck.programList->setIconSize(QSize(24, 24));
198 QTreeWidgetItem *mltitem = new QTreeWidgetItem(m_mltCheck.programList);
200 QTreeWidgetItem *meltitem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Melt") + " (" + KdenliveSettings::rendererpath() + ')');
201 meltitem->setData(1, Qt::UserRole, i18n("Required for rendering (part of MLT package)"));
202 meltitem->setSizeHint(0, itemSize);
203 meltitem->setIcon(0, m_okIcon);
205 // Check MLT's installed producers
206 QProcess checkProcess;
207 checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "producer");
208 if (!checkProcess.waitForStarted()) {
209 meltitem->setIcon(0, m_badIcon);
210 meltitem->setData(1, Qt::UserRole, i18n("Error starting MLT's command line player (melt)"));
211 button(QWizard::NextButton)->setEnabled(false);
213 checkProcess.waitForFinished();
214 QByteArray result = checkProcess.readAllStandardError();
216 // Check MLT avformat module
217 QTreeWidgetItem *avformatItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Avformat module (FFmpeg)"));
218 avformatItem->setData(1, Qt::UserRole, i18n("Required to work with various video formats (hdv, mpeg, flash, ...)"));
219 avformatItem->setSizeHint(0, itemSize);
220 if (!result.contains("- avformat")) {
221 avformatItem->setIcon(0, m_badIcon);
222 m_mltCheck.tabWidget->setTabEnabled(1, false);
224 avformatItem->setIcon(0, m_okIcon);
225 // Make sure we have MLT > 0.3.4
228 QString exepath = KStandardDirs::findExe("pkg-config");
229 if (!exepath.isEmpty()) {
230 checkProcess.start(exepath, QStringList() << "--variable=version" << "mlt++");
231 if (!checkProcess.waitForStarted()) {
232 kDebug() << "// Error querying MLT's version";
234 checkProcess.waitForFinished();
235 mltVersion = checkProcess.readAllStandardOutput();
236 version = 1000 * mltVersion.section('.', 0, 0).toInt() + 100 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt();
237 kDebug() << "// FOUND MLT's pkgconfig version: " << version;
241 checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "--version");
242 if (!checkProcess.waitForStarted()) {
243 kDebug() << "// Error querying MLT's version";
245 checkProcess.waitForFinished();
246 mltVersion = checkProcess.readAllStandardError();
247 mltVersion = mltVersion.section('\n', 0, 0).simplified();
248 mltVersion = mltVersion.section(' ', -1).simplified();
249 version = 1000 * mltVersion.section('.', 0, 0).toInt() + 100 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt();
250 kDebug() << "// FOUND MLT version: " << version;
254 mltitem->setText(1, i18n("MLT version: %1", mltVersion.simplified()));
255 mltitem->setSizeHint(0, itemSize);
257 mltitem->setData(1, Qt::UserRole, i18n("Your MLT version is unsupported!!!"));
258 mltitem->setIcon(0, m_badIcon);
260 if (version < recommendedMltVersion) {
261 mltitem->setData(1, Qt::UserRole, i18n("Please upgrade to the latest MLT version"));
262 mltitem->setIcon(0, m_badIcon);
264 mltitem->setData(1, Qt::UserRole, i18n("MLT version is correct"));
265 mltitem->setIcon(0, m_okIcon);
267 // Check installed audio codecs
268 QProcess checkProcess2;
269 checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "acodec=list");
270 if (!checkProcess2.waitForStarted()) {
271 m_mltCheck.tabWidget->setTabEnabled(1, false);
272 kDebug() << "// Error parsing MLT's avformat codecs";
274 checkProcess2.waitForFinished();
275 QByteArray codecList = checkProcess2.readAllStandardError();
276 QString acodecList(codecList);
278 QStringList alist = acodecList.split('\n', QString::SkipEmptyParts);
279 for (int i = 0; i < alist.count(); i++) {
280 if (alist.at(i).contains("- ")) result.append(alist.at(i).section("- ", 1).simplified().toLower());
282 m_mltCheck.acodecs_list->addItems(result);
283 KdenliveSettings::setAudiocodecs(result);
284 //kDebug()<<"// FOUND LIST:\n\n"<<m_audioCodecs<<"\n\n++++++++++++++++++++";
286 // Check video codecs
287 checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "vcodec=list");
288 if (!checkProcess2.waitForStarted()) {
289 kDebug() << "// Error parsing MLT's avformat codecs";
291 checkProcess2.waitForFinished();
292 QByteArray codecList = checkProcess2.readAllStandardError();
293 QString vcodecList(codecList);
295 QStringList vlist = vcodecList.split('\n', QString::SkipEmptyParts);
296 for (int i = 0; i < vlist.count(); i++) {
297 if (vlist.at(i).contains("- ")) result.append(vlist.at(i).section("- ", 1).simplified().toLower());
299 m_mltCheck.vcodecs_list->addItems(result);
300 KdenliveSettings::setVideocodecs(result);
301 //kDebug()<<"// FOUND LIST:\n\n"<<m_videoCodecs<<"\n\n++++++++++++++++++++";
304 checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "f=list");
305 if (!checkProcess2.waitForStarted()) {
306 kDebug() << "// Error parsing MLT's avformat codecs";
308 checkProcess2.waitForFinished();
309 QByteArray codecList = checkProcess2.readAllStandardError();
310 QString vcodecList(codecList);
312 QStringList vlist = vcodecList.split('\n', QString::SkipEmptyParts);
313 for (int i = 0; i < vlist.count(); i++) {
314 if (vlist.at(i).contains("- ")) {
315 QString format = vlist.at(i).section("- ", 1).simplified().toLower();
316 if (format.contains(',')) {
317 QStringList sub = format.split(',', QString::SkipEmptyParts);
318 for (int j = 0; j < sub.count(); j++)
319 result.append(sub.at(j));
320 } else result.append(format);
323 m_mltCheck.formats_list->addItems(result);
324 KdenliveSettings::setSupportedformats(result);
325 //kDebug()<<"// FOUND LIST:\n\n"<<m_videoCodecs<<"\n\n++++++++++++++++++++";
331 // Check MLT dv module
332 QTreeWidgetItem *dvItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("DV module (libdv)"));
333 dvItem->setData(1, Qt::UserRole, i18n("Required to work with dv files if avformat module is not installed"));
334 dvItem->setSizeHint(0, itemSize);
335 if (!result.contains("- libdv")) {
336 dvItem->setIcon(0, m_badIcon);
338 dvItem->setIcon(0, m_okIcon);
341 // Check MLT image format module
342 QTreeWidgetItem *imageItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("QImage module"));
343 imageItem->setData(1, Qt::UserRole, i18n("Required to work with images"));
344 imageItem->setSizeHint(0, itemSize);
345 if (!result.contains("- qimage")) {
346 imageItem->setIcon(0, m_badIcon);
347 imageItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Pixbuf module"));
348 imageItem->setData(1, Qt::UserRole, i18n("Required to work with images"));
349 imageItem->setSizeHint(0, itemSize);
350 if (!result.contains("- pixbuf")) imageItem->setIcon(0, m_badIcon);
351 else imageItem->setIcon(0, m_okIcon);
353 imageItem->setIcon(0, m_okIcon);
356 // Check MLT title module
357 QTreeWidgetItem *titleItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Title module"));
358 titleItem->setData(1, Qt::UserRole, i18n("Required to work with titles"));
359 titleItem->setSizeHint(0, itemSize);
360 if (!result.contains("- kdenlivetitle")) {
361 KdenliveSettings::setHastitleproducer(false);
362 titleItem->setIcon(0, m_badIcon);
364 titleItem->setIcon(0, m_okIcon);
365 KdenliveSettings::setHastitleproducer(true);
370 void Wizard::slotCheckPrograms()
372 QSize itemSize(20, fontMetrics().height() * 2.5);
373 m_check.programList->setColumnWidth(0, 30);
374 m_check.programList->setIconSize(QSize(24, 24));
376 QTreeWidgetItem *item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("FFmpeg & ffplay"));
377 item->setData(1, Qt::UserRole, i18n("Required for webcam capture"));
378 item->setSizeHint(0, itemSize);
379 QString exepath = KStandardDirs::findExe("ffmpeg");
380 if (exepath.isEmpty()) item->setIcon(0, m_badIcon);
381 else if (KStandardDirs::findExe("ffplay").isEmpty()) item->setIcon(0, m_badIcon);
382 else item->setIcon(0, m_okIcon);
385 item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("recordmydesktop"));
386 item->setData(1, Qt::UserRole, i18n("Required for screen capture"));
387 item->setSizeHint(0, itemSize);
388 if (KStandardDirs::findExe("recordmydesktop").isEmpty()) item->setIcon(0, m_badIcon);
389 else item->setIcon(0, m_okIcon);
391 item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("dvgrab"));
392 item->setData(1, Qt::UserRole, i18n("Required for firewire capture"));
393 item->setSizeHint(0, itemSize);
394 if (KStandardDirs::findExe("dvgrab").isEmpty()) item->setIcon(0, m_badIcon);
395 else item->setIcon(0, m_okIcon);
398 item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("dvdauthor"));
399 item->setData(1, Qt::UserRole, i18n("Required for creation of DVD"));
400 item->setSizeHint(0, itemSize);
401 if (KStandardDirs::findExe("dvdauthor").isEmpty()) item->setIcon(0, m_badIcon);
402 else item->setIcon(0, m_okIcon);
405 item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("genisoimage or mkisofs"));
406 item->setData(1, Qt::UserRole, i18n("Required for creation of DVD ISO images"));
407 item->setSizeHint(0, itemSize);
408 if (KStandardDirs::findExe("genisoimage").isEmpty()) {
409 // no GenIso, check for mkisofs
410 if (!KStandardDirs::findExe("mkisofs").isEmpty()) {
411 item->setIcon(0, m_okIcon);
412 } else item->setIcon(0, m_badIcon);
413 } else item->setIcon(0, m_okIcon);
415 // set up some default applications
417 if (KdenliveSettings::defaultimageapp().isEmpty()) {
418 program = KStandardDirs::findExe("gimp");
419 if (program.isEmpty()) program = KStandardDirs::findExe("krita");
420 if (!program.isEmpty()) KdenliveSettings::setDefaultimageapp(program);
422 if (KdenliveSettings::defaultaudioapp().isEmpty()) {
423 program = KStandardDirs::findExe("audacity");
424 if (program.isEmpty()) program = KStandardDirs::findExe("traverso");
425 if (!program.isEmpty()) KdenliveSettings::setDefaultaudioapp(program);
427 if (KdenliveSettings::defaultplayerapp().isEmpty()) {
428 KService::Ptr offer = KMimeTypeTrader::self()->preferredService("video/mpeg");
430 KdenliveSettings::setDefaultplayerapp(KRun::binaryName(offer->exec(), true));
434 void Wizard::installExtraMimes(QString baseName, QStringList globs)
436 QString mimefile = baseName;
437 mimefile.replace('/', '-');
438 KMimeType::Ptr mime = KMimeType::mimeType(baseName);
440 kDebug() << "KMimeTypeTrader: mimeType " << baseName << " not found";
442 QStringList extensions = mime->patterns();
443 QString comment = mime->comment();
444 foreach(const QString & glob, globs) {
445 if (!extensions.contains(glob)) extensions << glob;
447 kDebug() << "EXTS: " << extensions;
448 QString packageFileName = KStandardDirs::locateLocal("xdgdata-mime", "packages/" + mimefile + ".xml");
449 kDebug() << "INSTALLING NEW MIME TO: " << packageFileName;
450 QFile packageFile(packageFileName);
451 if (!packageFile.open(QIODevice::WriteOnly)) {
452 kError() << "Couldn't open" << packageFileName << "for writing";
455 QXmlStreamWriter writer(&packageFile);
456 writer.setAutoFormatting(true);
457 writer.writeStartDocument();
459 const QString nsUri = "http://www.freedesktop.org/standards/shared-mime-info";
460 writer.writeDefaultNamespace(nsUri);
461 writer.writeStartElement("mime-info");
462 writer.writeStartElement(nsUri, "mime-type");
463 writer.writeAttribute("type", baseName);
465 if (!comment.isEmpty()) {
466 writer.writeStartElement(nsUri, "comment");
467 writer.writeCharacters(comment);
468 writer.writeEndElement(); // comment
471 foreach(const QString & pattern, extensions) {
472 writer.writeStartElement(nsUri, "glob");
473 writer.writeAttribute("pattern", pattern);
474 writer.writeEndElement(); // glob
477 writer.writeEndElement(); // mime-info
478 writer.writeEndElement(); // mime-type
479 writer.writeEndDocument();
483 void Wizard::runUpdateMimeDatabase()
485 const QString localPackageDir = KStandardDirs::locateLocal("xdgdata-mime", QString());
486 //Q_ASSERT(!localPackageDir.isEmpty());
488 proc << "update-mime-database";
489 proc << localPackageDir;
490 const int exitCode = proc.execute();
492 kWarning() << proc.program() << "exited with error code" << exitCode;
496 void Wizard::slotCheckThumbs()
498 QString pixname = "timeline_vthumbs.png";
499 if (!m_extra.audiothumbs->isChecked() && !m_extra.videothumbs->isChecked()) {
500 pixname = "timeline_nothumbs.png";
501 } else if (m_extra.audiothumbs->isChecked()) {
502 if (m_extra.videothumbs->isChecked())
503 pixname = "timeline_avthumbs.png";
504 else pixname = "timeline_athumbs.png";
507 m_extra.timeline_preview->setPixmap(QPixmap(KStandardDirs::locate("appdata", pixname)));
510 void Wizard::slotCheckStandard()
512 m_standard.profiles_list->clear();
513 QStringList profiles;
514 if (!m_standard.button_hdv->isChecked()) {
516 QMapIterator<QString, QString> i(m_dvProfiles);
517 while (i.hasNext()) {
519 QListWidgetItem *item = new QListWidgetItem(i.key(), m_standard.profiles_list);
520 item->setData(Qt::UserRole, i.value());
523 if (!m_standard.button_dv->isChecked()) {
525 QMapIterator<QString, QString> i(m_hdvProfiles);
526 while (i.hasNext()) {
528 QListWidgetItem *item = new QListWidgetItem(i.key(), m_standard.profiles_list);
529 item->setData(Qt::UserRole, i.value());
532 if (m_standard.button_all->isChecked()) {
533 QMapIterator<QString, QString> i(m_otherProfiles);
534 while (i.hasNext()) {
536 QListWidgetItem *item = new QListWidgetItem(i.key(), m_standard.profiles_list);
537 item->setData(Qt::UserRole, i.value());
539 //m_standard.profiles_list->sortItems();
542 for (int i = 0; i < m_standard.profiles_list->count(); i++) {
543 QListWidgetItem *item = m_standard.profiles_list->item(i);
545 QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(item->data(Qt::UserRole).toString());
546 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"));
547 item->setToolTip(infoString);
550 m_standard.profiles_list->setSortingEnabled(true);
551 m_standard.profiles_list->setCurrentRow(0);
554 void Wizard::slotCheckSelectedItem()
556 // Make sure we always have an item highlighted
557 m_standard.profiles_list->setCurrentRow(m_standard.profiles_list->currentRow());
561 void Wizard::adjustSettings()
563 if (m_extra.installmimes->isChecked()) {
565 globs << "*.mts" << "*.m2t" << "*.mod" << "*.ts" << "*.m2ts";
566 installExtraMimes("video/mpeg", globs);
569 installExtraMimes("video/dv", globs);
570 runUpdateMimeDatabase();
572 KdenliveSettings::setAudiothumbnails(m_extra.audiothumbs->isChecked());
573 KdenliveSettings::setVideothumbnails(m_extra.videothumbs->isChecked());
574 KdenliveSettings::setCrashrecovery(m_extra.autosave->isChecked());
575 if (m_standard.profiles_list->currentItem()) {
576 QString selectedProfile = m_standard.profiles_list->currentItem()->data(Qt::UserRole).toString();
577 if (selectedProfile.isEmpty()) selectedProfile = "dv_pal";
578 KdenliveSettings::setDefault_profile(selectedProfile);
580 QString path = m_extra.projectfolder->url().path();
581 if (KStandardDirs::makeDir(path) == false) {
582 kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path;
583 } else KdenliveSettings::setDefaultprojectfolder(path);
587 void Wizard::slotCheckMlt()
589 QString errorMessage;
590 if (KdenliveSettings::rendererpath().isEmpty()) {
591 errorMessage.append(i18n("Your MLT installation cannot be found. Install MLT and restart Kdenlive.\n"));
593 /*QProcess checkProcess;
594 checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "producer");
595 if (!checkProcess.waitForStarted())
596 errorMessage.append(i18n("Error starting MLT's command line player (melt)") + ".\n");
598 checkProcess.waitForFinished();
600 QByteArray result = checkProcess.readAllStandardError();
601 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");*/
603 QProcess checkProcess2;
604 checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "consumer");
605 if (!checkProcess2.waitForStarted())
606 errorMessage.append(i18n("Error starting MLT's command line player (melt).") + '\n');
608 checkProcess2.waitForFinished();
610 QByteArray result = checkProcess2.readAllStandardError();
611 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');
613 if (!errorMessage.isEmpty()) {
614 errorMessage.prepend(QString("<b>%1</b><br />").arg(i18n("Fatal Error")));
615 QLabel *pix = new QLabel();
616 pix->setPixmap(KIcon("dialog-error").pixmap(30));
617 QLabel *label = new QLabel(errorMessage);
618 label->setWordWrap(true);
619 m_startLayout->addSpacing(40);
620 m_startLayout->addWidget(pix);
621 m_startLayout->addWidget(label);
622 m_systemCheckIsOk = false;
623 button(QWizard::NextButton)->setEnabled(false);
624 } else m_systemCheckIsOk = true;
626 if (m_systemCheckIsOk) checkMltComponents();
630 bool Wizard::isOk() const
632 return m_systemCheckIsOk;
635 void Wizard::slotShowWebInfos()
637 KRun::runUrl(KUrl("http://kdenlive.org/discover/" + QString(kdenlive_version).section(' ', 0, 0)), "text/html", this);
640 #include "wizard.moc"