some timeline refactoring, preparing for rewrites
This commit is contained in:
@@ -34,8 +34,8 @@ Block::Block() :
|
||||
length_input_ = new NodeInput(this, QStringLiteral("length_in"), NodeValue::kRational);
|
||||
length_input_->SetConnectable(false);
|
||||
length_input_->SetKeyframable(false);
|
||||
disconnect(length_input_, &NodeInput::ValueChanged, this, &Block::InputChanged);
|
||||
connect(length_input_, &NodeInput::ValueChanged, this, &Block::LengthInputChanged);
|
||||
IgnoreInvalidationsFrom(length_input_);
|
||||
connect(length_input_, &NodeInput::ValueChanged, this, &Block::LengthChanged);
|
||||
|
||||
media_in_input_ = new NodeInput(this, QStringLiteral("media_in_in"), NodeValue::kRational);
|
||||
media_in_input_->SetConnectable(false);
|
||||
@@ -92,11 +92,7 @@ void Block::set_length_and_media_out(const rational &length)
|
||||
return;
|
||||
}
|
||||
|
||||
rational old_length = this->length();
|
||||
|
||||
set_length_internal(length);
|
||||
|
||||
LengthChangedEvent(old_length, length, Timeline::kTrimOut);
|
||||
}
|
||||
|
||||
void Block::set_length_and_media_in(const rational &length)
|
||||
@@ -110,12 +106,8 @@ void Block::set_length_and_media_in(const rational &length)
|
||||
// Calculate media_in adjustment
|
||||
set_media_in(SequenceToMediaTime(in() + (this->length() - length)));
|
||||
|
||||
rational old_length = this->length();
|
||||
|
||||
// Set the length without setting media out
|
||||
set_length_internal(length);
|
||||
|
||||
LengthChangedEvent(old_length, length, Timeline::kTrimIn);
|
||||
}
|
||||
|
||||
TimeRange Block::range() const
|
||||
@@ -249,18 +241,9 @@ QVector<NodeInput *> Block::GetInputsToHash() const
|
||||
return inputs;
|
||||
}
|
||||
|
||||
void Block::LengthChangedEvent(const rational &, const rational &, const Timeline::MovementMode &)
|
||||
{
|
||||
}
|
||||
|
||||
void Block::set_length_internal(const rational &length)
|
||||
{
|
||||
length_input_->SetStandardValue (QVariant::fromValue(length));
|
||||
}
|
||||
|
||||
void Block::LengthInputChanged()
|
||||
{
|
||||
emit LengthChanged(length());
|
||||
length_input_->SetStandardValue(QVariant::fromValue(length));
|
||||
}
|
||||
|
||||
bool Block::Link(Block *a, Block *b)
|
||||
|
||||
+2
-16
@@ -86,19 +86,12 @@ public:
|
||||
public slots:
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted when this Block is refreshed
|
||||
*
|
||||
* Can be used as essentially a "changed" signal for UI widgets to know when to update their views
|
||||
*/
|
||||
void Refreshed();
|
||||
|
||||
void LengthChanged(const rational& length);
|
||||
|
||||
void LinksChanged();
|
||||
|
||||
void EnabledChanged();
|
||||
|
||||
void LengthChanged();
|
||||
|
||||
protected:
|
||||
rational SequenceToMediaTime(const rational& sequence_time) const;
|
||||
|
||||
@@ -110,10 +103,6 @@ protected:
|
||||
|
||||
virtual QVector<NodeInput*> GetInputsToHash() const override;
|
||||
|
||||
virtual void LengthChangedEvent(const rational& old_length,
|
||||
const rational& new_length,
|
||||
const Timeline::MovementMode& mode);
|
||||
|
||||
Block* previous_;
|
||||
Block* next_;
|
||||
|
||||
@@ -130,9 +119,6 @@ private:
|
||||
|
||||
QVector<Block*> linked_clips_;
|
||||
|
||||
private slots:
|
||||
void LengthInputChanged();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#ifndef CONNECTABLE_H
|
||||
#define CONNECTABLE_H
|
||||
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QVector>
|
||||
|
||||
@@ -77,7 +77,7 @@ protected:
|
||||
return output_connections_;
|
||||
}
|
||||
|
||||
const QHash<int, Node*>& input_connections() const
|
||||
const QMap<int, Node*>& input_connections() const
|
||||
{
|
||||
return input_connections_;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ protected:
|
||||
private:
|
||||
QVector<InputConnection> output_connections_;
|
||||
|
||||
QHash<int, Node*> input_connections_;
|
||||
QMap<int, Node*> input_connections_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ Node *NodeFactory::CreateFromFactoryIndex(const NodeFactory::InternalID &id)
|
||||
case kFootageInput:
|
||||
return new MediaInput();
|
||||
case kTrackOutput:
|
||||
return new TrackOutput();
|
||||
return new Track();
|
||||
case kViewerOutput:
|
||||
return new ViewerOutput();
|
||||
case kAudioVolume:
|
||||
|
||||
+30
-14
@@ -226,7 +226,7 @@ void NodeInput::Init(Node* parent, const QString &id, NodeValue::Type type, cons
|
||||
array_size_ = 0;
|
||||
data_type_ = type;
|
||||
|
||||
primary_ = new NodeInputImmediate(type, default_value_);
|
||||
primary_ = CreateImmediate();
|
||||
}
|
||||
|
||||
void NodeInput::LoadImmediate(QXmlStreamReader *reader, int element, XMLNodeData &xml_node_data, const QAtomicInt *cancelled)
|
||||
@@ -374,6 +374,18 @@ void NodeInput::SaveImmediate(QXmlStreamWriter* writer, int element) const
|
||||
}
|
||||
}
|
||||
|
||||
void NodeInput::ChangeArraySizeInternal(int size)
|
||||
{
|
||||
array_size_ = size;
|
||||
emit ArraySizeChanged(array_size_);
|
||||
emit ValueChanged(TimeRange(RATIONAL_MIN, RATIONAL_MAX), -1);
|
||||
}
|
||||
|
||||
NodeInputImmediate *NodeInput::CreateImmediate()
|
||||
{
|
||||
return new NodeInputImmediate(data_type_, default_value_);
|
||||
}
|
||||
|
||||
void NodeInput::GetDependencies(QVector<Node *> &list, bool traverse, bool exclusive_only) const
|
||||
{
|
||||
for (auto it=input_connections().cbegin(); it!=input_connections().cend(); it++) {
|
||||
@@ -423,28 +435,26 @@ QVector<Node *> NodeInput::GetImmediateDependencies() const
|
||||
|
||||
void NodeInput::ArrayInsert(int index)
|
||||
{
|
||||
// Prepend new input
|
||||
subinputs_.insert(index, new NodeInputImmediate(GetDataType(), default_value_));
|
||||
// Add new input
|
||||
subinputs_.insert(index, CreateImmediate());
|
||||
|
||||
// Move connections down
|
||||
QHash<int, Node*> copied_edges = edges();
|
||||
for (auto it=copied_edges.cbegin(); it!=copied_edges.cend(); it++) {
|
||||
auto copied_edges = edges();
|
||||
for (auto it=copied_edges.cend(); it!=copied_edges.cbegin(); it--) {
|
||||
if (it.key() >= index) {
|
||||
// Disconnect this and reconnect it one element down
|
||||
DisconnectEdge(it.value(), this, it.key());
|
||||
ConnectEdge(it.value(), this, it.key() + 1);
|
||||
}
|
||||
}
|
||||
|
||||
ChangeArraySizeInternal(array_size_ + 1);
|
||||
}
|
||||
|
||||
void NodeInput::ArrayRemove(int index)
|
||||
{
|
||||
// Remove subinput here
|
||||
delete subinputs_.at(index);
|
||||
subinputs_.removeAt(index);
|
||||
|
||||
// Move connections up
|
||||
QHash<int, Node*> copied_edges = edges();
|
||||
auto copied_edges = edges();
|
||||
for (auto it=copied_edges.cbegin(); it!=copied_edges.cend(); it++) {
|
||||
if (it.key() >= index) {
|
||||
// Disconnect this and reconnect it one element up if it's not the element being removed
|
||||
@@ -455,6 +465,10 @@ void NodeInput::ArrayRemove(int index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove input
|
||||
delete subinputs_.takeAt(index);
|
||||
ChangeArraySizeInternal(array_size_ - 1);
|
||||
}
|
||||
|
||||
void NodeInput::ArrayPrepend()
|
||||
@@ -479,13 +493,12 @@ void NodeInput::ArrayResize(int size)
|
||||
} else {
|
||||
// Size is larger, create any immediates that don't exist
|
||||
for (int i=subinputs_.size(); i<size; i++) {
|
||||
subinputs_.append(new NodeInputImmediate(GetDataType(), default_value_));
|
||||
subinputs_.append(CreateImmediate());
|
||||
}
|
||||
}
|
||||
|
||||
// Update array size
|
||||
array_size_ = size;
|
||||
emit ArraySizeChanged(array_size_);
|
||||
ChangeArraySizeInternal(size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -665,7 +678,10 @@ void NodeInput::CopyValuesOfElement(NodeInput *src, NodeInput *dst, int element)
|
||||
dst->SetIsKeyframing(src->IsKeyframing(element), element);
|
||||
}
|
||||
|
||||
emit dst->ValueChanged(TimeRange(RATIONAL_MIN, RATIONAL_MAX), element);
|
||||
// If this is the root of an array, copy the array size
|
||||
if (element == -1) {
|
||||
dst->ArrayResize(src->ArraySize());
|
||||
}
|
||||
}
|
||||
|
||||
QStringList NodeInput::get_combobox_strings() const
|
||||
|
||||
+5
-1
@@ -106,7 +106,7 @@ public:
|
||||
emit DataTypeChanged(type);
|
||||
}
|
||||
|
||||
const QHash<int, Node*>& edges() const
|
||||
const QMap<int, Node*>& edges() const
|
||||
{
|
||||
return input_connections();
|
||||
}
|
||||
@@ -367,6 +367,10 @@ private:
|
||||
|
||||
void SaveImmediate(QXmlStreamWriter *writer, int element) const;
|
||||
|
||||
void ChangeArraySizeInternal(int size);
|
||||
|
||||
NodeInputImmediate* CreateImmediate();
|
||||
|
||||
const NodeInputImmediate* GetImmediate(int element = -1) const
|
||||
{
|
||||
return element > -1 ? subinputs_.at(element) : primary_;
|
||||
|
||||
+7
-1
@@ -276,7 +276,7 @@ void Node::SendInvalidateCache(const TimeRange &range)
|
||||
}
|
||||
}
|
||||
|
||||
void Node::IgnoreConnectionSignalsFrom(NodeInput *input)
|
||||
void Node::IgnoreInvalidationsFrom(NodeInput *input)
|
||||
{
|
||||
ignore_connections_.append(input);
|
||||
}
|
||||
@@ -723,6 +723,12 @@ void Node::SetPosition(const QPointF &pos)
|
||||
|
||||
void Node::InputChanged(const TimeRange& range, int element)
|
||||
{
|
||||
NodeInput* input = static_cast<NodeInput*>(sender());
|
||||
|
||||
if (ignore_connections_.contains(input)) {
|
||||
return;
|
||||
}
|
||||
|
||||
InvalidateCache(range, InputConnection(static_cast<NodeInput*>(sender()), element));
|
||||
}
|
||||
|
||||
|
||||
+6
-8
@@ -411,7 +411,7 @@ protected:
|
||||
* parameters has changed throughout the duration of the clip (essential from 0 to infinity).
|
||||
* In some scenarios, it may be preferable to handle this signal separately in order to
|
||||
*/
|
||||
void IgnoreConnectionSignalsFrom(NodeInput* input);
|
||||
void IgnoreInvalidationsFrom(NodeInput* input);
|
||||
|
||||
virtual void LoadInternal(QXmlStreamReader* reader, XMLNodeData& xml_node_data);
|
||||
|
||||
@@ -439,11 +439,6 @@ protected:
|
||||
|
||||
virtual void childEvent(QChildEvent* event) override;
|
||||
|
||||
protected slots:
|
||||
void InputChanged(const olive::TimeRange &range, int element);
|
||||
|
||||
void InputConnectionChanged(Node* source, int element);
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted whenever the position is set through SetPosition()
|
||||
@@ -455,6 +450,11 @@ signals:
|
||||
*/
|
||||
void LabelChanged(const QString& s);
|
||||
|
||||
protected slots:
|
||||
void InputChanged(const olive::TimeRange &range, int element);
|
||||
|
||||
void InputConnectionChanged(Node* source, int element);
|
||||
|
||||
private:
|
||||
template<class T>
|
||||
static void FindInputNodeInternal(const Node* n, QVector<T *>& list);
|
||||
@@ -485,8 +485,6 @@ private:
|
||||
*/
|
||||
QString label_;
|
||||
|
||||
private slots:
|
||||
|
||||
};
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -29,85 +29,85 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
const double TrackOutput::kTrackHeightDefault = 3.0;
|
||||
const double TrackOutput::kTrackHeightMinimum = 1.5;
|
||||
const double TrackOutput::kTrackHeightInterval = 0.5;
|
||||
const double Track::kTrackHeightDefault = 3.0;
|
||||
const double Track::kTrackHeightMinimum = 1.5;
|
||||
const double Track::kTrackHeightInterval = 0.5;
|
||||
|
||||
TrackOutput::TrackOutput() :
|
||||
track_type_(Timeline::kTrackTypeNone),
|
||||
Track::Track() :
|
||||
track_type_(Track::kNone),
|
||||
index_(-1),
|
||||
locked_(false)
|
||||
{
|
||||
block_input_ = new NodeInput(this, QStringLiteral("block_in"), NodeValue::kNone);
|
||||
block_input_->SetKeyframable(false);
|
||||
connect(block_input_, &NodeInput::InputConnected, this, &TrackOutput::BlockConnected);
|
||||
connect(block_input_, &NodeInput::InputDisconnected, this, &TrackOutput::BlockDisconnected);
|
||||
connect(block_input_, &NodeInput::InputConnected, this, &Track::BlockConnected);
|
||||
connect(block_input_, &NodeInput::InputDisconnected, this, &Track::BlockDisconnected);
|
||||
|
||||
// Since blocks are time based, we can handle the invalidate timing a little more intelligently
|
||||
// on our end
|
||||
IgnoreConnectionSignalsFrom(block_input_);
|
||||
IgnoreInvalidationsFrom(block_input_);
|
||||
|
||||
muted_input_ = new NodeInput(this, QStringLiteral("muted_in"), NodeValue::kBoolean);
|
||||
muted_input_->SetKeyframable(false);
|
||||
connect(muted_input_, &NodeInput::ValueChanged, this, &TrackOutput::MutedInputValueChanged);
|
||||
connect(muted_input_, &NodeInput::ValueChanged, this, &Track::MutedInputValueChanged);
|
||||
|
||||
// Set default height
|
||||
track_height_ = kTrackHeightDefault;
|
||||
}
|
||||
|
||||
TrackOutput::~TrackOutput()
|
||||
Track::~Track()
|
||||
{
|
||||
DisconnectAll();
|
||||
}
|
||||
|
||||
void TrackOutput::set_track_type(const Timeline::TrackType &track_type)
|
||||
void Track::set_track_type(const Type &track_type)
|
||||
{
|
||||
track_type_ = track_type;
|
||||
}
|
||||
|
||||
const Timeline::TrackType& TrackOutput::track_type() const
|
||||
const Track::Type& Track::track_type() const
|
||||
{
|
||||
return track_type_;
|
||||
}
|
||||
|
||||
Node *TrackOutput::copy() const
|
||||
Node *Track::copy() const
|
||||
{
|
||||
return new TrackOutput();
|
||||
return new Track();
|
||||
}
|
||||
|
||||
QString TrackOutput::Name() const
|
||||
QString Track::Name() const
|
||||
{
|
||||
return tr("Track");
|
||||
}
|
||||
|
||||
QString TrackOutput::id() const
|
||||
QString Track::id() const
|
||||
{
|
||||
return QStringLiteral("org.olivevideoeditor.Olive.track");
|
||||
}
|
||||
|
||||
QVector<Node::CategoryID> TrackOutput::Category() const
|
||||
QVector<Node::CategoryID> Track::Category() const
|
||||
{
|
||||
return {kCategoryTimeline};
|
||||
}
|
||||
|
||||
QString TrackOutput::Description() const
|
||||
QString Track::Description() const
|
||||
{
|
||||
return tr("Node for representing and processing a single array of Blocks sorted by time. Also represents the end of "
|
||||
"a Sequence.");
|
||||
}
|
||||
|
||||
const double &TrackOutput::GetTrackHeight() const
|
||||
const double &Track::GetTrackHeight() const
|
||||
{
|
||||
return track_height_;
|
||||
}
|
||||
|
||||
void TrackOutput::SetTrackHeight(const double &height)
|
||||
void Track::SetTrackHeight(const double &height)
|
||||
{
|
||||
track_height_ = height;
|
||||
emit TrackHeightChangedInPixels(GetTrackHeightInPixels());
|
||||
}
|
||||
|
||||
void TrackOutput::LoadInternal(QXmlStreamReader *reader, XMLNodeData &)
|
||||
void Track::LoadInternal(QXmlStreamReader *reader, XMLNodeData &)
|
||||
{
|
||||
while (XMLReadNextStartElement(reader)) {
|
||||
if (reader->name() == QStringLiteral("height")) {
|
||||
@@ -118,12 +118,12 @@ void TrackOutput::LoadInternal(QXmlStreamReader *reader, XMLNodeData &)
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::SaveInternal(QXmlStreamWriter *writer) const
|
||||
void Track::SaveInternal(QXmlStreamWriter *writer) const
|
||||
{
|
||||
writer->writeTextElement(QStringLiteral("height"), QString::number(GetTrackHeight()));
|
||||
}
|
||||
|
||||
void TrackOutput::Retranslate()
|
||||
void Track::Retranslate()
|
||||
{
|
||||
Node::Retranslate();
|
||||
|
||||
@@ -131,19 +131,19 @@ void TrackOutput::Retranslate()
|
||||
muted_input_->set_name(tr("Muted"));
|
||||
}
|
||||
|
||||
const int &TrackOutput::Index()
|
||||
const int &Track::Index()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
void TrackOutput::SetIndex(const int &index)
|
||||
void Track::SetIndex(const int &index)
|
||||
{
|
||||
index_ = index;
|
||||
|
||||
emit IndexChanged(index);
|
||||
}
|
||||
|
||||
Block *TrackOutput::BlockContainingTime(const rational &time) const
|
||||
Block *Track::BlockContainingTime(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
if (block->in() < time && block->out() > time) {
|
||||
@@ -156,7 +156,7 @@ Block *TrackOutput::BlockContainingTime(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::NearestBlockBefore(const rational &time) const
|
||||
Block *Track::NearestBlockBefore(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
// Blocks are sorted by time, so the first Block who's out point is at/after this time is the correct Block
|
||||
@@ -168,7 +168,7 @@ Block *TrackOutput::NearestBlockBefore(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::NearestBlockBeforeOrAt(const rational &time) const
|
||||
Block *Track::NearestBlockBeforeOrAt(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
// Blocks are sorted by time, so the first Block who's out point is at/after this time is the correct Block
|
||||
@@ -180,7 +180,7 @@ Block *TrackOutput::NearestBlockBeforeOrAt(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::NearestBlockAfterOrAt(const rational &time) const
|
||||
Block *Track::NearestBlockAfterOrAt(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
// Blocks are sorted by time, so the first Block after this time is the correct Block
|
||||
@@ -192,7 +192,7 @@ Block *TrackOutput::NearestBlockAfterOrAt(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::NearestBlockAfter(const rational &time) const
|
||||
Block *Track::NearestBlockAfter(const rational &time) const
|
||||
{
|
||||
foreach (Block* block, block_cache_) {
|
||||
// Blocks are sorted by time, so the first Block after this time is the correct Block
|
||||
@@ -204,7 +204,7 @@ Block *TrackOutput::NearestBlockAfter(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Block *TrackOutput::BlockAtTime(const rational &time) const
|
||||
Block *Track::BlockAtTime(const rational &time) const
|
||||
{
|
||||
if (IsMuted()) {
|
||||
return nullptr;
|
||||
@@ -225,7 +225,7 @@ Block *TrackOutput::BlockAtTime(const rational &time) const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QVector<Block *> TrackOutput::BlocksAtTimeRange(const TimeRange &range) const
|
||||
QVector<Block *> Track::BlocksAtTimeRange(const TimeRange &range) const
|
||||
{
|
||||
QVector<Block*> list;
|
||||
|
||||
@@ -245,7 +245,7 @@ QVector<Block *> TrackOutput::BlocksAtTimeRange(const TimeRange &range) const
|
||||
return list;
|
||||
}
|
||||
|
||||
void TrackOutput::InvalidateCache(const TimeRange& range, const InputConnection& from)
|
||||
void Track::InvalidateCache(const TimeRange& range, const InputConnection& from)
|
||||
{
|
||||
TimeRange limited;
|
||||
|
||||
@@ -267,12 +267,12 @@ void TrackOutput::InvalidateCache(const TimeRange& range, const InputConnection&
|
||||
Node::InvalidateCache(limited, from);
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockBefore(Block* block, Block* after)
|
||||
void Track::InsertBlockBefore(Block* block, Block* after)
|
||||
{
|
||||
InsertBlockAtIndex(block, block_cache_.indexOf(after));
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockAfter(Block *block, Block *before)
|
||||
void Track::InsertBlockAfter(Block *block, Block *before)
|
||||
{
|
||||
int before_index = block_cache_.indexOf(before);
|
||||
|
||||
@@ -285,7 +285,7 @@ void TrackOutput::InsertBlockAfter(Block *block, Block *before)
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::PrependBlock(Block *block)
|
||||
void Track::PrependBlock(Block *block)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -298,7 +298,7 @@ void TrackOutput::PrependBlock(Block *block)
|
||||
Node::InvalidateCache(TimeRange(0, track_length()), InputConnection());
|
||||
}
|
||||
|
||||
void TrackOutput::InsertBlockAtIndex(Block *block, int index)
|
||||
void Track::InsertBlockAtIndex(Block *block, int index)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -311,7 +311,7 @@ void TrackOutput::InsertBlockAtIndex(Block *block, int index)
|
||||
Node::InvalidateCache(TimeRange(block->in(), track_length()));
|
||||
}
|
||||
|
||||
void TrackOutput::AppendBlock(Block *block)
|
||||
void Track::AppendBlock(Block *block)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -324,7 +324,7 @@ void TrackOutput::AppendBlock(Block *block)
|
||||
Node::InvalidateCache(TimeRange(block->in(), track_length()));
|
||||
}
|
||||
|
||||
void TrackOutput::RippleRemoveBlock(Block *block)
|
||||
void Track::RippleRemoveBlock(Block *block)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -338,7 +338,7 @@ void TrackOutput::RippleRemoveBlock(Block *block)
|
||||
Node::InvalidateCache(TimeRange(remove_in, qMax(track_length(), remove_out)));
|
||||
}
|
||||
|
||||
void TrackOutput::ReplaceBlock(Block *old, Block *replace)
|
||||
void Track::ReplaceBlock(Block *old, Block *replace)
|
||||
{
|
||||
BeginOperation();
|
||||
|
||||
@@ -357,57 +357,44 @@ void TrackOutput::ReplaceBlock(Block *old, Block *replace)
|
||||
}
|
||||
}
|
||||
|
||||
TrackOutput *TrackOutput::TrackFromBlock(const Block *block)
|
||||
{
|
||||
foreach (const InputConnection& conn, block->edges()) {
|
||||
TrackOutput* track = dynamic_cast<TrackOutput*>(conn.input->parent());
|
||||
|
||||
if (track) {
|
||||
return track;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const rational &TrackOutput::track_length() const
|
||||
const rational &Track::track_length() const
|
||||
{
|
||||
return track_length_;
|
||||
}
|
||||
|
||||
QString TrackOutput::GetDefaultTrackName(Timeline::TrackType type, int index)
|
||||
QString Track::GetDefaultTrackName(Track::Type type, int index)
|
||||
{
|
||||
// Starts tracks at 1 rather than 0
|
||||
int user_friendly_index = index+1;
|
||||
|
||||
switch (type) {
|
||||
case Timeline::kTrackTypeVideo: return tr("Video %1").arg(user_friendly_index);
|
||||
case Timeline::kTrackTypeAudio: return tr("Audio %1").arg(user_friendly_index);
|
||||
case Timeline::kTrackTypeSubtitle: return tr("Subtitle %1").arg(user_friendly_index);
|
||||
case Timeline::kTrackTypeNone:
|
||||
case Timeline::kTrackTypeCount:
|
||||
case Track::kVideo: return tr("Video %1").arg(user_friendly_index);
|
||||
case Track::kAudio: return tr("Audio %1").arg(user_friendly_index);
|
||||
case Track::kSubtitle: return tr("Subtitle %1").arg(user_friendly_index);
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
break;
|
||||
}
|
||||
|
||||
return tr("Track %1").arg(user_friendly_index);
|
||||
}
|
||||
|
||||
bool TrackOutput::IsMuted() const
|
||||
bool Track::IsMuted() const
|
||||
{
|
||||
return muted_input_->GetStandardValue().toBool();
|
||||
}
|
||||
|
||||
bool TrackOutput::IsLocked() const
|
||||
bool Track::IsLocked() const
|
||||
{
|
||||
return locked_;
|
||||
}
|
||||
|
||||
NodeInput *TrackOutput::block_input() const
|
||||
NodeInput *Track::block_input() const
|
||||
{
|
||||
return block_input_;
|
||||
}
|
||||
|
||||
void TrackOutput::Hash(QCryptographicHash &hash, const rational &time) const
|
||||
void Track::Hash(QCryptographicHash &hash, const rational &time) const
|
||||
{
|
||||
Block* b = BlockAtTime(time);
|
||||
|
||||
@@ -417,18 +404,18 @@ void TrackOutput::Hash(QCryptographicHash &hash, const rational &time) const
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::SetMuted(bool e)
|
||||
void Track::SetMuted(bool e)
|
||||
{
|
||||
muted_input_->SetStandardValue(e);
|
||||
Node::InvalidateCache(TimeRange(0, track_length()));
|
||||
}
|
||||
|
||||
void TrackOutput::SetLocked(bool e)
|
||||
void Track::SetLocked(bool e)
|
||||
{
|
||||
locked_ = e;
|
||||
}
|
||||
|
||||
void TrackOutput::UpdateInOutFrom(int index)
|
||||
void Track::UpdateInOutFrom(int index)
|
||||
{
|
||||
// Find block just before this one to find the last out point
|
||||
rational last_out = (index == 0) ? 0 : block_cache_.at(index - 1)->out();
|
||||
@@ -442,20 +429,18 @@ void TrackOutput::UpdateInOutFrom(int index)
|
||||
last_out += b->length();
|
||||
|
||||
b->set_out(last_out);
|
||||
|
||||
emit b->Refreshed();
|
||||
}
|
||||
|
||||
// Update track length
|
||||
SetLengthInternal(last_out);
|
||||
}
|
||||
|
||||
int TrackOutput::GetInputIndexFromCacheIndex(int cache_index)
|
||||
int Track::GetInputIndexFromCacheIndex(int cache_index)
|
||||
{
|
||||
return GetInputIndexFromCacheIndex(block_cache_.at(cache_index));
|
||||
}
|
||||
|
||||
int TrackOutput::GetInputIndexFromCacheIndex(Block *block)
|
||||
int Track::GetInputIndexFromCacheIndex(Block *block)
|
||||
{
|
||||
for (int i=0; i<block_input_->ArraySize(); i++) {
|
||||
if (block_input_->GetConnectedNode(i) == block) {
|
||||
@@ -466,7 +451,7 @@ int TrackOutput::GetInputIndexFromCacheIndex(Block *block)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void TrackOutput::SetLengthInternal(const rational &r, bool invalidate)
|
||||
void Track::SetLengthInternal(const rational &r, bool invalidate)
|
||||
{
|
||||
if (r != track_length_) {
|
||||
TimeRange invalidate_range(track_length_, r);
|
||||
@@ -480,7 +465,7 @@ void TrackOutput::SetLengthInternal(const rational &r, bool invalidate)
|
||||
}
|
||||
}
|
||||
|
||||
void TrackOutput::BlockConnected(Node *node, int element)
|
||||
void Track::BlockConnected(Node *node, int element)
|
||||
{
|
||||
if (element == -1) {
|
||||
// User has replaced the entire array, we will invalidate everything
|
||||
@@ -541,7 +526,7 @@ void TrackOutput::BlockConnected(Node *node, int element)
|
||||
UpdateInOutFrom(cache_index);
|
||||
|
||||
// Connect to the block
|
||||
connect(block, &Block::LengthChanged, this, &TrackOutput::BlockLengthChanged);
|
||||
connect(block, &Block::LengthChanged, this, &Track::BlockLengthChanged);
|
||||
|
||||
// Invalidate cache now that block should have an in point
|
||||
Node::InvalidateCache(TimeRange(block->in(), track_length()));
|
||||
@@ -550,7 +535,7 @@ void TrackOutput::BlockConnected(Node *node, int element)
|
||||
emit BlockAdded(block);
|
||||
}
|
||||
|
||||
void TrackOutput::BlockDisconnected(Node* node, int element)
|
||||
void Track::BlockDisconnected(Node* node, int element)
|
||||
{
|
||||
if (element == -1) {
|
||||
// User has replaced the entire array, we will invalidate everything
|
||||
@@ -592,14 +577,14 @@ void TrackOutput::BlockDisconnected(Node* node, int element)
|
||||
SetLengthInternal(block_cache_.last()->out());
|
||||
}
|
||||
|
||||
disconnect(b, &Block::LengthChanged, this, &TrackOutput::BlockLengthChanged);
|
||||
disconnect(b, &Block::LengthChanged, this, &Track::BlockLengthChanged);
|
||||
|
||||
emit BlockRemoved(b);
|
||||
|
||||
Node::InvalidateCache(invalidate_range);
|
||||
}
|
||||
|
||||
void TrackOutput::BlockLengthChanged()
|
||||
void Track::BlockLengthChanged()
|
||||
{
|
||||
// Assumes sender is a Block
|
||||
Block* b = static_cast<Block*>(sender());
|
||||
@@ -615,7 +600,7 @@ void TrackOutput::BlockLengthChanged()
|
||||
Node::InvalidateCache(invalidate_region);
|
||||
}
|
||||
|
||||
void TrackOutput::MutedInputValueChanged()
|
||||
void Track::MutedInputValueChanged()
|
||||
{
|
||||
emit MutedChanged(IsMuted());
|
||||
}
|
||||
|
||||
@@ -30,16 +30,24 @@ namespace olive {
|
||||
/**
|
||||
* @brief A time traversal Node for sorting through one channel/track of Blocks
|
||||
*/
|
||||
class TrackOutput : public Node
|
||||
class Track : public Node
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackOutput();
|
||||
enum Type {
|
||||
kNone = -1,
|
||||
kVideo,
|
||||
kAudio,
|
||||
kSubtitle,
|
||||
kCount
|
||||
};
|
||||
|
||||
virtual ~TrackOutput() override;
|
||||
Track();
|
||||
|
||||
const Timeline::TrackType& track_type() const;
|
||||
void set_track_type(const Timeline::TrackType& track_type);
|
||||
virtual ~Track() override;
|
||||
|
||||
const Track::Type& track_type() const;
|
||||
void set_track_type(const Track::Type& track_type);
|
||||
|
||||
virtual Node* copy() const override;
|
||||
|
||||
@@ -199,11 +207,9 @@ public:
|
||||
*/
|
||||
void ReplaceBlock(Block* old, Block* replace);
|
||||
|
||||
static TrackOutput* TrackFromBlock(const Block *block);
|
||||
|
||||
const rational& track_length() const;
|
||||
|
||||
static QString GetDefaultTrackName(Timeline::TrackType type, int index);
|
||||
static QString GetDefaultTrackName(Track::Type type, int index);
|
||||
|
||||
bool IsMuted() const;
|
||||
|
||||
@@ -282,7 +288,7 @@ private:
|
||||
|
||||
NodeInput* muted_input_;
|
||||
|
||||
Timeline::TrackType track_type_;
|
||||
Track::Type track_type_;
|
||||
|
||||
rational track_length_;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
TrackList::TrackList(ViewerOutput *parent, const Timeline::TrackType &type, NodeInput *track_input) :
|
||||
TrackList::TrackList(ViewerOutput *parent, const Track::Type &type, NodeInput *track_input) :
|
||||
QObject(parent),
|
||||
track_input_(track_input),
|
||||
type_(type)
|
||||
@@ -36,14 +36,14 @@ TrackList::TrackList(ViewerOutput *parent, const Timeline::TrackType &type, Node
|
||||
connect(track_input_, &NodeInput::InputDisconnected, this, &TrackList::TrackDisconnected);
|
||||
}
|
||||
|
||||
const Timeline::TrackType &TrackList::type() const
|
||||
const Track::Type &TrackList::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
void TrackList::TrackAddedBlock(Block *block)
|
||||
{
|
||||
emit BlockAdded(block, static_cast<TrackOutput*>(sender())->Index());
|
||||
emit BlockAdded(block, static_cast<Track*>(sender())->Index());
|
||||
}
|
||||
|
||||
void TrackList::TrackRemovedBlock(Block *block)
|
||||
@@ -51,12 +51,12 @@ void TrackList::TrackRemovedBlock(Block *block)
|
||||
emit BlockRemoved(block);
|
||||
}
|
||||
|
||||
const QVector<TrackOutput *> &TrackList::GetTracks() const
|
||||
const QVector<Track *> &TrackList::GetTracks() const
|
||||
{
|
||||
return track_cache_;
|
||||
}
|
||||
|
||||
TrackOutput *TrackList::GetTrackAt(int index) const
|
||||
Track *TrackList::GetTrackAt(int index) const
|
||||
{
|
||||
if (index < track_cache_.size()) {
|
||||
return track_cache_.at(index);
|
||||
@@ -83,16 +83,16 @@ void TrackList::TrackConnected(Node *node, int element)
|
||||
return;
|
||||
}
|
||||
|
||||
TrackOutput* track = dynamic_cast<TrackOutput*>(node);
|
||||
Track* track = dynamic_cast<Track*>(node);
|
||||
|
||||
if (!track) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Find "real" index
|
||||
TrackOutput* next = nullptr;
|
||||
Track* next = nullptr;
|
||||
for (int i=element+1; i<track_input_->ArraySize(); i++) {
|
||||
next = dynamic_cast<TrackOutput*>(track_input_->GetConnectedNode(i));
|
||||
next = dynamic_cast<Track*>(track_input_->GetConnectedNode(i));
|
||||
|
||||
if (next) {
|
||||
break;
|
||||
@@ -114,10 +114,10 @@ void TrackList::TrackConnected(Node *node, int element)
|
||||
// Update track indexes in the list (including this track)
|
||||
UpdateTrackIndexesFrom(track_index);
|
||||
|
||||
connect(track, &TrackOutput::BlockAdded, this, &TrackList::TrackAddedBlock);
|
||||
connect(track, &TrackOutput::BlockRemoved, this, &TrackList::TrackRemovedBlock);
|
||||
connect(track, &TrackOutput::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
|
||||
connect(track, &TrackOutput::TrackHeightChangedInPixels, this, &TrackList::TrackHeightChangedSlot);
|
||||
connect(track, &Track::BlockAdded, this, &TrackList::TrackAddedBlock);
|
||||
connect(track, &Track::BlockRemoved, this, &TrackList::TrackRemovedBlock);
|
||||
connect(track, &Track::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
|
||||
connect(track, &Track::TrackHeightChangedInPixels, this, &TrackList::TrackHeightChangedSlot);
|
||||
|
||||
track->set_track_type(type_);
|
||||
|
||||
@@ -134,7 +134,7 @@ void TrackList::TrackDisconnected(Node *node, int element)
|
||||
{
|
||||
Q_UNUSED(element)
|
||||
|
||||
TrackOutput* track = dynamic_cast<TrackOutput*>(node);
|
||||
Track* track = dynamic_cast<Track*>(node);
|
||||
|
||||
if (!track) {
|
||||
return;
|
||||
@@ -150,12 +150,12 @@ void TrackList::TrackDisconnected(Node *node, int element)
|
||||
emit TrackRemoved(track);
|
||||
|
||||
track->SetIndex(-1);
|
||||
track->set_track_type(Timeline::kTrackTypeNone);
|
||||
track->set_track_type(Track::kNone);
|
||||
|
||||
disconnect(track, &TrackOutput::BlockAdded, this, &TrackList::TrackAddedBlock);
|
||||
disconnect(track, &TrackOutput::BlockRemoved, this, &TrackList::TrackRemovedBlock);
|
||||
disconnect(track, &TrackOutput::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
|
||||
disconnect(track, &TrackOutput::TrackHeightChangedInPixels, this, &TrackList::TrackHeightChangedSlot);
|
||||
disconnect(track, &Track::BlockAdded, this, &TrackList::TrackAddedBlock);
|
||||
disconnect(track, &Track::BlockRemoved, this, &TrackList::TrackRemovedBlock);
|
||||
disconnect(track, &Track::TrackLengthChanged, this, &TrackList::UpdateTotalLength);
|
||||
disconnect(track, &Track::TrackHeightChangedInPixels, this, &TrackList::TrackHeightChangedSlot);
|
||||
|
||||
emit TrackListChanged();
|
||||
|
||||
@@ -178,7 +178,7 @@ void TrackList::UpdateTotalLength()
|
||||
{
|
||||
total_length_ = 0;
|
||||
|
||||
foreach (TrackOutput* track, track_cache_) {
|
||||
foreach (Track* track, track_cache_) {
|
||||
if (track) {
|
||||
total_length_ = qMax(total_length_, track->track_length());
|
||||
}
|
||||
@@ -189,7 +189,7 @@ void TrackList::UpdateTotalLength()
|
||||
|
||||
void TrackList::TrackHeightChangedSlot(int height)
|
||||
{
|
||||
emit TrackHeightChanged(static_cast<TrackOutput*>(sender())->Index(), height);
|
||||
emit TrackHeightChanged(static_cast<Track*>(sender())->Index(), height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ class TrackList : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackList(ViewerOutput *parent, const Timeline::TrackType& type, NodeInput* track_input);
|
||||
TrackList(ViewerOutput *parent, const Track::Type& type, NodeInput* track_input);
|
||||
|
||||
const Timeline::TrackType& type() const;
|
||||
const Track::Type& type() const;
|
||||
|
||||
const QVector<TrackOutput*>& GetTracks() const;
|
||||
const QVector<Track*>& GetTracks() const;
|
||||
|
||||
TrackOutput* GetTrackAt(int index) const;
|
||||
Track* GetTrackAt(int index) const;
|
||||
|
||||
const rational& GetTotalLength() const;
|
||||
|
||||
@@ -59,9 +59,9 @@ signals:
|
||||
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
void TrackAdded(TrackOutput* track);
|
||||
void TrackAdded(Track* track);
|
||||
|
||||
void TrackRemoved(TrackOutput* track);
|
||||
void TrackRemoved(Track* track);
|
||||
|
||||
void TrackListChanged();
|
||||
|
||||
@@ -75,13 +75,13 @@ private:
|
||||
/**
|
||||
* @brief A cache of connected Tracks
|
||||
*/
|
||||
QVector<TrackOutput*> track_cache_;
|
||||
QVector<Track*> track_cache_;
|
||||
|
||||
NodeInput* track_input_;
|
||||
|
||||
rational total_length_;
|
||||
|
||||
enum Timeline::TrackType type_;
|
||||
enum Track::Type type_;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
|
||||
@@ -34,16 +34,16 @@ ViewerOutput::ViewerOutput() :
|
||||
samples_input_ = new NodeInput(this, QStringLiteral("samples_in"), NodeValue::kSamples);
|
||||
|
||||
// Create TrackList instances
|
||||
track_inputs_.resize(Timeline::kTrackTypeCount);
|
||||
track_lists_.resize(Timeline::kTrackTypeCount);
|
||||
track_inputs_.resize(Track::kCount);
|
||||
track_lists_.resize(Track::kCount);
|
||||
|
||||
for (int i=0;i<Timeline::kTrackTypeCount;i++) {
|
||||
for (int i=0;i<Track::kCount;i++) {
|
||||
// Create track input
|
||||
NodeInput* track_input = new NodeInput(this, QStringLiteral("track_in_%1").arg(i), NodeValue::kNone);
|
||||
IgnoreConnectionSignalsFrom(track_input);
|
||||
IgnoreInvalidationsFrom(track_input);
|
||||
track_inputs_.replace(i, track_input);
|
||||
|
||||
TrackList* list = new TrackList(this, static_cast<Timeline::TrackType>(i), track_input);
|
||||
TrackList* list = new TrackList(this, static_cast<Track::Type>(i), track_input);
|
||||
track_lists_.replace(i, list);
|
||||
connect(list, &TrackList::TrackListChanged, this, &ViewerOutput::UpdateTrackCache);
|
||||
connect(list, &TrackList::LengthChanged, this, &ViewerOutput::VerifyLength);
|
||||
@@ -97,7 +97,7 @@ void ViewerOutput::ShiftAudioCache(const rational &from, const rational &to)
|
||||
{
|
||||
audio_playback_cache_.Shift(from, to);
|
||||
|
||||
foreach (TrackOutput* track, track_lists_.at(Timeline::kTrackTypeAudio)->GetTracks()) {
|
||||
foreach (Track* track, track_lists_.at(Track::kAudio)->GetTracks()) {
|
||||
track->waveform().Shift(from, to);
|
||||
}
|
||||
}
|
||||
@@ -176,9 +176,9 @@ rational ViewerOutput::GetLength()
|
||||
return last_length_;
|
||||
}
|
||||
|
||||
QVector<TrackOutput *> ViewerOutput::GetUnlockedTracks() const
|
||||
QVector<Track *> ViewerOutput::GetUnlockedTracks() const
|
||||
{
|
||||
QVector<TrackOutput*> tracks = GetTracks();
|
||||
QVector<Track*> tracks = GetTracks();
|
||||
|
||||
for (int i=0;i<tracks.size();i++) {
|
||||
if (tracks.at(i)->IsLocked()) {
|
||||
@@ -195,7 +195,7 @@ void ViewerOutput::UpdateTrackCache()
|
||||
track_cache_.clear();
|
||||
|
||||
foreach (TrackList* list, track_lists_) {
|
||||
foreach (TrackOutput* track, list->GetTracks()) {
|
||||
foreach (Track* track, list->GetTracks()) {
|
||||
track_cache_.append(track);
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ void ViewerOutput::VerifyLength()
|
||||
rational video_length, audio_length, subtitle_length;
|
||||
|
||||
{
|
||||
video_length = track_lists_.at(Timeline::kTrackTypeVideo)->GetTotalLength();
|
||||
video_length = track_lists_.at(Track::kVideo)->GetTotalLength();
|
||||
|
||||
if (video_length.isNull() && texture_input_->IsConnected()) {
|
||||
NodeValueTable t = traverser.GenerateTable(texture_input_->GetConnectedNode(), 0, 0);
|
||||
@@ -223,7 +223,7 @@ void ViewerOutput::VerifyLength()
|
||||
}
|
||||
|
||||
{
|
||||
audio_length = track_lists_.at(Timeline::kTrackTypeAudio)->GetTotalLength();
|
||||
audio_length = track_lists_.at(Track::kAudio)->GetTotalLength();
|
||||
|
||||
if (audio_length.isNull() && samples_input_->IsConnected()) {
|
||||
NodeValueTable t = traverser.GenerateTable(samples_input_->GetConnectedNode(), 0, 0);
|
||||
@@ -234,7 +234,7 @@ void ViewerOutput::VerifyLength()
|
||||
}
|
||||
|
||||
{
|
||||
subtitle_length = track_lists_.at(Timeline::kTrackTypeSubtitle)->GetTotalLength();
|
||||
subtitle_length = track_lists_.at(Track::kSubtitle)->GetTotalLength();
|
||||
}
|
||||
|
||||
rational real_length = qMax(subtitle_length, qMax(video_length, audio_length));
|
||||
@@ -256,18 +256,18 @@ void ViewerOutput::Retranslate()
|
||||
for (int i=0;i<track_inputs_.size();i++) {
|
||||
QString input_name;
|
||||
|
||||
switch (static_cast<Timeline::TrackType>(i)) {
|
||||
case Timeline::kTrackTypeVideo:
|
||||
switch (static_cast<Track::Type>(i)) {
|
||||
case Track::kVideo:
|
||||
input_name = tr("Video Tracks");
|
||||
break;
|
||||
case Timeline::kTrackTypeAudio:
|
||||
case Track::kAudio:
|
||||
input_name = tr("Audio Tracks");
|
||||
break;
|
||||
case Timeline::kTrackTypeSubtitle:
|
||||
case Track::kSubtitle:
|
||||
input_name = tr("Subtitle Tracks");
|
||||
break;
|
||||
case Timeline::kTrackTypeNone:
|
||||
case Timeline::kTrackTypeCount:
|
||||
case Track::kNone:
|
||||
case Track::kCount:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -293,13 +293,13 @@ void ViewerOutput::EndOperation()
|
||||
|
||||
void ViewerOutput::TrackListAddedBlock(Block *block, int index)
|
||||
{
|
||||
Timeline::TrackType type = static_cast<TrackList*>(sender())->type();
|
||||
Track::Type type = static_cast<TrackList*>(sender())->type();
|
||||
emit BlockAdded(block, TrackReference(type, index));
|
||||
}
|
||||
|
||||
void ViewerOutput::TrackListAddedTrack(TrackOutput *track)
|
||||
void ViewerOutput::TrackListAddedTrack(Track *track)
|
||||
{
|
||||
Timeline::TrackType type = static_cast<TrackList*>(sender())->type();
|
||||
Track::Type type = static_cast<TrackList*>(sender())->type();
|
||||
emit TrackAdded(track, type);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public:
|
||||
return uuid_;
|
||||
}
|
||||
|
||||
const QVector<TrackOutput *> &GetTracks() const
|
||||
const QVector<Track *> &GetTracks() const
|
||||
{
|
||||
return track_cache_;
|
||||
}
|
||||
@@ -100,14 +100,14 @@ public:
|
||||
/**
|
||||
* @brief Same as GetTracks() but omits tracks that are locked.
|
||||
*/
|
||||
QVector<TrackOutput *> GetUnlockedTracks() const;
|
||||
QVector<Track *> GetUnlockedTracks() const;
|
||||
|
||||
NodeInput* track_input(Timeline::TrackType type) const
|
||||
NodeInput* track_input(Track::Type type) const
|
||||
{
|
||||
return track_inputs_.at(type);
|
||||
}
|
||||
|
||||
TrackList* track_list(Timeline::TrackType type) const
|
||||
TrackList* track_list(Track::Type type) const
|
||||
{
|
||||
return track_lists_.at(type);
|
||||
}
|
||||
@@ -145,10 +145,10 @@ signals:
|
||||
void BlockAdded(Block* block, TrackReference track);
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
void TrackAdded(TrackOutput* track, Timeline::TrackType type);
|
||||
void TrackRemoved(TrackOutput* track);
|
||||
void TrackAdded(Track* track, Track::Type type);
|
||||
void TrackRemoved(Track* track);
|
||||
|
||||
void TrackHeightChanged(Timeline::TrackType type, int index, int height);
|
||||
void TrackHeightChanged(Track::Type type, int index, int height);
|
||||
|
||||
private:
|
||||
QUuid uuid_;
|
||||
@@ -165,7 +165,7 @@ private:
|
||||
|
||||
QVector<TrackList*> track_lists_;
|
||||
|
||||
QVector<TrackOutput*> track_cache_;
|
||||
QVector<Track*> track_cache_;
|
||||
|
||||
rational last_length_;
|
||||
|
||||
@@ -182,7 +182,7 @@ private slots:
|
||||
|
||||
void TrackListAddedBlock(Block* block, int index);
|
||||
|
||||
void TrackListAddedTrack(TrackOutput* track);
|
||||
void TrackListAddedTrack(Track* track);
|
||||
|
||||
void TrackHeightChangedSlot(int index, int height);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ NodeValueTable NodeTraverser::ProcessInput(NodeInput* input, const TimeRange& ra
|
||||
|
||||
NodeValueTable NodeTraverser::GenerateTable(const Node *n, const TimeRange& range)
|
||||
{
|
||||
const TrackOutput* track = dynamic_cast<const TrackOutput*>(n);
|
||||
const Track* track = dynamic_cast<const Track*>(n);
|
||||
if (track) {
|
||||
// If the range is not wholly contained in this Block, we'll need to do some extra processing
|
||||
return GenerateBlockTable(track, range);
|
||||
@@ -117,7 +117,7 @@ NodeValueTable NodeTraverser::GenerateTable(const Node *n, const rational &in, c
|
||||
return GenerateTable(n, TimeRange(in, out));
|
||||
}
|
||||
|
||||
NodeValueTable NodeTraverser::GenerateBlockTable(const TrackOutput *track, const TimeRange &range)
|
||||
NodeValueTable NodeTraverser::GenerateBlockTable(const Track *track, const TimeRange &range)
|
||||
{
|
||||
// By default, just follow the in point
|
||||
Block* active_block = track->BlockAtTime(range.in());
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
protected:
|
||||
NodeValueTable ProcessInput(NodeInput *input, const TimeRange &range);
|
||||
|
||||
virtual NodeValueTable GenerateBlockTable(const TrackOutput *track, const TimeRange& range);
|
||||
virtual NodeValueTable GenerateBlockTable(const Track *track, const TimeRange& range);
|
||||
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* stream, const rational &input_time);
|
||||
|
||||
|
||||
@@ -222,16 +222,16 @@ void Sequence::Save(QXmlStreamWriter *writer) const
|
||||
void Sequence::add_default_nodes()
|
||||
{
|
||||
// Create tracks and connect them to the viewer
|
||||
TrackOutput* video_track = new TrackOutput();
|
||||
Track* video_track = new Track();
|
||||
video_track->setParent(this);
|
||||
viewer_output_->track_input(Timeline::kTrackTypeVideo)->ArrayAppend();
|
||||
Node::ConnectEdge(video_track, viewer_output_->track_input(Timeline::kTrackTypeVideo), 0);
|
||||
viewer_output_->track_input(Track::kVideo)->ArrayAppend();
|
||||
Node::ConnectEdge(video_track, viewer_output_->track_input(Track::kVideo), 0);
|
||||
Node::ConnectEdge(video_track, viewer_output_->texture_input());
|
||||
|
||||
TrackOutput* audio_track = new TrackOutput();
|
||||
Track* audio_track = new Track();
|
||||
audio_track->setParent(this);
|
||||
viewer_output_->track_input(Timeline::kTrackTypeAudio)->ArrayAppend();
|
||||
Node::ConnectEdge(audio_track, viewer_output_->track_input(Timeline::kTrackTypeAudio), 0);
|
||||
viewer_output_->track_input(Track::kAudio)->ArrayAppend();
|
||||
Node::ConnectEdge(audio_track, viewer_output_->track_input(Track::kAudio), 0);
|
||||
Node::ConnectEdge(audio_track, viewer_output_->samples_input());
|
||||
}
|
||||
|
||||
|
||||
@@ -147,11 +147,11 @@ void PreviewAutoCacher::AudioRendered()
|
||||
QVector<RenderProcessor::RenderedWaveform> waveform_list = watcher->GetTicket()->property("waveforms").value< QVector<RenderProcessor::RenderedWaveform> >();
|
||||
foreach (const RenderProcessor::RenderedWaveform& waveform_info, waveform_list) {
|
||||
// Find original track
|
||||
TrackOutput* track = nullptr;
|
||||
Track* track = nullptr;
|
||||
|
||||
for (auto it=copy_map_.cbegin(); it!=copy_map_.cend(); it++) {
|
||||
if (it.value() == waveform_info.track) {
|
||||
track = static_cast<TrackOutput*>(it.key());
|
||||
track = static_cast<Track*>(it.key());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,9 +186,9 @@ void RenderProcessor::Process(RenderTicketPtr ticket, Renderer *render_ctx, Stil
|
||||
p.Run();
|
||||
}
|
||||
|
||||
NodeValueTable RenderProcessor::GenerateBlockTable(const TrackOutput *track, const TimeRange &range)
|
||||
NodeValueTable RenderProcessor::GenerateBlockTable(const Track *track, const TimeRange &range)
|
||||
{
|
||||
if (track->track_type() == Timeline::kTrackTypeAudio) {
|
||||
if (track->track_type() == Track::kAudio) {
|
||||
|
||||
const AudioParams& audio_params = ticket_->property("aparam").value<AudioParams>();
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ public:
|
||||
static void Process(RenderTicketPtr ticket, Renderer* render_ctx, StillImageCache* still_image_cache, DecoderCache* decoder_cache, ShaderCache* shader_cache, QVariant default_shader);
|
||||
|
||||
struct RenderedWaveform {
|
||||
const TrackOutput* track;
|
||||
const Track* track;
|
||||
AudioVisualWaveform waveform;
|
||||
TimeRange range;
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual NodeValueTable GenerateBlockTable(const TrackOutput *track, const TimeRange &range) override;
|
||||
virtual NodeValueTable GenerateBlockTable(const Track *track, const TimeRange &range) override;
|
||||
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* video_stream, const rational &input_time) override;
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
namespace olive {
|
||||
|
||||
class Block;
|
||||
class TrackOutput;
|
||||
class Track;
|
||||
|
||||
class Timeline {
|
||||
public:
|
||||
@@ -38,18 +38,10 @@ public:
|
||||
kTrimOut
|
||||
};
|
||||
|
||||
enum TrackType {
|
||||
kTrackTypeNone = -1,
|
||||
kTrackTypeVideo,
|
||||
kTrackTypeAudio,
|
||||
kTrackTypeSubtitle,
|
||||
kTrackTypeCount
|
||||
};
|
||||
|
||||
static bool IsATrimMode(MovementMode mode) {return mode == kTrimIn || mode == kTrimOut;}
|
||||
|
||||
struct EditToInfo {
|
||||
TrackOutput* track;
|
||||
Track* track;
|
||||
rational nearest_time;
|
||||
Block* nearest_block;
|
||||
};
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
namespace olive {
|
||||
|
||||
TimelineCoordinate::TimelineCoordinate() :
|
||||
track_(Timeline::kTrackTypeNone, 0)
|
||||
track_(Track::kNone, 0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ TimelineCoordinate::TimelineCoordinate(const rational &frame, const TrackReferen
|
||||
{
|
||||
}
|
||||
|
||||
TimelineCoordinate::TimelineCoordinate(const rational &frame, const Timeline::TrackType &track_type, const int &track_index) :
|
||||
TimelineCoordinate::TimelineCoordinate(const rational &frame, const Track::Type &track_type, const int &track_index) :
|
||||
frame_(frame),
|
||||
track_(track_type, track_index)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@ class TimelineCoordinate
|
||||
public:
|
||||
TimelineCoordinate();
|
||||
TimelineCoordinate(const rational& frame, const TrackReference& track);
|
||||
TimelineCoordinate(const rational& frame, const Timeline::TrackType& track_type, const int& track_index);
|
||||
TimelineCoordinate(const rational& frame, const Track::Type& track_type, const int& track_index);
|
||||
|
||||
const rational& GetFrame() const;
|
||||
const TrackReference& GetTrack() const;
|
||||
|
||||
@@ -23,18 +23,18 @@
|
||||
namespace olive {
|
||||
|
||||
TrackReference::TrackReference() :
|
||||
type_(Timeline::kTrackTypeNone),
|
||||
type_(Track::kNone),
|
||||
index_(0)
|
||||
{
|
||||
}
|
||||
|
||||
TrackReference::TrackReference(const Timeline::TrackType &type, const int &index) :
|
||||
TrackReference::TrackReference(const Track::Type &type, const int &index) :
|
||||
type_(type),
|
||||
index_(index)
|
||||
{
|
||||
}
|
||||
|
||||
const Timeline::TrackType &TrackReference::type() const
|
||||
const Track::Type &TrackReference::type() const
|
||||
{
|
||||
return type_;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef TRACKREFERENCE_H
|
||||
#define TRACKREFERENCE_H
|
||||
|
||||
#include "node/output/track/track.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
|
||||
namespace olive {
|
||||
@@ -30,9 +31,9 @@ class TrackReference
|
||||
public:
|
||||
TrackReference();
|
||||
|
||||
TrackReference(const Timeline::TrackType& type, const int& index);
|
||||
TrackReference(const Track::Type& type, const int& index);
|
||||
|
||||
const Timeline::TrackType& type() const;
|
||||
const Track::Type& type() const;
|
||||
|
||||
const int& index() const;
|
||||
|
||||
@@ -43,7 +44,7 @@ public:
|
||||
bool operator!=(const TrackReference& ref) const;
|
||||
|
||||
private:
|
||||
Timeline::TrackType type_;
|
||||
Track::Type type_;
|
||||
|
||||
int index_;
|
||||
|
||||
|
||||
@@ -639,7 +639,7 @@ void ProjectExplorer::DeleteSelected()
|
||||
QVector<Block*> blocks_to_remove;
|
||||
|
||||
foreach (Sequence* s, used_in_sequences) {
|
||||
foreach (TrackOutput* track, s->viewer_output()->GetTracks()) {
|
||||
foreach (Track* track, s->viewer_output()->GetTracks()) {
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
QVector<Node*> deps = b->GetDependencies();
|
||||
|
||||
|
||||
@@ -301,7 +301,7 @@ void TimeBasedWidget::GoToPrevCut()
|
||||
|
||||
int64_t closest_cut = 0;
|
||||
|
||||
foreach (TrackOutput* track, viewer_node_->GetTracks()) {
|
||||
foreach (Track* track, viewer_node_->GetTracks()) {
|
||||
int64_t this_track_closest_cut = 0;
|
||||
|
||||
foreach (Block* block, track->Blocks()) {
|
||||
@@ -328,7 +328,7 @@ void TimeBasedWidget::GoToNextCut()
|
||||
|
||||
int64_t closest_cut = INT64_MAX;
|
||||
|
||||
foreach (TrackOutput* track, GetConnectedNode()->GetTracks()) {
|
||||
foreach (Track* track, GetConnectedNode()->GetTracks()) {
|
||||
int64_t this_track_closest_cut = Timecode::time_to_timestamp(track->track_length(), timebase());
|
||||
|
||||
if (this_track_closest_cut <= GetTimestamp()) {
|
||||
|
||||
@@ -176,12 +176,6 @@ TimelineWidget::~TimelineWidget()
|
||||
|
||||
void TimelineWidget::Clear()
|
||||
{
|
||||
// Delete all items
|
||||
for (auto iterator=block_items_.begin(); iterator!=block_items_.end(); iterator++) {
|
||||
delete iterator.value();
|
||||
}
|
||||
block_items_.clear();
|
||||
|
||||
// Emit that we've deselected any selected blocks
|
||||
SignalDeselectedAllBlocks();
|
||||
|
||||
@@ -197,14 +191,6 @@ void TimelineWidget::TimebaseChangedEvent(const rational &timebase)
|
||||
|
||||
timecode_label_->setVisible(!timebase.isNull());
|
||||
|
||||
QMap<Block*, TimelineViewBlockItem*>::const_iterator iterator;
|
||||
|
||||
for (iterator=block_items_.begin();iterator!=block_items_.end();iterator++) {
|
||||
if (iterator.value()) {
|
||||
iterator.value()->SetTimebase(timebase);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateViewTimebases();
|
||||
}
|
||||
|
||||
@@ -227,14 +213,6 @@ void TimelineWidget::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimeBasedWidget::ScaleChangedEvent(scale);
|
||||
|
||||
QMap<Block*, TimelineViewBlockItem*>::const_iterator iterator;
|
||||
|
||||
for (iterator=block_items_.begin();iterator!=block_items_.end();iterator++) {
|
||||
if (iterator.value()) {
|
||||
iterator.value()->SetScale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (TimelineAndTrackView* view, views_) {
|
||||
view->view()->SetScale(scale);
|
||||
}
|
||||
@@ -254,7 +232,7 @@ void TimelineWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
SetTimebase(n->video_params().time_base());
|
||||
|
||||
for (int i=0;i<views_.size();i++) {
|
||||
Timeline::TrackType track_type = static_cast<Timeline::TrackType>(i);
|
||||
Track::Type track_type = static_cast<Track::Type>(i);
|
||||
TimelineView* view = views_.at(i)->view();
|
||||
TrackList* track_list = n->track_list(track_type);
|
||||
TrackView* track_view = views_.at(i)->track_view();
|
||||
@@ -263,7 +241,7 @@ void TimelineWidget::ConnectNodeInternal(ViewerOutput *n)
|
||||
view->ConnectTrackList(track_list);
|
||||
|
||||
// Defer to the track to make all the block UI items necessary
|
||||
foreach (TrackOutput* track, n->track_list(track_type)->GetTracks()) {
|
||||
foreach (Track* track, n->track_list(track_type)->GetTracks()) {
|
||||
AddTrack(track, track_type);
|
||||
}
|
||||
}
|
||||
@@ -280,7 +258,7 @@ void TimelineWidget::DisconnectNodeInternal(ViewerOutput *n)
|
||||
|
||||
DeselectAll();
|
||||
|
||||
foreach (TrackOutput* track, n->GetTracks()) {
|
||||
foreach (Track* track, n->GetTracks()) {
|
||||
RemoveTrack(track);
|
||||
}
|
||||
|
||||
@@ -299,24 +277,22 @@ void TimelineWidget::DisconnectNodeInternal(ViewerOutput *n)
|
||||
void TimelineWidget::CopyNodesToClipboardInternal(QXmlStreamWriter *writer, void* userdata)
|
||||
{
|
||||
// Cache the earliest in point so all copied clips have a "relative" in point that can be pasted anywhere
|
||||
QVector<TimelineViewBlockItem*>& selected = *static_cast<QVector<TimelineViewBlockItem*>*>(userdata);
|
||||
QVector<Block*>& selected = *static_cast<QVector<Block*>*>(userdata);
|
||||
rational earliest_in = RATIONAL_MAX;
|
||||
|
||||
foreach (TimelineViewBlockItem* item, selected) {
|
||||
foreach (Block* item, selected) {
|
||||
Block* block = item->block();
|
||||
|
||||
earliest_in = qMin(earliest_in, block->in());
|
||||
}
|
||||
|
||||
foreach (TimelineViewBlockItem* item, selected) {
|
||||
Block* block = item->block();
|
||||
|
||||
foreach (Block* block, selected) {
|
||||
writer->writeStartElement(QStringLiteral("block"));
|
||||
|
||||
writer->writeAttribute(QStringLiteral("ptr"), QString::number(reinterpret_cast<quintptr>(block)));
|
||||
writer->writeAttribute(QStringLiteral("in"), (block->in() - earliest_in).toString());
|
||||
|
||||
TrackOutput* track = TrackOutput::TrackFromBlock(block);
|
||||
Track* track = GetTrackFromBlock(block);
|
||||
|
||||
if (track) {
|
||||
writer->writeAttribute(QStringLiteral("tracktype"), QString::number(track->track_type()));
|
||||
@@ -341,7 +317,7 @@ void TimelineWidget::PasteNodesFromClipboardInternal(QXmlStreamReader *reader, X
|
||||
} else if (attr.name() == QStringLiteral("in")) {
|
||||
bpd.in = rational::fromString(attr.value().toString());
|
||||
} else if (attr.name() == QStringLiteral("tracktype")) {
|
||||
bpd.track_type = static_cast<Timeline::TrackType>(attr.value().toInt());
|
||||
bpd.track_type = static_cast<Track::Type>(attr.value().toInt());
|
||||
} else if (attr.name() == QStringLiteral("trackindex")) {
|
||||
bpd.track_index = attr.value().toInt();
|
||||
}
|
||||
@@ -417,7 +393,7 @@ void TimelineWidget::SplitAtPlayhead()
|
||||
bool some_blocks_are_selected = false;
|
||||
|
||||
// Get all blocks at the playhead
|
||||
foreach (TrackOutput* track, GetConnectedNode()->GetTracks()) {
|
||||
foreach (Track* track, GetConnectedNode()->GetTracks()) {
|
||||
Block* b = track->BlockContainingTime(playhead_time);
|
||||
|
||||
if (b && b->type() == Block::kClip) {
|
||||
@@ -464,7 +440,7 @@ void TimelineWidget::ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
|
||||
continue;
|
||||
}
|
||||
|
||||
TrackOutput* original_track = TrackOutput::TrackFromBlock(b);
|
||||
Track* original_track = Track::TrackFromBlock(b);
|
||||
|
||||
new TrackReplaceBlockWithGapCommand(original_track, b, command);
|
||||
|
||||
@@ -505,7 +481,7 @@ void TimelineWidget::DeleteSelected(bool ripple)
|
||||
|
||||
// For transitions, remove them but extend their attached blocks to fill their place
|
||||
foreach (TransitionBlock* transition, transitions_to_delete) {
|
||||
new TransitionRemoveCommand(TrackOutput::TrackFromBlock(transition),
|
||||
new TransitionRemoveCommand(Track::TrackFromBlock(transition),
|
||||
transition,
|
||||
command);
|
||||
|
||||
@@ -538,11 +514,11 @@ void TimelineWidget::IncreaseTrackHeight()
|
||||
return;
|
||||
}
|
||||
|
||||
QVector<TrackOutput*> all_tracks = GetConnectedNode()->GetTracks();
|
||||
QVector<Track*> all_tracks = GetConnectedNode()->GetTracks();
|
||||
|
||||
// Increase the height of each track by one "unit"
|
||||
foreach (TrackOutput* t, all_tracks) {
|
||||
t->SetTrackHeight(t->GetTrackHeight() + TrackOutput::kTrackHeightInterval);
|
||||
foreach (Track* t, all_tracks) {
|
||||
t->SetTrackHeight(t->GetTrackHeight() + Track::kTrackHeightInterval);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,11 +528,11 @@ void TimelineWidget::DecreaseTrackHeight()
|
||||
return;
|
||||
}
|
||||
|
||||
QVector<TrackOutput*> all_tracks = GetConnectedNode()->GetTracks();
|
||||
QVector<Track*> all_tracks = GetConnectedNode()->GetTracks();
|
||||
|
||||
// Decrease the height of each track by one "unit"
|
||||
foreach (TrackOutput* t, all_tracks) {
|
||||
t->SetTrackHeight(qMax(t->GetTrackHeight() - TrackOutput::kTrackHeightInterval, TrackOutput::kTrackHeightMinimum));
|
||||
foreach (Track* t, all_tracks) {
|
||||
t->SetTrackHeight(qMax(t->GetTrackHeight() - Track::kTrackHeightInterval, Track::kTrackHeightMinimum));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -688,9 +664,9 @@ void TimelineWidget::DeleteInToOut(bool ripple)
|
||||
command);
|
||||
|
||||
} else {
|
||||
QVector<TrackOutput*> unlocked_tracks = GetConnectedNode()->GetUnlockedTracks();
|
||||
QVector<Track*> unlocked_tracks = GetConnectedNode()->GetUnlockedTracks();
|
||||
|
||||
foreach (TrackOutput* track, unlocked_tracks) {
|
||||
foreach (Track* track, unlocked_tracks) {
|
||||
GapBlock* gap = new GapBlock();
|
||||
|
||||
gap->set_length_and_media_out(GetConnectedTimelinePoints()->workarea()->length());
|
||||
@@ -740,9 +716,9 @@ void TimelineWidget::ToggleSelectedEnabled()
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
QVector<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
||||
QVector<Block *> TimelineWidget::GetSelectedBlocks()
|
||||
{
|
||||
QVector<TimelineViewBlockItem *> list(selected_blocks_.size());
|
||||
QVector<Block*> list(selected_blocks_.size());
|
||||
|
||||
for (int i=0; i<selected_blocks_.size(); i++) {
|
||||
list[i] = block_items_.value(selected_blocks_.at(i));
|
||||
@@ -754,14 +730,14 @@ QVector<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
||||
void TimelineWidget::InsertGapsAt(const rational &earliest_point, const rational &insert_length, QUndoCommand *command)
|
||||
{
|
||||
for (int i=0;i<Timeline::kTrackTypeCount;i++) {
|
||||
new TrackListInsertGaps(GetConnectedNode()->track_list(static_cast<Timeline::TrackType>(i)),
|
||||
new TrackListInsertGaps(GetConnectedNode()->track_list(static_cast<Track::Type>(i)),
|
||||
earliest_point,
|
||||
insert_length,
|
||||
command);
|
||||
}
|
||||
}
|
||||
|
||||
TrackOutput *TimelineWidget::GetTrackFromReference(const TrackReference &ref)
|
||||
Track *TimelineWidget::GetTrackFromReference(const TrackReference &ref) const
|
||||
{
|
||||
return GetConnectedNode()->track_list(ref.type())->GetTrackAt(ref.index());
|
||||
}
|
||||
@@ -895,7 +871,6 @@ void TimelineWidget::AddBlock(Block *block, TrackReference track)
|
||||
// Add item to graphics scene
|
||||
views_.at(track.type())->view()->scene()->addItem(item);
|
||||
|
||||
connect(block, &Block::Refreshed, this, &TimelineWidget::BlockRefreshed);
|
||||
connect(block, &Block::LinksChanged, this, &TimelineWidget::BlockUpdated);
|
||||
connect(block, &Block::LabelChanged, this, &TimelineWidget::BlockUpdated);
|
||||
connect(block, &Block::EnabledChanged, this, &TimelineWidget::BlockUpdated);
|
||||
@@ -911,7 +886,6 @@ void TimelineWidget::AddBlock(Block *block, TrackReference track)
|
||||
void TimelineWidget::RemoveBlock(Block *b)
|
||||
{
|
||||
// Disconnect all signals
|
||||
disconnect(b, &Block::Refreshed, this, &TimelineWidget::BlockRefreshed);
|
||||
disconnect(b, &Block::LinksChanged, this, &TimelineWidget::BlockUpdated);
|
||||
disconnect(b, &Block::LabelChanged, this, &TimelineWidget::BlockUpdated);
|
||||
disconnect(b, &Block::EnabledChanged, this, &TimelineWidget::BlockUpdated);
|
||||
@@ -932,20 +906,20 @@ void TimelineWidget::RemoveBlock(Block *b)
|
||||
emit BlocksDeselected({b});
|
||||
}
|
||||
|
||||
void TimelineWidget::AddTrack(TrackOutput *track, Timeline::TrackType type)
|
||||
void TimelineWidget::AddTrack(Track *track, Track::Type type)
|
||||
{
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
AddBlock(b, TrackReference(type, track->Index()));
|
||||
}
|
||||
|
||||
connect(track, &TrackOutput::IndexChanged, this, &TimelineWidget::TrackIndexChanged);
|
||||
connect(track, &TrackOutput::PreviewChanged, this, &TimelineWidget::TrackPreviewUpdated);
|
||||
connect(track, &Track::IndexChanged, this, &TimelineWidget::TrackIndexChanged);
|
||||
connect(track, &Track::PreviewChanged, this, &TimelineWidget::TrackPreviewUpdated);
|
||||
}
|
||||
|
||||
void TimelineWidget::RemoveTrack(TrackOutput *track)
|
||||
void TimelineWidget::RemoveTrack(Track *track)
|
||||
{
|
||||
disconnect(track, &TrackOutput::IndexChanged, this, &TimelineWidget::TrackIndexChanged);
|
||||
disconnect(track, &TrackOutput::PreviewChanged, this, &TimelineWidget::TrackPreviewUpdated);
|
||||
disconnect(track, &Track::IndexChanged, this, &TimelineWidget::TrackIndexChanged);
|
||||
disconnect(track, &Track::PreviewChanged, this, &TimelineWidget::TrackPreviewUpdated);
|
||||
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
RemoveBlock(b);
|
||||
@@ -954,7 +928,7 @@ void TimelineWidget::RemoveTrack(TrackOutput *track)
|
||||
|
||||
void TimelineWidget::TrackIndexChanged()
|
||||
{
|
||||
TrackOutput* track = static_cast<TrackOutput*>(sender());
|
||||
Track* track = static_cast<Track*>(sender());
|
||||
TrackReference ref(track->track_type(), track->Index());
|
||||
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
@@ -987,7 +961,7 @@ void TimelineWidget::TrackPreviewUpdated()
|
||||
{
|
||||
QMap<Block*, TimelineViewBlockItem*>::const_iterator i;
|
||||
|
||||
TrackOutput* track = static_cast<TrackOutput*>(sender());
|
||||
Track* track = static_cast<Track*>(sender());
|
||||
TrackReference track_ref(track->track_type(), track->Index());
|
||||
|
||||
for (i=block_items_.constBegin(); i!=block_items_.constEnd(); i++) {
|
||||
@@ -1019,7 +993,7 @@ void TimelineWidget::UpdateTimecodeWidthFromSplitters(QSplitter* s)
|
||||
timecode_label_->setFixedWidth(s->sizes().first() + s->handleWidth());
|
||||
}
|
||||
|
||||
void TimelineWidget::TrackHeightChanged(Timeline::TrackType type, int index, int height)
|
||||
void TimelineWidget::TrackHeightChanged(Track::Type type, int index, int height)
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
Q_UNUSED(height)
|
||||
@@ -1195,7 +1169,7 @@ TimelineView *TimelineWidget::GetFirstTimelineView()
|
||||
return views_.first()->view();
|
||||
}
|
||||
|
||||
rational TimelineWidget::GetTimebaseForTrackType(Timeline::TrackType type)
|
||||
rational TimelineWidget::GetTimebaseForTrackType(Track::Type type)
|
||||
{
|
||||
return views_.at(type)->view()->timebase();
|
||||
}
|
||||
@@ -1253,7 +1227,7 @@ QVector<Timeline::EditToInfo> TimelineWidget::GetEditToInfo(const rational& play
|
||||
Timeline::MovementMode mode)
|
||||
{
|
||||
// Get list of unlocked tracks
|
||||
QVector<TrackOutput*> tracks = GetConnectedNode()->GetUnlockedTracks();
|
||||
QVector<Track*> tracks = GetConnectedNode()->GetUnlockedTracks();
|
||||
|
||||
// Create list to cache nearest times and the blocks at this point
|
||||
QVector<Timeline::EditToInfo> info_list(tracks.size());
|
||||
@@ -1261,7 +1235,7 @@ QVector<Timeline::EditToInfo> TimelineWidget::GetEditToInfo(const rational& play
|
||||
for (int i=0;i<tracks.size();i++) {
|
||||
Timeline::EditToInfo info;
|
||||
|
||||
TrackOutput* track = tracks.at(i);
|
||||
Track* track = tracks.at(i);
|
||||
info.track = track;
|
||||
|
||||
Block* b;
|
||||
@@ -1390,7 +1364,7 @@ void TimelineWidget::ShowSnap(const QList<rational> ×)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidget::UpdateViewports(const Timeline::TrackType &type)
|
||||
void TimelineWidget::UpdateViewports(const Track::Type &type)
|
||||
{
|
||||
if (type == Timeline::kTrackTypeNone) {
|
||||
foreach (TimelineAndTrackView* tview, views_) {
|
||||
@@ -1475,7 +1449,7 @@ void TimelineWidget::MoveRubberBandSelect(bool enable_selecting, bool select_lin
|
||||
continue;
|
||||
}
|
||||
|
||||
TrackOutput* t = GetTrackFromReference(block_item->Track());
|
||||
Track* t = GetTrackFromReference(block_item->Track());
|
||||
if (t && t->IsLocked()) {
|
||||
continue;
|
||||
}
|
||||
@@ -1515,7 +1489,7 @@ void TimelineWidget::AddSelection(const TimeRange &time, const TrackReference &t
|
||||
UpdateViewports(track.type());
|
||||
}
|
||||
|
||||
void TimelineWidget::AddSelection(TimelineViewBlockItem *item)
|
||||
void TimelineWidget::AddSelection(Block *item)
|
||||
{
|
||||
AddSelection(item->block()->range(), item->Track());
|
||||
}
|
||||
@@ -1527,7 +1501,7 @@ void TimelineWidget::RemoveSelection(const TimeRange &time, const TrackReference
|
||||
UpdateViewports(track.type());
|
||||
}
|
||||
|
||||
void TimelineWidget::RemoveSelection(TimelineViewBlockItem *item)
|
||||
void TimelineWidget::RemoveSelection(Block *item)
|
||||
{
|
||||
RemoveSelection(item->block()->range(), item->Track());
|
||||
}
|
||||
@@ -1539,7 +1513,7 @@ void TimelineWidget::SetSelections(const TimelineWidgetSelections &s)
|
||||
UpdateViewports();
|
||||
}
|
||||
|
||||
TimelineViewBlockItem *TimelineWidget::GetItemAtScenePos(const TimelineCoordinate& coord)
|
||||
Block *TimelineWidget::GetItemAtScenePos(const TimelineCoordinate& coord)
|
||||
{
|
||||
for (auto it=block_items_.cbegin(); it!=block_items_.cend(); it++) {
|
||||
Block* b = it.key();
|
||||
|
||||
@@ -89,7 +89,20 @@ public:
|
||||
|
||||
void ToggleSelectedEnabled();
|
||||
|
||||
QVector<TimelineViewBlockItem*> GetSelectedBlocks();
|
||||
const QVector<Block*>& GetSelectedBlocks() const
|
||||
{
|
||||
return selected_blocks_;
|
||||
}
|
||||
|
||||
Track* GetTrackFromBlock(Block* block) const
|
||||
{
|
||||
return GetTrackFromReference(GetTrackReferenceFromBlock(block));
|
||||
}
|
||||
|
||||
TrackReference GetTrackReferenceFromBlock(Block* block) const
|
||||
{
|
||||
return track_lookup_.value(block);
|
||||
}
|
||||
|
||||
virtual bool SnapPoint(QList<rational> start_times, rational *movement, int snap_points = kSnapAll) override;
|
||||
|
||||
@@ -107,18 +120,13 @@ public:
|
||||
* Requires a float-based scene position. If you have a screen position, use GetScenePos() first to convert it to a
|
||||
* scene position
|
||||
*/
|
||||
TimelineViewBlockItem* GetItemAtScenePos(const TimelineCoordinate &coord);
|
||||
|
||||
const QMap<Block*, TimelineViewBlockItem*>& GetBlockItems() const
|
||||
{
|
||||
return block_items_;
|
||||
}
|
||||
Block* GetItemAtScenePos(const TimelineCoordinate &coord);
|
||||
|
||||
void AddSelection(const TimeRange& time, const TrackReference& track);
|
||||
void AddSelection(TimelineViewBlockItem* item);
|
||||
void AddSelection(Block* item);
|
||||
|
||||
void RemoveSelection(const TimeRange& time, const TrackReference& track);
|
||||
void RemoveSelection(TimelineViewBlockItem* item);
|
||||
void RemoveSelection(Block* item);
|
||||
|
||||
const TimelineWidgetSelections& GetSelections() const
|
||||
{
|
||||
@@ -127,7 +135,7 @@ public:
|
||||
|
||||
void SetSelections(const TimelineWidgetSelections &s);
|
||||
|
||||
TrackOutput* GetTrackFromReference(const TrackReference& ref);
|
||||
Track* GetTrackFromReference(const TrackReference& ref) const;
|
||||
|
||||
void SetViewBeamCursor(const TimelineCoordinate& coord);
|
||||
|
||||
@@ -165,7 +173,7 @@ public:
|
||||
|
||||
TimelineView* GetFirstTimelineView();
|
||||
|
||||
rational GetTimebaseForTrackType(Timeline::TrackType type);
|
||||
rational GetTimebaseForTrackType(Track::Type type);
|
||||
|
||||
const QRect &GetRubberBandGeometry() const;
|
||||
|
||||
@@ -218,7 +226,7 @@ protected:
|
||||
struct BlockPasteData {
|
||||
Block* block;
|
||||
rational in;
|
||||
Timeline::TrackType track_type;
|
||||
Track::Type track_type;
|
||||
int track_index;
|
||||
};
|
||||
|
||||
@@ -231,7 +239,7 @@ private:
|
||||
|
||||
void ShowSnap(const QList<rational>& times);
|
||||
|
||||
void UpdateViewports(const Timeline::TrackType& type = Timeline::kTrackTypeNone);
|
||||
void UpdateViewports(const Track::Type& type = Track::kNone);
|
||||
|
||||
QPoint drag_origin_;
|
||||
|
||||
@@ -251,7 +259,7 @@ private:
|
||||
|
||||
QVector<TimelineViewGhostItem*> ghost_items_;
|
||||
|
||||
QMap<Block*, TimelineViewBlockItem*> block_items_;
|
||||
QHash<Block*, TrackReference> track_lookup_;
|
||||
|
||||
QList<TimelineAndTrackView*> views_;
|
||||
|
||||
@@ -283,8 +291,8 @@ private slots:
|
||||
void AddBlock(Block* block, TrackReference track);
|
||||
void RemoveBlock(Block *blocks);
|
||||
|
||||
void AddTrack(TrackOutput* track, Timeline::TrackType type);
|
||||
void RemoveTrack(TrackOutput* track);
|
||||
void AddTrack(Track* track, Track::Type type);
|
||||
void RemoveTrack(Track* track);
|
||||
void TrackIndexChanged();
|
||||
|
||||
/**
|
||||
@@ -303,7 +311,7 @@ private slots:
|
||||
|
||||
void UpdateTimecodeWidthFromSplitters(QSplitter *s);
|
||||
|
||||
void TrackHeightChanged(Timeline::TrackType type, int index, int height);
|
||||
void TrackHeightChanged(Track::Type type, int index, int height);
|
||||
|
||||
void ShowContextMenu();
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ void TimelineWidgetSelections::ShiftTime(const rational &diff)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineWidgetSelections::ShiftTracks(Timeline::TrackType type, int diff)
|
||||
void TimelineWidgetSelections::ShiftTracks(Track::Type type, int diff)
|
||||
{
|
||||
TimelineWidgetSelections cached_selections;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
|
||||
void ShiftTime(const rational& diff);
|
||||
|
||||
void ShiftTracks(Timeline::TrackType type, int diff);
|
||||
void ShiftTracks(Track::Type type, int diff);
|
||||
|
||||
void TrimIn(const rational& diff);
|
||||
|
||||
|
||||
@@ -40,21 +40,21 @@ void AddTool::MousePress(TimelineViewMouseEvent *event)
|
||||
const TrackReference& track = event->GetTrack();
|
||||
|
||||
// Check if track is locked
|
||||
TrackOutput* t = parent()->GetTrackFromReference(track);
|
||||
Track* t = parent()->GetTrackFromReference(track);
|
||||
if (t && t->IsLocked()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Timeline::TrackType add_type = Timeline::kTrackTypeNone;
|
||||
Track::Type add_type = Track::kNone;
|
||||
|
||||
switch (Core::instance()->GetSelectedAddableObject()) {
|
||||
case olive::Tool::kAddableBars:
|
||||
case olive::Tool::kAddableSolid:
|
||||
case olive::Tool::kAddableTitle:
|
||||
add_type = Timeline::kTrackTypeVideo;
|
||||
add_type = Track::kVideo;
|
||||
break;
|
||||
case olive::Tool::kAddableTone:
|
||||
add_type = Timeline::kTrackTypeAudio;
|
||||
add_type = Track::kAudio;
|
||||
break;
|
||||
case olive::Tool::kAddableEmpty:
|
||||
// Leave as "none", which means this block can be placed on any track
|
||||
@@ -64,7 +64,7 @@ void AddTool::MousePress(TimelineViewMouseEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (add_type == Timeline::kTrackTypeNone
|
||||
if (add_type == Track::kNone
|
||||
|| add_type == track.type()) {
|
||||
drag_start_point_ = ValidatedCoordinate(event->GetCoordinates(true)).GetFrame();
|
||||
|
||||
|
||||
@@ -78,9 +78,9 @@ void EditTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
|
||||
void EditTool::MouseDoubleClick(TimelineViewMouseEvent *event)
|
||||
{
|
||||
TimelineViewBlockItem* item = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
Block* item = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
|
||||
if (item && !parent()->GetTrackFromReference(item->Track())->IsLocked()) {
|
||||
if (item && !parent()->GetTrackFromBlock(item)->IsLocked()) {
|
||||
parent()->AddSelection(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,23 +40,23 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
Timeline::TrackType TrackTypeFromStreamType(Stream::Type stream_type)
|
||||
Track::Type TrackTypeFromStreamType(Stream::Type stream_type)
|
||||
{
|
||||
switch (stream_type) {
|
||||
case Stream::kVideo:
|
||||
return Timeline::kTrackTypeVideo;
|
||||
return Track::kVideo;
|
||||
case Stream::kAudio:
|
||||
return Timeline::kTrackTypeAudio;
|
||||
return Track::kAudio;
|
||||
case Stream::kSubtitle:
|
||||
// Temporarily disabled until we figure out a better thing to do with this
|
||||
//return Timeline::kTrackTypeSubtitle;
|
||||
//return Track::kSubtitle;
|
||||
case Stream::kUnknown:
|
||||
case Stream::kData:
|
||||
case Stream::kAttachment:
|
||||
break;
|
||||
}
|
||||
|
||||
return Timeline::kTrackTypeNone;
|
||||
return Track::kNone;
|
||||
}
|
||||
|
||||
ImportTool::ImportTool(TimelineWidget *parent) :
|
||||
@@ -214,7 +214,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
foreach (const DraggedFootage& footage, footage_list) {
|
||||
|
||||
// Each stream is offset by one track per track "type", we keep track of them in this vector
|
||||
QVector<int> track_offsets(Timeline::kTrackTypeCount);
|
||||
QVector<int> track_offsets(Track::kCount);
|
||||
track_offsets.fill(track_start);
|
||||
|
||||
QVector<TimelineViewGhostItem*> footage_ghosts;
|
||||
@@ -225,13 +225,13 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
|
||||
// Loop through all streams in footage
|
||||
foreach (Stream* stream, footage.footage()->streams()) {
|
||||
Timeline::TrackType track_type = TrackTypeFromStreamType(stream->type());
|
||||
Track::Type track_type = TrackTypeFromStreamType(stream->type());
|
||||
|
||||
quint64 cached_enabled_streams = enabled_streams;
|
||||
enabled_streams >>= 1;
|
||||
|
||||
// Check if this stream has a compatible TrackList
|
||||
if (track_type == Timeline::kTrackTypeNone
|
||||
if (track_type == Track::kNone
|
||||
|| !(cached_enabled_streams & 0x1)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void PointerTool::MousePress(TimelineViewMouseEvent *event)
|
||||
}
|
||||
|
||||
// If this item is already selected, no further selection needs to be made
|
||||
if (parent()->IsBlockSelected(clicked_item_->block())) {
|
||||
if (parent()->IsBlockSelected(clicked_item_)) {
|
||||
|
||||
// Collect item deselections
|
||||
QVector<Block*> deselected_blocks;
|
||||
@@ -210,7 +210,7 @@ void PointerTool::HoverMove(TimelineViewMouseEvent *event)
|
||||
{
|
||||
if (trimming_allowed_) {
|
||||
// No dragging, but we still want to process cursors
|
||||
TimelineViewBlockItem* block_at_cursor = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
Block* block_at_cursor = parent()->GetItemAtScenePos(event->GetCoordinates());
|
||||
|
||||
if (block_at_cursor) {
|
||||
switch (IsCursorInTrimHandle(block_at_cursor, event->GetSceneX())) {
|
||||
@@ -237,7 +237,7 @@ void SetGhostToSlideMode(TimelineViewGhostItem* g)
|
||||
g->SetData(TimelineViewGhostItem::kGhostIsSliding, true);
|
||||
}
|
||||
|
||||
void PointerTool::InitiateDragInternal(TimelineViewBlockItem *clicked_item,
|
||||
void PointerTool::InitiateDragInternal(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool dont_roll_trims,
|
||||
bool allow_nongap_rolling,
|
||||
@@ -731,7 +731,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
Timeline::MovementMode PointerTool::IsCursorInTrimHandle(TimelineViewBlockItem *block, qreal cursor_x)
|
||||
Timeline::MovementMode PointerTool::IsCursorInTrimHandle(Block *block, qreal cursor_x)
|
||||
{
|
||||
double kTrimHandle = QtUtils::QFontMetricsWidth(parent()->fontMetrics(), "H");
|
||||
|
||||
@@ -749,7 +749,7 @@ Timeline::MovementMode PointerTool::IsCursorInTrimHandle(TimelineViewBlockItem *
|
||||
}
|
||||
}
|
||||
|
||||
void PointerTool::InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
void PointerTool::InitiateDrag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, false, false, false);
|
||||
@@ -820,7 +820,7 @@ void PointerTool::AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::Movem
|
||||
parent()->AddGhost(ghost);
|
||||
}
|
||||
|
||||
bool PointerTool::IsClipTrimmable(TimelineViewBlockItem* clip,
|
||||
bool PointerTool::IsClipTrimmable(Block *clip,
|
||||
const QVector<TimelineViewBlockItem*>& items,
|
||||
const Timeline::MovementMode& mode)
|
||||
{
|
||||
@@ -839,7 +839,7 @@ bool PointerTool::IsClipTrimmable(TimelineViewBlockItem* clip,
|
||||
bool PointerTool::AddMovingTransitionsToClipGhost(Block* block,
|
||||
const TrackReference& track,
|
||||
Timeline::MovementMode movement,
|
||||
const QList<TimelineViewBlockItem*>& selected_items)
|
||||
const QVector<Block *> &selected_items)
|
||||
{
|
||||
// Assume block is a clip and see if it has any transitions
|
||||
TransitionBlock* transitions[2];
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
protected:
|
||||
virtual void FinishDrag(TimelineViewMouseEvent *event);
|
||||
|
||||
virtual void InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
virtual void InitiateDrag(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode);
|
||||
|
||||
TimelineViewGhostItem* AddGhostFromBlock(Block *block, const TrackReference& track, Timeline::MovementMode mode, bool check_if_exists = false);
|
||||
@@ -64,7 +64,7 @@ protected:
|
||||
|
||||
virtual void ProcessDrag(const TimelineCoordinate &mouse_pos);
|
||||
|
||||
void InitiateDragInternal(TimelineViewBlockItem* clicked_item,
|
||||
void InitiateDragInternal(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool dont_roll_trims,
|
||||
bool allow_nongap_rolling, bool slide_instead_of_moving);
|
||||
@@ -95,19 +95,19 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
Timeline::MovementMode IsCursorInTrimHandle(TimelineViewBlockItem* block, qreal cursor_x);
|
||||
Timeline::MovementMode IsCursorInTrimHandle(Block* block, qreal cursor_x);
|
||||
|
||||
void AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::MovementMode mode);
|
||||
|
||||
bool IsClipTrimmable(TimelineViewBlockItem* clip,
|
||||
const QVector<TimelineViewBlockItem *> &items,
|
||||
bool IsClipTrimmable(Block* clip,
|
||||
const QVector<Block*> &items,
|
||||
const Timeline::MovementMode& mode);
|
||||
|
||||
void ProcessGhostsForSliding();
|
||||
|
||||
void ProcessGhostsForRolling();
|
||||
|
||||
bool AddMovingTransitionsToClipGhost(Block *block, const TrackReference &track, Timeline::MovementMode movement, const QList<TimelineViewBlockItem *> &selected_items);
|
||||
bool AddMovingTransitionsToClipGhost(Block *block, const TrackReference &track, Timeline::MovementMode movement, const QVector<Block*> &selected_items);
|
||||
|
||||
bool movement_allowed_;
|
||||
bool trimming_allowed_;
|
||||
@@ -116,10 +116,10 @@ private:
|
||||
bool can_rubberband_select_;
|
||||
bool rubberband_selecting_;
|
||||
|
||||
Timeline::TrackType drag_track_type_;
|
||||
Track::Type drag_track_type_;
|
||||
Timeline::MovementMode drag_movement_mode_;
|
||||
|
||||
TimelineViewBlockItem* clicked_item_;
|
||||
Block* clicked_item_;
|
||||
|
||||
QPoint drag_global_start_;
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ void RazorTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
QVector<Block*> blocks_to_split;
|
||||
|
||||
foreach (const TrackReference& track_ref, split_tracks_) {
|
||||
TrackOutput* track = parent()->GetTrackFromReference(track_ref);
|
||||
Track* track = parent()->GetTrackFromReference(track_ref);
|
||||
|
||||
if (track == nullptr || track->IsLocked()) {
|
||||
continue;
|
||||
|
||||
@@ -33,7 +33,7 @@ RippleTool::RippleTool(TimelineWidget* parent) :
|
||||
SetGapTrimmingAllowed(true);
|
||||
}
|
||||
|
||||
void RippleTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
||||
void RippleTool::InitiateDrag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, true, true, false);
|
||||
@@ -58,7 +58,7 @@ void RippleTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
||||
}
|
||||
|
||||
// For each track that does NOT have a ghost, we need to make one for Gaps
|
||||
foreach (TrackOutput* track, parent()->GetConnectedNode()->GetTracks()) {
|
||||
foreach (Track* track, parent()->GetConnectedNode()->GetTracks()) {
|
||||
if (track->IsLocked()) {
|
||||
continue;
|
||||
}
|
||||
@@ -109,10 +109,10 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
Q_UNUSED(event)
|
||||
|
||||
if (parent()->HasGhosts()) {
|
||||
QVector< QList<TrackListRippleToolCommand::RippleInfo> > info_list(Timeline::kTrackTypeCount);
|
||||
QVector< QList<TrackListRippleToolCommand::RippleInfo> > info_list(Track::kCount);
|
||||
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->GetGhostItems()) {
|
||||
TrackOutput* track = parent()->GetTrackFromReference(ghost->GetTrack());
|
||||
Track* track = parent()->GetTrackFromReference(ghost->GetTrack());
|
||||
|
||||
TrackListRippleToolCommand::RippleInfo i = {Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kAttachedBlock)),
|
||||
Node::ValueToPtr<Block>(ghost->GetData(TimelineViewGhostItem::kReferenceBlock)),
|
||||
@@ -127,7 +127,7 @@ void RippleTool::FinishDrag(TimelineViewMouseEvent *event)
|
||||
|
||||
if (!info_list.isEmpty()) {
|
||||
for (int i=0;i<info_list.size();i++) {
|
||||
new TrackListRippleToolCommand(parent()->GetConnectedNode()->track_list(static_cast<Timeline::TrackType>(i)),
|
||||
new TrackListRippleToolCommand(parent()->GetConnectedNode()->track_list(static_cast<Track::Type>(i)),
|
||||
info_list.at(i),
|
||||
drag_movement_mode(),
|
||||
command);
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
protected:
|
||||
virtual void FinishDrag(TimelineViewMouseEvent *event) override;
|
||||
|
||||
virtual void InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
virtual void InitiateDrag(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ RollingTool::RollingTool(TimelineWidget* parent) :
|
||||
SetGapTrimmingAllowed(true);
|
||||
}
|
||||
|
||||
void RollingTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
||||
void RollingTool::InitiateDrag(Block *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, false, true, false);
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
RollingTool(TimelineWidget* parent);
|
||||
|
||||
protected:
|
||||
virtual void InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
virtual void InitiateDrag(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode) override;
|
||||
};
|
||||
|
||||
|
||||
@@ -34,8 +34,7 @@ SlideTool::SlideTool(TimelineWidget* parent) :
|
||||
SetGapTrimmingAllowed(true);
|
||||
}
|
||||
|
||||
void SlideTool::InitiateDrag(TimelineViewBlockItem *clicked_item,
|
||||
Timeline::MovementMode trim_mode)
|
||||
void SlideTool::InitiateDrag(Block *clicked_item, Timeline::MovementMode trim_mode)
|
||||
{
|
||||
InitiateDragInternal(clicked_item, trim_mode, false, true, true);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
SlideTool(TimelineWidget* parent);
|
||||
|
||||
protected:
|
||||
virtual void InitiateDrag(TimelineViewBlockItem* clicked_item,
|
||||
virtual void InitiateDrag(Block* clicked_item,
|
||||
Timeline::MovementMode trim_mode) override;
|
||||
|
||||
};
|
||||
|
||||
@@ -36,7 +36,7 @@ TransitionTool::TransitionTool(TimelineWidget *parent) :
|
||||
void TransitionTool::MousePress(TimelineViewMouseEvent *event)
|
||||
{
|
||||
const TrackReference& track = event->GetTrack();
|
||||
TrackOutput* t = parent()->GetTrackFromReference(track);
|
||||
Track* t = parent()->GetTrackFromReference(track);
|
||||
rational cursor_frame = event->GetFrame();
|
||||
|
||||
if (!t || t->IsLocked()) {
|
||||
|
||||
@@ -68,7 +68,7 @@ TrackView::TrackView(Qt::Alignment vertical_alignment, QWidget *parent) :
|
||||
void TrackView::ConnectTrackList(TrackList *list)
|
||||
{
|
||||
if (list_ != nullptr) {
|
||||
foreach (TrackOutput* track, list_->GetTracks()) {
|
||||
foreach (Track* track, list_->GetTracks()) {
|
||||
RemoveTrack(track);
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ void TrackView::ConnectTrackList(TrackList *list)
|
||||
list_ = list;
|
||||
|
||||
if (list_ != nullptr) {
|
||||
foreach (TrackOutput* track, list_->GetTracks()) {
|
||||
foreach (Track* track, list_->GetTracks()) {
|
||||
InsertTrack(track);
|
||||
}
|
||||
|
||||
@@ -120,14 +120,14 @@ void TrackView::TrackHeightChanged(int index, int height)
|
||||
list_->GetTrackAt(index)->SetTrackHeightInPixels(height);
|
||||
}
|
||||
|
||||
void TrackView::InsertTrack(TrackOutput *track)
|
||||
void TrackView::InsertTrack(Track *track)
|
||||
{
|
||||
splitter_->Insert(track->Index(),
|
||||
track->GetTrackHeightInPixels(),
|
||||
new TrackViewItem(track));
|
||||
}
|
||||
|
||||
void TrackView::RemoveTrack(TrackOutput *track)
|
||||
void TrackView::RemoveTrack(Track *track)
|
||||
{
|
||||
splitter_->Remove(track->Index());
|
||||
}
|
||||
|
||||
@@ -57,9 +57,9 @@ private slots:
|
||||
|
||||
void TrackHeightChanged(int index, int height);
|
||||
|
||||
void InsertTrack(TrackOutput* track);
|
||||
void InsertTrack(Track* track);
|
||||
|
||||
void RemoveTrack(TrackOutput* track);
|
||||
void RemoveTrack(Track* track);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
TrackViewItem::TrackViewItem(TrackOutput* track, QWidget *parent) :
|
||||
TrackViewItem::TrackViewItem(Track* track, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
track_(track)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ TrackViewItem::TrackViewItem(TrackOutput* track, QWidget *parent) :
|
||||
|
||||
label_ = new ClickableLabel();
|
||||
connect(label_, &ClickableLabel::MouseDoubleClicked, this, &TrackViewItem::LabelClicked);
|
||||
connect(track_, &TrackOutput::LabelChanged, this, &TrackViewItem::UpdateLabel);
|
||||
connect(track_, &Track::LabelChanged, this, &TrackViewItem::UpdateLabel);
|
||||
UpdateLabel();
|
||||
stack_->addWidget(label_);
|
||||
|
||||
@@ -51,19 +51,19 @@ TrackViewItem::TrackViewItem(TrackOutput* track, QWidget *parent) :
|
||||
stack_->addWidget(line_edit_);
|
||||
|
||||
mute_button_ = CreateMSLButton(tr("M"), Qt::red);
|
||||
connect(mute_button_, &QPushButton::toggled, track_, &TrackOutput::SetMuted);
|
||||
connect(mute_button_, &QPushButton::toggled, track_, &Track::SetMuted);
|
||||
layout->addWidget(mute_button_);
|
||||
|
||||
/*solo_button_ = CreateMSLButton(tr("S"), Qt::yellow);
|
||||
layout->addWidget(solo_button_);*/
|
||||
|
||||
lock_button_ = CreateMSLButton(tr("L"), Qt::gray);
|
||||
connect(lock_button_, &QPushButton::toggled, track_, &TrackOutput::SetLocked);
|
||||
connect(lock_button_, &QPushButton::toggled, track_, &Track::SetLocked);
|
||||
layout->addWidget(lock_button_);
|
||||
|
||||
setMinimumHeight(mute_button_->height());
|
||||
|
||||
connect(track, &TrackOutput::MutedChanged, mute_button_, &QPushButton::setChecked);
|
||||
connect(track, &Track::MutedChanged, mute_button_, &QPushButton::setChecked);
|
||||
}
|
||||
|
||||
QPushButton *TrackViewItem::CreateMSLButton(const QString& text, const QColor& checked_color) const
|
||||
|
||||
@@ -35,7 +35,7 @@ class TrackViewItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TrackViewItem(TrackOutput* track,
|
||||
TrackViewItem(Track* track,
|
||||
QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
@@ -50,7 +50,7 @@ private:
|
||||
QPushButton* solo_button_;
|
||||
QPushButton* lock_button_;
|
||||
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
private slots:
|
||||
void LabelClicked();
|
||||
|
||||
@@ -69,7 +69,7 @@ void TrackViewSplitter::HandleReceiver(TrackViewSplitterHandle *h, int diff)
|
||||
int new_ele_sz = old_ele_sz + diff;
|
||||
|
||||
// Limit by track minimum height
|
||||
new_ele_sz = qMax(new_ele_sz, TrackOutput::GetMinimumTrackHeightInPixels());
|
||||
new_ele_sz = qMax(new_ele_sz, Track::GetMinimumTrackHeightInPixels());
|
||||
|
||||
if (alignment_ == Qt::AlignBottom) {
|
||||
ele_id = count() - ele_id - 1;
|
||||
|
||||
@@ -99,7 +99,7 @@ void BlockSetMediaInCommand::undo_internal()
|
||||
block_->set_media_in(old_media_in_);
|
||||
}
|
||||
|
||||
TrackRippleRemoveBlockCommand::TrackRippleRemoveBlockCommand(TrackOutput *track, Block *block, QUndoCommand *parent) :
|
||||
TrackRippleRemoveBlockCommand::TrackRippleRemoveBlockCommand(Track *track, Block *block, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
block_(block)
|
||||
@@ -126,7 +126,7 @@ void TrackRippleRemoveBlockCommand::undo_internal()
|
||||
}
|
||||
}
|
||||
|
||||
TrackInsertBlockAfterCommand::TrackInsertBlockAfterCommand(TrackOutput *track,
|
||||
TrackInsertBlockAfterCommand::TrackInsertBlockAfterCommand(Track *track,
|
||||
Block *block,
|
||||
Block *before,
|
||||
QUndoCommand *parent) :
|
||||
@@ -152,7 +152,7 @@ void TrackInsertBlockAfterCommand::undo_internal()
|
||||
track_->RippleRemoveBlock(block_);
|
||||
}
|
||||
|
||||
TrackRippleRemoveAreaCommand::TrackRippleRemoveAreaCommand(TrackOutput *track, rational in, rational out, QUndoCommand *parent) :
|
||||
TrackRippleRemoveAreaCommand::TrackRippleRemoveAreaCommand(Track *track, rational in, rational out, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
in_(in),
|
||||
@@ -385,12 +385,12 @@ void TrackPlaceBlockCommand::redo_internal()
|
||||
added_tracks_.resize(track_index_ - timeline_->GetTracks().size() + 1);
|
||||
|
||||
for (int i=0; i<added_tracks_.size(); i++) {
|
||||
added_tracks_[i] = new TrackOutput();
|
||||
added_tracks_[i] = new Track();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=0; i<added_tracks_.size(); i++) {
|
||||
TrackOutput* track = added_tracks_.at(i);
|
||||
Track* track = added_tracks_.at(i);
|
||||
track->setParent(timeline_->GetParentGraph());
|
||||
|
||||
timeline_->track_input()->ArrayAppend();
|
||||
@@ -435,14 +435,14 @@ void TrackPlaceBlockCommand::undo_internal()
|
||||
}
|
||||
|
||||
for (int i=added_tracks_.size()-1; i>=0; i--) {
|
||||
TrackOutput* track = added_tracks_.at(i);
|
||||
Track* track = added_tracks_.at(i);
|
||||
Node::DisconnectEdge(track, timeline_->track_input(), timeline_->track_input()->ArraySize() - 1);
|
||||
track->setParent(&memory_manager_);
|
||||
timeline_->track_input()->ArrayRemoveLast();
|
||||
}
|
||||
}
|
||||
|
||||
BlockSplitCommand::BlockSplitCommand(TrackOutput* track, Block *block, rational point, QUndoCommand *parent) :
|
||||
BlockSplitCommand::BlockSplitCommand(Track* track, Block *block, rational point, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
block_(block),
|
||||
@@ -543,7 +543,7 @@ Block *BlockSplitCommand::new_block()
|
||||
return new_block_;
|
||||
}
|
||||
|
||||
TrackSplitAtTimeCommand::TrackSplitAtTimeCommand(TrackOutput *track, rational point, QUndoCommand *parent) :
|
||||
TrackSplitAtTimeCommand::TrackSplitAtTimeCommand(Track *track, rational point, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track)
|
||||
{
|
||||
@@ -565,7 +565,7 @@ Project *TrackSplitAtTimeCommand::GetRelevantProject() const
|
||||
return static_cast<Sequence*>(track_->parent())->project();
|
||||
}
|
||||
|
||||
TrackReplaceBlockCommand::TrackReplaceBlockCommand(TrackOutput* track, Block *old, Block *replace, QUndoCommand *parent) :
|
||||
TrackReplaceBlockCommand::TrackReplaceBlockCommand(Track* track, Block *old, Block *replace, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
old_(old),
|
||||
@@ -588,7 +588,7 @@ void TrackReplaceBlockCommand::undo_internal()
|
||||
track_->ReplaceBlock(replace_, old_);
|
||||
}
|
||||
|
||||
TrackPrependBlockCommand::TrackPrependBlockCommand(TrackOutput *track, Block *block, QUndoCommand *parent) :
|
||||
TrackPrependBlockCommand::TrackPrependBlockCommand(Track *track, Block *block, QUndoCommand *parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
block_(block)
|
||||
@@ -626,7 +626,7 @@ BlockSplitPreservingLinksCommand::BlockSplitPreservingLinksCommand(const QVector
|
||||
Block* b = blocks.at(j);
|
||||
|
||||
if (b->in() < time && b->out() > time) {
|
||||
TrackOutput* track = TrackOutput::TrackFromBlock(b);
|
||||
Track* track = Track::TrackFromBlock(b);
|
||||
|
||||
Q_ASSERT(track);
|
||||
|
||||
@@ -686,7 +686,7 @@ void TimelineRippleDeleteGapsAtRegionsCommand::redo_internal()
|
||||
|
||||
QList<Block*> blocks_around_range;
|
||||
|
||||
foreach (TrackOutput* track, timeline_->GetTracks()) {
|
||||
foreach (Track* track, timeline_->GetTracks()) {
|
||||
// Get the block from every other track that is either at or just before our block's in point
|
||||
Block* block_at_time = track->NearestBlockBeforeOrAt(range.in());
|
||||
|
||||
@@ -706,7 +706,7 @@ void TimelineRippleDeleteGapsAtRegionsCommand::redo_internal()
|
||||
foreach (Block* resize, blocks_around_range) {
|
||||
if (resize->length() == max_ripple_length) {
|
||||
// Remove block entirely
|
||||
TrackRippleRemoveBlockCommand* remove_command = new TrackRippleRemoveBlockCommand(TrackOutput::TrackFromBlock(resize), resize);
|
||||
TrackRippleRemoveBlockCommand* remove_command = new TrackRippleRemoveBlockCommand(Track::TrackFromBlock(resize), resize);
|
||||
remove_command->redo();
|
||||
commands_.append(remove_command);
|
||||
} else {
|
||||
@@ -880,7 +880,7 @@ void BlockEnableDisableCommand::undo_internal()
|
||||
block_->set_enabled(old_enabled_);
|
||||
}
|
||||
|
||||
BlockTrimCommand::BlockTrimCommand(TrackOutput* track, Block *block, rational new_length, Timeline::MovementMode mode, QUndoCommand *command) :
|
||||
BlockTrimCommand::BlockTrimCommand(Track* track, Block *block, rational new_length, Timeline::MovementMode mode, QUndoCommand *command) :
|
||||
UndoCommand(command),
|
||||
track_(track),
|
||||
block_(block),
|
||||
@@ -1045,7 +1045,7 @@ void BlockTrimCommand::undo_internal()
|
||||
track_->Node::InvalidateCache(invalidate_range, track_->block_input());
|
||||
}
|
||||
|
||||
TrackReplaceBlockWithGapCommand::TrackReplaceBlockWithGapCommand(TrackOutput *track, Block *block, QUndoCommand *command) :
|
||||
TrackReplaceBlockWithGapCommand::TrackReplaceBlockWithGapCommand(Track *track, Block *block, QUndoCommand *command) :
|
||||
UndoCommand(command),
|
||||
track_(track),
|
||||
block_(block),
|
||||
@@ -1187,7 +1187,7 @@ void TrackReplaceBlockWithGapCommand::undo_internal()
|
||||
track_->Node::InvalidateCache(TimeRange(block_->in(), block_->out()), track_->block_input());
|
||||
}
|
||||
|
||||
TrackSlideCommand::TrackSlideCommand(TrackOutput* track, const QList<Block*>& moving_blocks, Block *in_adjacent, Block *out_adjacent, const rational& movement, QUndoCommand* parent) :
|
||||
TrackSlideCommand::TrackSlideCommand(Track* track, const QList<Block*>& moving_blocks, Block *in_adjacent, Block *out_adjacent, const rational& movement, QUndoCommand* parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
blocks_(moving_blocks),
|
||||
@@ -1319,7 +1319,7 @@ TrackListRippleRemoveAreaCommand::TrackListRippleRemoveAreaCommand(TrackList *li
|
||||
{
|
||||
all_tracks_unlocked_ = true;
|
||||
|
||||
foreach (TrackOutput* track, list_->GetTracks()) {
|
||||
foreach (Track* track, list_->GetTracks()) {
|
||||
if (track->IsLocked()) {
|
||||
all_tracks_unlocked_ = false;
|
||||
continue;
|
||||
@@ -1346,13 +1346,13 @@ void TrackListRippleRemoveAreaCommand::redo_internal()
|
||||
if (all_tracks_unlocked_) {
|
||||
// We can optimize here by simply shifting the whole cache forward instead of re-caching
|
||||
// everything following this time
|
||||
if (list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(list_->parent())->ShiftVideoCache(out_, in_);
|
||||
} else if (list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(list_->parent())->ShiftAudioCache(out_, in_);
|
||||
}
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->BeginOperation();
|
||||
}
|
||||
}
|
||||
@@ -1362,7 +1362,7 @@ void TrackListRippleRemoveAreaCommand::redo_internal()
|
||||
}
|
||||
|
||||
if (all_tracks_unlocked_) {
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->EndOperation();
|
||||
}
|
||||
}
|
||||
@@ -1373,13 +1373,13 @@ void TrackListRippleRemoveAreaCommand::undo_internal()
|
||||
if (all_tracks_unlocked_) {
|
||||
// We can optimize here by simply shifting the whole cache forward instead of re-caching
|
||||
// everything following this time
|
||||
if (list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(list_->parent())->ShiftVideoCache(in_, out_);
|
||||
} else if (list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(list_->parent())->ShiftAudioCache(in_, out_);
|
||||
}
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->BeginOperation();
|
||||
}
|
||||
}
|
||||
@@ -1389,7 +1389,7 @@ void TrackListRippleRemoveAreaCommand::undo_internal()
|
||||
}
|
||||
|
||||
if (all_tracks_unlocked_) {
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->EndOperation();
|
||||
}
|
||||
}
|
||||
@@ -1399,8 +1399,8 @@ TimelineRippleRemoveAreaCommand::TimelineRippleRemoveAreaCommand(ViewerOutput *t
|
||||
UndoCommand(parent),
|
||||
timeline_(timeline)
|
||||
{
|
||||
for (int i=0; i<Timeline::kTrackTypeCount; i++) {
|
||||
new TrackListRippleRemoveAreaCommand(timeline->track_list(static_cast<Timeline::TrackType>(i)),
|
||||
for (int i=0; i<Track::kCount; i++) {
|
||||
new TrackListRippleRemoveAreaCommand(timeline->track_list(static_cast<Track::Type>(i)),
|
||||
in,
|
||||
out,
|
||||
this);
|
||||
@@ -1506,9 +1506,9 @@ void TrackListRippleToolCommand::redo_internal()
|
||||
}
|
||||
}
|
||||
|
||||
if (track_list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (track_list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftVideoCache(old_latest_pt, new_latest_pt);
|
||||
} else if (track_list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (track_list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftAudioCache(old_latest_pt, new_latest_pt);
|
||||
}
|
||||
|
||||
@@ -1574,7 +1574,7 @@ TrackListInsertGaps::TrackListInsertGaps(TrackList *track_list, const rational &
|
||||
{
|
||||
all_tracks_unlocked_ = true;
|
||||
|
||||
foreach (TrackOutput* track, track_list_->GetTracks()) {
|
||||
foreach (Track* track, track_list_->GetTracks()) {
|
||||
if (track->IsLocked()) {
|
||||
all_tracks_unlocked_ = false;
|
||||
continue;
|
||||
@@ -1593,13 +1593,13 @@ void TrackListInsertGaps::redo_internal()
|
||||
{
|
||||
if (all_tracks_unlocked_) {
|
||||
// Optimize by shifting over since we have a constant amount of time being inserted
|
||||
if (track_list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (track_list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftVideoCache(point_, point_ + length_);
|
||||
} else if (track_list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (track_list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftAudioCache(point_, point_ + length_);
|
||||
}
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->BeginOperation();
|
||||
}
|
||||
}
|
||||
@@ -1607,7 +1607,7 @@ void TrackListInsertGaps::redo_internal()
|
||||
QVector<Block*> blocks_to_split;
|
||||
QVector<Block*> blocks_to_append_gap_to;
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
foreach (Block* b, track->Blocks()) {
|
||||
if (b->type() == Block::kGap && b->in() <= point_ && b->out() >= point_) {
|
||||
// Found a gap at the location
|
||||
@@ -1637,12 +1637,12 @@ void TrackListInsertGaps::redo_internal()
|
||||
GapBlock* gap = new GapBlock();
|
||||
gap->set_length_and_media_out(length_);
|
||||
gap->setParent(block->parent());
|
||||
TrackOutput::TrackFromBlock(block)->InsertBlockAfter(gap, block);
|
||||
Track::TrackFromBlock(block)->InsertBlockAfter(gap, block);
|
||||
gaps_added_.append(gap);
|
||||
}
|
||||
|
||||
if (all_tracks_unlocked_) {
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->EndOperation();
|
||||
}
|
||||
}
|
||||
@@ -1652,20 +1652,20 @@ void TrackListInsertGaps::undo_internal()
|
||||
{
|
||||
if (all_tracks_unlocked_) {
|
||||
// Optimize by shifting over since we have a constant amount of time being inserted
|
||||
if (track_list_->type() == Timeline::kTrackTypeVideo) {
|
||||
if (track_list_->type() == Track::kVideo) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftVideoCache(point_ + length_, point_);
|
||||
} else if (track_list_->type() == Timeline::kTrackTypeAudio) {
|
||||
} else if (track_list_->type() == Track::kAudio) {
|
||||
static_cast<ViewerOutput*>(track_list_->parent())->ShiftAudioCache(point_ + length_, point_);
|
||||
}
|
||||
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->BeginOperation();
|
||||
}
|
||||
}
|
||||
|
||||
// Remove added gaps
|
||||
foreach (GapBlock* gap, gaps_added_) {
|
||||
TrackOutput::TrackFromBlock(gap)->RippleRemoveBlock(gap);
|
||||
Track::TrackFromBlock(gap)->RippleRemoveBlock(gap);
|
||||
gap->setParent(&memory_manager_);
|
||||
}
|
||||
gaps_added_.clear();
|
||||
@@ -1684,13 +1684,13 @@ void TrackListInsertGaps::undo_internal()
|
||||
gaps_to_extend_.clear();
|
||||
|
||||
if (all_tracks_unlocked_) {
|
||||
foreach (TrackOutput* track, working_tracks_) {
|
||||
foreach (Track* track, working_tracks_) {
|
||||
track->EndOperation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TransitionRemoveCommand::TransitionRemoveCommand(TrackOutput* track, TransitionBlock *block, QUndoCommand* parent) :
|
||||
TransitionRemoveCommand::TransitionRemoveCommand(Track* track, TransitionBlock *block, QUndoCommand* parent) :
|
||||
UndoCommand(parent),
|
||||
track_(track),
|
||||
block_(block),
|
||||
|
||||
@@ -68,7 +68,7 @@ private:
|
||||
|
||||
class BlockTrimCommand : public UndoCommand {
|
||||
public:
|
||||
BlockTrimCommand(TrackOutput *track, Block* block, rational new_length, Timeline::MovementMode mode, QUndoCommand* command = nullptr);
|
||||
BlockTrimCommand(Track *track, Block* block, rational new_length, Timeline::MovementMode mode, QUndoCommand* command = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -82,7 +82,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* block_;
|
||||
rational old_length_;
|
||||
rational new_length_;
|
||||
@@ -116,7 +116,7 @@ private:
|
||||
|
||||
class TrackRippleRemoveBlockCommand : public UndoCommand {
|
||||
public:
|
||||
TrackRippleRemoveBlockCommand(TrackOutput* track, Block* block, QUndoCommand* parent = nullptr);
|
||||
TrackRippleRemoveBlockCommand(Track* track, Block* block, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -125,7 +125,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
Block* block_;
|
||||
|
||||
@@ -134,7 +134,7 @@ private:
|
||||
|
||||
class TrackPrependBlockCommand : public UndoCommand {
|
||||
public:
|
||||
TrackPrependBlockCommand(TrackOutput* track, Block* block, QUndoCommand* parent = nullptr);
|
||||
TrackPrependBlockCommand(Track* track, Block* block, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -143,13 +143,13 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* block_;
|
||||
};
|
||||
|
||||
class TrackInsertBlockAfterCommand : public UndoCommand {
|
||||
public:
|
||||
TrackInsertBlockAfterCommand(TrackOutput* track, Block* block, Block* before, QUndoCommand* parent = nullptr);
|
||||
TrackInsertBlockAfterCommand(Track* track, Block* block, Block* before, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -158,7 +158,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
Block* block_;
|
||||
|
||||
@@ -174,7 +174,7 @@ private:
|
||||
*/
|
||||
class TrackRippleRemoveAreaCommand : public UndoCommand {
|
||||
public:
|
||||
TrackRippleRemoveAreaCommand(TrackOutput* track, rational in, rational out, QUndoCommand* parent = nullptr);
|
||||
TrackRippleRemoveAreaCommand(Track* track, rational in, rational out, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -187,7 +187,7 @@ protected:
|
||||
protected:
|
||||
Project* project_;
|
||||
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
rational in_;
|
||||
rational out_;
|
||||
|
||||
@@ -227,7 +227,7 @@ protected:
|
||||
private:
|
||||
TrackList* list_;
|
||||
|
||||
QList<TrackOutput*> working_tracks_;
|
||||
QList<Track*> working_tracks_;
|
||||
|
||||
rational in_;
|
||||
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
struct RippleInfo {
|
||||
Block* block;
|
||||
Block* ref_block;
|
||||
TrackOutput* track;
|
||||
Track* track;
|
||||
rational new_length;
|
||||
rational old_length;
|
||||
};
|
||||
@@ -312,13 +312,13 @@ private:
|
||||
int track_index_;
|
||||
bool append_;
|
||||
GapBlock* gap_;
|
||||
QVector<TrackOutput*> added_tracks_;
|
||||
QVector<Track*> added_tracks_;
|
||||
|
||||
};
|
||||
|
||||
class BlockSplitCommand : public UndoCommand {
|
||||
public:
|
||||
BlockSplitCommand(TrackOutput* track, Block* block, rational point, QUndoCommand* parent = nullptr);
|
||||
BlockSplitCommand(Track* track, Block* block, rational point, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -329,7 +329,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* block_;
|
||||
Block* new_block_;
|
||||
|
||||
@@ -347,12 +347,12 @@ private:
|
||||
|
||||
class TrackSplitAtTimeCommand : public UndoCommand {
|
||||
public:
|
||||
TrackSplitAtTimeCommand(TrackOutput* track, rational point, QUndoCommand* parent = nullptr);
|
||||
TrackSplitAtTimeCommand(Track* track, rational point, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
};
|
||||
|
||||
@@ -375,7 +375,7 @@ private:
|
||||
*/
|
||||
class TrackReplaceBlockCommand : public UndoCommand {
|
||||
public:
|
||||
TrackReplaceBlockCommand(TrackOutput* track, Block* old, Block* replace, QUndoCommand* parent = nullptr);
|
||||
TrackReplaceBlockCommand(Track* track, Block* old, Block* replace, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -384,14 +384,14 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* old_;
|
||||
Block* replace_;
|
||||
};
|
||||
|
||||
class TrackReplaceBlockWithGapCommand : public UndoCommand {
|
||||
public:
|
||||
TrackReplaceBlockWithGapCommand(TrackOutput* track, Block* block, QUndoCommand* command = nullptr);
|
||||
TrackReplaceBlockWithGapCommand(Track* track, Block* block, QUndoCommand* command = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -400,7 +400,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
Block* block_;
|
||||
|
||||
GapBlock* existing_gap_;
|
||||
@@ -542,7 +542,7 @@ private:
|
||||
|
||||
class TrackSlideCommand : public UndoCommand {
|
||||
public:
|
||||
TrackSlideCommand(TrackOutput* track, const QList<Block*>& moving_blocks, Block* in_adjacent, Block* out_adjacent, const rational& movement, QUndoCommand* parent = nullptr);
|
||||
TrackSlideCommand(Track* track, const QList<Block*>& moving_blocks, Block* in_adjacent, Block* out_adjacent, const rational& movement, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -553,7 +553,7 @@ protected:
|
||||
private:
|
||||
void slide_internal(bool undo);
|
||||
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
QList<Block*> blocks_;
|
||||
rational movement_;
|
||||
|
||||
@@ -583,7 +583,7 @@ private:
|
||||
|
||||
rational length_;
|
||||
|
||||
QList<TrackOutput*> working_tracks_;
|
||||
QList<Track*> working_tracks_;
|
||||
|
||||
bool all_tracks_unlocked_;
|
||||
|
||||
@@ -599,7 +599,7 @@ private:
|
||||
|
||||
class TransitionRemoveCommand : public UndoCommand {
|
||||
public:
|
||||
TransitionRemoveCommand(TrackOutput *track, TransitionBlock* block, QUndoCommand *parent = nullptr);
|
||||
TransitionRemoveCommand(Track *track, TransitionBlock* block, QUndoCommand *parent = nullptr);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
@@ -608,7 +608,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
TrackOutput* track_;
|
||||
Track* track_;
|
||||
|
||||
TransitionBlock* block_;
|
||||
|
||||
|
||||
@@ -18,13 +18,7 @@ set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timelinewidget/view/timelineview.cpp
|
||||
widget/timelinewidget/view/timelineview.h
|
||||
widget/timelinewidget/view/timelineviewmouseevent.cpp
|
||||
widget/timelinewidget/view/timelineviewmouseevent.h
|
||||
widget/timelinewidget/view/timelineviewrect.cpp
|
||||
widget/timelinewidget/view/timelineviewrect.h
|
||||
widget/timelinewidget/view/timelineviewblockitem.cpp
|
||||
widget/timelinewidget/view/timelineviewblockitem.h
|
||||
widget/timelinewidget/view/timelineviewghostitem.cpp
|
||||
widget/timelinewidget/view/timelineviewghostitem.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -209,7 +209,7 @@ void TimelineView::drawBackground(QPainter *painter, const QRectF &rect)
|
||||
|
||||
int line_y = 0;
|
||||
|
||||
foreach (TrackOutput* track, connected_track_list_->GetTracks()) {
|
||||
foreach (Track* track, connected_track_list_->GetTracks()) {
|
||||
line_y += track->GetTrackHeightInPixels();
|
||||
|
||||
// One px gap between tracks
|
||||
@@ -322,7 +322,7 @@ void TimelineView::SceneRectUpdateEvent(QRectF &rect)
|
||||
}
|
||||
}
|
||||
|
||||
Timeline::TrackType TimelineView::ConnectedTrackType()
|
||||
Track::Type TimelineView::ConnectedTrackType()
|
||||
{
|
||||
if (connected_track_list_) {
|
||||
return connected_track_list_->type();
|
||||
@@ -331,7 +331,7 @@ Timeline::TrackType TimelineView::ConnectedTrackType()
|
||||
return Timeline::kTrackTypeNone;
|
||||
}
|
||||
|
||||
Stream::Type TimelineView::TrackTypeToStreamType(Timeline::TrackType track_type)
|
||||
Stream::Type TimelineView::TrackTypeToStreamType(Track::Type track_type)
|
||||
{
|
||||
switch (track_type) {
|
||||
case Timeline::kTrackTypeNone:
|
||||
@@ -417,7 +417,7 @@ int TimelineView::GetTrackY(int track_index) const
|
||||
int TimelineView::GetTrackHeight(int track_index) const
|
||||
{
|
||||
if (!connected_track_list_ || track_index >= connected_track_list_->GetTrackCount()) {
|
||||
return TrackOutput::GetDefaultTrackHeightInPixels();
|
||||
return Track::GetDefaultTrackHeightInPixels();
|
||||
}
|
||||
|
||||
return connected_track_list_->GetTrackAt(track_index)->GetTrackHeightInPixels();
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <QDropEvent>
|
||||
|
||||
#include "node/block/clip/clip.h"
|
||||
#include "timelineviewblockitem.h"
|
||||
#include "timelineviewmouseevent.h"
|
||||
#include "timelineviewghostitem.h"
|
||||
#include "widget/timebased/timebasedview.h"
|
||||
@@ -101,8 +100,8 @@ protected:
|
||||
virtual void SceneRectUpdateEvent(QRectF& rect) override;
|
||||
|
||||
private:
|
||||
Timeline::TrackType ConnectedTrackType();
|
||||
Stream::Type TrackTypeToStreamType(Timeline::TrackType track_type);
|
||||
Track::Type ConnectedTrackType();
|
||||
Stream::Type TrackTypeToStreamType(Track::Type track_type);
|
||||
|
||||
TimelineCoordinate ScreenToCoordinate(const QPoint& pt);
|
||||
TimelineCoordinate SceneToCoordinate(const QPointF& pt);
|
||||
|
||||
@@ -1,195 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewblockitem.h"
|
||||
|
||||
#include <QBrush>
|
||||
#include <QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QFloat16>
|
||||
#include <QGraphicsScene>
|
||||
#include <QGraphicsSceneMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
|
||||
#include "common/qtutils.h"
|
||||
#include "config/config.h"
|
||||
#include "core.h"
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "widget/viewer/audiowaveformview.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
TimelineViewBlockItem::TimelineViewBlockItem(Block *block, QGraphicsItem* parent) :
|
||||
TimelineViewRect(parent),
|
||||
block_(block)
|
||||
{
|
||||
setBrush(Qt::white);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
Block *TimelineViewBlockItem::block() const
|
||||
{
|
||||
return block_;
|
||||
}
|
||||
|
||||
void TimelineViewBlockItem::UpdateRect()
|
||||
{
|
||||
double item_left = TimeToScene(block_->in());
|
||||
double item_width = TimeToScene(block_->length());
|
||||
|
||||
// -1 on width and height so we don't overlap any adjacent clips
|
||||
setRect(0, y_, item_width - 1, height_);
|
||||
setPos(item_left, 0.0);
|
||||
|
||||
setToolTip(QCoreApplication::translate("TimelineViewBlockItem",
|
||||
"%1\n\nIn: %2\nOut: %3\nLength: %4").arg(block_->Name(),
|
||||
Timecode::time_to_timecode(block_->in(), timebase(), Core::instance()->GetTimecodeDisplay()),
|
||||
Timecode::time_to_timecode(block_->out(), timebase(), Core::instance()->GetTimecodeDisplay()),
|
||||
Timecode::time_to_timecode(block_->out() - block_->in(), timebase(), Core::instance()->GetTimecodeDisplay())));
|
||||
}
|
||||
|
||||
void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
|
||||
{
|
||||
switch (block_->type()) {
|
||||
case Block::kClip:
|
||||
{
|
||||
QLinearGradient grad;
|
||||
grad.setStart(0, rect().top());
|
||||
grad.setFinalStop(0, rect().bottom());
|
||||
|
||||
if (block_->is_enabled()) {
|
||||
grad.setColorAt(0.0, QColor(160, 160, 240));
|
||||
grad.setColorAt(1.0, QColor(128, 128, 192));
|
||||
} else {
|
||||
grad.setColorAt(0.0, QColor(160, 160, 160));
|
||||
grad.setColorAt(1.0, QColor(128, 128, 128));
|
||||
}
|
||||
|
||||
painter->fillRect(rect(), grad);
|
||||
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
painter->fillRect(rect(), QColor(0, 0, 0, 64));
|
||||
}
|
||||
|
||||
// Draw waveform if one is available
|
||||
painter->setPen(QColor(64, 64, 64));
|
||||
TrackOutput* track = TrackOutput::TrackFromBlock(block_);
|
||||
if (track) {
|
||||
AudioVisualWaveform::DrawWaveform(painter,
|
||||
rect().toRect(),
|
||||
this->GetScale(),
|
||||
track->waveform(),
|
||||
block_->in());
|
||||
}
|
||||
|
||||
painter->setPen(Qt::white);
|
||||
painter->drawLine(rect().topLeft(), QPointF(rect().right(), rect().top()));
|
||||
painter->drawLine(rect().topLeft(), QPointF(rect().left(), rect().bottom() - 1));
|
||||
|
||||
// Draw text
|
||||
if (block_->is_enabled()) {
|
||||
painter->setPen(Qt::white);
|
||||
} else {
|
||||
painter->setPen(Qt::lightGray);
|
||||
}
|
||||
|
||||
int text_top = TrackOutput::GetMinimumTrackHeightInPixels() / 2 - painter->fontMetrics().height() / 2;
|
||||
QRectF text_rect = rect();
|
||||
text_rect.adjust(0, text_top, 0, 0);
|
||||
painter->drawText(text_rect, Qt::AlignLeft | Qt::AlignTop, block_->GetLabel());
|
||||
|
||||
// Linked clips are underlined
|
||||
if (block_->HasLinks()) {
|
||||
QFontMetrics fm = painter->fontMetrics();
|
||||
int text_width = qMin(qRound(rect().width()), QtUtils::QFontMetricsWidth(fm, block_->GetLabel()));
|
||||
|
||||
QPointF underline_start = rect().topLeft() + QPointF(0, text_top + fm.height());
|
||||
QPointF underline_end = underline_start + QPointF(text_width, 0);
|
||||
|
||||
painter->drawLine(underline_start, underline_end);
|
||||
}
|
||||
|
||||
painter->setPen(QColor(64, 64, 64));
|
||||
painter->drawLine(QPointF(rect().left(), rect().bottom() - 1), QPointF(rect().right(), rect().bottom() - 1));
|
||||
painter->drawLine(QPointF(rect().right(), rect().bottom() - 1), QPointF(rect().right(), rect().top()));
|
||||
break;
|
||||
}
|
||||
case Block::kGap:
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
// FIXME: Make this palette or CSS
|
||||
painter->fillRect(rect(), QColor(255, 255, 255, 128));
|
||||
}
|
||||
break;
|
||||
case Block::kTransition:
|
||||
{
|
||||
QLinearGradient grad;
|
||||
grad.setStart(0, rect().top());
|
||||
grad.setFinalStop(0, rect().bottom());
|
||||
grad.setColorAt(0.0, QColor(192, 160, 224));
|
||||
grad.setColorAt(1.0, QColor(160, 128, 192));
|
||||
painter->setBrush(grad);
|
||||
painter->setPen(QPen(QColor(96, 80, 112), 1));
|
||||
painter->drawRect(rect());
|
||||
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
painter->fillRect(rect(), QColor(0, 0, 0, 64));
|
||||
}
|
||||
|
||||
// Draw lines antialiased
|
||||
painter->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
TransitionBlock* t = static_cast<TransitionBlock*>(block_);
|
||||
|
||||
if (t->connected_out_block() && t->connected_in_block()) {
|
||||
|
||||
// Draw line between out offset and in offset
|
||||
qreal crossover_line = rect().left();
|
||||
crossover_line += TimeToScene(t->out_offset());
|
||||
painter->drawLine(qRound(crossover_line),
|
||||
qRound(rect().top()),
|
||||
qRound(crossover_line),
|
||||
qRound(rect().bottom()));
|
||||
|
||||
// Draw lines to mid point
|
||||
QPointF mid_point(crossover_line, rect().center().y());
|
||||
painter->drawLine(rect().topLeft(), mid_point);
|
||||
painter->drawLine(rect().bottomLeft(), mid_point);
|
||||
painter->drawLine(rect().topRight(), mid_point);
|
||||
painter->drawLine(rect().bottomRight(), mid_point);
|
||||
|
||||
} else if (t->connected_out_block()) {
|
||||
|
||||
// Transition fades something out, we'll draw a line
|
||||
painter->drawLine(rect().topLeft(), rect().bottomRight());
|
||||
|
||||
} else if (t->connected_in_block()) {
|
||||
|
||||
// Transition fades something in, we'll draw a line
|
||||
painter->drawLine(rect().bottomLeft(), rect().topRight());
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEVIEWCLIPITEM_H
|
||||
#define TIMELINEVIEWCLIPITEM_H
|
||||
|
||||
#include "timelineviewrect.h"
|
||||
#include "node/block/clip/clip.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
/**
|
||||
* @brief A graphical representation of a ClipBlock
|
||||
*/
|
||||
class TimelineViewBlockItem : public TimelineViewRect
|
||||
{
|
||||
public:
|
||||
TimelineViewBlockItem(Block* block, QGraphicsItem* parent = nullptr);
|
||||
|
||||
Block* block() const;
|
||||
|
||||
virtual void UpdateRect() override;
|
||||
|
||||
protected:
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr) override;
|
||||
|
||||
private:
|
||||
Block* block_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEVIEWCLIPITEM_H
|
||||
@@ -1,194 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewghostitem.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
namespace olive {
|
||||
|
||||
TimelineViewGhostItem::TimelineViewGhostItem() :
|
||||
track_adj_(0),
|
||||
mode_(Timeline::kNone),
|
||||
can_have_zero_length_(true),
|
||||
can_move_tracks_(true),
|
||||
invisible_(false)
|
||||
{
|
||||
}
|
||||
|
||||
TimelineViewGhostItem *TimelineViewGhostItem::FromBlock(Block *block, const TrackReference& track)
|
||||
{
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
|
||||
ghost->SetIn(block->in());
|
||||
ghost->SetOut(block->out());
|
||||
ghost->SetMediaIn(block->media_in());
|
||||
ghost->SetTrack(track);
|
||||
ghost->SetData(kAttachedBlock, Node::PtrToValue(block));
|
||||
|
||||
switch (block->type()) {
|
||||
case Block::kClip:
|
||||
ghost->can_have_zero_length_ = false;
|
||||
break;
|
||||
case Block::kTransition:
|
||||
ghost->can_have_zero_length_ = false;
|
||||
ghost->SetCanMoveTracks(false);
|
||||
break;
|
||||
case Block::kGap:
|
||||
break;
|
||||
}
|
||||
|
||||
return ghost;
|
||||
}
|
||||
|
||||
bool TimelineViewGhostItem::CanHaveZeroLength() const
|
||||
{
|
||||
return can_have_zero_length_;
|
||||
}
|
||||
|
||||
bool TimelineViewGhostItem::GetCanMoveTracks() const
|
||||
{
|
||||
return can_move_tracks_;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetCanMoveTracks(bool e)
|
||||
{
|
||||
can_move_tracks_ = e;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetIn() const
|
||||
{
|
||||
return in_;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetOut() const
|
||||
{
|
||||
return out_;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetMediaIn() const
|
||||
{
|
||||
return media_in_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetLength() const
|
||||
{
|
||||
return out_ - in_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetAdjustedLength() const
|
||||
{
|
||||
return GetAdjustedOut() - GetAdjustedIn();
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetIn(const rational &in)
|
||||
{
|
||||
in_ = in;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetOut(const rational &out)
|
||||
{
|
||||
out_ = out;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetMediaIn(const rational &media_in)
|
||||
{
|
||||
media_in_ = media_in;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetInAdjustment(const rational &in_adj)
|
||||
{
|
||||
in_adj_ = in_adj;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetOutAdjustment(const rational &out_adj)
|
||||
{
|
||||
out_adj_ = out_adj;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetTrackAdjustment(const int &track_adj)
|
||||
{
|
||||
track_adj_ = track_adj;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetMediaInAdjustment(const rational &media_in_adj)
|
||||
{
|
||||
media_in_adj_ = media_in_adj;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetInAdjustment() const
|
||||
{
|
||||
return in_adj_;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetOutAdjustment() const
|
||||
{
|
||||
return out_adj_;
|
||||
}
|
||||
|
||||
const rational &TimelineViewGhostItem::GetMediaInAdjustment() const
|
||||
{
|
||||
return media_in_adj_;
|
||||
}
|
||||
|
||||
const int &TimelineViewGhostItem::GetTrackAdjustment() const
|
||||
{
|
||||
return track_adj_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetAdjustedIn() const
|
||||
{
|
||||
return in_ + in_adj_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetAdjustedOut() const
|
||||
{
|
||||
return out_ + out_adj_;
|
||||
}
|
||||
|
||||
rational TimelineViewGhostItem::GetAdjustedMediaIn() const
|
||||
{
|
||||
return media_in_ + media_in_adj_;
|
||||
}
|
||||
|
||||
TrackReference TimelineViewGhostItem::GetAdjustedTrack() const
|
||||
{
|
||||
return TrackReference(track_.type(), track_.index() + track_adj_);
|
||||
}
|
||||
|
||||
const Timeline::MovementMode &TimelineViewGhostItem::GetMode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetMode(const Timeline::MovementMode &mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
}
|
||||
|
||||
bool TimelineViewGhostItem::HasBeenAdjusted() const
|
||||
{
|
||||
return GetInAdjustment() != 0
|
||||
|| GetOutAdjustment() != 0
|
||||
|| GetMediaInAdjustment() != 0
|
||||
|| GetTrackAdjustment() != 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,8 +25,7 @@
|
||||
|
||||
#include "project/item/footage/footage.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
#include "timelineviewblockitem.h"
|
||||
#include "timelineviewrect.h"
|
||||
#include "timeline/trackreference.h"
|
||||
|
||||
namespace olive {
|
||||
/**
|
||||
@@ -44,45 +43,172 @@ public:
|
||||
kTrimShouldBeIgnored
|
||||
};
|
||||
|
||||
TimelineViewGhostItem();
|
||||
TimelineViewGhostItem() :
|
||||
track_adj_(0),
|
||||
mode_(Timeline::kNone),
|
||||
can_have_zero_length_(true),
|
||||
can_move_tracks_(true),
|
||||
invisible_(false)
|
||||
{
|
||||
}
|
||||
|
||||
static TimelineViewGhostItem* FromBlock(Block *block, const TrackReference &track);
|
||||
static TimelineViewGhostItem* FromBlock(Block *block, const TrackReference &track)
|
||||
{
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
|
||||
bool CanHaveZeroLength() const;
|
||||
ghost->SetIn(block->in());
|
||||
ghost->SetOut(block->out());
|
||||
ghost->SetMediaIn(block->media_in());
|
||||
ghost->SetTrack(track);
|
||||
ghost->SetData(kAttachedBlock, Node::PtrToValue(block));
|
||||
|
||||
bool GetCanMoveTracks() const;
|
||||
void SetCanMoveTracks(bool e);
|
||||
switch (block->type()) {
|
||||
case Block::kClip:
|
||||
ghost->can_have_zero_length_ = false;
|
||||
break;
|
||||
case Block::kTransition:
|
||||
ghost->can_have_zero_length_ = false;
|
||||
ghost->SetCanMoveTracks(false);
|
||||
break;
|
||||
case Block::kGap:
|
||||
break;
|
||||
}
|
||||
|
||||
const rational& GetIn() const;
|
||||
const rational& GetOut() const;
|
||||
const rational& GetMediaIn() const;
|
||||
return ghost;
|
||||
}
|
||||
|
||||
rational GetLength() const;
|
||||
rational GetAdjustedLength() const;
|
||||
bool CanHaveZeroLength() const
|
||||
{
|
||||
return can_have_zero_length_;
|
||||
}
|
||||
|
||||
void SetIn(const rational& in);
|
||||
void SetOut(const rational& out);
|
||||
void SetMediaIn(const rational& media_in);
|
||||
bool GetCanMoveTracks() const
|
||||
{
|
||||
return can_move_tracks_;
|
||||
}
|
||||
|
||||
void SetInAdjustment(const rational& in_adj);
|
||||
void SetOutAdjustment(const rational& out_adj);
|
||||
void SetTrackAdjustment(const int& track_adj);
|
||||
void SetMediaInAdjustment(const rational& media_in_adj);
|
||||
void SetCanMoveTracks(bool e)
|
||||
{
|
||||
can_move_tracks_ = e;
|
||||
}
|
||||
|
||||
const rational& GetInAdjustment() const;
|
||||
const rational& GetOutAdjustment() const;
|
||||
const rational& GetMediaInAdjustment() const;
|
||||
const int& GetTrackAdjustment() const;
|
||||
const rational& GetIn() const
|
||||
{
|
||||
return in_;
|
||||
}
|
||||
|
||||
rational GetAdjustedIn() const;
|
||||
rational GetAdjustedOut() const;
|
||||
rational GetAdjustedMediaIn() const;
|
||||
TrackReference GetAdjustedTrack() const;
|
||||
const rational& GetOut() const
|
||||
{
|
||||
return out_;
|
||||
}
|
||||
|
||||
const Timeline::MovementMode& GetMode() const;
|
||||
void SetMode(const Timeline::MovementMode& GetMode);
|
||||
const rational& GetMediaIn() const
|
||||
{
|
||||
return media_in_;
|
||||
}
|
||||
|
||||
bool HasBeenAdjusted() const;
|
||||
rational GetLength() const
|
||||
{
|
||||
return out_ - in_;
|
||||
}
|
||||
|
||||
rational GetAdjustedLength() const
|
||||
{
|
||||
return GetAdjustedOut() - GetAdjustedIn();
|
||||
}
|
||||
|
||||
void SetIn(const rational& in)
|
||||
{
|
||||
in_ = in;
|
||||
}
|
||||
|
||||
void SetOut(const rational& out)
|
||||
{
|
||||
out_ = out;
|
||||
}
|
||||
|
||||
void SetMediaIn(const rational& media_in)
|
||||
{
|
||||
media_in_ = media_in;
|
||||
}
|
||||
|
||||
void SetInAdjustment(const rational& in_adj)
|
||||
{
|
||||
in_adj_ = in_adj;
|
||||
}
|
||||
|
||||
void SetOutAdjustment(const rational& out_adj)
|
||||
{
|
||||
out_adj_ = out_adj;
|
||||
}
|
||||
|
||||
void SetTrackAdjustment(const int& track_adj)
|
||||
{
|
||||
track_adj_ = track_adj;
|
||||
}
|
||||
|
||||
void SetMediaInAdjustment(const rational& media_in_adj)
|
||||
{
|
||||
media_in_adj_ = media_in_adj;
|
||||
}
|
||||
|
||||
const rational& GetInAdjustment() const
|
||||
{
|
||||
return in_adj_;
|
||||
}
|
||||
|
||||
const rational& GetOutAdjustment() const
|
||||
{
|
||||
return out_adj_;
|
||||
}
|
||||
|
||||
const rational& GetMediaInAdjustment() const
|
||||
{
|
||||
return media_in_adj_;
|
||||
}
|
||||
|
||||
const int& GetTrackAdjustment() const
|
||||
{
|
||||
return track_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedIn() const
|
||||
{
|
||||
return in_ + in_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedOut() const
|
||||
{
|
||||
return out_ + out_adj_;
|
||||
}
|
||||
|
||||
rational GetAdjustedMediaIn() const
|
||||
{
|
||||
return media_in_ + media_in_adj_;
|
||||
}
|
||||
|
||||
TrackReference GetAdjustedTrack() const
|
||||
{
|
||||
return TrackReference(track_.type(), track_.index() + track_adj_);
|
||||
}
|
||||
|
||||
const Timeline::MovementMode& GetMode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void SetMode(const Timeline::MovementMode& mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
}
|
||||
|
||||
bool HasBeenAdjusted() const
|
||||
{
|
||||
return GetInAdjustment() != 0
|
||||
|| GetOutAdjustment() != 0
|
||||
|| GetMediaInAdjustment() != 0
|
||||
|| GetTrackAdjustment() != 0;
|
||||
}
|
||||
|
||||
QVariant GetData(int key) const
|
||||
{
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewmouseevent.h"
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
TimelineViewMouseEvent::TimelineViewMouseEvent(const qreal &scene_x,
|
||||
const double &scale_x,
|
||||
const rational &timebase,
|
||||
const TrackReference &track,
|
||||
const Qt::MouseButton &button,
|
||||
const Qt::KeyboardModifiers &modifiers) :
|
||||
scene_x_(scene_x),
|
||||
scale_x_(scale_x),
|
||||
timebase_(timebase),
|
||||
track_(track),
|
||||
button_(button),
|
||||
modifiers_(modifiers),
|
||||
source_event_(nullptr),
|
||||
mime_data_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
TimelineCoordinate TimelineViewMouseEvent::GetCoordinates(bool round_time) const
|
||||
{
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers &TimelineViewMouseEvent::GetModifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
|
||||
rational TimelineViewMouseEvent::GetFrame(bool round) const
|
||||
{
|
||||
return TimeScaledObject::SceneToTime(scene_x_, scale_x_, timebase_, round);
|
||||
}
|
||||
|
||||
const TrackReference &TimelineViewMouseEvent::GetTrack() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
const QMimeData* TimelineViewMouseEvent::GetMimeData()
|
||||
{
|
||||
return mime_data_;
|
||||
}
|
||||
|
||||
void TimelineViewMouseEvent::SetMimeData(const QMimeData *data)
|
||||
{
|
||||
mime_data_ = data;
|
||||
}
|
||||
|
||||
void TimelineViewMouseEvent::SetEvent(QEvent *event)
|
||||
{
|
||||
source_event_ = event;
|
||||
}
|
||||
|
||||
const qreal &TimelineViewMouseEvent::GetSceneX() const
|
||||
{
|
||||
return scene_x_;
|
||||
}
|
||||
|
||||
const Qt::MouseButton &TimelineViewMouseEvent::GetButton() const
|
||||
{
|
||||
return button_;
|
||||
}
|
||||
|
||||
void TimelineViewMouseEvent::accept()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->accept();
|
||||
}
|
||||
|
||||
void TimelineViewMouseEvent::ignore()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->ignore();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <QPoint>
|
||||
|
||||
#include "timeline/timelinecoordinate.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -37,10 +38,27 @@ public:
|
||||
const rational& timebase,
|
||||
const TrackReference &track,
|
||||
const Qt::MouseButton &button,
|
||||
const Qt::KeyboardModifiers& modifiers = Qt::NoModifier);
|
||||
const Qt::KeyboardModifiers& modifiers = Qt::NoModifier) :
|
||||
scene_x_(scene_x),
|
||||
scale_x_(scale_x),
|
||||
timebase_(timebase),
|
||||
track_(track),
|
||||
button_(button),
|
||||
modifiers_(modifiers),
|
||||
source_event_(nullptr),
|
||||
mime_data_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const;
|
||||
const Qt::KeyboardModifiers& GetModifiers() const;
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const
|
||||
{
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers& GetModifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Gets the time at this cursor point
|
||||
@@ -51,21 +69,52 @@ public:
|
||||
* always to the left of the cursor. The former behavior is better for clicking between frames (e.g. razor tool) and
|
||||
* the latter is better for clicking directly on frames (e.g. pointer tool).
|
||||
*/
|
||||
rational GetFrame(bool round = false) const;
|
||||
rational GetFrame(bool round = false) const
|
||||
{
|
||||
return TimeScaledObject::SceneToTime(scene_x_, scale_x_, timebase_, round);
|
||||
}
|
||||
|
||||
const TrackReference& GetTrack() const;
|
||||
const TrackReference& GetTrack() const
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
const QMimeData *GetMimeData();
|
||||
void SetMimeData(const QMimeData *data);
|
||||
const QMimeData *GetMimeData()
|
||||
{
|
||||
return mime_data_;
|
||||
}
|
||||
|
||||
void SetEvent(QEvent* event);
|
||||
void SetMimeData(const QMimeData *data)
|
||||
{
|
||||
mime_data_ = data;
|
||||
}
|
||||
|
||||
const qreal& GetSceneX() const;
|
||||
void SetEvent(QEvent* event)
|
||||
{
|
||||
source_event_ = event;
|
||||
}
|
||||
|
||||
const Qt::MouseButton& GetButton() const;
|
||||
const qreal& GetSceneX() const
|
||||
{
|
||||
return scene_x_;
|
||||
}
|
||||
|
||||
void accept();
|
||||
void ignore();
|
||||
const Qt::MouseButton& GetButton() const
|
||||
{
|
||||
return button_;
|
||||
}
|
||||
|
||||
void accept()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->accept();
|
||||
}
|
||||
|
||||
void ignore()
|
||||
{
|
||||
if (source_event_ != nullptr)
|
||||
source_event_->ignore();
|
||||
}
|
||||
|
||||
private:
|
||||
qreal scene_x_;
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewrect.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
TimelineViewRect::TimelineViewRect(QGraphicsItem* parent) :
|
||||
QGraphicsRectItem(parent),
|
||||
y_(0),
|
||||
height_(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TimelineViewRect::SetYCoords(int y, int height)
|
||||
{
|
||||
y_ = y;
|
||||
height_ = height;
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
const TrackReference &TimelineViewRect::Track()
|
||||
{
|
||||
return track_;
|
||||
}
|
||||
|
||||
void TimelineViewRect::SetTrack(const TrackReference &track)
|
||||
{
|
||||
track_ = track;
|
||||
}
|
||||
|
||||
void TimelineViewRect::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimeScaledObject::ScaleChangedEvent(scale);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
void TimelineViewRect::TimebaseChangedEvent(const rational &tb)
|
||||
{
|
||||
TimeScaledObject::TimebaseChangedEvent(tb);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2020 Olive Team
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
***/
|
||||
|
||||
#ifndef TIMELINEVIEWRECT_H
|
||||
#define TIMELINEVIEWRECT_H
|
||||
|
||||
#include <QGraphicsRectItem>
|
||||
|
||||
#include "timeline/timelinecoordinate.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
/**
|
||||
* @brief A base class for graphical representations of Block nodes
|
||||
*/
|
||||
class TimelineViewRect : public QGraphicsRectItem, public TimeScaledObject
|
||||
{
|
||||
public:
|
||||
TimelineViewRect(QGraphicsItem* parent = nullptr);
|
||||
|
||||
void SetYCoords(int y, int height);
|
||||
|
||||
const TrackReference& Track();
|
||||
void SetTrack(const TrackReference& track);
|
||||
|
||||
virtual void UpdateRect() = 0;
|
||||
|
||||
protected:
|
||||
virtual void ScaleChangedEvent(const double &) override;
|
||||
|
||||
virtual void TimebaseChangedEvent(const rational&) override;
|
||||
|
||||
int y_;
|
||||
|
||||
int height_;
|
||||
|
||||
TrackReference track_;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // TIMELINEVIEWRECT_H
|
||||
Reference in New Issue
Block a user