Freesound: save audio file url in clip comment (for attribution)

parent a3912e34
......@@ -460,7 +460,7 @@ void ClipManager::resetProducersList(const QList <Mlt::Producer *> prods, bool d
emit checkAllClips(displayRatioChanged, fpsChanged, brokenClips);
}
void ClipManager::slotAddClipList(const KUrl::List urls, const QString &group, const QString &groupId)
void ClipManager::slotAddClipList(const KUrl::List urls, const QString &group, const QString &groupId, const QString &comment)
{
QUndoCommand *addClips = new QUndoCommand();
foreach(const KUrl & file, urls) {
......@@ -476,6 +476,7 @@ void ClipManager::slotAddClipList(const KUrl::List urls, const QString &group, c
prod.setAttribute("resource", file.path());
uint id = m_clipIdCounter++;
prod.setAttribute("id", QString::number(id));
if (!comment.isEmpty()) prod.setAttribute("description", comment);
if (!group.isEmpty()) {
prod.setAttribute("groupname", group);
prod.setAttribute("groupid", groupId);
......@@ -536,9 +537,9 @@ void ClipManager::slotAddClipList(const KUrl::List urls, const QString &group, c
}
}
void ClipManager::slotAddClipFile(const KUrl &url, const QString &group, const QString &groupId)
void ClipManager::slotAddClipFile(const KUrl &url, const QString &group, const QString &groupId, const QString &comment)
{
slotAddClipList(KUrl::List(url), group, groupId);
slotAddClipList(KUrl::List(url), group, groupId, comment);
}
void ClipManager::slotAddXmlClipFile(const QString &name, const QDomElement &xml, const QString &group, const QString &groupId)
......
......@@ -72,14 +72,14 @@ Q_OBJECT public:
* @param url file to add
* @param group name of the group to insert the file in (can be empty)
* @param groupId id of the group (if any) */
void slotAddClipFile(const KUrl &url, const QString &group, const QString &groupId);
void slotAddClipFile(const KUrl &url, const QString &group, const QString &groupId, const QString &comment = QString());
/** @brief Adds a list of files to the project.
* @param urls files to add
* @param group name of the group to insert the files in (can be empty)
* @param groupId id of the group (if any)
* It checks for duplicated items and asks to the user for instructions. */
void slotAddClipList(const KUrl::List urls, const QString &group, const QString &groupId);
void slotAddClipList(const KUrl::List urls, const QString &group, const QString &groupId, const QString &comment = QString());
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);
......
......@@ -1201,9 +1201,9 @@ void KdenliveDoc::slotAddClipList(const KUrl::List urls, const QString &group, c
}
void KdenliveDoc::slotAddClipFile(const KUrl &url, const QString &group, const QString &groupId)
void KdenliveDoc::slotAddClipFile(const KUrl &url, const QString &group, const QString &groupId, const QString &comment)
{
m_clipManager->slotAddClipFile(url, group, groupId);
m_clipManager->slotAddClipFile(url, group, groupId, comment);
emit selectLastAddedClip(QString::number(m_clipManager->lastClipId()));
setModified(true);
}
......
......@@ -83,7 +83,7 @@ Q_OBJECT public:
*
* If the clip wasn't added before, it tries to add it to the project. */
bool addClipInfo(QDomElement elem, QDomElement orig, QString clipId);
void slotAddClipFile(const KUrl &url, const QString &group, const QString &groupId = QString());
void slotAddClipFile(const KUrl &url, const QString &group, const QString &groupId = QString(), const QString &comment = QString());
void slotAddClipList(const KUrl::List urls, const QString &group, const QString &groupId = QString());
void deleteClip(const QString &clipId);
int getFramePos(QString duration);
......
......@@ -3055,10 +3055,10 @@ void MainWindow::slotEditItemDuration()
m_activeTimeline->projectView()->editItemDuration();
}
void MainWindow::slotAddProjectClip(KUrl url)
void MainWindow::slotAddProjectClip(KUrl url, const QString &comment)
{
if (m_activeDocument)
m_activeDocument->slotAddClipFile(url, QString());
m_activeDocument->slotAddClipFile(url, QString(), QString(), comment);
}
void MainWindow::slotAddProjectClipList(KUrl::List urls)
......@@ -4508,7 +4508,7 @@ void MainWindow::slotDownloadAudio()
if (m_activeDocument) currentFolder = m_activeDocument->projectFolder().path();
else currentFolder = KdenliveSettings::defaultprojectfolder();
FreeSound *d = new FreeSound(currentFolder);
connect(d, SIGNAL(addClip(KUrl)), this, SLOT(slotAddProjectClip(KUrl)));
connect(d, SIGNAL(addClip(KUrl, const QString &)), this, SLOT(slotAddProjectClip(KUrl, const QString &)));
d->show();
}
......
......@@ -411,7 +411,7 @@ private slots:
void slotSelectAddTimelineTransition();
void slotAddVideoEffect(QAction *result);
void slotAddTransition(QAction *result);
void slotAddProjectClip(KUrl url);
void slotAddProjectClip(KUrl url, const QString &comment = QString());
void slotAddProjectClipList(KUrl::List urls);
void slotShowClipProperties(DocClipBase *clip);
void slotShowClipProperties(QList <DocClipBase *>cliplist, QMap<QString, QString> commonproperties);
......
......@@ -199,7 +199,7 @@ void FreeSound::slotSaveSound()
QString saveUrl = KFileDialog::getSaveFileName(KUrl(path), ext);
if (saveUrl.isEmpty()) return;
if (KIO::NetAccess::download(KUrl(m_currentUrl), saveUrl, this)) {
emit addClip(KUrl(saveUrl));
emit addClip(KUrl(saveUrl), sound_name->url());
}
}
......
......@@ -59,7 +59,7 @@ private:
QProcess *m_previewProcess;
signals:
void addClip(KUrl);
void addClip(KUrl, const QString &);
};
......
......@@ -82,6 +82,9 @@
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="1">
......@@ -116,6 +119,9 @@
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
......
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