]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
- mainwindow.cpp: possibly avoid a step when locating MLT environment in parseProfiles()
[kdenlive] / src / mainwindow.cpp
index 38b4d51524a9a3c6d164f308b0b7424244160319..7abcf53436aa3ebf39779e5c01f9a868a9410056 100644 (file)
@@ -1738,11 +1738,8 @@ void MainWindow::recoverFiles(QList<KAutoSaveFile *> staleFiles)
     }
 }
 
-
 void MainWindow::parseProfiles(const QString &mltPath)
 {
-    // kDebug()<<" + + YOUR MLT INSTALL WAS FOUND IN: "<< MLT_PREFIX <<endl;
-
     //KdenliveSettings::setDefaulttmpfolder();
     if (!mltPath.isEmpty()) {
         KdenliveSettings::setMltpath(mltPath + "/share/mlt/profiles/");
@@ -1752,28 +1749,40 @@ void MainWindow::parseProfiles(const QString &mltPath)
     if (KdenliveSettings::mltpath().isEmpty()) {
         KdenliveSettings::setMltpath(QString(MLT_PREFIX) + QString("/share/mlt/profiles/"));
     }
+
     if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::rendererpath().endsWith("inigo")) {
         QString meltPath = QString(MLT_PREFIX) + QString("/bin/melt");
         if (!QFile::exists(meltPath))
             meltPath = KStandardDirs::findExe("melt");
         KdenliveSettings::setRendererpath(meltPath);
     }
+
+    if (KdenliveSettings::rendererpath().isEmpty()) {
+        // Cannot find the MLT melt renderer, ask for location
+        KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of MLT)"), this);
+        if (getUrl->exec() == QDialog::Rejected) {
+            ::exit(0);
+        }
+        KUrl rendererPath = getUrl->selectedUrl();
+        delete getUrl;
+        if (rendererPath.isEmpty()) ::exit(0);
+        KdenliveSettings::setRendererpath(rendererPath.path());
+    }
+
     QStringList profilesFilter;
     profilesFilter << "*";
     QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-
     if (profilesList.isEmpty()) {
         // Cannot find MLT path, try finding melt
         QString profilePath = KdenliveSettings::rendererpath();
         if (!profilePath.isEmpty()) {
             profilePath = profilePath.section('/', 0, -3);
             KdenliveSettings::setMltpath(profilePath + "/share/mlt/profiles/");
-            QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
+            profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
         }
-
         if (profilesList.isEmpty()) {
             // Cannot find the MLT profiles, ask for location
-            KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your Mlt profiles, please give the path"), this);
+            KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(KdenliveSettings::mltpath(), i18n("Cannot find your MLT profiles, please give the path"), this);
             getUrl->fileDialog()->setMode(KFile::Directory);
             if (getUrl->exec() == QDialog::Rejected) {
                 ::exit(0);
@@ -1782,25 +1791,13 @@ void MainWindow::parseProfiles(const QString &mltPath)
             delete getUrl;
             if (mltPath.isEmpty()) ::exit(0);
             KdenliveSettings::setMltpath(mltPath.path(KUrl::AddTrailingSlash));
-            QStringList profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
-        }
-    }
-
-    if (KdenliveSettings::rendererpath().isEmpty()) {
-        // Cannot find the MLT melt renderer, ask for location
-        KUrlRequesterDialog *getUrl = new KUrlRequesterDialog(QString(), i18n("Cannot find the melt program required for rendering (part of Mlt)"), this);
-        if (getUrl->exec() == QDialog::Rejected) {
-            ::exit(0);
+            profilesList = QDir(KdenliveSettings::mltpath()).entryList(profilesFilter, QDir::Files);
         }
-        KUrl rendererPath = getUrl->selectedUrl();
-        delete getUrl;
-        if (rendererPath.isEmpty()) ::exit(0);
-        KdenliveSettings::setRendererpath(rendererPath.path());
     }
 
     kDebug() << "RESULTING MLT PATH: " << KdenliveSettings::mltpath();
 
-    // Parse MLT profiles to build a list of available video formats
+    // Parse again MLT profiles to build a list of available video formats
     if (profilesList.isEmpty()) parseProfiles();
 }
 
@@ -2947,12 +2944,9 @@ void MainWindow::keyPressEvent(QKeyEvent *ke)
 /** Gets called when the window gets hidden */
 void MainWindow::hideEvent(QHideEvent */*event*/)
 {
-    // kDebug() << "I was hidden";
-    // issue http://www.kdenlive.org/mantis/view.php?id=231
-    if (isMinimized()) {
-        // kDebug() << "I am minimized";
-        if (m_monitorManager) m_monitorManager->stopActiveMonitor();
-    }
+    if (isMinimized())
+        if (m_monitorManager)
+            m_monitorManager->stopActiveMonitor();
 }
 
 bool MainWindow::eventFilter(QObject *obj, QEvent *event)