<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui name="kdenlive" version="33">
+<gui name="kdenlive" version="35">
<ToolBar name="extraToolBar" >
<text>Extra Toolbar</text>
<Action name="project_render" />
<Menu name="generators" ><text>Generators</text>
</Menu>
<Separator />
+ <Action name="reload_clip" />
<Action name="clip_properties" />
<Action name="edit_clip" />
<Action name="delete_clip" />
m_projectList->setRenderer(m_projectMonitor->render);
connect(m_projectList, SIGNAL(receivedClipDuration(const QString &, int)), this, SLOT(slotSetClipDuration(const QString &, int)));
connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
- connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, const QString &)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement &, const QString &)));
+ connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, const QString &, bool)), m_projectMonitor->render, SLOT(getFileProperties(const QDomElement &, const QString &, bool)));
connect(m_projectMonitor->render, SIGNAL(replyGetImage(const QString &, const QPixmap &)), m_projectList, SLOT(slotReplyGetImage(const QString &, const QPixmap &)));
- connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &)));
+ connect(m_projectMonitor->render, SIGNAL(replyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool)), m_projectList, SLOT(slotReplyGetFileProperties(const QString &, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool)));
connect(m_projectMonitor->render, SIGNAL(removeInvalidClip(const QString &)), m_projectList, SLOT(slotRemoveInvalidClip(const QString &)));
collection->addAction("clip_properties", clipProperties);
clipProperties->setData("clip_properties");
connect(clipProperties , SIGNAL(triggered()), m_projectList, SLOT(slotEditClip()));
+ clipProperties->setEnabled(false);
QAction *openClip = new KAction(KIcon("document-open"), i18n("Edit Clip"), this);
collection->addAction("edit_clip", openClip);
openClip->setData("edit_clip");
connect(openClip , SIGNAL(triggered()), m_projectList, SLOT(slotOpenClip()));
+ openClip->setEnabled(false);
QAction *deleteClip = new KAction(KIcon("edit-delete"), i18n("Delete Clip"), this);
collection->addAction("delete_clip", deleteClip);
deleteClip->setData("delete_clip");
connect(deleteClip , SIGNAL(triggered()), m_projectList, SLOT(slotRemoveClip()));
+ deleteClip->setEnabled(false);
+
+ QAction *reloadClip = new KAction(KIcon("view-refresh"), i18n("Reload Clip"), this);
+ collection->addAction("reload_clip", reloadClip);
+ reloadClip->setData("reload_clip");
+ connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
+ reloadClip->setEnabled(false);
QMenu *addClips = new QMenu();
addClips->addAction(addClip);
addClips->addAction(addTitleClip);
addClips->addAction(addFolderButton);
+ addClips->addAction(reloadClip);
addClips->addAction(clipProperties);
addClips->addAction(openClip);
addClips->addAction(deleteClip);
#include "editfoldercommand.h"
ProjectList::ProjectList(QWidget *parent)
- : QWidget(parent), m_render(NULL), m_fps(-1), m_commandStack(NULL), m_selectedItem(NULL), m_infoQueue(QMap <QString, QDomElement> ()), m_thumbnailQueue(QList <QString> ()), m_refreshed(false), m_editAction(NULL), m_openAction(NULL), m_deleteAction(NULL) {
+ : QWidget(parent), m_render(NULL), m_fps(-1), m_commandStack(NULL), m_selectedItem(NULL), m_infoQueue(QMap <QString, QDomElement> ()), m_thumbnailQueue(QList <QString> ()), m_refreshed(false), m_editAction(NULL), m_openAction(NULL), m_deleteAction(NULL), m_reloadAction(NULL) {
QWidget *vbox = new QWidget;
listView = new ProjectListView(this);;
}
void ProjectList::setupMenu(QMenu *addMenu, QAction *defaultAction) {
-
QList <QAction *> actions = addMenu->actions();
for (int i = 0; i < actions.count(); i++) {
if (actions.at(i)->data().toString() == "clip_properties") {
m_openAction = actions.at(i);
actions.removeAt(i);
i--;
+ } else if (actions.at(i)->data().toString() == "reload_clip") {
+ m_reloadAction = actions.at(i);
+ actions.removeAt(i);
+ i--;
}
}
m_menu->addMenu(addMenu);
if (addMenu->isEmpty()) addMenu->setEnabled(false);
+ m_menu->addAction(m_reloadAction);
m_menu->addAction(m_editAction);
m_menu->addAction(m_openAction);
m_menu->addAction(m_deleteAction);
}
}
+void ProjectList::slotReloadClip() {
+ ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
+ if (item && !item->isGroup()) {
+ if (item->clipType() == IMAGE) {
+ item->referencedClip()->producer()->set("force_reload", 1);
+ }
+ emit getFileProperties(item->toXml(), item->clipId(), false);
+ }
+}
+
void ProjectList::setRenderer(Render *projectRender) {
m_render = projectRender;
listView->setIconSize(QSize(40 * m_render->dar(), 40));
}
m_editAction->setEnabled(true);
m_deleteAction->setEnabled(true);
- m_openAction->setEnabled(true);
+ m_reloadAction->setEnabled(true);
+ if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
+ m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
+ m_openAction->setEnabled(true);
+ } else if (clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
+ m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
+ m_openAction->setEnabled(true);
+ } else m_openAction->setEnabled(false);
} else {
emit clipSelected(NULL);
m_editAction->setEnabled(false);
m_deleteAction->setEnabled(false);
m_openAction->setEnabled(false);
+ m_reloadAction->setEnabled(false);
}
}
}
m_editAction->setEnabled(enable);
m_deleteAction->setEnabled(enable);
- m_openAction->setEnabled(enable);
+ m_reloadAction->setEnabled(enable);
+ if (enable) {
+ ProjectItem *clip = static_cast <ProjectItem*>(item);
+ if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
+ m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
+ m_openAction->setEnabled(true);
+ } else if (clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
+ m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
+ m_openAction->setEnabled(true);
+ } else m_openAction->setEnabled(false);
+ } else m_openAction->setEnabled(false);
m_menu->popup(pos);
}
m_editAction->setEnabled(false);
m_deleteAction->setEnabled(false);
m_openAction->setEnabled(false);
+ m_reloadAction->setEnabled(false);
}
}
const QDomElement dom = i.value();
const QString id = i.key();
m_infoQueue.remove(i.key());
- emit getFileProperties(dom, id);
+ emit getFileProperties(dom, id, true);
}
if (m_infoQueue.isEmpty()) listView->setEnabled(true);
}
}
}
-void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata) {
+void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata, bool replace) {
ProjectItem *item = getItemById(clipId);
if (item && producer) {
listView->blockSignals(true);
item->setProperties(properties, metadata);
Q_ASSERT_X(item->referencedClip(), "void ProjectList::slotReplyGetFileProperties", QString("Item with groupName %1 does not have a clip associated").arg(item->groupName()).toLatin1());
- item->referencedClip()->setProducer(producer);
+ if (replace) item->referencedClip()->setProducer(producer);
emit receivedClipDuration(clipId, item->clipMaxDuration());
listView->blockSignals(false);
} else kDebug() << "//////// COULD NOT FIND CLIP TO UPDATE PRPS...";
}
void ProjectList::slotSelectClip(const QString &ix) {
- ProjectItem *p = getItemById(ix);
- if (p) {
- listView->setCurrentItem(p);
- listView->scrollToItem(p);
+ ProjectItem *clip = getItemById(ix);
+ if (clip) {
+ listView->setCurrentItem(clip);
+ listView->scrollToItem(clip);
m_editAction->setEnabled(true);
m_deleteAction->setEnabled(true);
- m_openAction->setEnabled(true);
+ m_reloadAction->setEnabled(true);
+ if (clip->clipType() == IMAGE && !KdenliveSettings::defaultimageapp().isEmpty()) {
+ m_openAction->setIcon(KIcon(KdenliveSettings::defaultimageapp()));
+ m_openAction->setEnabled(true);
+ } else if (clip->clipType() == AUDIO && !KdenliveSettings::defaultaudioapp().isEmpty()) {
+ m_openAction->setIcon(KIcon(KdenliveSettings::defaultaudioapp()));
+ m_openAction->setEnabled(true);
+ } else m_openAction->setEnabled(false);
}
}
public slots:
void setDocument(KdenliveDoc *doc);
void slotReplyGetImage(const QString &clipId, const QPixmap &pix);
- void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata);
+ void slotReplyGetFileProperties(const QString &clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata, bool replace);
void slotAddClip(DocClipBase *clip, bool getProperties);
void slotDeleteClip(const QString &clipId);
void slotUpdateClip(const QString &id);
void slotResetProjectList();
void slotOpenClip();
void slotEditClip();
+ void slotReloadClip();
private:
ProjectListView *listView;
QAction *m_editAction;
QAction *m_deleteAction;
QAction *m_openAction;
+ QAction *m_reloadAction;
KdenliveDoc *m_doc;
ProjectItem *m_selectedItem;
bool m_refreshed;
signals:
void clipSelected(DocClipBase *);
- void getFileProperties(const QDomElement&, const QString &);
+ void getFileProperties(const QDomElement&, const QString &, bool);
void receivedClipDuration(const QString &, int);
void showClipProperties(DocClipBase *);
void projectModified();
m_mltConsumer->set("resize", 1);
m_mltConsumer->set("window_id", m_winid);
m_mltConsumer->set("terminate_on_pause", 1);
- m_mltConsumer->set("window_background", (int) KdenliveSettings::window_background().rgb ());
+ m_mltConsumer->set("window_background", (int) KdenliveSettings::window_background().rgb());
m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
m_mltConsumer->set("rescale", "nearest");
}
}
-void Render::getFileProperties(const QDomElement &xml, const QString &clipId) {
+void Render::getFileProperties(const QDomElement &xml, const QString &clipId, bool replaceProducer) {
int height = 50;
int width = (int)(height * m_mltProfile->dar());
QMap < QString, QString > filePropertyMap;
KUrl url = KUrl(xml.attribute("resource", QString::null));
Mlt::Producer *producer = NULL;
if (xml.attribute("type").toInt() == TEXT && !QFile::exists(url.path())) {
- emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap);
+ emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
return;
}
if (xml.attribute("type").toInt() == COLOR) {
metadataPropertyMap[ name.section(".", 0, -2)] = value;
}
- emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap);
+ emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
kDebug() << "REquested fuile info for: " << url.path();
if (frame) delete frame;
//if (producer) delete producer;
signals: // Signals
/** emitted when the renderer recieves a reply to a getFileProperties request. */
- void replyGetFileProperties(const QString &clipId, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &);
+ void replyGetFileProperties(const QString &clipId, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &, bool);
/** emitted when the renderer recieves a reply to a getImage request. */
void replyGetImage(const QString &, const QPixmap &);
/** Wraps the VEML command of the same name. Requests the file properties
for the specified url from the renderer. Upon return, the result will be emitted
via replyGetFileProperties(). */
- void getFileProperties(const QDomElement &xml, const QString &clipId);
+ void getFileProperties(const QDomElement &xml, const QString &clipId, bool replaceProducer = true);
void exportFileToFirewire(QString srcFileName, int port, GenTime startTime, GenTime endTime);
static char *decodedString(QString str);