From 8a39629b05192d636ee630f80c648b17aa6ff11d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Tue, 23 Dec 2008 11:47:36 +0000 Subject: [PATCH] Also show kdenlive lumas in the slideshow dialog svn path=/branches/KDE4/; revision=2820 --- src/clipproperties.cpp | 36 +++++++++++++++++++++--------------- src/slideshowclip.cpp | 30 +++++++++++++++++++----------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/src/clipproperties.cpp b/src/clipproperties.cpp index d1adbba1..ee08ce24 100644 --- a/src/clipproperties.cpp +++ b/src/clipproperties.cpp @@ -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())); diff --git a/src/slideshowclip.cpp b/src/slideshowclip.cpp index 29d84b2a..55f63fd1 100644 --- a/src/slideshowclip.cpp +++ b/src/slideshowclip.cpp @@ -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(); -- 2.39.2