m_tc(tc),
m_fps(fps),
m_count(0),
- m_clipNeedsRefresh(false)
+ m_clipNeedsRefresh(false),
+ m_clipNeedsReLoad(false)
{
setFont(KGlobalSettings::toolBarFont());
m_view.setupUi(this);
} else if (t == IMAGE) {
if ((int) m_view.image_transparency->isChecked() != old_props.value("transparency").toInt()) {
props["transparency"] = QString::number((int)m_view.image_transparency->isChecked());
- m_clipNeedsRefresh = true;
+ //m_clipNeedsRefresh = true;
}
int duration = m_tc.getFrameCount(m_view.clip_duration->text());
if (duration != m_clip->duration().frames(m_fps)) {
}
QString new_path = m_view.clip_path->text() + extension;
if (new_path != old_props.value("resource")) {
- m_clipNeedsRefresh = true;
+ m_clipNeedsReLoad = true;
props["resource"] = new_path;
kDebug() << "//// SLIDE EDIT, NEW:" << new_path << ", OLD; " << old_props.value("resource");
}
return m_clipNeedsRefresh;
}
+bool ClipProperties::needsTimelineReload() const
+{
+ return m_clipNeedsReLoad;
+}
+
void ClipProperties::parseFolder()
{
QMap <QString, QString> properties();
const QString &clipId() const;
bool needsTimelineRefresh() const;
+ bool needsTimelineReload() const;
private slots:
void parseFolder();
double m_fps;
/** used to count images in slideshow clip */
int m_count;
+ /** some visual properties changed, reload thumbnails */
bool m_clipNeedsRefresh;
+ /** clip resource changed, reload it */
+ bool m_clipNeedsReLoad;
signals:
void addMarker(const QString &, GenTime, QString);
m_thumbsTimer.start();
}
-void CustomTrackView::slotUpdateClip(const QString &clipId)
+void CustomTrackView::slotUpdateClip(const QString &clipId, bool reload)
{
QList<QGraphicsItem *> list = scene()->items();
ClipItem *clip = NULL;
if (clip->clipProducer() == clipId) {
ItemInfo info = clip->info();
info.track = m_document->tracksCount() - clip->track();
- m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer());
+ if (reload) m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer());
clip->refreshClip(true);
clip->update();
}
void slotSwitchTrackAudio(int ix);
void slotSwitchTrackVideo(int ix);
void slotSwitchTrackLock(int ix);
- void slotUpdateClip(const QString &clipId);
+ void slotUpdateClip(const QString &clipId, bool reload = true);
void slotAddClipMarker(const QString &id, GenTime t, QString c);
bool addGuide(const GenTime pos, const QString &comment);
void slotAddGuide();
} else if (key == "force_aspect_ratio") {
if (value.isEmpty()) {
m_properties.remove("force_aspect_ratio");
+ //TODO: find a was to remove the "force_aspect_ratio" property from producer, currently does not work
setProducerProperty("force_aspect_ratio", 0);
} else setProducerProperty("force_aspect_ratio", value.toDouble());
} else if (key == "threads") {
m_documentProperties.remove("position");
// m_document xml is now useless, clear it
m_document.clear();
- checkProjectClips();
return 0;
}
{
m_projectList->setRenderer(m_projectMonitor->render);
- connect(m_projectList, SIGNAL(receivedClipDuration(const QString &)), this, SLOT(slotUpdateClip(const QString &)));
+ //connect(m_projectList, SIGNAL(receivedClipDuration(const QString &)), this, SLOT(slotUpdateClip(const QString &)));
connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *)));
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 &)));
EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), dia.properties(), true);
m_activeDocument->commandStack()->push(command);
- //m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
if (dia.needsTimelineRefresh()) {
// update clip occurences in timeline
- m_activeTimeline->projectView()->slotUpdateClip(clip->getId());
+ m_activeTimeline->projectView()->slotUpdateClip(clip->getId(), dia.needsTimelineReload());
}
}
}
oldprops.insert("templatetext", clip->referencedClip()->getProperty("templatetext"));
newprops.insert("templatetext", item->text(2));
}
-
slotUpdateClipProperties(clip->clipId(), newprops);
EditClipCommand *command = new EditClipCommand(this, clip->clipId(), oldprops, newprops, false);
m_commandStack->push(command);
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, replace);
- emit receivedClipDuration(clipId);
+ //emit receivedClipDuration(clipId);
if (m_listView->isEnabled() && replace) {
// update clip in clip monitor
emit clipSelected(NULL);
}
//kDebug() << "//RESET WITHSCENE: " << scene;
setSceneList(scene, pos);
-
+ // producers have changed (different profile), so reset them...
+ emit refreshDocumentProducers();
/*char *tmp = decodedString(scene);
Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile , "xml-string", tmp);
delete[] tmp;
m_isBlocked = false;
blockSignals(false);
- emit refreshDocumentProducers();
+
return error;
//kDebug()<<"// SETSCN LST, POS: "<<position;
//if (position != 0) emit rendererPosition(position);
void Render::mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod)
{
// TODO: optimize
+ Mlt::Service service(m_mltProducer->parent().get_service());
+ if (service.type() != tractor_type) {
+ kWarning() << "// TRACTOR PROBLEM";
+ return;
+ }
+ Mlt::Tractor tractor(service);
+ Mlt::Producer trackProducer(tractor.track(info.track));
+ Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
+ int startPos = info.startPos.frames(m_fps);
+ int clipIndex = trackPlaylist.get_clip_index_at(startPos);
+ Mlt::Producer *clip = trackPlaylist.get_clip(clipIndex);
+
+ // keep effects
+ QList <Mlt::Filter *> filtersList;
+ Mlt::Service sourceService(clip->get_service());
+ int ct = 0;
+ Mlt::Filter *filter = sourceService.filter(ct);
+ while (filter) {
+ if (filter->get("kdenlive_ix") != 0) {
+ filtersList.append(filter);
+ }
+ ct++;
+ filter = sourceService.filter(ct);
+ }
mltRemoveClip(info.track, info.startPos);
mltInsertClip(info, element, prod);
+ if (!filtersList.isEmpty()) {
+ clipIndex = trackPlaylist.get_clip_index_at(startPos);
+ Mlt::Producer *destclip = trackPlaylist.get_clip(clipIndex);
+ Mlt::Service destService(destclip->get_service());
+ delete destclip;
+ for (int i = 0; i < filtersList.count(); i++)
+ destService.attach(*(filtersList.at(i)));
+ }
}