]> git.sesse.net Git - kdenlive/commitdiff
Check that MLT's avformat is ok at first start, it should help detect startup crashes...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 25 Sep 2008 11:46:01 +0000 (11:46 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 25 Sep 2008 11:46:01 +0000 (11:46 +0000)
svn path=/branches/KDE4/; revision=2409

src/mainwindow.cpp
src/wizard.cpp
src/wizard.h

index 1db221c1b12134432494ba1ef04ef1f48022fbc2..bb8f3c122b4ca99b9fb5970760118c9e9b2dc69d 100644 (file)
@@ -769,11 +769,15 @@ void MainWindow::readOptions() {
     if (!initialGroup.exists()) {
         // this is our first run, show Wizard
         Wizard *w = new Wizard(this);
-        if (w->exec() == QDialog::Accepted) {
+        if (w->exec() == QDialog::Accepted && w->isOk()) {
             w->adjustSettings();
             initialGroup.writeEntry("version", "0.7");
+            delete w;
+        } else {
+            delete w;
+            // TODO: find a better way to exit application faster
+            QTimer::singleShot(1000, this, SLOT(queryQuit()));
         }
-        delete w;
     }
 }
 
@@ -978,7 +982,7 @@ void MainWindow::parseProfiles() {
 
     if (KdenliveSettings::rendererpath().isEmpty()) {
         // Cannot find the MLT inigo renderer, ask for location
-        KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find the inigo program required for rendering (part of Mlt)"), this);
+        KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the inigo program required for rendering (part of Mlt)"), this);
         getUrl->exec();
         KUrl rendererPath = getUrl->selectedUrl();
         delete getUrl;
index 3a16b883f6657ee1746db3d7785ea0d46da59ce7..014d5358277cfe0e4631de6d9d2a8aec5419b29b 100644 (file)
  ***************************************************************************/
 
 #include <QLabel>
-#include <QVBoxLayout>
 #include <QFile>
 #include <QXmlStreamWriter>
+#include <QApplication>
+#include <QTimer>
 
 #include <KStandardDirs>
 #include <KLocale>
@@ -36,15 +37,15 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) {
 
     QWizardPage *page1 = new QWizardPage;
     page1->setTitle("Welcome");
-    QLabel *label = new QLabel("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...");
+    QLabel *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);
-    QVBoxLayout *layout = new QVBoxLayout;
-    layout->addWidget(label);
-    page1->setLayout(layout);
+    m_startLayout = new QVBoxLayout;
+    m_startLayout->addWidget(label);
+    page1->setLayout(m_startLayout);
     addPage(page1);
 
     QWizardPage *page2 = new QWizardPage;
-    page2->setTitle("Video Standard");
+    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()));
@@ -54,7 +55,7 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) {
     addPage(page2);
 
     QWizardPage *page3 = new QWizardPage;
-    page3->setTitle("Additional Settings");
+    page3->setTitle(i18n("Additional Settings"));
     m_extra.setupUi(page3);
     m_extra.videothumbs->setChecked(KdenliveSettings::videothumbnails());
     m_extra.audiothumbs->setChecked(KdenliveSettings::audiothumbnails());
@@ -63,6 +64,7 @@ Wizard::Wizard(QWidget *parent): QWizard(parent) {
     connect(m_extra.audiothumbs, SIGNAL(stateChanged(int)), this, SLOT(slotCheckThumbs()));
     slotCheckThumbs();
     addPage(page3);
+    QTimer::singleShot(500, this, SLOT(slotCheckMlt()));
 }
 
 void Wizard::installExtraMimes(QString baseName, QStringList globs) {
@@ -115,7 +117,7 @@ void Wizard::installExtraMimes(QString baseName, QStringList globs) {
 
 void Wizard::runUpdateMimeDatabase() {
     const QString localPackageDir = KStandardDirs::locateLocal("xdgdata-mime", QString());
-    Q_ASSERT(!localPackageDir.isEmpty());
+    //Q_ASSERT(!localPackageDir.isEmpty());
     KProcess proc;
     proc << "update-mime-database";
     proc << localPackageDir;
@@ -188,4 +190,36 @@ void Wizard::adjustSettings() {
     }
 }
 
+void Wizard::slotCheckMlt() {
+    QString errorMessage;
+    if (KdenliveSettings::rendererpath().isEmpty()) {
+        errorMessage.append(i18n("your MLT installation cannot be found. Install MLT and restart Kdenlive.\n"));
+    }
+    QProcess checkProcess;
+    checkProcess.start(KdenliveSettings::rendererpath(), QStringList() << "-query" << "producer");
+    if (!checkProcess.waitForStarted())
+        errorMessage.append("Error starting MLT's command line player (inigo).\n");
+
+    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 (!errorMessage.isEmpty()) {
+        QLabel *pix = new QLabel();
+        pix->setPixmap(KIcon("process-stop").pixmap(30));
+        QLabel *label = new QLabel(errorMessage);
+        label->setWordWrap(true);
+        m_startLayout->addSpacing(40);
+        m_startLayout->addWidget(pix);
+        m_startLayout->addWidget(label);
+        m_systemCheckIsOk = false;
+        button(QWizard::NextButton)->setEnabled(false);
+    } else m_systemCheckIsOk = true;
+}
+
+bool Wizard::isOk() const {
+    return m_systemCheckIsOk;
+}
+
 #include "wizard.moc"
index ba9fa42244c000319b720f90edf25f0468fcf781..36ea34bd6b4df6f69db3c305c58ee1b81939657f 100644 (file)
@@ -22,6 +22,7 @@
 #define WIZARD_H
 
 #include <QWizard>
+#include <QVBoxLayout>
 #include <KDebug>
 
 #include "ui_wizardstandard_ui.h"
@@ -35,15 +36,19 @@ public:
     void installExtraMimes(QString baseName, QStringList globs);
     void runUpdateMimeDatabase();
     void adjustSettings();
+    bool isOk() const;
 
 private:
     Ui::WizardStandard_UI m_standard;
     Ui::WizardExtra_UI m_extra;
+    QVBoxLayout *m_startLayout;
+    bool m_systemCheckIsOk;
 
 private slots:
     void slotCheckThumbs();
     void slotCheckStandard();
     void slotCheckSelectedItem();
+    void slotCheckMlt();
 };
 
 #endif