]> git.sesse.net Git - kdenlive/commitdiff
Better to use nepomukcore
authorMontel Laurent <montel@kde.org>
Wed, 22 May 2013 15:04:16 +0000 (17:04 +0200)
committerMontel Laurent <montel@kde.org>
Wed, 22 May 2013 15:04:16 +0000 (17:04 +0200)
src/CMakeLists.txt
src/clipproperties.cpp
src/projectlist.cpp
src/projectlist.h
src/utils/resourcewidget.cpp

index 0e51aab45614814097834e3a4c4868f69323f410..73983ce94f0677fc909772b1d04774a668e81af6 100644 (file)
@@ -66,6 +66,10 @@ macro_log_feature(Nepomuk_FOUND
   "http://nepomuk.semanticdesktop.org"
 )
 
+find_package(NepomukCore QUIET CONFIG)
+set_package_properties(NepomukCore PROPERTIES DESCRIPTION "The Nepomuk Core libraries" URL "http://www.kde.org" TYPE RECOMMENDED PURPOSE "Support for the Nepomuk semantic desktop system")
+
+
 macro_log_feature(QJSON_FOUND
   "QJson"
   "Qt-based library that maps JSON data to QVariant objects"
@@ -344,11 +348,17 @@ if(SDL_FOUND)
   target_link_libraries(kdenlive ${SDL_LIBRARY})
 endif(SDL_FOUND)
 
-if(Nepomuk_FOUND)
-  add_definitions(-DUSE_NEPOMUK)
-  include_directories(${NEPOMUK_INCLUDES})
-  target_link_libraries(kdenlive ${NEPOMUK_LIBRARIES})
-endif(Nepomuk_FOUND)
+if(NepomukCore_FOUND)
+    add_definitions(-DUSE_NEPOMUKCORE)
+    include_directories(${NEPOMUK_CORE_INCLUDE_DIR})
+    target_link_libraries(kdenlive ${NEPOMUK_CORE_LIBRARY})
+else(NepomukWidgets_FOUND)
+  if(Nepomuk_FOUND)
+    add_definitions(-DUSE_NEPOMUK)
+    include_directories(${NEPOMUK_INCLUDES})
+    target_link_libraries(kdenlive ${NEPOMUK_LIBRARIES})
+  endif(Nepomuk_FOUND)
+endif()
 
 if(QJSON_FOUND)
   add_definitions(-DUSE_QJSON)
index 82c536f15508a9ba3300b7f0c747af5ee9fe739c..a9e6afe6e9e235af49cd32ce18f1310540140f26 100644 (file)
 #include <Nepomuk/Vocabulary/NIE>
 #endif
 #endif
+#ifdef USE_NEPOMUKCORE
+#include <Nepomuk2/Variant>
+#include <Nepomuk2/Resource>
+#include <Nepomuk2/ResourceManager>
+#include <Nepomuk2/Vocabulary/NIE>
+#endif
 
 
 #include <QDir>
@@ -490,6 +496,7 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps
 
     // Check for Nepomuk metadata
 #ifdef USE_NEPOMUK
+
 #if KDE_IS_VERSION(4,6,0)
     if (!url.isEmpty()) {
         Nepomuk::ResourceManager::instance()->init();
@@ -509,10 +516,32 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps
 #else
     m_view.clip_license->setHidden(true);
 #endif
+
+#else
+
+#ifdef USE_NEPOMUKCORE
+
+    if (!url.isEmpty()) {
+        Nepomuk2::ResourceManager::instance()->init();
+        Nepomuk2::Resource res( url.path() );
+        // Check if file has a license
+        if (res.hasProperty(Nepomuk2::Vocabulary::NIE::license())) {
+            QString ltype = res.property(Nepomuk2::Vocabulary::NIE::licenseType()).toString();
+            m_view.clip_license->setText(i18n("License: %1", res.property(Nepomuk2::Vocabulary::NIE::license()).toString()));
+            if (ltype.startsWith("http")) {
+                m_view.clip_license->setUrl(ltype);
+                connect(m_view.clip_license, SIGNAL(leftClickedUrl(QString)), this, SLOT(slotOpenUrl(QString)));
+            }
+        }
+        else m_view.clip_license->setHidden(true);
+    }
+    else m_view.clip_license->setHidden(true);
 #else
     m_view.clip_license->setHidden(true);
 #endif
-    
+
+#endif
+
     slotFillMarkersList(m_clip);
     slotUpdateAnalysisData(m_clip);
     
index 51488ee130336513055786184f4b418422a9f333..0c395164f59327f5dfe46c1d18ad60521b96a6b4 100644 (file)
 //#include <nepomuk/tag.h>
 #endif
 
+#ifdef USE_NEPOMUKCORE
+#include <nepomuk2/resourcemanager.h>
+#include <Nepomuk2/Resource>
+#endif
+
 #include <QMouseEvent>
 #include <QStylePainter>
 #include <QPixmap>
@@ -341,6 +346,16 @@ ProjectList::ProjectList(QWidget *parent) :
         }
     }
 #endif
+#ifdef USE_NEPOMUKCORE
+    if (KdenliveSettings::activate_nepomuk()) {
+        Nepomuk2::ResourceManager::instance()->init();
+        if (!Nepomuk2::ResourceManager::instance()->initialized()) {
+            kDebug() << "Cannot communicate with Nepomuk, DISABLING it";
+            KdenliveSettings::setActivate_nepomuk(false);
+        }
+    }
+#endif
+
 }
 
 ProjectList::~ProjectList()
index 070bb4acb4081d0b9c76769b25e4e388b4ea3b7d..3470239dd7010889e14bb30121ee0d25e50cebd8 100644 (file)
 #include <nepomuk/resource.h>
 #endif
 
+#ifdef NEPOMUKCORE
+#include <nepomuk2/kratingpainter.h>
+#include <nepomuk2/resource.h>
+#endif
+
+
 #include "definitions.h"
 #include "timecode.h"
 #include "kdenlivesettings.h"
@@ -219,6 +225,10 @@ public:
 #ifdef NEPOMUK
             KRatingPainter::paintRating(painter, r1, Qt::AlignCenter, index.data().toInt());
 #endif
+#ifdef NEPOMUKCORE
+          KRatingPainter::paintRating(painter, r1, Qt::AlignCenter, index.data().toInt());
+#endif
+
         } else {
             QStyledItemDelegate::paint(painter, option, index);
         }
index 4771540e2e2d11ba34324221a95295afa138e758..9935f674d0de89a9aa164104bf6a43c5394c77ab 100644 (file)
 #endif
 #endif
 
+#ifdef USE_NEPOMUKCORE
+#include <Nepomuk2/Variant>
+#include <Nepomuk2/Resource>
+#include <Nepomuk2/ResourceManager>
+#include <Nepomuk2/Vocabulary/NIE>
+#include <Nepomuk2/Vocabulary/NCO>
+#include <Nepomuk2/Vocabulary/NDO>
+#endif
+
 ResourceWidget::ResourceWidget(const QString & folder, QWidget * parent) :
         QDialog(parent),
         m_folder(folder),
@@ -261,6 +270,17 @@ void ResourceWidget::slotGotFile(KJob *job)
         //res.setProperty( Soprano::Vocabulary::NAO::description(), 
 #endif
 #endif
+
+#ifdef USE_NEPOMUKCORE
+        Nepomuk2::Resource res( filePath );
+        res.setProperty( Nepomuk2::Vocabulary::NIE::license(), (Nepomuk2::Variant) job->property("license") );
+        res.setProperty( Nepomuk2::Vocabulary::NIE::licenseType(), (Nepomuk2::Variant) job->property("licenseurl") );
+        res.setProperty( Nepomuk2::Vocabulary::NDO::copiedFrom(), (Nepomuk2::Variant) job->property("originurl") );
+        res.setProperty( Nepomuk2::Vocabulary::NCO::creator(), (Nepomuk2::Variant) job->property("author") );
+        //res.setDescription(item_description->toPlainText());
+        //res.setProperty( Soprano::Vocabulary::NAO::description(), 
+#endif
+
         emit addClip(filePath, stringMap());
 }