timeline: reimplemented linking/unlinking functionality
This commit is contained in:
@@ -202,20 +202,25 @@ void Block::LengthInputChanged()
|
||||
emit LengthChanged(length());
|
||||
}
|
||||
|
||||
void Block::Link(Block *a, Block *b)
|
||||
bool Block::Link(Block *a, Block *b)
|
||||
{
|
||||
if (a == b || !a || !b) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Prevent duplicate link entries (assume that we only need to check one clip since this should be the only function
|
||||
// that adds to the linked array)
|
||||
if (a->linked_clips_.contains(b)) {
|
||||
return;
|
||||
if (Block::AreLinked(a, b)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
a->linked_clips_.append(b);
|
||||
b->linked_clips_.append(a);
|
||||
|
||||
emit a->LinksChanged();
|
||||
emit b->LinksChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Block::Link(const QList<Block*>& blocks)
|
||||
@@ -227,14 +232,23 @@ void Block::Link(const QList<Block*>& blocks)
|
||||
}
|
||||
}
|
||||
|
||||
void Block::Unlink(Block *a, Block *b)
|
||||
bool Block::Unlink(Block *a, Block *b)
|
||||
{
|
||||
if (a == b || !a || !b) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Block::AreLinked(a, b)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
a->linked_clips_.removeOne(b);
|
||||
b->linked_clips_.removeOne(a);
|
||||
|
||||
emit a->LinksChanged();
|
||||
emit b->LinksChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Block::Unlink(const QList<Block *> &blocks)
|
||||
|
||||
@@ -76,9 +76,9 @@ public:
|
||||
QString block_name() const;
|
||||
void set_block_name(const QString& name);
|
||||
|
||||
static void Link(Block* a, Block* b);
|
||||
static bool Link(Block* a, Block* b);
|
||||
static void Link(const QList<Block*>& blocks);
|
||||
static void Unlink(Block* a, Block* b);
|
||||
static bool Unlink(Block* a, Block* b);
|
||||
static void Unlink(const QList<Block*>& blocks);
|
||||
static bool AreLinked(Block* a, Block* b);
|
||||
const QVector<Block*>& linked_clips();
|
||||
@@ -104,6 +104,8 @@ signals:
|
||||
|
||||
void LengthChanged(const rational& length);
|
||||
|
||||
void LinksChanged();
|
||||
|
||||
protected:
|
||||
rational SequenceToMediaTime(const rational& sequence_time) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user