implemented track locking in the timeline widget

This commit is contained in:
itsmattkc
2019-12-11 16:34:38 +11:00
parent 7117616635
commit 79c2953662
6 changed files with 32 additions and 7 deletions
+12 -1
View File
@@ -30,7 +30,8 @@
TrackOutput::TrackOutput() :
track_type_(kTrackTypeNone),
block_invalidate_cache_stack_(0),
index_(-1)
index_(-1),
locked_(false)
{
block_input_ = new NodeInputArray("block_in");
AddInput(block_input_);
@@ -369,6 +370,11 @@ bool TrackOutput::IsMuted() const
return muted_input_->get_value_at_time(0).toBool();
}
bool TrackOutput::IsLocked() const
{
return locked_;
}
void TrackOutput::SetTrackName(const QString &name)
{
track_name_ = name;
@@ -380,6 +386,11 @@ void TrackOutput::SetMuted(bool e)
InvalidateCache(0, track_length());
}
void TrackOutput::SetLocked(bool e)
{
locked_ = e;
}
void TrackOutput::UpdateInOutFrom(int index)
{
Q_ASSERT(index >= 0);
+6
View File
@@ -138,11 +138,15 @@ public:
bool IsMuted() const;
bool IsLocked() const;
public slots:
void SetTrackName(const QString& name);
void SetMuted(bool e);
void SetLocked(bool e);
signals:
/**
* @brief Signal emitted when a Block is added to this Track
@@ -189,6 +193,8 @@ private:
int index_;
bool locked_;
private slots:
void BlockConnected(NodeEdgePtr edge);
+7 -2
View File
@@ -756,11 +756,16 @@ void TimelineWidget::MoveRubberBandSelect(bool select_links)
}
foreach (QGraphicsItem* item, new_selected_list) {
item->setSelected(true);
TimelineViewBlockItem* block_item = static_cast<TimelineViewBlockItem*>(item);
if (GetTrackFromReference(block_item->Track())->IsLocked()) {
continue;
}
block_item->setSelected(true);
if (select_links) {
// Select the block's links
Block* b = static_cast<TimelineViewBlockItem*>(item)->block();
Block* b = block_item->block();
SetBlockLinksSelected(b, true);
// Add its links to the list
+3 -1
View File
@@ -46,7 +46,9 @@ void TimelineWidget::PointerTool::MousePress(TimelineViewMouseEvent *event)
TimelineViewBlockItem* item = GetItemAtScenePos(event->GetCoordinates());
bool selectable_item = (item != nullptr && item->flags() & QGraphicsItem::ItemIsSelectable);
bool selectable_item = (item != nullptr
&& item->flags() & QGraphicsItem::ItemIsSelectable
&& !parent()->GetTrackFromReference(item->Track())->IsLocked());
if (selectable_item) {
// Cache the clip's type for use later
+1 -1
View File
@@ -59,7 +59,7 @@ void TimelineWidget::RazorTool::MouseRelease(TimelineViewMouseEvent *event)
foreach (const TrackReference& track_ref, split_tracks_) {
TrackOutput* track = parent()->GetTrackFromReference(track_ref);
if (track == nullptr) {
if (track == nullptr || track->IsLocked()) {
continue;
}
@@ -30,10 +30,11 @@ TrackViewItem::TrackViewItem(TrackOutput* track, QWidget *parent) :
connect(mute_button_, SIGNAL(toggled(bool)), track_, SLOT(SetMuted(bool)));
layout->addWidget(mute_button_);
solo_button_ = CreateMSLButton(tr("S"), Qt::yellow);
layout->addWidget(solo_button_);
/*solo_button_ = CreateMSLButton(tr("S"), Qt::yellow);
layout->addWidget(solo_button_);*/
lock_button_ = CreateMSLButton(tr("L"), Qt::gray);
connect(lock_button_, SIGNAL(toggled(bool)), track_, SLOT(SetLocked(bool)));
layout->addWidget(lock_button_);
setMinimumHeight(mute_button_->height());