timeline views can be siblings
This commit is contained in:
@@ -106,12 +106,6 @@ int rational::getActiveInstances()
|
||||
return activeInstances;
|
||||
}
|
||||
|
||||
rational::operator QString() const
|
||||
{
|
||||
return QString("%1/%2").arg(QString::number(numer),
|
||||
QString::number(denom));
|
||||
}
|
||||
|
||||
const intType &rational::numerator() const
|
||||
{
|
||||
return numer;
|
||||
@@ -427,3 +421,8 @@ istream& operator>>(istream &in, rational &value)
|
||||
return in;
|
||||
}
|
||||
|
||||
QDebug operator<<(QDebug debug, const rational &r)
|
||||
{
|
||||
debug.nospace() << r.numerator() << "/" << r.denominator();
|
||||
return debug.maybeSpace();
|
||||
}
|
||||
|
||||
@@ -115,8 +115,6 @@ public:
|
||||
friend ostream& operator<<(ostream &out, const rational &value);
|
||||
friend istream& operator>>(istream &in, rational &value);
|
||||
|
||||
operator QString() const;
|
||||
|
||||
const intType& numerator() const;
|
||||
const intType& denominator() const;
|
||||
|
||||
@@ -136,6 +134,8 @@ private:
|
||||
intType gcd(intType &x, intType &y);
|
||||
};
|
||||
|
||||
QDebug operator<<(QDebug debug, const rational& r);
|
||||
|
||||
#define RATIONAL_MIN rational(INT32_MIN, 1)
|
||||
#define RATIONAL_MAX rational(INT32_MAX, 1)
|
||||
|
||||
|
||||
@@ -483,3 +483,24 @@ void TimelineView::SetEndTime(const rational &length)
|
||||
{
|
||||
end_item_->SetEndTime(length);
|
||||
}
|
||||
|
||||
void TimelineView::SetSiblings(TimelineView *a, TimelineView *b)
|
||||
{
|
||||
if (a == b)
|
||||
return;
|
||||
|
||||
if (!a->siblings_.contains(b))
|
||||
a->siblings_.append(b);
|
||||
|
||||
if (!b->siblings_.contains(a))
|
||||
b->siblings_.append(a);
|
||||
}
|
||||
|
||||
void TimelineView::SetSiblings(const QList<TimelineView *> &siblings)
|
||||
{
|
||||
foreach (TimelineView* view, siblings) {
|
||||
foreach (TimelineView* sibling, siblings) {
|
||||
SetSiblings(view, sibling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,10 @@ public:
|
||||
|
||||
void SetEndTime(const rational& length);
|
||||
|
||||
static void SetSiblings(TimelineView* a, TimelineView* b);
|
||||
|
||||
static void SetSiblings(const QList<TimelineView*>& siblings);
|
||||
|
||||
public slots:
|
||||
void SetTimebase(const rational& timebase);
|
||||
|
||||
@@ -385,6 +389,8 @@ private:
|
||||
|
||||
bool use_tracklist_length_directly_;
|
||||
|
||||
QVector<TimelineView*> siblings_;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Slot for when a Block node changes its parameters and the graphics need to update
|
||||
|
||||
@@ -30,7 +30,10 @@ TimelineWidget::TimelineWidget(QWidget *parent) :
|
||||
views_.append(new TimelineView(Qt::AlignBottom));
|
||||
|
||||
// Audio view
|
||||
views_.append(new TimelineView());
|
||||
views_.append(new TimelineView(Qt::AlignTop));
|
||||
|
||||
// Set both views as siblings
|
||||
TimelineView::SetSiblings(views_);
|
||||
|
||||
// Global scrollbar
|
||||
horizontal_scroll_ = new QScrollBar(Qt::Horizontal);
|
||||
|
||||
@@ -60,7 +60,7 @@ private:
|
||||
|
||||
void SetTimeAndSignal(const int64_t& t);
|
||||
|
||||
QVector<TimelineView*> views_;
|
||||
QList<TimelineView*> views_;
|
||||
|
||||
TimeRuler* ruler_;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user