#include <KService>
#include <KMimeTypeTrader>
+#if KDE_IS_VERSION(4,7,0)
+#include <KMessageWidget>
+#endif
+
#include <QLabel>
#include <QFile>
#include <QXmlStreamWriter>
QWizardPage *page1 = new QWizardPage;
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(kdenlive_version).section(' ', 0, 0)));
+ m_welcomeLabel = 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)), this);
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);
+ m_welcomeLabel = 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..."), this);
+ m_welcomeLabel->setWordWrap(true);
m_startLayout = new QVBoxLayout;
- m_startLayout->addWidget(label);
+ m_startLayout->addWidget(m_welcomeLabel);
QPushButton *but = new QPushButton(KIcon("help-about"), i18n("Discover the features of this Kdenlive release"), this);
connect(but, SIGNAL(clicked()), this, SLOT(slotShowWebInfos()));
m_startLayout->addStretch();
result << QString(formats.get(i));
m_mltCheck.formats_list->addItems(result);
KdenliveSettings::setSupportedformats(result);
+ checkMissingCodecs();
delete consumer;
}
}
}
+void Wizard::checkMissingCodecs()
+{
+ const QStringList acodecsList = KdenliveSettings::audiocodecs();
+ const QStringList vcodecsList = KdenliveSettings::videocodecs();
+ bool replaceVorbisCodec = false;
+ if (acodecsList.contains("libvorbis")) replaceVorbisCodec = true;
+ bool replaceLibfaacCodec = false;
+ if (!acodecsList.contains("aac") && acodecsList.contains("libfaac")) replaceLibfaacCodec = true;
+
+ QString exportFolder = KStandardDirs::locateLocal("appdata", "export/");
+ QDir directory = QDir(exportFolder);
+ QStringList filter;
+ filter << "*.xml";
+ QStringList fileList = directory.entryList(filter, QDir::Files);
+ // We should parse customprofiles.xml in last position, so that user profiles
+ // can also override profiles installed by KNewStuff
+ QStringList requiredACodecs;
+ QStringList requiredVCodecs;
+ foreach(const QString &filename, fileList) {
+ QDomDocument doc;
+ QFile file(exportFolder + filename);
+ doc.setContent(&file, false);
+ file.close();
+ QString std;
+ QString format;
+ QDomNodeList profiles = doc.elementsByTagName("profile");
+ for (int i = 0; i < profiles.count(); i++) {
+ std = profiles.at(i).toElement().attribute("args");
+ format.clear();
+ if (std.startsWith("acodec=")) format = std.section("acodec=", 1, 1);
+ else if (std.contains(" acodec=")) format = std.section(" acodec=", 1, 1);
+ if (!format.isEmpty()) requiredACodecs << format.section(' ', 0, 0).toLower();
+ format.clear();
+ if (std.startsWith("vcodec=")) format = std.section("vcodec=", 1, 1);
+ else if (std.contains(" vcodec=")) format = std.section(" vcodec=", 1, 1);
+ if (!format.isEmpty()) requiredVCodecs << format.section(' ', 0, 0).toLower();
+ }
+ }
+ requiredACodecs.removeDuplicates();
+ requiredVCodecs.removeDuplicates();
+ if (replaceVorbisCodec) requiredACodecs.replaceInStrings("vorbis", "libvorbis");
+ if (replaceLibfaacCodec) requiredACodecs.replaceInStrings("aac", "libfaac");
+
+ for (int i = 0; i < acodecsList.count(); i++)
+ requiredACodecs.removeAll(acodecsList.at(i));
+ for (int i = 0; i < vcodecsList.count(); i++)
+ requiredVCodecs.removeAll(vcodecsList.at(i));
+ if (!requiredACodecs.isEmpty() || !requiredVCodecs.isEmpty()) {
+ QString missing = requiredACodecs.join(",");
+ if (!missing.isEmpty() && !requiredVCodecs.isEmpty()) missing.append(',');
+ missing.append(requiredVCodecs.join(","));
+ missing.prepend(i18n("The following codecs were not found on your system. Check our <a href=''>online manual</a> if you need them: "));
+ // Some codecs required for rendering are not present on this system, warn user
+ show();
+#if KDE_IS_VERSION(4,7,0)
+ KMessageWidget *infoMessage = new KMessageWidget(this);
+ m_startLayout->insertWidget(1, infoMessage);
+ infoMessage->setCloseButtonVisible(false);
+ infoMessage->setWordWrap(true);
+ infoMessage->setMessageType(KMessageWidget::Warning);
+#if KDE_IS_VERSION(4,10,0)
+ connect(infoMessage, SIGNAL(linkActivated (const QString &)), this, SLOT(slotOpenManual()));
+ infoMessage->setText(missing);
+#else
+ // clickable text in kmessagewidget only available since KDE 4.10
+ // remove link from text
+ missing.remove(QRegExp("<[^>]*>"));
+ infoMessage->setText(missing);
+ QAction *manualAction = new QAction(i18n("Check online manual"), this);
+ connect(manualAction, SIGNAL(triggered()), this, SLOT(slotOpenManual()));
+ infoMessage->addAction(manualAction);
+#endif
+ infoMessage->animatedShow();
+#else
+ m_welcomeLabel->setText(m_welcomeLabel->text() + "<br><hr />" + missing);
+ connect(m_welcomeLabel, SIGNAL(linkActivated (const QString &)), this, SLOT(slotOpenManual()));
+#endif
+ }
+
+}
+
void Wizard::slotCheckPrograms()
{
QSize itemSize(20, fontMetrics().height() * 2.5);
return m_systemCheckIsOk;
}
+void Wizard::slotOpenManual()
+{
+ KRun::runUrl(KUrl("http://kdenlive.org/troubleshooting"), "text/html", this);
+}
+
void Wizard::slotShowWebInfos()
{
KRun::runUrl(KUrl("http://kdenlive.org/discover/" + QString(kdenlive_version).section(' ', 0, 0)), "text/html", this);