Commit 4990696d authored by Laurent Montel's avatar Laurent Montel 😁

Better to use nepomukcore

parent c60be946
......@@ -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)
......
......@@ -40,6 +40,12 @@
#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);
......
......@@ -69,6 +69,11 @@
//#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()
......
......@@ -47,6 +47,12 @@
#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);
}
......
......@@ -57,6 +57,15 @@
#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());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment