if (m_clipType != UNKNOWN) slotSetToolTip();
setText(1, name);
setText(2, m_clip->description());
+ if (m_clipType != SLIDESHOW && m_clipType != TEXT && m_clipType != COLOR) setData(3, Qt::UserRole, m_clip->getProperty("resource"));
if ((m_clip->clipType() == AV || m_clip->clipType() == AUDIO) && KdenliveSettings::audiothumbnails()) m_clip->askForAudioThumbs();
//setFlags(Qt::NoItemFlags);
//kDebug() << "Constructed with clipId: " << m_clipId;
#include <KMessageBox>
#include <nepomuk/global.h>
-#include <nepomuk/resource.h>
-#include <nepomuk/tag.h>
+#include <nepomuk/resourcemanager.h>
+//#include <nepomuk/tag.h>
#include "projectlist.h"
#include "projectitem.h"
ItemDelegate *listViewDelegate = new ItemDelegate(listView);
listView->setItemDelegate(listViewDelegate);
+
+ if (KdenliveSettings::activate_nepomuk()) {
+ Nepomuk::ResourceManager::instance()->init();
+ if (!Nepomuk::ResourceManager::instance()->initialized()) {
+ kDebug() << "Cannot communicate with Nepomuk, DISABLING it";
+ KdenliveSettings::setActivate_nepomuk(false);
+ }
+ }
}
ProjectList::~ProjectList() {
if (KdenliveSettings::activate_nepomuk() && (type == AUDIO || type == VIDEO || type == AV || type == IMAGE || type == PLAYLIST)) {
// Use Nepomuk system to store clip description
Nepomuk::Resource f(clip->clipUrl().path());
- if (f.isValid()) {
- f.setDescription(properties.value("description"));
- } else {
- KMessageBox::sorry(this, i18n("Cannot access Desktop Search info for %1.\nDisabling Desktop Search integration.", clip->clipUrl().path()));
- KdenliveSettings::setActivate_nepomuk(false);
- }
+ f.setDescription(properties.value("description"));
}
emit projectModified();
}
if (!url.isEmpty() && KdenliveSettings::activate_nepomuk()) {
// if file has Nepomuk comment, use it
Nepomuk::Resource f(url.path());
- QString annotation;
- if (f.isValid()) {
- annotation = f.description();
- /*
- Nepomuk::Tag tag("test");
- f.addTag(tag);*/
- } else {
- KMessageBox::sorry(this, i18n("Cannot access Desktop Search info for %1.\nDisabling Desktop Search integration.", url.path()));
- KdenliveSettings::setActivate_nepomuk(false);
- }
+ QString annotation = f.description();
if (!annotation.isEmpty()) item->setText(2, annotation);
}
listView->blockSignals(false);
#include <KTreeWidgetSearchLine>
#include <KUrl>
+#include <nepomuk/kratingpainter.h>
+#include <nepomuk/resource.h>
#include "definitions.h"
#include "timecode.h"
+#include "kdenlivesettings.h"
namespace Mlt {
class Producer;
*/
void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
if (index.column() == 1) {
- const bool hover = option.state & (QStyle::State_Selected);
QRect r1 = option.rect;
painter->save();
- if (hover) {
+ if (option.state & (QStyle::State_Selected)) {
painter->setPen(option.palette.color(QPalette::HighlightedText));
- QColor backgroundColor = option.palette.color(QPalette::Highlight);
- painter->setBrush(QBrush(backgroundColor));
- painter->fillRect(r1, QBrush(backgroundColor));
+ painter->fillRect(r1, option.palette.highlight());
}
QFont font = painter->font();
font.setBold(true);
painter->setPen(option.palette.color(QPalette::Mid));
painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , subText);
painter->restore();
+ } else if (index.column() == 3 && KdenliveSettings::activate_nepomuk()) {
+ const QString url = index.data(Qt::UserRole).toString();
+ if (url.isEmpty()) {
+ QItemDelegate::paint(painter, option, index);
+ return;
+ }
+ QRect r1 = option.rect;
+ if (option.state & (QStyle::State_Selected)) {
+ painter->fillRect(r1, option.palette.highlight());
+ }
+ Nepomuk::Resource f(url);
+ KRatingPainter::paintRating(painter, r1, Qt::AlignCenter, f.rating());
} else {
QItemDelegate::paint(painter, option, index);
}
const QString text = model()->headerData(i, Qt::Horizontal).toString();
QAction* action = popup.addAction(text);
action->setCheckable(true);
- action->setChecked(!headerView->isSectionHidden(logicalIndex));
+ action->setChecked(!headerView->isSectionHidden(i));
action->setData(i);
}