]> git.sesse.net Git - kdenlive/commitdiff
"Get New Lumas" option in settings menu to automatically download new transition...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 13 Dec 2008 19:03:42 +0000 (19:03 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sat, 13 Dec 2008 19:03:42 +0000 (19:03 +0000)
svn path=/branches/KDE4/; revision=2786

src/CMakeLists.txt
src/initeffects.cpp
src/initeffects.h
src/kdenlive.knsrc [new file with mode: 0644]
src/kdenliveui.rc
src/mainwindow.cpp
src/mainwindow.h

index 34c80f92a1e99f1253774d036cfe6d90330507e3..c868d10d6b88e329ef6a03cb7174fe3858add0f2 100644 (file)
@@ -153,7 +153,8 @@ kde4_add_executable(kdenlive ${kdenlive_SRCS} ${kdenlive_UI})
 
 target_link_libraries(kdenlive 
   ${KDE4_KDEUI_LIBS}
-  ${KDE4_KIO_LIBS} 
+  ${KDE4_KIO_LIBS}
+  ${KDE4_KNEWSTUFF2_LIBS}
   ${LIBMLTPLUS_LIBRARY}
   ${LIBMLT_LIBRARY}
   ${NEPOMUK_LIBRARIES}
@@ -165,6 +166,7 @@ install( FILES kdenliveui.rc kdenlive.notifyrc DESTINATION  ${DATA_INSTALL_DIR}/
 install (FILES kdenlivesettings.kcfg DESTINATION share/config.kcfg)
 install (FILES kdenlive.desktop DESTINATION share/applications/kde)
 install (FILES application-x-kdenlive.svgz video-mlt-playlist.svgz DESTINATION share/icons/oxygen/scalable/mimetypes)
+install( FILES kdenlive.knsrc  DESTINATION  ${CONFIG_INSTALL_DIR} )
 kde4_install_icons( ${ICON_INSTALL_DIR} )
 
 
index fd4c46f13a05eecf240de104e5fe612ab6c95b0e..1470cc48f7e91049c79bc15743e038f65b4fffc4 100644 (file)
@@ -66,6 +66,48 @@ initEffects::initEffects() {
 initEffects::~initEffects() {
 }
 
+
+// static
+void initEffects::refreshLumas() {
+
+    // Check for Kdenlive installed luma files
+    QStringList imagenamelist;
+    QStringList imagefiles;
+    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) {
+            imagenamelist.append(fname);
+            imagefiles.append(folder + '/' + fname);
+        }
+    }
+
+    // Check for MLT lumas
+    QString folder = mlt_environment("MLT_DATA");
+    folder.append("/lumas/").append(mlt_environment("MLT_NORMALISATION"));
+    QDir lumafolder(folder);
+    QStringList filesnames = lumafolder.entryList(filters, QDir::Files);
+    foreach(const QString &fname, filesnames) {
+        imagenamelist.append(fname);
+        imagefiles.append(folder + '/' + fname);
+    }
+    QDomElement lumaTransition = MainWindow::transitions.getEffectByTag("luma", QString());
+    QDomNodeList params = lumaTransition.elementsByTagName("parameter");
+    for (int i = 0; i < params.count(); i++) {
+        QDomElement e = params.item(i).toElement();
+        if (e.attribute("tag") == "resource") {
+            e.setAttribute("paramlistdisplay", imagenamelist.join(","));
+            e.setAttribute("paramlist", imagefiles.join(","));
+            break;
+        }
+    }
+
+
+}
+
 //static
 Mlt::Repository *initEffects::parseEffectFiles() {
     QStringList::Iterator more;
@@ -655,7 +697,7 @@ void initEffects::fillTransitionsList(Mlt::Repository * repository, EffectsList*
 
         transitions->append(ret.documentElement());
         //kDebug() << "//// ////  TRANSITON XML";
-        //kDebug() << ret.toString();
+        kDebug() << ret.toString();
         /*
 
          <transition fill="1" in="11" a_track="1" out="73" mlt_service="luma" b_track="2" softness="0" resource="/home/marco/Projekte/kdenlive/install_cmake/share/apps/kdenlive/pgm/PAL/square2.pgm" />
index 01b3852de055cf8249b85656fd066f790daf25be..3da9dd54cde9607a024f1c4186683c2f365494fa 100644 (file)
@@ -48,6 +48,7 @@ public:
     ~initEffects();
 
     static Mlt::Repository *parseEffectFiles();
+    static void refreshLumas();
     static QDomDocument createDescriptionFromMlt(Mlt::Repository* repository, const QString& type, const QString& name);
     static void fillTransitionsList(Mlt::Repository *, EffectsList* transitions, QStringList names);
     static QDomElement quickParameterFill(QDomDocument & doc, QString name, QString tag, QString type, QString def = QString(), QString min = QString(), QString max = QString(), QString list = QString(), QString listdisplaynames = QString(), QString factor = QString(), QString namedesc = QString(), QString format = QString());
diff --git a/src/kdenlive.knsrc b/src/kdenlive.knsrc
new file mode 100644 (file)
index 0000000..593662d
--- /dev/null
@@ -0,0 +1,4 @@
+[KNewStuff2]
+ProvidersUrl=http://download.kde.org/khotnewstuff/kdenlive-providers.xml
+TargetDir=kdenlive/lumas
+Uncompress=archive
\ No newline at end of file
index a1e2bf004c4a941c3f50184772b0d2eb2008f67f..869966495137cc05c30b92cb4e7683e586cd8ad4 100644 (file)
@@ -92,6 +92,7 @@
     </Menu>
     <Menu name="settings" >
       <Action name="manage_profiles" />
+      <Action name="get_new_stuff" />      
     </Menu>
   </MenuBar>
 </gui>
\ No newline at end of file
index 69c24e9dce2897faf7846e4cbfeabf079ed864cc..96bcdca7a4534dff418f01f92515f0055c08e5a6 100644 (file)
@@ -51,6 +51,8 @@
 #include <KFileItem>
 #include <KNotification>
 #include <KNotifyConfigWidget>
+#include <knewstuff2/engine.h>
+#include <knewstuff2/ui/knewstuffaction.h>
 
 #include <mlt++/Mlt.h>
 
@@ -690,6 +692,8 @@ void MainWindow::setupActions() {
     collection->addAction("manage_profiles", profilesAction);
     connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
 
+    KAction* fileGHNS = KNS::standardAction(i18n("Download New Lumas..."), this, SLOT(slotGetNewStuff()), actionCollection(), "get_new_stuff");
+
     KAction* projectAction = new KAction(KIcon("configure"), i18n("Project Settings"), this);
     collection->addAction("project_settings", projectAction);
     connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
@@ -1989,5 +1993,23 @@ void MainWindow::slotSetOutPoint() {
     } else m_activeTimeline->projectView()->setOutPoint();
 }
 
+void MainWindow::slotGetNewStuff() {
+    kDebug() << "// GET NEW STUFF";
+    //KNS::Entry::List download();
+    KNS::Entry::List entries = KNS::Engine::download();
+    int numberInstalled = 0;
+    // list of changed entries
+    kDebug() << "// PARSING KNS";
+    foreach(KNS::Entry* entry, entries) {
+        // care only about installed ones
+        if (entry->status() == KNS::Entry::Installed) {
+            foreach(const QString &file, entry->installedFiles()) {
+                kDebug() << "// CURRENTLY INSTALLED: " << file;
+            }
+        }
+    }
+    qDeleteAll(entries);
+    initEffects::refreshLumas();
+}
 
 #include "mainwindow.moc"
index ca7d7a81d0e48994443ed71aa420a338d70ec815..c9ef5e9f343a8b5e4e0382b951aec4e4c836e023 100644 (file)
@@ -269,6 +269,7 @@ private slots:
     void slotInsertTrack(int ix = 0);
     void slotDeleteTrack(int ix = 0);
     void slotChangeTrack(int ix = 0);
+    void slotGetNewStuff();
 };