Commit 08a49ce4 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Display Jpeg exif data in clip properties metadata

svn path=/trunk/kdenlive/; revision=4608
parent 032e0d7c
......@@ -36,6 +36,8 @@
#include <QGraphicsItemGroup>
#include <KFileMetaInfo>
ClipManager::ClipManager(KdenliveDoc *doc) :
QObject(),
m_audioThumbsQueue(),
......@@ -292,6 +294,15 @@ void ClipManager::slotAddClipList(const KUrl::List urls, const QString group, co
prod.setAttribute("type", (int) IMAGE);
prod.setAttribute("in", 0);
prod.setAttribute("out", m_doc->getFramePos(KdenliveSettings::image_duration()) - 1);
// Read EXIF metadata for JPEG
if (type->is("image/jpeg")) {
KFileMetaInfo metaInfo(file.path(), QString("image/jpeg"), KFileMetaInfo::TechnicalInfo);
const QHash<QString, KFileMetaInfoItem> metaInfoItems = metaInfo.items();
foreach(const KFileMetaInfoItem& metaInfoItem, metaInfoItems) {
prod.setAttribute("meta.attr." + metaInfoItem.name().section("#", 1), metaInfoItem.value().toString());
}
}
} else if (type->is("application/x-kdenlivetitle")) {
// opening a title file
QDomDocument txtdoc("titledocument");
......@@ -324,6 +335,22 @@ void ClipManager::slotAddClipFile(const KUrl url, const QString group, const QSt
slotAddClipList(KUrl::List(url), group, groupId);
}
void ClipManager::slotAddXmlClipFile(const QString name, const QDomElement xml, const QString group, const QString &groupId)
{
QDomDocument doc;
doc.appendChild(doc.importNode(xml, true));
QDomElement prod = doc.documentElement();
prod.setAttribute("type", (int) PLAYLIST);
uint id = m_clipIdCounter++;
prod.setAttribute("id", QString::number(id));
prod.setAttribute("name", name);
if (!group.isEmpty()) {
prod.setAttribute("groupname", group);
prod.setAttribute("groupid", groupId);
}
AddClipCommand *command = new AddClipCommand(m_doc, doc.documentElement(), QString::number(id), true);
m_doc->commandStack()->push(command);
}
void ClipManager::slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId)
{
......
......@@ -74,6 +74,7 @@ Q_OBJECT public:
void slotAddClipList(const KUrl::List urls, const QString group, const QString &groupId);
void slotAddTextClipFile(const QString titleName, int out, const QString xml, const QString group, const QString &groupId);
void slotAddTextTemplateClip(QString titleName, const KUrl path, const QString group, const QString &groupId);
void slotAddXmlClipFile(const QString name, const QDomElement xml, const QString group, const QString &groupId);
void slotAddColorClipFile(const QString name, const QString color, QString duration, const QString group, const QString &groupId);
void slotAddSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const int softness, const QString group, const QString &groupId);
DocClipBase *getClipById(QString clipId);
......
......@@ -57,7 +57,9 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin
if (m_placeHolder) xml.removeAttribute("placeholder");
QDomNamedNodeMap attributes = xml.attributes();
for (int i = 0; i < attributes.count(); i++) {
m_properties.insert(attributes.item(i).nodeName(), attributes.item(i).nodeValue());
QString name = attributes.item(i).nodeName();
if (name.startsWith("meta.attr.")) m_metadata.insert(name.section('.', 2, 3), attributes.item(i).nodeValue());
else m_properties.insert(name, attributes.item(i).nodeValue());
}
if (xml.hasAttribute("cutzones")) {
......@@ -721,7 +723,11 @@ void DocClipBase::setProperties(QMap <QString, QString> properties)
void DocClipBase::setMetadata(QMap <QString, QString> properties)
{
m_metadata = properties;
QMapIterator<QString, QString> i(properties);
while (i.hasNext()) {
i.next();
m_metadata.insert(i.key(), i.value());
}
}
QMap <QString, QString> DocClipBase::metadata() const
......
This diff is collapsed.
......@@ -145,6 +145,7 @@ private:
QDomDocument createEmptyDocument(QList <TrackInfo> tracks);
public slots:
void slotCreateXmlClip(const QString &name, const QDomElement xml, QString group, const QString &groupId);
void slotCreateColorClip(const QString &name, const QString &color, const QString &duration, QString group, const QString &groupId);
void slotCreateSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const int softness, QString group, const QString &groupId);
void slotCreateTextClip(QString group, const QString &groupId, const QString &templatePath = QString());
......
......@@ -541,6 +541,9 @@
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<widget class="QTreeWidget" name="metadata_list">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rootIsDecorated">
<bool>false</bool>
</property>
......
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