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

Fix metadata not properly set for project: http://kdenlive.org/mantis/view.php?id=2996

parent ac6267bc
......@@ -99,6 +99,14 @@ int main(int argc, char **argv)
args.removeAll("pass=1");
doerase = erase;
}
// Decode metadata
for (int i = 0; i < args.count(); i++) {
if (args.at(i).startsWith("meta.attr")) {
QString data = args.at(i);
args.replace(i, data.section('=', 0, 0) + "=\"" + QUrl::fromPercentEncoding(data.section('=', 1).toUtf8()) + "\"");
}
}
qDebug() << "//STARTING RENDERING: " << erase << "," << usekuiserver << "," << render << "," << profile << "," << rendermodule << "," << player << "," << src << "," << dest << "," << preargs << "," << args << "," << in << "," << out ;
RenderJob *job = new RenderJob(doerase, usekuiserver, pid, render, profile, rendermodule, player, src, dest, preargs, args, in, out);
......
......@@ -135,21 +135,59 @@ ProjectSettings::ProjectSettings(ProjectList *projectlist, QMap <QString, QStrin
// Metadata list
QTreeWidgetItem *item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("Title"));
item->setData(0, Qt::UserRole, QString("meta.attr.title.markup"));
if (metadata.contains("meta.attr.title.markup")) item->setText(1, metadata.value("meta.attr.title.markup"));
if (metadata.contains("meta.attr.title.markup")) {
item->setText(1, metadata.value("meta.attr.title.markup"));
metadata.remove("meta.attr.title.markup");
}
item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("Author"));
item->setData(0, Qt::UserRole, QString("meta.attr.author.markup"));
if (metadata.contains("meta.attr.author.markup")) item->setText(1, metadata.value("meta.attr.author.markup"));
if (metadata.contains("meta.attr.author.markup")) {
item->setText(1, metadata.value("meta.attr.author.markup"));
metadata.remove("meta.attr.author.markup");
}
else if (metadata.contains("meta.attr.artist.markup")) {
item->setText(0, i18n("Artist"));
item->setData(0, Qt::UserRole, QString("meta.attr.artist.markup"));
item->setText(1, metadata.value("meta.attr.artist.markup"));
metadata.remove("meta.attr.artist.markup");
}
item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("Copyright"));
item->setData(0, Qt::UserRole, QString("meta.attr.copyright.markup"));
if (metadata.contains("meta.attr.copyright.markup")) item->setText(1, metadata.value("meta.attr.copyright.markup"));
if (metadata.contains("meta.attr.copyright.markup")) {
item->setText(1, metadata.value("meta.attr.copyright.markup"));
metadata.remove("meta.attr.copyright.markup");
}
item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("Year"));
item->setData(0, Qt::UserRole, QString("meta.attr.year.markup"));
if (metadata.contains("meta.attr.year.markup")) item->setText(1, metadata.value("meta.attr.year.markup"));
if (metadata.contains("meta.attr.year.markup")) {
item->setText(1, metadata.value("meta.attr.year.markup"));
metadata.remove("meta.attr.year.markup");
}
else if (metadata.contains("meta.attr.date.markup")) {
item->setText(0, i18n("Date"));
item->setData(0, Qt::UserRole, QString("meta.attr.date.markup"));
item->setText(1, metadata.value("meta.attr.date.markup"));
metadata.remove("meta.attr.date.markup");
}
item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
QMap<QString, QString>::const_iterator meta = metadata.constBegin();
while (meta != metadata.constEnd()) {
item = new QTreeWidgetItem(metadata_list, QStringList() << meta.key().section('.', 2,2));
item->setData(0, Qt::UserRole, meta.key());
item->setText(1, meta.value());
item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
++meta;
}
connect(add_metadata, SIGNAL(clicked()), this, SLOT(slotAddMetadataField()));
connect(delete_metadata, SIGNAL(clicked()), this, SLOT(slotDeleteMetadataField()));
add_metadata->setIcon(KIcon("list-add"));
delete_metadata->setIcon(KIcon("list-remove"));
slotUpdateDisplay();
if (m_projectList != NULL) {
slotUpdateFiles();
......@@ -575,13 +613,26 @@ const QMap <QString, QString> ProjectSettings::metadata() const
if (!item->text(1).simplified().isEmpty()) {
// Insert metadata entry
QString key = item->data(0, Qt::UserRole).toString();
if (key.isEmpty()) key = "meta.attr." + item->text(0).simplified() + ".markup";
QString value = item->text(1);
metadata.insert(key, value);
if (!key.contains(' ')) metadata.insert(key, value);
}
}
return metadata;
}
void ProjectSettings::slotAddMetadataField()
{
QTreeWidgetItem *item = new QTreeWidgetItem(metadata_list, QStringList() << i18n("field_name"));
item->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
void ProjectSettings::slotDeleteMetadataField()
{
QTreeWidgetItem *item = metadata_list->currentItem();
if (item) delete item;
}
#include "projectsettings.moc"
......@@ -63,6 +63,10 @@ private slots:
void slotExportToText();
/** @brief Update the displayed proxy parameters when user changes selection. */
void slotUpdateProxyParams();
/** @brief Insert a new metadata field. */
void slotAddMetadataField();
/** @brief Delete current metadata field. */
void slotDeleteMetadataField();
private:
QPushButton *m_buttonOk;
......
......@@ -907,7 +907,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const
if (m_view.export_meta->isChecked()) {
QMap<QString, QString>::const_iterator i = metadata.constBegin();
while (i != metadata.constEnd()) {
renderArgs.append(QString(" %1=\"%2\"").arg(i.key()).arg(i.value()));
renderArgs.append(QString(" %1=%2").arg(i.key()).arg(QString(QUrl::toPercentEncoding(i.value()))));
++i;
}
}
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>345</width>
<height>524</height>
<width>364</width>
<height>555</height>
</rect>
</property>
<property name="windowTitle">
......@@ -378,6 +378,37 @@
</column>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QToolButton" name="add_metadata">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="delete_metadata">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
......
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