X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fwizard.cpp;h=e491d1d380557d94734c5defcc955c7e38e974db;hb=ccf25150e7a1556cc8a3738884600f157f9d3fdd;hp=a1ac631040ae951372391868d78c0d95cb38bbda;hpb=62740646e6ef3d62e6cebf9b14a785e8e08e13c1;p=kdenlive diff --git a/src/wizard.cpp b/src/wizard.cpp index a1ac6310..e491d1d3 100644 --- a/src/wizard.cpp +++ b/src/wizard.cpp @@ -20,6 +20,7 @@ #include "wizard.h" #include "kdenlivesettings.h" #include "profilesdialog.h" +#include "v4l/v4lcapture.h" #include "kdenlive-config.h" #include @@ -35,11 +36,11 @@ #include #include -const double recommendedMltVersion = 45; -static const char version[] = VERSION; +const double recommendedMltVersion = 510; +static const char kdenlive_version[] = VERSION; Wizard::Wizard(bool upgrade, QWidget *parent) : - QWizard(parent) + QWizard(parent) { setWindowTitle(i18n("Config Wizard")); setPixmap(QWizard::WatermarkPixmap, QPixmap(KStandardDirs::locate("appdata", "banner.png"))); @@ -48,7 +49,7 @@ Wizard::Wizard(bool upgrade, QWidget *parent) : page1->setTitle(i18n("Welcome")); QLabel *label; if (upgrade) - label = new QLabel(i18n("Your Kdenlive version was upgraded to version %1. Please take some time to review the basic settings", QString(version).section(' ', 0, 0))); + 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))); else 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...")); label->setWordWrap(true); @@ -113,7 +114,7 @@ Wizard::Wizard(bool upgrade, QWidget *parent) : page3->setTitle(i18n("Additional Settings")); m_extra.setupUi(page3); m_extra.projectfolder->setMode(KFile::Directory); - m_extra.projectfolder->setPath(KdenliveSettings::defaultprojectfolder()); + m_extra.projectfolder->setUrl(KUrl(KdenliveSettings::defaultprojectfolder())); m_extra.videothumbs->setChecked(KdenliveSettings::videothumbnails()); m_extra.audiothumbs->setChecked(KdenliveSettings::audiothumbnails()); m_extra.autosave->setChecked(KdenliveSettings::crashrecovery()); @@ -122,6 +123,16 @@ Wizard::Wizard(bool upgrade, QWidget *parent) : slotCheckThumbs(); addPage(page3); +#ifndef Q_WS_MAC + QWizardPage *page6 = new QWizardPage; + page6->setTitle(i18n("Webcam")); + m_capture.setupUi(page6); + connect(m_capture.button_reload, SIGNAL(clicked()), this, SLOT(slotDetectWebcam())); + connect(m_capture.device_list, SIGNAL(itemSelectionChanged()), this, SLOT(slotUpdateCaptureParameters())); + m_capture.button_reload->setIcon(KIcon("view-refresh")); + + addPage(page6); +#endif QWizardPage *page5 = new QWizardPage; page5->setTitle(i18n("Checking system")); @@ -130,10 +141,55 @@ Wizard::Wizard(bool upgrade, QWidget *parent) : listViewDelegate = new WizardDelegate(m_check.programList); m_check.programList->setItemDelegate(listViewDelegate); - + slotDetectWebcam(); QTimer::singleShot(500, this, SLOT(slotCheckMlt())); } +void Wizard::slotDetectWebcam() +{ +#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) + m_capture.device_list->clear(); + + // Video 4 Linux device detection + V4lCaptureHandler v4l(NULL); + for (int i = 0; i < 10; i++) { + QString path = "/dev/video" + QString::number(i); + if (QFile::exists(path)) { + QStringList deviceInfo = v4l.getDeviceName(path.toUtf8().constData()); + if (!deviceInfo.isEmpty()) { + QTreeWidgetItem *item = new QTreeWidgetItem(m_capture.device_list, QStringList() << deviceInfo.at(0) << "(" + deviceInfo.at(1) + ") " + deviceInfo.at(2)); + item->setData(0, Qt::UserRole, path); + item->setData(0, Qt::UserRole + 1, deviceInfo.at(1)); + } + } + } + if (m_capture.device_list->topLevelItemCount() > 0) { + m_capture.v4l_status->setText(i18n("Select your default video4linux device")); + // select default device + bool found = false; + for (int i = 0; i < m_capture.device_list->topLevelItemCount(); i++) { + QTreeWidgetItem * item = m_capture.device_list->topLevelItem(i); + if (item && item->data(0, Qt::UserRole).toString() == KdenliveSettings::video4vdevice()) { + m_capture.device_list->setCurrentItem(item); + found = true; + break; + } + } + if (!found) m_capture.device_list->setCurrentItem(m_capture.device_list->topLevelItem(0)); + } else m_capture.v4l_status->setText(i18n("No device found, plug your webcam and refresh.")); +#endif +} + +void Wizard::slotUpdateCaptureParameters() +{ + QTreeWidgetItem * item = m_capture.device_list->currentItem(); + if (!item) return; + QString device = item->data(0, Qt::UserRole).toString(); + if (!device.isEmpty()) KdenliveSettings::setVideo4vdevice(device); + + QString size = item->data(0, Qt::UserRole + 1).toString(); + if (!size.isEmpty()) KdenliveSettings::setVideo4size(size); +} void Wizard::checkMltComponents() { @@ -180,7 +236,7 @@ void Wizard::checkMltComponents() } else { checkProcess.waitForFinished(); mltVersion = checkProcess.readAllStandardOutput(); - version = 100 * mltVersion.section('.', 0, 0).toInt() + 10 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt(); + version = 1000 * mltVersion.section('.', 0, 0).toInt() + 100 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt(); kDebug() << "// FOUND MLT's pkgconfig version: " << version; } } @@ -193,14 +249,14 @@ void Wizard::checkMltComponents() 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(); + version = 1000 * mltVersion.section('.', 0, 0).toInt() + 100 * mltVersion.section('.', 1, 1).toInt() + mltVersion.section('.', 2, 2).toInt(); kDebug() << "// FOUND MLT version: " << version; } } mltitem->setText(1, i18n("MLT version: %1", mltVersion.simplified())); mltitem->setSizeHint(0, itemSize); - if (version < 40) { + if (version < 506) { mltitem->setData(1, Qt::UserRole, i18n("Your MLT version is unsupported!!!")); mltitem->setIcon(0, m_badIcon); } else { @@ -299,6 +355,18 @@ void Wizard::checkMltComponents() } else { imageItem->setIcon(0, m_okIcon); } + + // Check MLT title module + QTreeWidgetItem *titleItem = new QTreeWidgetItem(m_mltCheck.programList, QStringList() << QString() << i18n("Title module")); + titleItem->setData(1, Qt::UserRole, i18n("Required to work with titles")); + titleItem->setSizeHint(0, itemSize); + if (!result.contains("- kdenlivetitle")) { + KdenliveSettings::setHastitleproducer(false); + titleItem->setIcon(0, m_badIcon); + } else { + titleItem->setIcon(0, m_okIcon); + KdenliveSettings::setHastitleproducer(true); + } } } @@ -316,29 +384,36 @@ void Wizard::slotCheckPrograms() else if (KStandardDirs::findExe("ffplay").isEmpty()) item->setIcon(0, m_badIcon); else item->setIcon(0, m_okIcon); - item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("Recordmydesktop")); +#ifndef Q_WS_MAC + 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, m_badIcon); else item->setIcon(0, m_okIcon); - item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("Dvgrab")); + 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, m_badIcon); else item->setIcon(0, m_okIcon); +#endif - item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("Dvdauthor")); + 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, m_badIcon); else item->setIcon(0, m_okIcon); - item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("Mkisofs")); + + item = new QTreeWidgetItem(m_check.programList, QStringList() << QString() << i18n("genisoimage or 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, m_badIcon); - else item->setIcon(0, m_okIcon); + if (KStandardDirs::findExe("genisoimage").isEmpty()) { + // no GenIso, check for mkisofs + if (!KStandardDirs::findExe("mkisofs").isEmpty()) { + item->setIcon(0, m_okIcon); + } else item->setIcon(0, m_badIcon); + } else item->setIcon(0, m_okIcon); // set up some default applications QString program; @@ -369,7 +444,7 @@ void Wizard::installExtraMimes(QString baseName, QStringList globs) } else { QStringList extensions = mime->patterns(); QString comment = mime->comment(); - foreach(const QString &glob, globs) { + foreach(const QString & glob, globs) { if (!extensions.contains(glob)) extensions << glob; } kDebug() << "EXTS: " << extensions; @@ -396,7 +471,7 @@ void Wizard::installExtraMimes(QString baseName, QStringList globs) writer.writeEndElement(); // comment } - foreach(const QString& pattern, extensions) { + foreach(const QString & pattern, extensions) { writer.writeStartElement(nsUri, "glob"); writer.writeAttribute("pattern", pattern); writer.writeEndElement(); // glob @@ -506,8 +581,9 @@ void Wizard::adjustSettings() 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); + if (KStandardDirs::makeDir(path) == false) { + kDebug() << "/// ERROR CREATING PROJECT FOLDER: " << path; + } else KdenliveSettings::setDefaultprojectfolder(path); } @@ -538,7 +614,7 @@ void Wizard::slotCheckMlt() 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()) { - errorMessage.prepend(QString("%1
").arg(i18n("Fatal Error"))); + errorMessage.prepend(QString("%1
").arg(i18n("Fatal Error"))); QLabel *pix = new QLabel(); pix->setPixmap(KIcon("dialog-error").pixmap(30)); QLabel *label = new QLabel(errorMessage); @@ -561,7 +637,7 @@ bool Wizard::isOk() const void Wizard::slotShowWebInfos() { - KRun::runUrl(KUrl("http://kdenlive.org/discover/" + QString(version).section(' ', 0, 0)), "text/html", this); + KRun::runUrl(KUrl("http://kdenlive.org/discover/" + QString(kdenlive_version).section(' ', 0, 0)), "text/html", this); } #include "wizard.moc"