viewer: ensure view is updated if the cache is shifted
Also moves "ForceUpdate" to a queued connection so it occurs as soon as the rest of the processing is done. This ensures the viewer isn't updated too early.
This commit is contained in:
@@ -82,7 +82,11 @@ void PlaybackCache::Shift(const rational &from, const rational &to)
|
||||
locker.unlock();
|
||||
|
||||
emit Invalidated(invalidate_range);
|
||||
} else {
|
||||
locker.unlock();
|
||||
}
|
||||
|
||||
emit Shifted(from, to);
|
||||
}
|
||||
|
||||
void PlaybackCache::Validate(const TimeRange &r)
|
||||
|
||||
@@ -75,6 +75,8 @@ signals:
|
||||
|
||||
void Validated(const OLIVE_NAMESPACE::TimeRange& r);
|
||||
|
||||
void Shifted(const OLIVE_NAMESPACE::rational& from, const OLIVE_NAMESPACE::rational& to);
|
||||
|
||||
void LengthChanged(const OLIVE_NAMESPACE::rational& r);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -177,6 +177,7 @@ void ViewerWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
connect(n, &ViewerOutput::LengthChanged, this, &ViewerWidget::LengthChangedSlot);
|
||||
connect(n, &ViewerOutput::ParamsChanged, this, &ViewerWidget::UpdateRendererParameters);
|
||||
connect(n->video_frame_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedVideoRange);
|
||||
connect(n->video_frame_cache(), &FrameHashCache::Shifted, this, &ViewerWidget::ViewerShiftedRange);
|
||||
connect(n->audio_playback_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedRange);
|
||||
connect(n, &ViewerOutput::GraphChangedFrom, this, &ViewerWidget::UpdateStack);
|
||||
|
||||
@@ -231,6 +232,7 @@ void ViewerWidget::DisconnectNodeInternal(ViewerOutput *n)
|
||||
disconnect(n, &ViewerOutput::LengthChanged, this, &ViewerWidget::LengthChangedSlot);
|
||||
disconnect(n, &ViewerOutput::ParamsChanged, this, &ViewerWidget::UpdateRendererParameters);
|
||||
disconnect(n->video_frame_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedVideoRange);
|
||||
disconnect(n->video_frame_cache(), &FrameHashCache::Shifted, this, &ViewerWidget::ViewerShiftedRange);
|
||||
disconnect(n->audio_playback_cache(), &FrameHashCache::Invalidated, this, &ViewerWidget::ViewerInvalidatedRange);
|
||||
disconnect(n, &ViewerOutput::GraphChangedFrom, this, &ViewerWidget::UpdateStack);
|
||||
|
||||
@@ -1204,7 +1206,7 @@ void ViewerWidget::SetZoomFromMenu(QAction *action)
|
||||
void ViewerWidget::ViewerInvalidatedVideoRange(const TimeRange &range)
|
||||
{
|
||||
if (GetTime() >= range.in() && (GetTime() < range.out() || range.in() == range.out())) {
|
||||
ForceUpdate();
|
||||
QMetaObject::invokeMethod(this, "ForceUpdate", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
ViewerInvalidatedRange();
|
||||
@@ -1221,4 +1223,11 @@ void ViewerWidget::ViewerInvalidatedRange()
|
||||
}
|
||||
}
|
||||
|
||||
void ViewerWidget::ViewerShiftedRange(const rational &from, const rational &to)
|
||||
{
|
||||
if (GetTime() >= qMin(from, to)) {
|
||||
QMetaObject::invokeMethod(this, "ForceUpdate", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -85,8 +85,6 @@ public:
|
||||
*/
|
||||
void SetFullScreen(QScreen* screen = nullptr);
|
||||
|
||||
void ForceUpdate();
|
||||
|
||||
RenderBackend* renderer() const
|
||||
{
|
||||
return renderer_;
|
||||
@@ -122,6 +120,8 @@ public slots:
|
||||
*/
|
||||
void SetSignalCursorColorEnabled(bool e);
|
||||
|
||||
void ForceUpdate();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Wrapper for ViewerGLWidget::CursorColor()
|
||||
@@ -272,6 +272,8 @@ private slots:
|
||||
|
||||
void ViewerInvalidatedRange();
|
||||
|
||||
void ViewerShiftedRange(const OLIVE_NAMESPACE::rational& from, const OLIVE_NAMESPACE::rational& to);
|
||||
|
||||
void UpdateStack();
|
||||
|
||||
void ContextMenuSetFullScreen(QAction* action);
|
||||
|
||||
Reference in New Issue
Block a user