]> git.sesse.net Git - kdenlive/commitdiff
Also show kdenlive lumas in the slideshow dialog
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 23 Dec 2008 11:47:36 +0000 (11:47 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 23 Dec 2008 11:47:36 +0000 (11:47 +0000)
svn path=/branches/KDE4/; revision=2820

src/clipproperties.cpp
src/slideshowclip.cpp

index d1adbba1ccb4bb5ed61e1b12ab0a21d9bcbfa791..ee08ce24317b54070b629319e21f43f3432ec69b 100644 (file)
@@ -140,26 +140,32 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
 
         m_view.luma_duration->setText(tc.getTimecodeFromFrames(props.value("luma_duration").toInt()));
         QString lumaFile = props.value("luma_file");
+
+        // Check for Kdenlive installed luma files
+        QStringList filters;
+        filters << "*.pgm" << "*.png";
+
+        QStringList customLumas = KGlobal::dirs()->findDirs("appdata", "lumas");
+        foreach(const QString &folder, customLumas) {
+            QStringList filesnames = QDir(folder).entryList(filters, QDir::Files);
+            foreach(const QString &fname, filesnames) {
+                m_view.luma_file->addItem(KIcon(folder + '/' + fname), fname, folder + '/' + fname);
+            }
+        }
+
+        // Check for MLT lumas
         QString profilePath = KdenliveSettings::mltpath();
-        profilePath = profilePath.section('/', 0, -3);
-        profilePath += "/lumas/PAL/";
-
-        QDir dir(profilePath);
-        QStringList filter;
-        filter << "*.pgm";
-        const QStringList result = dir.entryList(filter, QDir::Files);
-        QStringList imagefiles;
-        QStringList imagenamelist;
-        int current;
-        foreach(const QString file, result) {
-            m_view.luma_file->addItem(KIcon(profilePath + file), file, profilePath + file);
-            if (!lumaFile.isEmpty() && lumaFile == QString(profilePath + file))
-                current = m_view.luma_file->count() - 1;
+        QString folder = profilePath.section('/', 0, -3);
+        folder.append("/lumas/PAL"); // TODO: cleanup the PAL / NTSC mess in luma files
+        QDir lumafolder(folder);
+        QStringList filesnames = lumafolder.entryList(filters, QDir::Files);
+        foreach(const QString &fname, filesnames) {
+            m_view.luma_file->addItem(KIcon(folder + '/' + fname), fname, folder + '/' + fname);
         }
 
         if (!lumaFile.isEmpty()) {
             m_view.slide_luma->setChecked(true);
-            m_view.luma_file->setCurrentIndex(current);
+            m_view.luma_file->setCurrentIndex(m_view.luma_file->findData(lumaFile));
         }
 
         connect(m_view.image_type, SIGNAL(currentIndexChanged(int)), this, SLOT(parseFolder()));
index 29d84b2ae441b902eab6193dbe5f5edd5a8a7cf9..55f63fd14f5f4cb0e9b662711d7b811c97856090 100644 (file)
@@ -53,18 +53,26 @@ SlideshowClip::SlideshowClip(QWidget * parent): QDialog(parent), m_count(0) {
     m_view.folder_url->setUrl(QDir::homePath());
 
 
+    // Check for Kdenlive installed luma files
+    QStringList filters;
+    filters << "*.pgm" << "*.png";
+
+    QStringList customLumas = KGlobal::dirs()->findDirs("appdata", "lumas");
+    foreach(const QString &folder, customLumas) {
+        QStringList filesnames = QDir(folder).entryList(filters, QDir::Files);
+        foreach(const QString &fname, filesnames) {
+            m_view.luma_file->addItem(KIcon(folder + '/' + fname), fname, folder + '/' + fname);
+        }
+    }
+
+    // Check for MLT lumas
     QString profilePath = KdenliveSettings::mltpath();
-    profilePath = profilePath.section('/', 0, -3);
-    profilePath += "/lumas/PAL/";
-
-    QDir dir(profilePath);
-    QStringList filter;
-    filter << "*.pgm";
-    const QStringList result = dir.entryList(filter, QDir::Files);
-    QStringList imagefiles;
-    QStringList imagenamelist;
-    foreach(const QString file, result) {
-        m_view.luma_file->addItem(KIcon(profilePath + file), file, profilePath + file);
+    QString folder = profilePath.section('/', 0, -3);
+    folder.append("/lumas/PAL"); // TODO: cleanup the PAL / NTSC mess in luma files
+    QDir lumafolder(folder);
+    QStringList filesnames = lumafolder.entryList(filters, QDir::Files);
+    foreach(const QString &fname, filesnames) {
+        m_view.luma_file->addItem(KIcon(folder + '/' + fname), fname, folder + '/' + fname);
     }
 
     adjustSize();