keyframeview: show correct length and jump to the corresponding time in NodeParamView

This commit is contained in:
itsmattkc
2020-04-15 03:35:48 +10:00
parent 7ea8c52c78
commit cc421d4108
8 changed files with 53 additions and 39 deletions
+16 -3
View File
@@ -96,15 +96,23 @@ void TimeBasedWidget::ConnectViewerNode(ViewerOutput *node)
ConnectNodeInternal(viewer_node_);
}
UpdateMaximumScroll();
}
void TimeBasedWidget::UpdateMaximumScroll()
{
if (!viewer_node_ || !auto_max_scrollbar_) {
return;
rational length = (viewer_node_) ? viewer_node_->Length() : rational();
if (auto_max_scrollbar_) {
scrollbar_->setMaximum(qMax(0, qCeil(TimeToScene(length)) - width()));
}
scrollbar_->setMaximum(qMax(0, qCeil(TimeToScene(viewer_node_->Length())) - width()));
foreach (TimelineViewBase* base, timeline_views_) {
base->SetEndTime(length);
}
ruler()->SetCacheStatusLength(length);
}
void TimeBasedWidget::ScrollBarResized(const double &multiplier)
@@ -183,6 +191,11 @@ TimelinePoints *TimeBasedWidget::GetConnectedTimelinePoints() const
return points_;
}
void TimeBasedWidget::ConnectTimelineView(TimelineViewBase *base)
{
timeline_views_.append(base);
}
void TimeBasedWidget::SetTime(int64_t timestamp)
{
ruler_->SetTime(timestamp);
+5
View File
@@ -27,6 +27,7 @@
#include "node/output/viewer/viewer.h"
#include "widget/resizablescrollbar/resizablescrollbar.h"
#include "widget/timelinewidget/timelinescaledobject.h"
#include "widget/timelinewidget/view/timelineview.h"
#include "widget/timeruler/timeruler.h"
OLIVE_NAMESPACE_ENTER
@@ -111,6 +112,8 @@ protected:
TimelinePoints* GetConnectedTimelinePoints() const;
void ConnectTimelineView(TimelineViewBase* base);
protected slots:
/**
* @brief Slot to center the horizontal scroll bar on the playhead's current position
@@ -153,6 +156,8 @@ private:
TimelinePoints* points_;
QList<TimelineViewBase*> timeline_views_;
private slots:
void UpdateMaximumScroll();