Create marker widget and attempt to add to timeline

This commit is contained in:
Thomas Wilshaw
2021-10-22 22:15:47 +01:00
parent be24e7e580
commit 4ce922536e
5 changed files with 39 additions and 0 deletions
+5
View File
@@ -30,6 +30,8 @@
#include "patreon.h"
#include "scrollinglabel.h"
#include "widget/marker/marker.h"
namespace olive {
AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent) :
@@ -74,6 +76,9 @@ AboutDialog::AboutDialog(bool welcome_dialog, QWidget *parent) :
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
horiz_layout->addWidget(label);
Marker* marker = new Marker();
horiz_layout->addWidget(marker);
layout->addLayout(horiz_layout);
// Patrons where possible
+1
View File
@@ -28,6 +28,7 @@ add_subdirectory(focusablelineedit)
add_subdirectory(handmovableview)
add_subdirectory(keyframeview)
add_subdirectory(manageddisplay)
add_subdirectory(marker)
add_subdirectory(menu)
add_subdirectory(nodecombobox)
add_subdirectory(nodeparamview)
+23
View File
@@ -44,6 +44,10 @@ SeekableWidget::SeekableWidget(QWidget* parent) :
playhead_width_ = QtUtils::QFontMetricsWidth(fm, "H");
setContextMenuPolicy(Qt::CustomContextMenu);
marker_layout_ = new QHBoxLayout(this);
UpdateMarkers();
}
void SeekableWidget::ConnectTimelinePoints(TimelinePoints *points)
@@ -62,6 +66,8 @@ void SeekableWidget::ConnectTimelinePoints(TimelinePoints *points)
connect(timeline_points_->workarea(), &TimelineWorkArea::EnabledChanged, this, static_cast<void (SeekableWidget::*)()>(&SeekableWidget::update));
connect(timeline_points_->markers(), &TimelineMarkerList::MarkerAdded, this, static_cast<void (SeekableWidget::*)()>(&SeekableWidget::update));
connect(timeline_points_->markers(), &TimelineMarkerList::MarkerRemoved, this, static_cast<void (SeekableWidget::*)()>(&SeekableWidget::update));
connect(timeline_points_->markers(), &TimelineMarkerList::MarkerAdded, this, static_cast<void (SeekableWidget::*)()>(&SeekableWidget::UpdateMarkers));
}
update();
@@ -127,6 +133,23 @@ void SeekableWidget::SetScroll(int s)
update();
}
void SeekableWidget::UpdateMarkers()
{
printf("Test");
if (timeline_points()) {
foreach(Marker * marker, marker_widgets) {
marker->deleteLater();
}
marker_widgets.clear();
foreach(TimelineMarker * marker, timeline_points()->markers()->list()) {
Marker* marker_widget = new Marker();
marker_widgets.append(marker_widget);
marker_layout_->addWidget(marker_widget);
}
}
}
int SeekableWidget::TimeToScreen(const rational &time) const
{
return qFloor(TimeToScene(time)) - scroll_;
+9
View File
@@ -21,10 +21,13 @@
#ifndef SEEKABLEWIDGET_H
#define SEEKABLEWIDGET_H
#include <QHBoxLayout>
#include "common/rational.h"
#include "timeline/timelinepoints.h"
#include "widget/snapservice/snapservice.h"
#include "widget/timebased/timescaledobject.h"
#include "widget/marker/marker.h"
namespace olive {
@@ -55,6 +58,8 @@ public slots:
void SetScroll(int s);
void UpdateMarkers();
protected:
void SeekToScreenPoint(int screen);
@@ -102,6 +107,10 @@ private:
bool dragging_;
QHBoxLayout* marker_layout_;
QVector<Marker*> marker_widgets;
};
}
+1
View File
@@ -27,6 +27,7 @@
#include "common/timerange.h"
#include "seekablewidget.h"
#include "render/playbackcache.h"
#include "widget/marker/marker.h"
namespace olive {