nodes/clips: use node label as clip name and allow changing multiple labels at once

Merges the "clip name" and "node label" into the same entity.
This commit is contained in:
itsmattkc
2020-06-16 16:23:05 +10:00
parent cbbf1c9149
commit 41b04d976c
11 changed files with 55 additions and 70 deletions
+2 -2
View File
@@ -965,7 +965,7 @@ void TimelineWidget::AddBlock(Block *block, TrackReference track)
connect(block, &Block::Refreshed, this, &TimelineWidget::BlockRefreshed);
connect(block, &Block::LinksChanged, this, &TimelineWidget::BlockUpdated);
connect(block, &Block::NameChanged, this, &TimelineWidget::BlockUpdated);
connect(block, &Block::LabelChanged, this, &TimelineWidget::BlockUpdated);
connect(block, &Block::EnabledChanged, this, &TimelineWidget::BlockUpdated);
}
@@ -973,7 +973,7 @@ void TimelineWidget::RemoveBlock(Block *block)
{
disconnect(block, &Block::Refreshed, this, &TimelineWidget::BlockRefreshed);
disconnect(block, &Block::LinksChanged, this, &TimelineWidget::BlockUpdated);
disconnect(block, &Block::NameChanged, this, &TimelineWidget::BlockUpdated);
disconnect(block, &Block::LabelChanged, this, &TimelineWidget::BlockUpdated);
disconnect(block, &Block::EnabledChanged, this, &TimelineWidget::BlockUpdated);
delete block_items_.take(block);
+1 -1
View File
@@ -105,7 +105,7 @@ void TimelineWidget::AddTool::MouseRelease(TimelineViewMouseEvent *event)
ClipBlock* clip = new ClipBlock();
clip->set_length_and_media_out(ghost_->AdjustedLength());
clip->set_block_name(OLIVE_NAMESPACE::Tool::GetAddableObjectName(Core::instance()->selected_addable_object()));
clip->SetLabel(OLIVE_NAMESPACE::Tool::GetAddableObjectName(Core::instance()->selected_addable_object()));
NodeGraph* graph = static_cast<NodeGraph*>(parent()->GetConnectedNode()->parent());
+1 -1
View File
@@ -396,7 +396,7 @@ void TimelineWidget::ImportTool::DropGhosts(bool insert)
ClipBlock* clip = new ClipBlock();
clip->set_media_in(ghost->MediaIn());
clip->set_length_and_media_out(ghost->Length());
clip->set_block_name(footage_stream->footage()->name());
clip->SetLabel(footage_stream->footage()->name());
new NodeAddCommand(dst_graph, clip, command);
switch (footage_stream->type()) {
@@ -122,12 +122,12 @@ void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsI
int text_top = TrackOutput::GetTrackHeightMinimum() / 2 - painter->fontMetrics().height() / 2;
QRectF text_rect = rect();
text_rect.adjust(0, text_top, 0, 0);
painter->drawText(text_rect, Qt::AlignLeft | Qt::AlignTop, block_->block_name());
painter->drawText(text_rect, Qt::AlignLeft | Qt::AlignTop, block_->GetLabel());
// Linked clips are underlined
if (block_->HasLinks()) {
QFontMetrics fm = painter->fontMetrics();
int text_width = qMin(qRound(rect().width()), QFontMetricsWidth(fm, block_->block_name()));
int text_width = qMin(qRound(rect().width()), QFontMetricsWidth(fm, block_->GetLabel()));
QPointF underline_start = rect().topLeft() + QPointF(0, text_top + fm.height());
QPointF underline_end = underline_start + QPointF(text_width, 0);