X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fwizard.cpp;h=fdd947f8a0d0cb73f1495de38c4c381b2895e998;hb=2bb3e6b046c0ecd26ced536bd2bfd0487bc7fb06;hp=83d0494e0e7d77b32fa89e0971c852cbd149500b;hpb=118603397f5fc3c16ce6f71dd1127c60a6926695;p=kdenlive diff --git a/src/wizard.cpp b/src/wizard.cpp index 83d0494e..fdd947f8 100644 --- a/src/wizard.cpp +++ b/src/wizard.cpp @@ -44,19 +44,45 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) { page1->setLayout(m_startLayout); addPage(page1); + QWizardPage *page4 = new QWizardPage; + page4->setTitle(i18n("Checking MLT engine")); + m_mltCheck.setupUi(page4); + addPage(page4); + + WizardDelegate *listViewDelegate = new WizardDelegate(m_mltCheck.programList); + m_mltCheck.programList->setItemDelegate(listViewDelegate); + QWizardPage *page2 = new QWizardPage; page2->setTitle(i18n("Video Standard")); m_standard.setupUi(page2); - m_standard.profiles_list->setMaximumHeight(100); - connect(m_standard.button_pal, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard())); + + // build profiles lists + m_profilesInfo = ProfilesDialog::getProfilesInfo(); + QMap::const_iterator i = m_profilesInfo.constBegin(); + while (i != m_profilesInfo.constEnd()) { + QMap< QString, QString > profileData = ProfilesDialog::getSettingsFromFile(i.value()); + if (profileData.value("width") == "720") m_dvProfiles.append(i.key()); + else if (profileData.value("width").toInt() >= 1080) m_hdvProfiles.append(i.key()); + else m_otherProfiles.append(i.key()); + ++i; + } + + connect(m_standard.button_all, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard())); + connect(m_standard.button_hdv, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard())); connect(m_standard.button_dv, SIGNAL(toggled(bool)), this, SLOT(slotCheckStandard())); - slotCheckStandard(); + m_standard.button_all->setChecked(true); connect(m_standard.profiles_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotCheckSelectedItem())); + + // select default profile + QList profiles = m_standard.profiles_list->findItems(ProfilesDialog::getProfileDescription(KdenliveSettings::default_profile()), Qt::MatchExactly); + if (profiles.count() > 0) m_standard.profiles_list->setCurrentItem(profiles.at(0)); addPage(page2); QWizardPage *page3 = new QWizardPage; page3->setTitle(i18n("Additional Settings")); m_extra.setupUi(page3); + m_extra.projectfolder->setMode(KFile::Directory); + m_extra.projectfolder->setPath(QDir::homePath() + "/kdenlive"); m_extra.videothumbs->setChecked(KdenliveSettings::videothumbnails()); m_extra.audiothumbs->setChecked(KdenliveSettings::audiothumbnails()); m_extra.autosave->setChecked(KdenliveSettings::crashrecovery()); @@ -64,9 +90,224 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) { connect(m_extra.audiothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs())); slotCheckThumbs(); addPage(page3); + + + QWizardPage *page5 = new QWizardPage; + page5->setTitle(i18n("Checking system")); + m_check.setupUi(page5); + slotCheckPrograms(); + addPage(page5); + + listViewDelegate = new WizardDelegate(m_check.programList); + m_check.programList->setItemDelegate(listViewDelegate); + QTimer::singleShot(500, this, SLOT(slotCheckMlt())); } + +void Wizard::checkMltComponents() { + m_mltCheck.programList->setColumnCount(2); + m_mltCheck.programList->setRootIsDecorated(false); + m_mltCheck.programList->setHeaderHidden(true); + QSize itemSize(20, this->fontMetrics().height() * 2.5); + KIcon okIcon("dialog-ok"); + KIcon missingIcon("dialog-close"); + m_mltCheck.programList->setColumnWidth(0, 30); + m_mltCheck.programList->setIconSize(QSize(24, 24)); + + + QTreeWidgetItem *item = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Inigo") + " (" + KdenliveSettings::rendererpath() + ')'); + item->setData(1, Qt::UserRole, i18n("Required for rendering (part of MLT package)")); + item->setSizeHint(0, itemSize); + item->setIcon(0, okIcon); + + // Check MLT's installed producers + QProcess checkProcess; + checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "producer"); + if (!checkProcess.waitForStarted()) { + item->setIcon(0, missingIcon); + item->setData(1, Qt::UserRole, i18n("Error starting MLT's command line player (inigo)")); + button(QWizard::NextButton)->setEnabled(false); + } else { + checkProcess.waitForFinished(); + QByteArray result = checkProcess.readAllStandardError(); + + // Check MLT avformat module + QTreeWidgetItem *avformatItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Avformat module (FFmpeg)")); + avformatItem->setData(1, Qt::UserRole, i18n("Required to work with various video formats (hdv, mpeg, flash, ...)")); + avformatItem->setSizeHint(0, itemSize); + if (!result.contains("- avformat")) { + avformatItem->setIcon(0, missingIcon); + m_mltCheck.tabWidget->setTabEnabled(1, false); + } else { + avformatItem->setIcon(0, okIcon); + // Make sure we have MLT > 0.3.4 + bool recentMlt = false; + int version = 0; + QString exepath = KStandardDirs::findExe("pkg-config"); + if (!exepath.isEmpty()) { + checkProcess.start(exepath, QStringList() << "--variable=version" << "mlt-framework"); + if (!checkProcess.waitForStarted()) { + kDebug() << "// Error querying MLT's version"; + } else { + checkProcess.waitForFinished(); + QString mltVersion = checkProcess.readAllStandardOutput(); + version = 100 * mltVersion.section('.', 0, 0).toInt() + 10 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt(); + kDebug() << "// FOUND MLT's pkgconfig version: " << version; + if (version > 34) recentMlt = true; + } + } + if (version == 0) { + checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "--version"); + if (!checkProcess.waitForStarted()) { + kDebug() << "// Error querying MLT's version"; + } else { + checkProcess.waitForFinished(); + QString mltVersion = checkProcess.readAllStandardError(); + mltVersion = mltVersion.section("\n", 0, 0).simplified(); + mltVersion = mltVersion.section(' ', -1).simplified(); + version = 100 * mltVersion.section('.', 0, 0).toInt() + 10 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt(); + kDebug() << "// FOUND MLT version: " << version; + if (version > 34) recentMlt = true; + } + } + + if (recentMlt) { + // Check installed audio codecs + QProcess checkProcess2; + checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "noise:" << "-consumer" << "avformat" << "acodec=list"); + if (!checkProcess2.waitForStarted()) { + m_mltCheck.tabWidget->setTabEnabled(1, false); + kDebug() << "// Error parsing MLT's avformat codecs"; + } else { + checkProcess2.waitForFinished(); + QByteArray codecList = checkProcess2.readAllStandardError(); + QString acodecList(codecList); + QStringList result; + QStringList alist = acodecList.split("\n", QString::SkipEmptyParts); + for (int i = 0; i < alist.count(); i++) { + if (alist.at(i).contains("- ")) result.append(alist.at(i).section("- ", 1).simplified().toLower()); + } + m_mltCheck.acodecs_list->addItems(result); + KdenliveSettings::setAudiocodecs(result); + //kDebug()<<"// FOUND LIST:\n\n"<addItems(result); + KdenliveSettings::setVideocodecs(result); + //kDebug()<<"// FOUND LIST:\n\n"<addItems(result); + KdenliveSettings::setSupportedformats(result); + //kDebug()<<"// FOUND LIST:\n\n"<setData(1, Qt::UserRole, i18n("Required to work with dv files if avformat module is not installed")); + dvItem->setSizeHint(0, itemSize); + if (!result.contains("- libdv")) { + dvItem->setIcon(0, missingIcon); + } else { + dvItem->setIcon(0, okIcon); + } + + // Check MLT image format module + QTreeWidgetItem *imageItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("QImage module")); + imageItem->setData(1, Qt::UserRole, i18n("Required to work with images")); + imageItem->setSizeHint(0, itemSize); + if (!result.contains("- qimage")) { + imageItem->setIcon(0, missingIcon); + imageItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Pixbuf module")); + imageItem->setData(1, Qt::UserRole, i18n("Required to work with images")); + imageItem->setSizeHint(0, itemSize); + if (!result.contains("- pixbuf")) imageItem->setIcon(0, missingIcon); + else imageItem->setIcon(0, okIcon); + } else { + imageItem->setIcon(0, okIcon); + } + } +} + +void Wizard::slotCheckPrograms() { + m_check.programList->setColumnCount(2); + m_check.programList->setRootIsDecorated(false); + m_check.programList->setHeaderHidden(true); + QSize itemSize(20, this->fontMetrics().height() * 2.5); + KIcon okIcon("dialog-ok"); + KIcon missingIcon("dialog-close"); + m_check.programList->setColumnWidth(0, 30); + m_check.programList->setIconSize(QSize(24, 24)); + + QTreeWidgetItem *item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("FFmpeg & ffplay")); + item->setData(1, Qt::UserRole, i18n("Required for webcam capture")); + item->setSizeHint(0, itemSize); + QString exepath = KStandardDirs::findExe("ffmpeg"); + if (exepath.isEmpty()) item->setIcon(0, missingIcon); + else if (KStandardDirs::findExe("ffplay").isEmpty()) item->setIcon(0, missingIcon); + else item->setIcon(0, okIcon); + + item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("Recordmydesktop")); + item->setData(1, Qt::UserRole, i18n("Required for screen capture")); + item->setSizeHint(0, itemSize); + if (KStandardDirs::findExe("recordmydesktop").isEmpty()) item->setIcon(0, missingIcon); + else item->setIcon(0, okIcon); + + item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("Dvgrab")); + item->setData(1, Qt::UserRole, i18n("Required for firewire capture")); + item->setSizeHint(0, itemSize); + if (KStandardDirs::findExe("dvgrab").isEmpty()) item->setIcon(0, missingIcon); + else item->setIcon(0, okIcon); + + item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("Dvdauthor")); + item->setData(1, Qt::UserRole, i18n("Required for creation of DVD")); + item->setSizeHint(0, itemSize); + if (KStandardDirs::findExe("dvdauthor").isEmpty()) item->setIcon(0, missingIcon); + else item->setIcon(0, okIcon); + + item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("Mkisofs")); + item->setData(1, Qt::UserRole, i18n("Required for creation of DVD iso images")); + item->setSizeHint(0, itemSize); + if (KStandardDirs::findExe("mkisofs").isEmpty()) item->setIcon(0, missingIcon); + else item->setIcon(0, okIcon); + +} + void Wizard::installExtraMimes(QString baseName, QStringList globs) { QString mimefile = baseName; mimefile.replace('/', '-'); @@ -141,31 +382,28 @@ void Wizard::slotCheckThumbs() { } void Wizard::slotCheckStandard() { + m_standard.profiles_list->clear(); QStringList profiles; - if (m_standard.button_pal->isChecked()) { - // PAL standard - if (m_standard.button_dv->isChecked()) { - profiles << "dv_pal" << "dv_pal_wide"; - } else { - profiles << "hdv_720_25p" << "hdv_720_50p" << "hdv_1080_50i" << "hdv_1080_25p" << "atsc_1080p_24" << "atsc_1080p_25"; - } + if (m_standard.button_dv->isChecked()) { + // DV standard + m_standard.profiles_list->addItems(m_dvProfiles); + } else if (m_standard.button_hdv->isChecked()) { + // HDV standard + m_standard.profiles_list->addItems(m_hdvProfiles); } else { - // NTSC standard - if (m_standard.button_dv->isChecked()) { - profiles << "dv_ntsc" << "dv_ntsc_wide"; - } else { - profiles << "hdv_720_30p" << "hdv_720_60p" << "hdv_1080_30p" << "hdv_1080_60i" << "atsc_720p_30" << "atsc_1080i_60"; - } + m_standard.profiles_list->addItems(m_dvProfiles); + m_standard.profiles_list->addItems(m_hdvProfiles); + m_standard.profiles_list->addItems(m_otherProfiles); + //m_standard.profiles_list->sortItems(); } - m_standard.profiles_list->clear(); - QStringList profilesDescription; - foreach(const QString &prof, profiles) { - QString desc = ProfilesDialog::getProfileDescription(prof); - if (!desc.isEmpty()) { - QListWidgetItem *item = new QListWidgetItem(desc, m_standard.profiles_list); - item->setData(Qt::UserRole, prof); - } + + for (int i = 0; i < m_standard.profiles_list->count(); i++) { + QListWidgetItem *item = m_standard.profiles_list->item(i); + MltVideoProfile prof = ProfilesDialog::getVideoProfile(m_profilesInfo.value(item->text())); + const QString infoString = ("" + i18n("Frame size:") + " %1x%2
" + i18n("Frame rate:") + " %3/%4
" + i18n("Pixel aspect ratio:") + "%5/%6
" + i18n("Display aspect ratio:") + " %7/%8").arg(QString::number(prof.width), QString::number(prof.height), QString::number(prof.frame_rate_num), QString::number(prof.frame_rate_den), QString::number(prof.sample_aspect_num), QString::number(prof.sample_aspect_den), QString::number(prof.display_aspect_num), QString::number(prof.display_aspect_den)); + item->setToolTip(infoString); } + m_standard.profiles_list->setSortingEnabled(true); m_standard.profiles_list->setCurrentRow(0); } @@ -179,7 +417,7 @@ void Wizard::slotCheckSelectedItem() { void Wizard::adjustSettings() { if (m_extra.installmimes->isChecked()) { QStringList globs; - globs << "*.mts" << "*.m2t"; + globs << "*.mts" << "*.m2t" << "*.mod" << "*.ts"; installExtraMimes("video/mpeg", globs); globs.clear(); globs << "*.dv"; @@ -190,8 +428,14 @@ void Wizard::adjustSettings() { KdenliveSettings::setVideothumbnails(m_extra.videothumbs->isChecked()); KdenliveSettings::setCrashrecovery(m_extra.autosave->isChecked()); if (m_standard.profiles_list->currentItem()) { - KdenliveSettings::setDefault_profile(m_standard.profiles_list->currentItem()->data(Qt::UserRole).toString()); + QString selectedProfile = m_profilesInfo.value(m_standard.profiles_list->currentItem()->text()); + if (selectedProfile.isEmpty()) selectedProfile = "dv_pal"; + KdenliveSettings::setDefault_profile(selectedProfile); } + QString path = m_extra.projectfolder->url().path(); + if (KStandardDirs::makeDir(path) == false) kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path; + KdenliveSettings::setDefaultprojectfolder(path); + } void Wizard::slotCheckMlt() { @@ -199,7 +443,7 @@ void Wizard::slotCheckMlt() { if (KdenliveSettings::rendererpath().isEmpty()) { errorMessage.append(i18n("your MLT installation cannot be found. Install MLT and restart Kdenlive.\n")); } - QProcess checkProcess; + /*QProcess checkProcess; checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "producer"); if (!checkProcess.waitForStarted()) errorMessage.append(i18n("Error starting MLT's command line player (inigo)") + ".\n"); @@ -207,7 +451,7 @@ void Wizard::slotCheckMlt() { checkProcess.waitForFinished(); QByteArray result = checkProcess.readAllStandardError(); - 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"); + 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");*/ QProcess checkProcess2; checkProcess2.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "consumer"); @@ -216,7 +460,7 @@ void Wizard::slotCheckMlt() { checkProcess2.waitForFinished(); - result = checkProcess2.readAllStandardError(); + QByteArray result = checkProcess2.readAllStandardError(); 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"); if (!errorMessage.isEmpty()) { @@ -231,6 +475,8 @@ void Wizard::slotCheckMlt() { m_systemCheckIsOk = false; button(QWizard::NextButton)->setEnabled(false); } else m_systemCheckIsOk = true; + + if (m_systemCheckIsOk) checkMltComponents(); } bool Wizard::isOk() const {