ported seekablewidget to timebasedview
Cuts down on a lot of code duplication and opens up usage of the new TimelineViewSelectionManager framework
This commit is contained in:
+2
-11
@@ -80,18 +80,9 @@ NodeGraph *Node::parent() const
|
||||
return static_cast<NodeGraph*>(QObject::parent());
|
||||
}
|
||||
|
||||
Project* Node::project() const
|
||||
Project *Node::project() const
|
||||
{
|
||||
QObject *t = this->parent();
|
||||
|
||||
while (t) {
|
||||
if (Project *p = dynamic_cast<Project*>(t)) {
|
||||
return p;
|
||||
}
|
||||
t = t->parent();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return Project::GetProjectFromObject(this);
|
||||
}
|
||||
|
||||
QString Node::ShortName() const
|
||||
|
||||
@@ -169,6 +169,20 @@ void Project::RegenerateUuid()
|
||||
uuid_ = QUuid::createUuid();
|
||||
}
|
||||
|
||||
Project *Project::GetProjectFromObject(const QObject *o)
|
||||
{
|
||||
QObject *t = o->parent();
|
||||
|
||||
while (t) {
|
||||
if (Project *p = dynamic_cast<Project*>(t)) {
|
||||
return p;
|
||||
}
|
||||
t = t->parent();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Project::ColorManagerValueChanged(const NodeInput &input, const TimeRange &range)
|
||||
{
|
||||
Q_UNUSED(input)
|
||||
|
||||
@@ -109,6 +109,14 @@ public:
|
||||
saved_url_ = url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Find project parent from object
|
||||
*
|
||||
* If an object is expected to be a child of a project, this function will traverse its parent
|
||||
* tree until it finds it.
|
||||
*/
|
||||
static Project *GetProjectFromObject(const QObject *o);
|
||||
|
||||
signals:
|
||||
void NameChanged();
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "serializer210528.h"
|
||||
|
||||
#include "config/config.h"
|
||||
#include "node/factory.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -604,7 +605,7 @@ void ProjectSerializer210528::LoadMarkerList(QXmlStreamReader *reader, TimelineM
|
||||
}
|
||||
}
|
||||
|
||||
markers->AddMarker(TimeRange(in, out), name);
|
||||
new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers);
|
||||
}
|
||||
|
||||
reader->skipCurrentElement();
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "serializer210907.h"
|
||||
|
||||
#include "config/config.h"
|
||||
#include "node/factory.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -596,7 +597,7 @@ void ProjectSerializer210907::LoadMarkerList(QXmlStreamReader *reader, TimelineM
|
||||
}
|
||||
}
|
||||
|
||||
markers->AddMarker(TimeRange(in, out), name);
|
||||
new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers);
|
||||
}
|
||||
|
||||
reader->skipCurrentElement();
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "serializer211228.h"
|
||||
|
||||
#include "config/config.h"
|
||||
#include "node/factory.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -646,7 +647,7 @@ void ProjectSerializer211228::LoadMarkerList(QXmlStreamReader *reader, TimelineM
|
||||
}
|
||||
}
|
||||
|
||||
markers->AddMarker(TimeRange(in, out), name);
|
||||
new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers);
|
||||
}
|
||||
|
||||
reader->skipCurrentElement();
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "serializer220403.h"
|
||||
|
||||
#include "config/config.h"
|
||||
#include "node/factory.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -1001,7 +1002,7 @@ void ProjectSerializer220403::LoadMarkerList(QXmlStreamReader *reader, TimelineM
|
||||
}
|
||||
}
|
||||
|
||||
markers->AddMarker(TimeRange(in, out), name);
|
||||
new TimelineMarker(Config::Current()[QStringLiteral("MarkerColor")].toInt(), TimeRange(in, out), name, markers);
|
||||
}
|
||||
|
||||
reader->skipCurrentElement();
|
||||
|
||||
Reference in New Issue
Block a user