various: extended marker and timeline functionality

This commit is contained in:
itsmattkc
2022-05-01 21:17:22 -07:00
parent cdcd83c09a
commit 6a0b5856c9
23 changed files with 781 additions and 240 deletions
@@ -50,6 +50,7 @@ void ResizableTimelineScrollBar::ConnectTimelinePoints(TimelinePoints *points)
disconnect(points_->workarea(), &TimelineWorkArea::EnabledChanged, this, static_cast<void (ResizableTimelineScrollBar::*)()>(&ResizableTimelineScrollBar::update));
disconnect(points_->markers(), &TimelineMarkerList::MarkerAdded, this, static_cast<void (ResizableTimelineScrollBar::*)()>(&ResizableTimelineScrollBar::update));
disconnect(points_->markers(), &TimelineMarkerList::MarkerRemoved, this, static_cast<void (ResizableTimelineScrollBar::*)()>(&ResizableTimelineScrollBar::update));
disconnect(points_->markers(), &TimelineMarkerList::MarkerModified, this, static_cast<void (ResizableTimelineScrollBar::*)()>(&ResizableTimelineScrollBar::update));
}
points_ = points;
@@ -59,6 +60,7 @@ void ResizableTimelineScrollBar::ConnectTimelinePoints(TimelinePoints *points)
connect(points_->workarea(), &TimelineWorkArea::EnabledChanged, this, static_cast<void (ResizableTimelineScrollBar::*)()>(&ResizableTimelineScrollBar::update));
connect(points_->markers(), &TimelineMarkerList::MarkerAdded, this, static_cast<void (ResizableTimelineScrollBar::*)()>(&ResizableTimelineScrollBar::update));
connect(points_->markers(), &TimelineMarkerList::MarkerRemoved, this, static_cast<void (ResizableTimelineScrollBar::*)()>(&ResizableTimelineScrollBar::update));
connect(points_->markers(), &TimelineMarkerList::MarkerModified, this, static_cast<void (ResizableTimelineScrollBar::*)()>(&ResizableTimelineScrollBar::update));
}
update();
@@ -77,7 +79,7 @@ void ResizableTimelineScrollBar::paintEvent(QPaintEvent *event)
if (points_
&& !timebase().isNull()
&& (points_->workarea()->enabled() || !points_->markers()->list().empty())) {
&& (points_->workarea()->enabled() || !points_->markers()->empty())) {
QStyleOptionSlider opt;
initStyleOption(&opt);
@@ -110,11 +112,13 @@ void ResizableTimelineScrollBar::paintEvent(QPaintEvent *event)
workarea_color);
}
if (!points_->markers()->list().empty()) {
foreach (TimelineMarker* marker, points_->markers()->list()) {
if (!points_->markers()->empty()) {
for (auto it=points_->markers()->cbegin(); it!=points_->markers()->cend(); it++) {
TimelineMarker* marker = *it;
QColor marker_color = ColorCoding::GetColor(marker->color()).toQColor();
int64_t in = qRound64(ratio * TimeToScene(marker->time().in()));
int64_t out = qRound64(ratio * TimeToScene(marker->time().out()));
int64_t in = qRound64(ratio * TimeToScene(marker->time_range().in()));
int64_t out = qRound64(ratio * TimeToScene(marker->time_range().out()));
int64_t length = qMax(int64_t(1), out-in);
p.fillRect(gr.x() + in,