timeline: separate markers and workarea

This commit is contained in:
itsmattkc
2022-06-27 23:39:31 -07:00
parent 63f74691a5
commit 079d6beff2
34 changed files with 324 additions and 338 deletions
+6 -6
View File
@@ -204,17 +204,17 @@ void ClipBlock::InvalidateCache(const TimeRange& range, const QString& from, int
if (new_connected_viewer != connected_viewer_) {
if (connected_viewer_) {
disconnect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerAdded, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerRemoved, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerModified, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerAdded, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerRemoved, this, &ClipBlock::PreviewChanged);
disconnect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerModified, this, &ClipBlock::PreviewChanged);
}
connected_viewer_ = new_connected_viewer;
if (connected_viewer_) {
connect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerAdded, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerRemoved, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetTimelinePoints()->markers(), &TimelineMarkerList::MarkerModified, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerAdded, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerRemoved, this, &ClipBlock::PreviewChanged);
connect(connected_viewer_->GetMarkers(), &TimelineMarkerList::MarkerModified, this, &ClipBlock::PreviewChanged);
}
}
+2 -1
View File
@@ -58,7 +58,8 @@ ViewerOutput::ViewerOutput(bool create_buffer_inputs, bool create_default_stream
SetFlags(kDontShowInParamView);
timeline_points_ = new TimelinePoints(this);
workarea_ = new TimelineWorkArea(this);
markers_ = new TimelineMarkerList(this);
}
QString ViewerOutput::Name() const
+6 -6
View File
@@ -29,7 +29,8 @@
#include "render/framehashcache.h"
#include "render/subtitleparams.h"
#include "render/videoparams.h"
#include "timeline/timelinepoints.h"
#include "timeline/timelinemarker.h"
#include "timeline/timelineworkarea.h"
namespace olive {
@@ -142,10 +143,8 @@ public:
const rational &GetVideoLength() const { return video_length_; }
const rational &GetAudioLength() const { return audio_length_; }
TimelinePoints* GetTimelinePoints()
{
return timeline_points_;
}
TimelineWorkArea *GetWorkArea() const { return workarea_; }
TimelineMarkerList *GetMarkers() const { return markers_; }
QVector<Track::Reference> GetEnabledStreamsAsReferences() const;
@@ -212,7 +211,8 @@ private:
AudioParams cached_audio_params_;
TimelinePoints *timeline_points_;
TimelineWorkArea *workarea_;
TimelineMarkerList *markers_;
};
-1
View File
@@ -29,7 +29,6 @@
#include "node/output/viewer/viewer.h"
#include "render/audioparams.h"
#include "render/videoparams.h"
#include "timeline/timelinepoints.h"
namespace olive {
-1
View File
@@ -23,7 +23,6 @@
#include "node/output/track/tracklist.h"
#include "node/output/viewer/viewer.h"
#include "timeline/timelinepoints.h"
namespace olive {
@@ -496,7 +496,7 @@ void ProjectSerializer210528::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("points")) {
LoadTimelinePoints(reader, viewer->GetTimelinePoints());
LoadTimelinePoints(reader, viewer);
} else if (reader->name() == QStringLiteral("timestamp") && footage) {
footage->set_timestamp(reader->readElementText().toLongLong());
} else {
@@ -553,13 +553,13 @@ void ProjectSerializer210528::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
}
}
void ProjectSerializer210528::LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const
void ProjectSerializer210528::LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const
{
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("markers")) {
LoadMarkerList(reader, points->markers());
LoadMarkerList(reader, points->GetMarkers());
} else if (reader->name() == QStringLiteral("workarea")) {
LoadWorkArea(reader, points->workarea());
LoadWorkArea(reader, points->GetWorkArea());
} else {
reader->skipCurrentElement();
}
@@ -78,7 +78,7 @@ private:
void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const;
void LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const;
void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const;
void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const;
@@ -488,7 +488,7 @@ void ProjectSerializer210907::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("points")) {
LoadTimelinePoints(reader, viewer->GetTimelinePoints());
LoadTimelinePoints(reader, viewer);
} else if (reader->name() == QStringLiteral("timestamp") && footage) {
footage->set_timestamp(reader->readElementText().toLongLong());
} else {
@@ -545,13 +545,13 @@ void ProjectSerializer210907::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
}
}
void ProjectSerializer210907::LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const
void ProjectSerializer210907::LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const
{
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("markers")) {
LoadMarkerList(reader, points->markers());
LoadMarkerList(reader, points->GetMarkers());
} else if (reader->name() == QStringLiteral("workarea")) {
LoadWorkArea(reader, points->workarea());
LoadWorkArea(reader, points->GetWorkArea());
} else {
reader->skipCurrentElement();
}
@@ -77,7 +77,7 @@ private:
void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const;
void LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const;
void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const;
void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const;
@@ -538,7 +538,7 @@ void ProjectSerializer211228::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("points")) {
LoadTimelinePoints(reader, viewer->GetTimelinePoints());
LoadTimelinePoints(reader, viewer);
} else if (reader->name() == QStringLiteral("timestamp") && footage) {
footage->set_timestamp(reader->readElementText().toLongLong());
} else {
@@ -595,13 +595,13 @@ void ProjectSerializer211228::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
}
}
void ProjectSerializer211228::LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const
void ProjectSerializer211228::LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const
{
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("markers")) {
LoadMarkerList(reader, points->markers());
LoadMarkerList(reader, points->GetMarkers());
} else if (reader->name() == QStringLiteral("workarea")) {
LoadWorkArea(reader, points->workarea());
LoadWorkArea(reader, points->GetWorkArea());
} else {
reader->skipCurrentElement();
}
@@ -78,7 +78,7 @@ private:
void LoadNodeCustom(QXmlStreamReader *reader, Node *node, XMLNodeData &xml_node_data) const;
void LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const;
void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *points) const;
void LoadWorkArea(QXmlStreamReader *reader, TimelineWorkArea *workarea) const;
@@ -989,7 +989,7 @@ void ProjectSerializer220403::LoadNodeCustom(QXmlStreamReader *reader, Node *nod
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("points")) {
LoadTimelinePoints(reader, viewer->GetTimelinePoints());
LoadTimelinePoints(reader, viewer);
} else if (reader->name() == QStringLiteral("timestamp") && footage) {
footage->set_timestamp(reader->readElementText().toLongLong());
} else {
@@ -1084,7 +1084,7 @@ void ProjectSerializer220403::SaveNodeCustom(QXmlStreamWriter *writer, Node *nod
if (ViewerOutput *viewer = dynamic_cast<ViewerOutput*>(node)) {
// Write TimelinePoints
writer->writeStartElement(QStringLiteral("points"));
SaveTimelinePoints(writer, viewer->GetTimelinePoints());
SaveTimelinePoints(writer, viewer);
writer->writeEndElement(); // points
if (Footage *footage = dynamic_cast<Footage*>(node)) {
@@ -1136,27 +1136,27 @@ void ProjectSerializer220403::SaveNodeCustom(QXmlStreamWriter *writer, Node *nod
}
}
void ProjectSerializer220403::LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const
void ProjectSerializer220403::LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *viewer) const
{
while (XMLReadNextStartElement(reader)) {
if (reader->name() == QStringLiteral("markers")) {
LoadMarkerList(reader, points->markers());
LoadMarkerList(reader, viewer->GetMarkers());
} else if (reader->name() == QStringLiteral("workarea")) {
LoadWorkArea(reader, points->workarea());
LoadWorkArea(reader, viewer->GetWorkArea());
} else {
reader->skipCurrentElement();
}
}
}
void ProjectSerializer220403::SaveTimelinePoints(QXmlStreamWriter *writer, TimelinePoints *points) const
void ProjectSerializer220403::SaveTimelinePoints(QXmlStreamWriter *writer, ViewerOutput *viewer) const
{
writer->writeStartElement(QStringLiteral("workarea"));
SaveWorkArea(writer, points->workarea());
SaveWorkArea(writer, viewer->GetWorkArea());
writer->writeEndElement(); // workarea
writer->writeStartElement(QStringLiteral("markers"));
SaveMarkerList(writer, points->markers());
SaveMarkerList(writer, viewer->GetMarkers());
writer->writeEndElement(); // markers
}
@@ -100,9 +100,9 @@ private:
void SaveNodeCustom(QXmlStreamWriter *writer, Node *node) const;
void LoadTimelinePoints(QXmlStreamReader *reader, TimelinePoints *points) const;
void LoadTimelinePoints(QXmlStreamReader *reader, ViewerOutput *viewer) const;
void SaveTimelinePoints(QXmlStreamWriter *writer, TimelinePoints *points) const;
void SaveTimelinePoints(QXmlStreamWriter *writer, ViewerOutput *viewer) const;
void LoadMarker(QXmlStreamReader *reader, TimelineMarker *marker) const;