X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fclipproperties.cpp;h=79b8c2c222d5587b576f77fafc412021dd54038c;hb=c3302003093710ee247ad84c0fe2ef3c579d417f;hp=82c536f15508a9ba3300b7f0c747af5ee9fe739c;hpb=70ebf67bae6316df767bf9f15d52f9fc72bc9d88;p=kdenlive diff --git a/src/clipproperties.cpp b/src/clipproperties.cpp index 82c536f1..79b8c2c2 100644 --- a/src/clipproperties.cpp +++ b/src/clipproperties.cpp @@ -40,6 +40,12 @@ #include #endif #endif +#ifdef USE_NEPOMUKCORE +#include +#include +#include +#include +#endif #include @@ -203,8 +209,9 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps QStringList values = i.value(); QString parentName; QString iconName; - if (values.count() > 1 && !values.at(1).isEmpty()) parentName = values.at(1); - else { + if (values.count() > 1 && !values.at(1).isEmpty()) { + parentName = values.at(1); + } else { if (KdenliveSettings::ffmpegpath().endsWith("avconv")) { parentName = i18n("Libav"); iconName = "meta_libav.png"; @@ -216,9 +223,11 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps } QTreeWidgetItem *parent = NULL; QList matches = m_view.metadata_list->findItems(parentName, Qt::MatchExactly); - if (!matches.isEmpty()) parent = matches.at(0); - else { - if (parentName == "Magic Lantern") iconName = "meta_magiclantern.png"; + if (!matches.isEmpty()) { + parent = matches.at(0); + } else { + if (parentName == "Magic Lantern") + iconName = "meta_magiclantern.png"; parent = new QTreeWidgetItem(m_view.metadata_list, QStringList() << parentName); if (!iconName.isEmpty()) { KIcon icon(KStandardDirs::locate("appdata", iconName)); @@ -308,7 +317,8 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps m_view.image_transparency->setChecked(props.value("transparency").toInt()); connect(m_view.image_transparency, SIGNAL(toggled(bool)), this, SLOT(slotModified())); int width = 180.0 * KdenliveSettings::project_display_ratio(); - if (width % 2 == 1) width++; + if (width % 2 == 1) + width++; m_view.clip_thumb->setPixmap(QPixmap(url.path()).scaled(QSize(width, 180), Qt::KeepAspectRatio)); } else if (t == COLOR) { m_view.clip_path->setEnabled(false); @@ -321,7 +331,7 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps m_view.clip_color->setColor(QColor('#' + props.value("colour").right(8).left(6))); connect(m_view.clip_color, SIGNAL(changed(QColor)), this, SLOT(slotModified())); } else if (t == SLIDESHOW) { - if (url.fileName().startsWith(".all.")) { + if (url.fileName().startsWith(QLatin1String(".all."))) { // the image sequence is defined by mimetype m_view.clip_path->setText(url.directory()); } else { @@ -446,7 +456,8 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps m_view.clip_thumb->setMinimumSize(180 * KdenliveSettings::project_display_ratio(), 180); - if (t == IMAGE || t == VIDEO || t == PLAYLIST) m_view.tabWidget->removeTab(AUDIOTAB); + if (t == IMAGE || t == VIDEO || t == PLAYLIST) + m_view.tabWidget->removeTab(AUDIOTAB); } else { m_view.tabWidget->removeTab(IMAGETAB); m_view.tabWidget->removeTab(SLIDETAB); @@ -464,8 +475,9 @@ ClipProperties::ClipProperties(DocClipBase *clip, const Timecode &tc, double fps } m_view.clip_duration->setInputMask(tc.mask()); m_view.clip_duration->setText(tc.getTimecode(m_clip->duration())); - if (t != IMAGE && t != COLOR && t != TEXT) m_view.clip_duration->setReadOnly(true); - else { + if (t != IMAGE && t != COLOR && t != TEXT) { + m_view.clip_duration->setReadOnly(true); + } else { connect(m_view.clip_duration, SIGNAL(editingFinished()), this, SLOT(slotCheckMaxLength())); connect(m_view.clip_duration, SIGNAL(textChanged(QString)), this, SLOT(slotModified())); } @@ -490,6 +502,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 +522,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); @@ -673,7 +708,9 @@ ClipProperties::ClipProperties(const QList &cliplist, const Time if (commonproperties.value("out").toInt() > 0) { m_view.clip_force_out->setChecked(true); m_view.clip_out->setText(m_tc.getTimecodeFromFrames(commonproperties.value("out").toInt())); - } else m_view.clip_out->setText(KdenliveSettings::image_duration()); + } else { + m_view.clip_out->setText(KdenliveSettings::image_duration()); + } } else { m_view.clip_force_out->setHidden(true); m_view.clip_out->setHidden(true); @@ -723,7 +760,8 @@ void ClipProperties::loadVideoProperties(const QMap &props) void ClipProperties::slotGotThumbnail(const QString &id, const QImage &img) { - if (id != m_clip->getId()) return; + if (id != m_clip->getId()) + return; QPixmap framedPix(img.width(), img.height()); framedPix.fill(Qt::transparent); QPainter p(&framedPix); @@ -750,13 +788,15 @@ void ClipProperties::slotApplyProperties() void ClipProperties::slotReloadVideoProperties() { - if (m_clip == NULL) return; + if (m_clip == NULL) + return; loadVideoProperties(m_clip->properties()); } void ClipProperties::slotReloadVideoThumb() { - if (m_clip == NULL) return; + if (m_clip == NULL) + return; emit requestThumb(QString('?' + m_clip->getId()), QList() << m_clip->getClipThumbFrame()); } @@ -886,8 +926,9 @@ void ClipProperties::slotDeleteAnalysis() void ClipProperties::slotSaveAnalysis() { - QString url = KFileDialog::getSaveFileName(KUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Save Analysis Data")); - if (url.isEmpty()) return; + const QString url = KFileDialog::getSaveFileName(KUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Save Analysis Data")); + if (url.isEmpty()) + return; KSharedConfigPtr config = KSharedConfig::openConfig(url, KConfig::SimpleConfig); KConfigGroup analysisConfig(config, "Analysis"); QTreeWidgetItem *current = m_view.analysis_list->currentItem(); @@ -896,8 +937,9 @@ void ClipProperties::slotSaveAnalysis() void ClipProperties::slotLoadAnalysis() { - QString url = KFileDialog::getOpenFileName(KUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Open Analysis Data")); - if (url.isEmpty()) return; + const QString url = KFileDialog::getOpenFileName(KUrl("kfiledialog:///projectfolder"), "text/plain", this, i18n("Open Analysis Data")); + if (url.isEmpty()) + return; KSharedConfigPtr config = KSharedConfig::openConfig(url, KConfig::SimpleConfig); KConfigGroup transConfig(config, "Analysis"); // read the entries @@ -1211,8 +1253,9 @@ void ClipProperties::parseFolder(bool reloadThumb) void ClipProperties::slotCheckMaxLength() { - if (m_clip->maxDuration() == GenTime()) return; - int duration = m_tc.getFrameCount(m_view.clip_duration->text()); + if (m_clip->maxDuration() == GenTime()) + return; + const int duration = m_tc.getFrameCount(m_view.clip_duration->text()); if (duration > m_clip->maxDuration().frames(m_fps)) { m_view.clip_duration->setText(m_tc.getTimecode(m_clip->maxDuration())); } @@ -1220,7 +1263,7 @@ void ClipProperties::slotCheckMaxLength() void ClipProperties::slotUpdateDurationFormat(int ix) { - bool framesFormat = ix == 1; + bool framesFormat = (ix == 1); if (framesFormat) { // switching to frames count, update widget m_view.slide_duration_frames->setValue(m_tc.getFrameCount(m_view.slide_duration->text())); @@ -1242,10 +1285,11 @@ void ClipProperties::slotUpdateDurationFormat(int ix) void ClipProperties::slotDeleteProxy() { - QString proxy = m_clip->getProperty("proxy"); - if (proxy.isEmpty()) return; + const QString proxy = m_clip->getProperty("proxy"); + if (proxy.isEmpty()) + return; emit deleteProxy(proxy); - if (m_proxyContainer) delete m_proxyContainer; + delete m_proxyContainer; } void ClipProperties::slotOpenUrl(const QString &url)