Create marker widget and attempt to add to timeline
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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_;
|
||||
|
||||
@@ -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;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "common/timerange.h"
|
||||
#include "seekablewidget.h"
|
||||
#include "render/playbackcache.h"
|
||||
#include "widget/marker/marker.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user