small update to timeline ruler and fix bug causing slowdown and invalid...

small update to timeline ruler and fix bug causing slowdown and invalid timeline preview on document opening
parent 5f9e4351
......@@ -263,13 +263,13 @@ GenTime ProjectClip::duration() const
return GenTime();
}
void ProjectClip::reloadProducer(bool thumbnailOnly)
void ProjectClip::reloadProducer(bool refreshOnly)
{
QDomDocument doc;
QDomElement xml = toXml(doc);
if (thumbnailOnly) {
if (refreshOnly) {
// set a special flag to request thumbnail only
xml.setAttribute(QStringLiteral("thumbnailOnly"), QStringLiteral("1"));
xml.setAttribute(QStringLiteral("refreshOnly"), QStringLiteral("1"));
}
bin()->reloadProducer(m_id, xml);
}
......
......@@ -67,7 +67,7 @@ public:
ProjectClip(const QDomElement &description, QIcon thumb, ProjectFolder *parent);
virtual ~ProjectClip();
void reloadProducer(bool thumbnailOnly = false);
void reloadProducer(bool refreshOnly = false);
/** @brief Returns a unique hash identifier used to store clip thumbnails. */
//virtual void hash() = 0;
......
......@@ -139,7 +139,7 @@ void ProducerQueue::processFileProperties()
while (!m_requestList.isEmpty()) {
m_infoMutex.lock();
info = m_requestList.takeFirst();
if (info.xml.hasAttribute(QStringLiteral("thumbnailOnly"))) {
if (info.xml.hasAttribute(QStringLiteral("thumbnailOnly")) || info.xml.hasAttribute(QStringLiteral("refreshOnly"))) {
m_infoMutex.unlock();
// Special case, we just want the thumbnail for existing producer
Mlt::Producer *prod = new Mlt::Producer(*m_binController->getBinProducer(info.clipId));
......@@ -167,8 +167,10 @@ void ProducerQueue::processFileProperties()
}
delete frame;
delete prod;
// inform timeline about change
emit refreshTimelineProducer(info.clipId);
if (info.xml.hasAttribute(QStringLiteral("refreshOnly"))) {
// inform timeline about change
emit refreshTimelineProducer(info.clipId);
}
continue;
}
m_processingClipId.append(info.clipId);
......
......@@ -516,13 +516,12 @@ void ProjectManager::doOpenFile(const QUrl &url, KAutoSaveFile *stale)
connect(m_trackView, &Timeline::loadingBin, m_progressDialog, &QProgressDialog::setValue, Qt::DirectConnection);
// Set default target tracks to upper audio / lower video tracks
m_project = doc;
m_trackView->audioTarget = doc->getDocumentProperty(QStringLiteral("audiotargettrack"), QStringLiteral("-1")).toInt();
m_trackView->videoTarget = doc->getDocumentProperty(QStringLiteral("videotargettrack"), QStringLiteral("-1")).toInt();
m_trackView->loadTimeline();
m_trackView->loadGuides(pCore->binController()->takeGuidesData());
connect(m_trackView->projectView(), SIGNAL(importPlaylistClips(ItemInfo, QUrl, QUndoCommand*)), pCore->bin(), SLOT(slotExpandUrl(ItemInfo, QUrl, QUndoCommand*)), Qt::DirectConnection);
m_project = doc;
pCore->window()->connectDocument();
bool disabled = m_project->getDocumentProperty(QStringLiteral("disabletimelineeffects")) == QLatin1String("1");
QAction *disableEffects = pCore->window()->actionCollection()->action(QStringLiteral("disable_timeline_effects"));
......
This diff is collapsed.
......@@ -41,7 +41,6 @@ class CustomRuler : public QWidget
public:
CustomRuler(const Timecode &tc, const QList<QAction *> &rulerActions, CustomTrackView *parent);
bool hidePreview;
void setPixelPerMark(int rate, bool force = false);
static const int comboScale[];
int outPoint() const;
......@@ -63,6 +62,7 @@ public:
/** @brief Refresh timeline preview range */
void updatePreviewDisplay(int start, int end);
bool isUnderPreview(int start, int end);
void hidePreview(bool hide);
protected:
void paintEvent(QPaintEvent * /*e*/);
......@@ -81,6 +81,7 @@ private:
double m_factor;
double m_scale;
int m_offset;
bool m_hidePreview;
/** @brief the position of the seek point */
int m_headPosition;
QColor m_zoneBG;
......
......@@ -525,7 +525,11 @@ void PreviewManager::gotPreviewRender(int frame, const QString &file, int progre
m_ruler->updatePreview(frame, true, true);
prod.set("mlt_service", "avformat-novalidate");
m_previewTrack->insert_at(frame, &prod, 1);
} else {
qDebug()<<"* * * INVALID PROD: "<<file;
}
} else {
qDebug()<<"* * * NON EMPTY PROD: "<<frame;
}
m_previewTrack->consolidate_blanks();
m_tractor->unlock();
......
......@@ -1790,6 +1790,7 @@ void Timeline::loadPreviewRender()
m_disablePreview->blockSignals(false);
QDateTime documentDate = QFileInfo(m_doc->url().path()).lastModified();
if (!chunks.isEmpty() || !dirty.isEmpty()) {
m_ruler->hidePreview(false);
if (!m_timelinePreview) {
initializePreview();
}
......@@ -1798,6 +1799,8 @@ void Timeline::loadPreviewRender()
m_timelinePreview->buildPreviewTrack();
m_timelinePreview->loadChunks(chunks.split(",", QString::SkipEmptyParts), dirty.split(",", QString::SkipEmptyParts), documentDate);
m_usePreview = true;
} else {
m_ruler->hidePreview(true);
}
}
......@@ -1872,8 +1875,7 @@ void Timeline::disablePreview(bool disable)
{
if (disable) {
m_timelinePreview->deletePreviewTrack();
m_ruler->hidePreview = true;
m_ruler->update();
m_ruler->hidePreview(true);
m_usePreview = false;
} else {
if (!m_usePreview) {
......@@ -1885,8 +1887,7 @@ void Timeline::disablePreview(bool disable)
}
QPair <QStringList, QStringList> chunks = m_ruler->previewChunks();
m_timelinePreview->loadChunks(chunks.first, chunks.second, QDateTime());
m_ruler->hidePreview = false;
m_ruler->update();
m_ruler->hidePreview(false);
m_usePreview = true;
}
}
......
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