timeline hierarchical length signalling

This commit is contained in:
itsmattkc
2019-10-07 02:33:52 +11:00
parent f34eb0dfb6
commit 31f11cd87d
17 changed files with 215 additions and 188 deletions
@@ -61,6 +61,9 @@ TimelineWidget::TimelineWidget(QWidget *parent) :
}
}
// Split viewer 50/50
view_splitter->setSizes({INT_MAX, INT_MAX});
// FIXME: Magic number
SetScale(90.0);
}
@@ -105,6 +108,10 @@ void TimelineWidget::SetTime(const int64_t &timestamp)
void TimelineWidget::ConnectTimelineNode(TimelineOutput *node)
{
if (timeline_node_ != nullptr) {
disconnect(timeline_node_, SIGNAL(LengthChanged(const rational&)), this, SLOT(UpdateTimelineLength(const rational&)));
}
timeline_node_ = node;
int track_type = 0;
@@ -114,6 +121,14 @@ void TimelineWidget::ConnectTimelineNode(TimelineOutput *node)
track_type++;
}
if (timeline_node_ != nullptr) {
connect(timeline_node_, SIGNAL(LengthChanged(const rational&)), this, SLOT(UpdateTimelineLength(const rational&)));
foreach (TimelineView* view, views_) {
view->SetEndTime(timeline_node_->timeline_length());
}
}
}
void TimelineWidget::DisconnectTimelineNode()
@@ -313,3 +328,10 @@ void TimelineWidget::UpdateInternalTime(const int64_t &timestamp)
{
playhead_ = timestamp;
}
void TimelineWidget::UpdateTimelineLength(const rational &length)
{
foreach (TimelineView* view, views_) {
view->SetEndTime(length);
}
}