Merge branch 'master' of https://github.com/olive-editor/olive
This commit is contained in:
@@ -24,11 +24,11 @@ add_subdirectory(curvewidget)
|
||||
add_subdirectory(flowlayout)
|
||||
add_subdirectory(focusablelineedit)
|
||||
add_subdirectory(footagecombobox)
|
||||
add_subdirectory(handmovableview)
|
||||
add_subdirectory(keyframeview)
|
||||
add_subdirectory(manageddisplay)
|
||||
add_subdirectory(menu)
|
||||
add_subdirectory(nodecombobox)
|
||||
add_subdirectory(nodecopypaste)
|
||||
add_subdirectory(nodetableview)
|
||||
add_subdirectory(nodetreeview)
|
||||
add_subdirectory(nodeparamview)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include "widget/nodeparamview/nodeparamviewkeyframecontrol.h"
|
||||
#include "widget/nodeparamview/nodeparamviewwidgetbridge.h"
|
||||
#include "widget/nodetreeview/nodetreeview.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ FootageComboBox::FootageComboBox(QWidget *parent) :
|
||||
|
||||
void FootageComboBox::showPopup()
|
||||
{
|
||||
if (root_ == nullptr || root_->child_count() == 0) {
|
||||
if (root_ == nullptr || root_->item_child_count() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ void FootageComboBox::showPopup()
|
||||
QAction* selected = menu.exec(parentWidget()->mapToGlobal(pos()));
|
||||
|
||||
if (selected != nullptr) {
|
||||
SetFootage(selected->data().value<StreamPtr>());
|
||||
SetFootage(Node::ValueToPtr<Stream>(selected->data()));
|
||||
|
||||
emit FootageChanged(footage_);
|
||||
}
|
||||
@@ -69,12 +69,7 @@ void FootageComboBox::SetOnlyShowReadyFootage(bool e)
|
||||
only_show_ready_footage_ = e;
|
||||
}
|
||||
|
||||
StreamPtr FootageComboBox::SelectedFootage()
|
||||
{
|
||||
return footage_;
|
||||
}
|
||||
|
||||
void FootageComboBox::SetFootage(StreamPtr f)
|
||||
void FootageComboBox::SetFootage(Stream *f)
|
||||
{
|
||||
// Remove existing single item used to show the footage name
|
||||
footage_ = f;
|
||||
@@ -82,10 +77,9 @@ void FootageComboBox::SetFootage(StreamPtr f)
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m) const
|
||||
{
|
||||
for (int i=0;i<f->child_count();i++) {
|
||||
Item* child = f->child(i);
|
||||
foreach (Item* child, f->children()) {
|
||||
|
||||
if (child->CanHaveChildren()) {
|
||||
|
||||
@@ -102,13 +96,15 @@ void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
Menu* stream_menu = new Menu(footage->name(), m);
|
||||
m->addMenu(stream_menu);
|
||||
|
||||
foreach (StreamPtr stream, footage->streams()) {
|
||||
QAction* stream_action = stream_menu->addAction(FootageToString(stream.get()));
|
||||
stream_action->setData(QVariant::fromValue(stream));
|
||||
foreach (Stream* stream, footage->streams()) {
|
||||
QAction* stream_action = stream_menu->addAction(FootageToString(stream));
|
||||
stream_action->setData(Node::PtrToValue(stream));
|
||||
stream_action->setIcon(stream->icon());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +115,7 @@ void FootageComboBox::UpdateText()
|
||||
|
||||
if (footage_) {
|
||||
// Use combobox functions to show the footage name
|
||||
addItem(FootageToString(footage_.get()));
|
||||
addItem(FootageToString(footage_));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,16 +41,19 @@ public:
|
||||
|
||||
void SetOnlyShowReadyFootage(bool e);
|
||||
|
||||
StreamPtr SelectedFootage();
|
||||
Stream* SelectedFootage() const
|
||||
{
|
||||
return footage_;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void SetFootage(StreamPtr f);
|
||||
void SetFootage(Stream* f);
|
||||
|
||||
signals:
|
||||
void FootageChanged(StreamPtr f);
|
||||
void FootageChanged(Stream* f);
|
||||
|
||||
private:
|
||||
void TraverseFolder(const Folder *f, QMenu* m);
|
||||
void TraverseFolder(const Folder *f, QMenu* m) const;
|
||||
|
||||
void UpdateText();
|
||||
|
||||
@@ -58,7 +61,7 @@ private:
|
||||
|
||||
const Folder* root_;
|
||||
|
||||
StreamPtr footage_;
|
||||
Stream* footage_;
|
||||
|
||||
bool only_show_ready_footage_;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# 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/>.
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/handmovableview/handmovableview.h
|
||||
widget/handmovableview/handmovableview.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -33,7 +33,7 @@
|
||||
namespace olive {
|
||||
|
||||
KeyframeViewBase::KeyframeViewBase(QWidget *parent) :
|
||||
TimelineViewBase(parent),
|
||||
TimeBasedView(parent),
|
||||
dragging_bezier_point_(nullptr),
|
||||
currently_autoselecting_(false)
|
||||
{
|
||||
@@ -275,7 +275,7 @@ void KeyframeViewBase::mouseReleaseEvent(QMouseEvent *event)
|
||||
|
||||
void KeyframeViewBase::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimelineViewBase::ScaleChangedEvent(scale);
|
||||
TimeBasedView::ScaleChangedEvent(scale);
|
||||
|
||||
QMap<NodeKeyframe*, KeyframeViewItem*>::const_iterator iterator;
|
||||
|
||||
|
||||
@@ -25,12 +25,12 @@
|
||||
#include "node/keyframe.h"
|
||||
#include "widget/curvewidget/beziercontrolpointitem.h"
|
||||
#include "widget/menu/menu.h"
|
||||
#include "widget/timelinewidget/view/timelineviewbase.h"
|
||||
#include "widget/timebased/timebasedview.h"
|
||||
#include "widget/timetarget/timetarget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class KeyframeViewBase : public TimelineViewBase, public TimeTargetObject
|
||||
class KeyframeViewBase : public TimeBasedView, public TimeTargetObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -1,180 +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 "nodecopypaste.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "core.h"
|
||||
#include "node/factory.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
#include "window/mainwindow/mainwindow.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
void NodeCopyPasteWidget::CopyNodesToClipboard(const QVector<Node *> &nodes, void *userdata)
|
||||
{
|
||||
QString copy_str;
|
||||
|
||||
QXmlStreamWriter writer(©_str);
|
||||
writer.setAutoFormatting(true);
|
||||
|
||||
writer.writeStartDocument();
|
||||
writer.writeStartElement(QStringLiteral("olive"));
|
||||
|
||||
foreach (Node* n, nodes) {
|
||||
writer.writeStartElement(QStringLiteral("node"));
|
||||
writer.writeAttribute(QStringLiteral("id"), n->id());
|
||||
n->Save(&writer);
|
||||
writer.writeEndElement(); // node
|
||||
}
|
||||
|
||||
writer.writeStartElement(QStringLiteral("custom"));
|
||||
CopyNodesToClipboardInternal(&writer, userdata);
|
||||
writer.writeEndElement(); // custom
|
||||
|
||||
writer.writeEndElement(); // olive
|
||||
writer.writeEndDocument();
|
||||
|
||||
Core::CopyStringToClipboard(copy_str);
|
||||
}
|
||||
|
||||
QVector<Node *> NodeCopyPasteWidget::PasteNodesFromClipboard(Sequence *graph, QUndoCommand* command, void *userdata)
|
||||
{
|
||||
QString clipboard = Core::PasteStringFromClipboard();
|
||||
|
||||
if (clipboard.isEmpty()) {
|
||||
return QVector<Node*>();
|
||||
}
|
||||
|
||||
QXmlStreamReader reader(clipboard);
|
||||
|
||||
QVector<Node*> pasted_nodes;
|
||||
XMLNodeData xml_node_data;
|
||||
|
||||
while (XMLReadNextStartElement(&reader)) {
|
||||
if (reader.name() == QStringLiteral("olive")) {
|
||||
while (XMLReadNextStartElement(&reader)) {
|
||||
if (reader.name() == QStringLiteral("node")) {
|
||||
Node* node = nullptr;
|
||||
|
||||
XMLAttributeLoop((&reader), attr) {
|
||||
if (attr.name() == QStringLiteral("id")) {
|
||||
node = NodeFactory::CreateFromID(attr.value().toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (node) {
|
||||
node->Load(&reader, xml_node_data, nullptr);
|
||||
|
||||
pasted_nodes.append(node);
|
||||
}
|
||||
} else if (reader.name() == QStringLiteral("custom")) {
|
||||
PasteNodesFromClipboardInternal(&reader, xml_node_data, userdata);
|
||||
} else {
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
reader.skipCurrentElement();
|
||||
}
|
||||
}
|
||||
|
||||
if (pasted_nodes.isEmpty()) {
|
||||
// If we passed through the whole string and there were no nodes, it must not be data for us after all
|
||||
return QVector<Node*>();
|
||||
}
|
||||
|
||||
// If we have some nodes AND the XML data was malformed, the user should probably know
|
||||
if (reader.hasError()) {
|
||||
// Delete all nodes so this is a no-op
|
||||
foreach (Node* n, pasted_nodes) {
|
||||
delete n;
|
||||
}
|
||||
|
||||
// If this was NOT an internal error, we assume it's an XML error that the user needs to know about
|
||||
QMessageBox::critical(Core::instance()->main_window(),
|
||||
QCoreApplication::translate("NodeCopyPasteWidget", "Error pasting nodes"),
|
||||
QCoreApplication::translate("NodeCopyPasteWidget", "Failed to paste nodes: %1").arg(reader.errorString()),
|
||||
QMessageBox::Ok);
|
||||
|
||||
return QVector<Node*>();
|
||||
}
|
||||
|
||||
// Add all nodes to graph
|
||||
foreach (Node* n, pasted_nodes) {
|
||||
new NodeAddCommand(graph, n, command);
|
||||
}
|
||||
|
||||
// Make connections
|
||||
if (!xml_node_data.desired_connections.isEmpty()) {
|
||||
XMLConnectNodes(xml_node_data, command);
|
||||
}
|
||||
|
||||
// Link blocks
|
||||
XMLLinkBlocks(xml_node_data);
|
||||
|
||||
// Connect footage to existing footage if it exists
|
||||
if (!xml_node_data.footage_connections.isEmpty()) {
|
||||
// Get list of all footage from project
|
||||
QList<ItemPtr> footage = graph->project()->get_items_of_type(Item::kFootage);
|
||||
|
||||
if (!footage.isEmpty()) {
|
||||
foreach (const XMLNodeData::FootageConnection& con, xml_node_data.footage_connections) {
|
||||
if (con.footage) {
|
||||
// Assume this is a pointer to a Stream*
|
||||
Stream* loaded_stream = reinterpret_cast<Stream*>(con.footage);
|
||||
|
||||
bool found = false;
|
||||
|
||||
foreach (ItemPtr item, footage) {
|
||||
const QList<StreamPtr>& streams = std::static_pointer_cast<Footage>(item)->streams();
|
||||
|
||||
foreach (StreamPtr s, streams) {
|
||||
if (s.get() == loaded_stream) {
|
||||
con.input->set_standard_value(QVariant::fromValue(s));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pasted_nodes;
|
||||
}
|
||||
|
||||
void NodeCopyPasteWidget::CopyNodesToClipboardInternal(QXmlStreamWriter*, void*)
|
||||
{
|
||||
}
|
||||
|
||||
void NodeCopyPasteWidget::PasteNodesFromClipboardInternal(QXmlStreamReader* reader, XMLNodeData &xml_node_data, void*)
|
||||
{
|
||||
reader->skipCurrentElement();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +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 NODECOPYPASTEWIDGET_H
|
||||
#define NODECOPYPASTEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QUndoCommand>
|
||||
|
||||
#include "node/node.h"
|
||||
#include "project/item/sequence/sequence.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class NodeCopyPasteWidget
|
||||
{
|
||||
public:
|
||||
NodeCopyPasteWidget() = default;
|
||||
|
||||
protected:
|
||||
void CopyNodesToClipboard(const QVector<Node *> &nodes, void* userdata = nullptr);
|
||||
|
||||
QVector<Node*> PasteNodesFromClipboard(Sequence *graph, QUndoCommand *command, void* userdata = nullptr);
|
||||
|
||||
virtual void CopyNodesToClipboardInternal(QXmlStreamWriter *writer, void* userdata);
|
||||
|
||||
virtual void PasteNodesFromClipboardInternal(QXmlStreamReader *reader, XMLNodeData &xml_node_data, void* userdata);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODECOPYPASTEWIDGET_H
|
||||
@@ -125,7 +125,7 @@ NodeParamView::NodeParamView(QWidget *parent) :
|
||||
// Set a default scale - FIXME: Hardcoded
|
||||
SetScale(120);
|
||||
|
||||
SetMaximumScale(TimelineViewBase::kMaximumScale);
|
||||
SetMaximumScale(TimeBasedView::kMaximumScale);
|
||||
|
||||
// Pickup on widget focus changes
|
||||
connect(qApp,
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include "node/node.h"
|
||||
#include "nodeparamviewitem.h"
|
||||
#include "widget/keyframeview/keyframeview.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ void NodeParamViewWidgetBridge::UpdateWidgetValues()
|
||||
break;
|
||||
}
|
||||
case NodeParam::kFootage:
|
||||
static_cast<FootageComboBox*>(widgets_.first())->SetFootage(input_->get_value_at_time(node_time).value<StreamPtr>());
|
||||
static_cast<FootageComboBox*>(widgets_.first())->SetFootage(Node::ValueToPtr<Stream>(input_->get_value_at_time(node_time)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
QVariant NodeTableTraverser::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
|
||||
QVariant NodeTableTraverser::ProcessVideoFootage(VideoStream *video_stream, const rational &input_time)
|
||||
{
|
||||
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
|
||||
return QVariant::fromValue(VideoParams(video_stream->width(),
|
||||
video_stream->height(),
|
||||
video_stream->timebase(),
|
||||
@@ -34,10 +32,8 @@ QVariant NodeTableTraverser::ProcessVideoFootage(StreamPtr stream, const rationa
|
||||
video_stream->pixel_aspect_ratio()));
|
||||
}
|
||||
|
||||
QVariant NodeTableTraverser::ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time)
|
||||
QVariant NodeTableTraverser::ProcessAudioFootage(AudioStream *audio_stream, const TimeRange &input_time)
|
||||
{
|
||||
AudioStreamPtr audio_stream = std::static_pointer_cast<AudioStream>(stream);
|
||||
|
||||
return QVariant::fromValue(AudioParams(audio_stream->sample_rate(),
|
||||
audio_stream->channel_layout(),
|
||||
AudioParams::kInternalFormat));
|
||||
|
||||
@@ -31,9 +31,9 @@ public:
|
||||
NodeTableTraverser() = default;
|
||||
|
||||
protected:
|
||||
virtual QVariant ProcessVideoFootage(StreamPtr stream, const rational &input_time);
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* video_stream, const rational &input_time);
|
||||
|
||||
virtual QVariant ProcessAudioFootage(StreamPtr stream, const TimeRange &input_time);
|
||||
virtual QVariant ProcessAudioFootage(AudioStream* audio_stream, const TimeRange &input_time);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#define NODETABLEWIDGET_H
|
||||
|
||||
#include "nodetableview.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include "node/graph.h"
|
||||
#include "node/nodecopypaste.h"
|
||||
#include "nodeviewscene.h"
|
||||
#include "widget/timelinewidget/view/handmovableview.h"
|
||||
#include "widget/nodecopypaste/nodecopypaste.h"
|
||||
#include "widget/handmovableview/handmovableview.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace olive {
|
||||
* This widget takes a NodeGraph object and constructs a QGraphicsScene representing its data, viewing and allowing
|
||||
* the user to make modifications to it.
|
||||
*/
|
||||
class NodeView : public HandMovableView, public NodeCopyPasteWidget
|
||||
class NodeView : public HandMovableView, public NodeCopyPasteService
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -307,7 +307,7 @@ void ProjectExplorer::ShowContextMenu()
|
||||
bool all_items_are_footage_or_sequence = true;
|
||||
|
||||
foreach (Item* i, context_menu_items_) {
|
||||
if (i->type() == Item::kFootage && !static_cast<Footage*>(i)->HasStreamsOfType(Stream::kVideo)) {
|
||||
if (i->type() == Item::kFootage && !static_cast<Footage*>(i)->HasEnabledStreamsOfType(Stream::kVideo)) {
|
||||
all_items_have_video_streams = false;
|
||||
}
|
||||
|
||||
@@ -324,15 +324,15 @@ void ProjectExplorer::ShowContextMenu()
|
||||
Menu* proxy_menu = new Menu(tr("Pre-Cache"), &menu);
|
||||
menu.addMenu(proxy_menu);
|
||||
|
||||
QList<ItemPtr> sequences = project()->get_items_of_type(Item::kSequence);
|
||||
QVector<Item*> sequences = project()->get_items_of_type(Item::kSequence);
|
||||
|
||||
if (sequences.isEmpty()) {
|
||||
QAction* a = proxy_menu->addAction(tr("No sequences exist in project"));
|
||||
a->setEnabled(false);
|
||||
} else {
|
||||
foreach (ItemPtr i, sequences) {
|
||||
foreach (Item* i, sequences) {
|
||||
QAction* a = proxy_menu->addAction(tr("For \"%1\"").arg(i->name()));
|
||||
a->setData(Node::PtrToValue(i.get()));
|
||||
a->setData(Node::PtrToValue(i));
|
||||
}
|
||||
|
||||
connect(proxy_menu, &Menu::triggered, this, &ProjectExplorer::ContextMenuStartProxy);
|
||||
@@ -416,11 +416,12 @@ void ProjectExplorer::OpenContextMenuItemInNewWindow()
|
||||
|
||||
void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
||||
{
|
||||
QList<VideoStreamPtr> video_streams;
|
||||
QVector<VideoStream*> video_streams;
|
||||
|
||||
// To get here, the `context_menu_items_` must be all kFootage
|
||||
foreach (Item* i, context_menu_items_) {
|
||||
VideoStreamPtr s = std::static_pointer_cast<VideoStream>(static_cast<Footage*>(i)->get_first_stream_of_type(Stream::kVideo));
|
||||
Footage* f = static_cast<Footage*>(i);
|
||||
VideoStream* s = static_cast<VideoStream*>(f->get_first_enabled_stream_of_type(Stream::kVideo));
|
||||
|
||||
if (s) {
|
||||
video_streams.append(s);
|
||||
@@ -430,7 +431,7 @@ void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
||||
Sequence* sequence = Node::ValueToPtr<Sequence>(a->data());
|
||||
|
||||
// Start a background task for proxying
|
||||
foreach (VideoStreamPtr video_stream, video_streams) {
|
||||
foreach (VideoStream* video_stream, video_streams) {
|
||||
PreCacheTask* proxy_task = new PreCacheTask(video_stream, sequence);
|
||||
TaskManager::instance()->AddTask(proxy_task);
|
||||
}
|
||||
@@ -501,7 +502,7 @@ Folder *ProjectExplorer::GetSelectedFolder() const
|
||||
|
||||
// If this item is not a folder, presumably it's parent is
|
||||
if (!sel_item->CanHaveChildren()) {
|
||||
sel_item = sel_item->parent();
|
||||
sel_item = sel_item->item_parent();
|
||||
|
||||
Q_ASSERT(sel_item->CanHaveChildren());
|
||||
}
|
||||
@@ -545,11 +546,11 @@ QList<MediaInput *> ProjectExplorer::GetMediaNodesUsingFootage(Footage *item)
|
||||
QList<MediaInput *> list;
|
||||
|
||||
// Get all sequences.
|
||||
QList<ItemPtr> sequences = model_.project()->get_items_of_type(Item::kSequence);
|
||||
QVector<Item*> sequences = model_.project()->get_items_of_type(Item::kSequence);
|
||||
|
||||
// Footage can contain multiple streams, all of which need to be dealt with
|
||||
foreach (ItemPtr s, sequences) {
|
||||
const QList<Node*>& nodes = static_cast<Sequence*>(s.get())->nodes();
|
||||
foreach (Item* s, sequences) {
|
||||
const QList<Node*>& nodes = static_cast<Sequence*>(s)->nodes();
|
||||
foreach (Node* n, nodes) {
|
||||
if (n->IsMedia()) {
|
||||
MediaInput* media_node = static_cast<MediaInput*>(n);
|
||||
@@ -677,7 +678,7 @@ void ProjectExplorer::DeleteSelected()
|
||||
break;
|
||||
}
|
||||
|
||||
new ProjectViewModel::RemoveItemCommand(&model_, item->get_shared_ptr(), command);
|
||||
new ProjectViewModel::RemoveItemCommand(&model_, item, command);
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
virtual void undo_internal() override;
|
||||
|
||||
private:
|
||||
QMap<MediaInput*, StreamPtr> stream_data_;
|
||||
QMap<MediaInput*, Stream*> stream_data_;
|
||||
|
||||
Project* project_;
|
||||
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
|
||||
#include "resizablescrollbar.h"
|
||||
#include "timeline/timelinepoints.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class ResizableTimelineScrollBar : public ResizableScrollBar, public TimelineScaledObject
|
||||
class ResizableTimelineScrollBar : public ResizableScrollBar, public TimeScaledObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/nodecopypaste/nodecopypaste.h
|
||||
widget/nodecopypaste/nodecopypaste.cpp
|
||||
widget/snapservice/snapservice.cpp
|
||||
widget/snapservice/snapservice.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -16,7 +16,11 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timebased/timebased.h
|
||||
widget/timebased/timebased.cpp
|
||||
widget/timebased/timebasedview.cpp
|
||||
widget/timebased/timebasedview.h
|
||||
widget/timebased/timebasedwidget.cpp
|
||||
widget/timebased/timebasedwidget.h
|
||||
widget/timebased/timescaledobject.cpp
|
||||
widget/timebased/timescaledobject.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
+25
-25
@@ -18,7 +18,7 @@
|
||||
|
||||
***/
|
||||
|
||||
#include "timelineviewbase.h"
|
||||
#include "timebasedview.h"
|
||||
|
||||
#include <QGraphicsRectItem>
|
||||
#include <QMouseEvent>
|
||||
@@ -30,9 +30,9 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
const double TimelineViewBase::kMaximumScale = 8192;
|
||||
const double TimeBasedView::kMaximumScale = 8192;
|
||||
|
||||
TimelineViewBase::TimelineViewBase(QWidget *parent) :
|
||||
TimeBasedView::TimeBasedView(QWidget *parent) :
|
||||
HandMovableView(parent),
|
||||
playhead_(0),
|
||||
playhead_scene_left_(-1),
|
||||
@@ -53,7 +53,7 @@ TimelineViewBase::TimelineViewBase(QWidget *parent) :
|
||||
SetDefaultDragMode(NoDrag);
|
||||
|
||||
// Signal to update bounding rect when the scene changes
|
||||
connect(&scene_, &QGraphicsScene::changed, this, &TimelineViewBase::UpdateSceneRect);
|
||||
connect(&scene_, &QGraphicsScene::changed, this, &TimeBasedView::UpdateSceneRect);
|
||||
|
||||
// Always enforce maximum scale
|
||||
SetMaximumScale(kMaximumScale);
|
||||
@@ -64,13 +64,13 @@ TimelineViewBase::TimelineViewBase(QWidget *parent) :
|
||||
setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||
}
|
||||
|
||||
void TimelineViewBase::TimebaseChangedEvent(const rational &)
|
||||
void TimeBasedView::TimebaseChangedEvent(const rational &)
|
||||
{
|
||||
// Timebase influences position/visibility of playhead
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineViewBase::EnableSnap(const QList<rational> &points)
|
||||
void TimeBasedView::EnableSnap(const QList<rational> &points)
|
||||
{
|
||||
snapped_ = true;
|
||||
snap_time_ = points;
|
||||
@@ -78,28 +78,28 @@ void TimelineViewBase::EnableSnap(const QList<rational> &points)
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineViewBase::DisableSnap()
|
||||
void TimeBasedView::DisableSnap()
|
||||
{
|
||||
snapped_ = false;
|
||||
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineViewBase::SetSnapService(SnapService *service)
|
||||
void TimeBasedView::SetSnapService(SnapService *service)
|
||||
{
|
||||
snap_service_ = service;
|
||||
}
|
||||
|
||||
const double &TimelineViewBase::GetYScale() const
|
||||
const double &TimeBasedView::GetYScale() const
|
||||
{
|
||||
return y_scale_;
|
||||
}
|
||||
|
||||
void TimelineViewBase::VerticalScaleChangedEvent(double)
|
||||
void TimeBasedView::VerticalScaleChangedEvent(double)
|
||||
{
|
||||
}
|
||||
|
||||
void TimelineViewBase::SetYScale(const double &y_scale)
|
||||
void TimeBasedView::SetYScale(const double &y_scale)
|
||||
{
|
||||
y_scale_ = y_scale;
|
||||
|
||||
@@ -110,7 +110,7 @@ void TimelineViewBase::SetYScale(const double &y_scale)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineViewBase::SetTime(const int64_t time)
|
||||
void TimeBasedView::SetTime(const int64_t time)
|
||||
{
|
||||
playhead_ = time;
|
||||
|
||||
@@ -118,7 +118,7 @@ void TimelineViewBase::SetTime(const int64_t time)
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
void TimelineViewBase::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
void TimeBasedView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
{
|
||||
QGraphicsView::drawForeground(painter, rect);
|
||||
|
||||
@@ -154,12 +154,12 @@ void TimelineViewBase::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
}
|
||||
}
|
||||
|
||||
rational TimelineViewBase::GetPlayheadTime() const
|
||||
rational TimeBasedView::GetPlayheadTime() const
|
||||
{
|
||||
return Timecode::timestamp_to_time(playhead_, timebase());
|
||||
}
|
||||
|
||||
bool TimelineViewBase::PlayheadPress(QMouseEvent *event)
|
||||
bool TimeBasedView::PlayheadPress(QMouseEvent *event)
|
||||
{
|
||||
QPointF scene_pos = mapToScene(event->pos());
|
||||
|
||||
@@ -170,7 +170,7 @@ bool TimelineViewBase::PlayheadPress(QMouseEvent *event)
|
||||
return dragging_playhead_;
|
||||
}
|
||||
|
||||
bool TimelineViewBase::PlayheadMove(QMouseEvent *event)
|
||||
bool TimeBasedView::PlayheadMove(QMouseEvent *event)
|
||||
{
|
||||
if (!dragging_playhead_) {
|
||||
return false;
|
||||
@@ -198,7 +198,7 @@ bool TimelineViewBase::PlayheadMove(QMouseEvent *event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TimelineViewBase::PlayheadRelease(QMouseEvent*)
|
||||
bool TimeBasedView::PlayheadRelease(QMouseEvent*)
|
||||
{
|
||||
if (dragging_playhead_) {
|
||||
dragging_playhead_ = false;
|
||||
@@ -213,19 +213,19 @@ bool TimelineViewBase::PlayheadRelease(QMouseEvent*)
|
||||
return false;
|
||||
}
|
||||
|
||||
qreal TimelineViewBase::GetPlayheadX()
|
||||
qreal TimeBasedView::GetPlayheadX()
|
||||
{
|
||||
return TimeToScene(Timecode::timestamp_to_time(playhead_, timebase()));
|
||||
}
|
||||
|
||||
void TimelineViewBase::SetEndTime(const rational &length)
|
||||
void TimeBasedView::SetEndTime(const rational &length)
|
||||
{
|
||||
end_time_ = length;
|
||||
|
||||
UpdateSceneRect();
|
||||
}
|
||||
|
||||
void TimelineViewBase::UpdateSceneRect()
|
||||
void TimeBasedView::UpdateSceneRect()
|
||||
{
|
||||
QRectF bounding_rect = scene_.itemsBoundingRect();
|
||||
|
||||
@@ -244,16 +244,16 @@ void TimelineViewBase::UpdateSceneRect()
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineViewBase::resizeEvent(QResizeEvent *event)
|
||||
void TimeBasedView::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QGraphicsView::resizeEvent(event);
|
||||
|
||||
UpdateSceneRect();
|
||||
}
|
||||
|
||||
void TimelineViewBase::ScaleChangedEvent(const double &scale)
|
||||
void TimeBasedView::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimelineScaledObject::ScaleChangedEvent(scale);
|
||||
TimeScaledObject::ScaleChangedEvent(scale);
|
||||
|
||||
// Update scene rect
|
||||
UpdateSceneRect();
|
||||
@@ -262,7 +262,7 @@ void TimelineViewBase::ScaleChangedEvent(const double &scale)
|
||||
viewport()->update();
|
||||
}
|
||||
|
||||
bool TimelineViewBase::HandleZoomFromScroll(QWheelEvent *event)
|
||||
bool TimeBasedView::HandleZoomFromScroll(QWheelEvent *event)
|
||||
{
|
||||
if (WheelEventIsAZoomEvent(event)) {
|
||||
// If CTRL is held (or a preference is set to swap CTRL behavior), we zoom instead of scrolling
|
||||
@@ -326,7 +326,7 @@ bool TimelineViewBase::HandleZoomFromScroll(QWheelEvent *event)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TimelineViewBase::WheelEventIsAZoomEvent(QWheelEvent *event)
|
||||
bool TimeBasedView::WheelEventIsAZoomEvent(QWheelEvent *event)
|
||||
{
|
||||
return (static_cast<bool>(event->modifiers() & Qt::ControlModifier) == !Config::Current()["ScrollZooms"].toBool());
|
||||
}
|
||||
+5
-5
@@ -24,17 +24,17 @@
|
||||
#include <QGraphicsView>
|
||||
|
||||
#include "core.h"
|
||||
#include "handmovableview.h"
|
||||
#include "widget/timelinewidget/snapservice.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "timescaledobject.h"
|
||||
#include "widget/handmovableview/handmovableview.h"
|
||||
#include "widget/snapservice/snapservice.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class TimelineViewBase : public HandMovableView, public TimelineScaledObject
|
||||
class TimeBasedView : public HandMovableView, public TimeScaledObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
TimelineViewBase(QWidget* parent = nullptr);
|
||||
TimeBasedView(QWidget* parent = nullptr);
|
||||
|
||||
static const double kMaximumScale;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
***/
|
||||
|
||||
#include "timebased.h"
|
||||
#include "timebasedwidget.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QUndoCommand>
|
||||
@@ -132,7 +132,7 @@ void TimeBasedWidget::UpdateMaximumScroll()
|
||||
scrollbar_->setMaximum(qMax(0, qCeil(TimeToScene(length)) - width()));
|
||||
}
|
||||
|
||||
foreach (TimelineViewBase* base, timeline_views_) {
|
||||
foreach (TimeBasedView* base, timeline_views_) {
|
||||
base->SetEndTime(length);
|
||||
}
|
||||
}
|
||||
@@ -238,7 +238,7 @@ TimelinePoints *TimeBasedWidget::GetConnectedTimelinePoints() const
|
||||
return points_;
|
||||
}
|
||||
|
||||
void TimeBasedWidget::ConnectTimelineView(TimelineViewBase *base)
|
||||
void TimeBasedWidget::ConnectTimelineView(TimeBasedView *base)
|
||||
{
|
||||
timeline_views_.append(base);
|
||||
}
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
#include "widget/resizablescrollbar/resizabletimelinescrollbar.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
#include "widget/timelinewidget/view/timelineview.h"
|
||||
#include "widget/timeruler/timeruler.h"
|
||||
|
||||
@@ -121,7 +121,7 @@ protected:
|
||||
|
||||
TimelinePoints* GetConnectedTimelinePoints() const;
|
||||
|
||||
void ConnectTimelineView(TimelineViewBase* base);
|
||||
void ConnectTimelineView(TimeBasedView* base);
|
||||
|
||||
void PassWheelEventsToScrollBar(QObject* object);
|
||||
|
||||
@@ -194,7 +194,7 @@ private:
|
||||
|
||||
TimelinePoints* points_;
|
||||
|
||||
QList<TimelineViewBase*> timeline_views_;
|
||||
QList<TimeBasedView*> timeline_views_;
|
||||
|
||||
bool toggle_show_all_;
|
||||
|
||||
+16
-16
@@ -18,7 +18,7 @@
|
||||
|
||||
***/
|
||||
|
||||
#include "timelinescaledobject.h"
|
||||
#include "timescaledobject.h"
|
||||
|
||||
#include <cfloat>
|
||||
#include <QtMath>
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
const int TimelineScaledObject::kCalculateDimensionsPadding = 10;
|
||||
const int TimeScaledObject::kCalculateDimensionsPadding = 10;
|
||||
|
||||
TimelineScaledObject::TimelineScaledObject() :
|
||||
TimeScaledObject::TimeScaledObject() :
|
||||
scale_(1.0),
|
||||
min_scale_(0),
|
||||
max_scale_(DBL_MAX)
|
||||
@@ -37,7 +37,7 @@ TimelineScaledObject::TimelineScaledObject() :
|
||||
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetTimebase(const rational &timebase)
|
||||
void TimeScaledObject::SetTimebase(const rational &timebase)
|
||||
{
|
||||
timebase_ = timebase;
|
||||
timebase_dbl_ = timebase_.toDouble();
|
||||
@@ -45,17 +45,17 @@ void TimelineScaledObject::SetTimebase(const rational &timebase)
|
||||
TimebaseChangedEvent(timebase);
|
||||
}
|
||||
|
||||
const rational &TimelineScaledObject::timebase() const
|
||||
const rational &TimeScaledObject::timebase() const
|
||||
{
|
||||
return timebase_;
|
||||
}
|
||||
|
||||
const double &TimelineScaledObject::timebase_dbl() const
|
||||
const double &TimeScaledObject::timebase_dbl() const
|
||||
{
|
||||
return timebase_dbl_;
|
||||
}
|
||||
|
||||
rational TimelineScaledObject::SceneToTime(const double &x, const double &x_scale, const rational &timebase, bool round)
|
||||
rational TimeScaledObject::SceneToTime(const double &x, const double &x_scale, const rational &timebase, bool round)
|
||||
{
|
||||
double unscaled_time = x / x_scale / timebase.toDouble();
|
||||
|
||||
@@ -72,17 +72,17 @@ rational TimelineScaledObject::SceneToTime(const double &x, const double &x_scal
|
||||
return rational(rounded_x_mvmt * timebase.numerator(), timebase.denominator());
|
||||
}
|
||||
|
||||
double TimelineScaledObject::TimeToScene(const rational &time)
|
||||
double TimeScaledObject::TimeToScene(const rational &time)
|
||||
{
|
||||
return time.toDouble() * scale_;
|
||||
}
|
||||
|
||||
rational TimelineScaledObject::SceneToTime(const double &x, bool round)
|
||||
rational TimeScaledObject::SceneToTime(const double &x, bool round)
|
||||
{
|
||||
return SceneToTime(x, scale_, timebase_, round);
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetMaximumScale(const double &max)
|
||||
void TimeScaledObject::SetMaximumScale(const double &max)
|
||||
{
|
||||
max_scale_ = max;
|
||||
|
||||
@@ -91,7 +91,7 @@ void TimelineScaledObject::SetMaximumScale(const double &max)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetMinimumScale(const double &min)
|
||||
void TimeScaledObject::SetMinimumScale(const double &min)
|
||||
{
|
||||
min_scale_ = min;
|
||||
|
||||
@@ -100,12 +100,12 @@ void TimelineScaledObject::SetMinimumScale(const double &min)
|
||||
}
|
||||
}
|
||||
|
||||
const double& TimelineScaledObject::GetScale() const
|
||||
const double& TimeScaledObject::GetScale() const
|
||||
{
|
||||
return scale_;
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetScale(const double& scale)
|
||||
void TimeScaledObject::SetScale(const double& scale)
|
||||
{
|
||||
Q_ASSERT(scale > 0);
|
||||
|
||||
@@ -114,17 +114,17 @@ void TimelineScaledObject::SetScale(const double& scale)
|
||||
ScaleChangedEvent(scale_);
|
||||
}
|
||||
|
||||
void TimelineScaledObject::SetScaleFromDimensions(double viewport_width, double content_width)
|
||||
void TimeScaledObject::SetScaleFromDimensions(double viewport_width, double content_width)
|
||||
{
|
||||
SetScale(CalculateScaleFromDimensions(viewport_width, content_width));
|
||||
}
|
||||
|
||||
double TimelineScaledObject::CalculateScaleFromDimensions(double viewport_sz, double content_sz)
|
||||
double TimeScaledObject::CalculateScaleFromDimensions(double viewport_sz, double content_sz)
|
||||
{
|
||||
return static_cast<double>(viewport_sz / kCalculateDimensionsPadding * (kCalculateDimensionsPadding-1)) / static_cast<double>(content_sz);
|
||||
}
|
||||
|
||||
double TimelineScaledObject::CalculatePaddingFromDimensionScale(double viewport_sz)
|
||||
double TimeScaledObject::CalculatePaddingFromDimensionScale(double viewport_sz)
|
||||
{
|
||||
return (viewport_sz / (kCalculateDimensionsPadding * 2));
|
||||
}
|
||||
+7
-4
@@ -27,11 +27,14 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
class TimelineScaledObject
|
||||
/**
|
||||
* @brief Provides base functionality for any object that uses time and scale
|
||||
*/
|
||||
class TimeScaledObject
|
||||
{
|
||||
public:
|
||||
TimelineScaledObject();
|
||||
virtual ~TimelineScaledObject() = default;
|
||||
TimeScaledObject();
|
||||
virtual ~TimeScaledObject() = default;
|
||||
|
||||
void SetTimebase(const rational &timebase);
|
||||
|
||||
@@ -75,7 +78,7 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class TimelineScaledWidget : public QWidget, public TimelineScaledObject
|
||||
class TimelineScaledWidget : public QWidget, public TimeScaledObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -21,12 +21,8 @@ add_subdirectory(view)
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timelinewidget/snapservice.h
|
||||
widget/timelinewidget/snapservice.cpp
|
||||
widget/timelinewidget/timelineandtrackview.h
|
||||
widget/timelinewidget/timelineandtrackview.cpp
|
||||
widget/timelinewidget/timelinescaledobject.h
|
||||
widget/timelinewidget/timelinescaledobject.cpp
|
||||
widget/timelinewidget/timelinewidget.h
|
||||
widget/timelinewidget/timelinewidget.cpp
|
||||
widget/timelinewidget/timelinewidgetselections.h
|
||||
|
||||
@@ -160,7 +160,7 @@ TimelineWidget::TimelineWidget(QWidget *parent) :
|
||||
// FIXME: Magic number
|
||||
SetScale(90.0);
|
||||
|
||||
SetMaximumScale(TimelineViewBase::kMaximumScale);
|
||||
SetMaximumScale(TimeBasedView::kMaximumScale);
|
||||
SetAutoSetTimebase(false);
|
||||
|
||||
connect(Core::instance(), &Core::ToolChanged, this, &TimelineWidget::ToolChanged);
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
|
||||
#include "core.h"
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "node/nodecopypaste.h"
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "snapservice.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
#include "timelineandtrackview.h"
|
||||
#include "widget/nodecopypaste/nodecopypaste.h"
|
||||
#include "widget/slider/timeslider.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/snapservice/snapservice.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
#include "widget/timelinewidget/timelinewidgetselections.h"
|
||||
#include "widget/timelinewidget/tool/import.h"
|
||||
#include "widget/timelinewidget/tool/tool.h"
|
||||
@@ -45,7 +45,7 @@ namespace olive {
|
||||
*
|
||||
* Encapsulates TimelineViews, TimeRulers, and scrollbars for a complete widget to manipulate Timelines
|
||||
*/
|
||||
class TimelineWidget : public TimeBasedWidget, public NodeCopyPasteWidget, public SnapService
|
||||
class TimelineWidget : public TimeBasedWidget, public NodeCopyPasteService, public SnapService
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -224,7 +224,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
quint64 enabled_streams = footage.streams();
|
||||
|
||||
// Loop through all streams in footage
|
||||
foreach (StreamPtr stream, footage.footage()->streams()) {
|
||||
foreach (Stream* stream, footage.footage()->streams()) {
|
||||
Timeline::TrackType track_type = TrackTypeFromStreamType(stream->type());
|
||||
|
||||
quint64 cached_enabled_streams = enabled_streams;
|
||||
@@ -239,7 +239,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
|
||||
if (stream->type() == Stream::kVideo
|
||||
&& std::static_pointer_cast<VideoStream>(stream)->video_type() == VideoStream::kVideoTypeStill) {
|
||||
&& static_cast<VideoStream*>(stream)->video_type() == VideoStream::kVideoTypeStill) {
|
||||
// Stream is essentially length-less - we may use the default still image length in config,
|
||||
// or we may use another stream's length depending on the circumstance
|
||||
contains_image_stream = true;
|
||||
@@ -260,7 +260,7 @@ void ImportTool::FootageToGhosts(rational ghost_start, const QList<DraggedFootag
|
||||
// Increment track count for this track type
|
||||
track_offsets[track_type]++;
|
||||
|
||||
ghost->SetData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(stream));
|
||||
ghost->SetData(TimelineViewGhostItem::kAttachedFootage, Node::PtrToValue(stream));
|
||||
ghost->SetMode(Timeline::kMove);
|
||||
|
||||
footage_ghosts.append(ghost);
|
||||
@@ -353,7 +353,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
Project* active_project = Core::instance()->GetActiveProject();
|
||||
|
||||
if (active_project) {
|
||||
SequencePtr new_sequence = Core::instance()->CreateNewSequenceForProject(active_project);
|
||||
Sequence* new_sequence = Core::instance()->CreateNewSequenceForProject(active_project);
|
||||
|
||||
new_sequence->set_default_parameters();
|
||||
|
||||
@@ -371,7 +371,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
} else {
|
||||
|
||||
SequenceDialog sd(new_sequence.get(), SequenceDialog::kNew, parent());
|
||||
SequenceDialog sd(new_sequence, SequenceDialog::kNew, parent());
|
||||
sd.SetUndoable(false);
|
||||
|
||||
if (sd.exec() != QDialog::Accepted) {
|
||||
@@ -390,11 +390,15 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
FootageToGhosts(0, dragged_footage_, new_sequence->video_params().time_base(), 0);
|
||||
|
||||
dst_graph = new_sequence.get();
|
||||
dst_graph = new_sequence;
|
||||
viewer_node = new_sequence->viewer_output();
|
||||
|
||||
// Set this as the sequence to open
|
||||
open_sequence = new_sequence.get();
|
||||
open_sequence = new_sequence;
|
||||
} else {
|
||||
// If the sequence is valid, ownership is passed to AddItemCommand.
|
||||
// Otherwise, we're responsible for deleting it.
|
||||
delete new_sequence;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,7 +416,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
for (int i=0;i<parent()->GetGhostItems().size();i++) {
|
||||
TimelineViewGhostItem* ghost = parent()->GetGhostItems().at(i);
|
||||
|
||||
StreamPtr footage_stream = ghost->GetData(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
|
||||
Stream* footage_stream = Node::ValueToPtr<Stream>(ghost->GetData(TimelineViewGhostItem::kAttachedFootage));
|
||||
|
||||
ClipBlock* clip = new ClipBlock();
|
||||
clip->set_media_in(ghost->GetMediaIn());
|
||||
@@ -475,7 +479,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
|
||||
// Link any clips so far that share the same Footage with this one
|
||||
for (int j=0;j<i;j++) {
|
||||
StreamPtr footage_compare = parent()->GetGhostItems().at(j)->GetData(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
|
||||
Stream* footage_compare = Node::ValueToPtr<Stream>(parent()->GetGhostItems().at(j)->GetData(TimelineViewGhostItem::kAttachedFootage));
|
||||
|
||||
if (footage_compare->footage() == footage_stream->footage()) {
|
||||
Block::Link(block_items.at(j), clip);
|
||||
|
||||
@@ -68,7 +68,7 @@ void ZoomTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
// Normalize scale to 1.0 scale
|
||||
double scene_width = (scene_right - scene_left) / parent()->GetScale();
|
||||
|
||||
double new_scale = qMin(TimelineViewBase::kMaximumScale, static_cast<double>(reference_view->viewport()->width()) / scene_width);
|
||||
double new_scale = qMin(TimeBasedView::kMaximumScale, static_cast<double>(reference_view->viewport()->width()) / scene_width);
|
||||
|
||||
parent()->SetScale(new_scale);
|
||||
|
||||
|
||||
@@ -16,19 +16,15 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timelinewidget/view/handmovableview.h
|
||||
widget/timelinewidget/view/handmovableview.cpp
|
||||
widget/timelinewidget/view/timelineview.h
|
||||
widget/timelinewidget/view/timelineview.cpp
|
||||
widget/timelinewidget/view/timelineviewmouseevent.h
|
||||
widget/timelinewidget/view/timelineview.h
|
||||
widget/timelinewidget/view/timelineviewmouseevent.cpp
|
||||
widget/timelinewidget/view/timelineviewrect.h
|
||||
widget/timelinewidget/view/timelineviewmouseevent.h
|
||||
widget/timelinewidget/view/timelineviewrect.cpp
|
||||
widget/timelinewidget/view/timelineviewbase.h
|
||||
widget/timelinewidget/view/timelineviewbase.cpp
|
||||
widget/timelinewidget/view/timelineviewblockitem.h
|
||||
widget/timelinewidget/view/timelineviewrect.h
|
||||
widget/timelinewidget/view/timelineviewblockitem.cpp
|
||||
widget/timelinewidget/view/timelineviewghostitem.h
|
||||
widget/timelinewidget/view/timelineviewblockitem.h
|
||||
widget/timelinewidget/view/timelineviewghostitem.cpp
|
||||
widget/timelinewidget/view/timelineviewghostitem.h
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
namespace olive {
|
||||
|
||||
TimelineView::TimelineView(Qt::Alignment vertical_alignment, QWidget *parent) :
|
||||
TimelineViewBase(parent),
|
||||
TimeBasedView(parent),
|
||||
selections_(nullptr),
|
||||
ghosts_(nullptr),
|
||||
show_beam_cursor_(false),
|
||||
@@ -59,7 +59,7 @@ void TimelineView::mousePressEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
TimelineViewBase::mousePressEvent(event);
|
||||
TimeBasedView::mousePressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void TimelineView::mouseMoveEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
TimelineViewBase::mouseMoveEvent(event);
|
||||
TimeBasedView::mouseMoveEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ void TimelineView::mouseReleaseEvent(QMouseEvent *event)
|
||||
}
|
||||
|
||||
if (dragMode() != GetDefaultDragMode()) {
|
||||
TimelineViewBase::mouseReleaseEvent(event);
|
||||
TimeBasedView::mouseReleaseEvent(event);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ void TimelineView::drawForeground(QPainter *painter, const QRectF &rect)
|
||||
}
|
||||
|
||||
// Draw standard TimelineViewBase things (such as playhead)
|
||||
TimelineViewBase::drawForeground(painter, rect);
|
||||
TimeBasedView::drawForeground(painter, rect);
|
||||
}
|
||||
|
||||
void TimelineView::ToolChangedEvent(Tool::Item tool)
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
#include <QDropEvent>
|
||||
|
||||
#include "node/block/clip/clip.h"
|
||||
#include "timelineviewbase.h"
|
||||
#include "timelineviewblockitem.h"
|
||||
#include "timelineviewmouseevent.h"
|
||||
#include "timelineviewghostitem.h"
|
||||
#include "widget/timebased/timebasedview.h"
|
||||
#include "widget/timelinewidget/undo/undo.h"
|
||||
#include "undo/undostack.h"
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace olive {
|
||||
*
|
||||
* This widget primarily exposes users to viewing and modifying Block nodes, usually through a TimelineOutput node.
|
||||
*/
|
||||
class TimelineView : public TimelineViewBase
|
||||
class TimelineView : public TimeBasedView
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace olive {
|
||||
|
||||
TimelineViewGhostItem::TimelineViewGhostItem() :
|
||||
track_adj_(0),
|
||||
stream_(nullptr),
|
||||
mode_(Timeline::kNone),
|
||||
can_have_zero_length_(true),
|
||||
can_move_tracks_(true),
|
||||
|
||||
@@ -127,8 +127,6 @@ private:
|
||||
|
||||
int track_adj_;
|
||||
|
||||
StreamPtr stream_;
|
||||
|
||||
Timeline::MovementMode mode_;
|
||||
|
||||
bool can_have_zero_length_;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <QEvent>
|
||||
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -48,14 +48,14 @@ TimelineCoordinate TimelineViewMouseEvent::GetCoordinates(bool round_time) const
|
||||
return TimelineCoordinate(GetFrame(round_time), track_);
|
||||
}
|
||||
|
||||
const Qt::KeyboardModifiers TimelineViewMouseEvent::GetModifiers() const
|
||||
const Qt::KeyboardModifiers &TimelineViewMouseEvent::GetModifiers() const
|
||||
{
|
||||
return modifiers_;
|
||||
}
|
||||
|
||||
rational TimelineViewMouseEvent::GetFrame(bool round) const
|
||||
{
|
||||
return TimelineScaledObject::SceneToTime(scene_x_, scale_x_, timebase_, round);
|
||||
return TimeScaledObject::SceneToTime(scene_x_, scale_x_, timebase_, round);
|
||||
}
|
||||
|
||||
const TrackReference &TimelineViewMouseEvent::GetTrack() const
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
const Qt::KeyboardModifiers& modifiers = Qt::NoModifier);
|
||||
|
||||
TimelineCoordinate GetCoordinates(bool round_time = false) const;
|
||||
const Qt::KeyboardModifiers GetModifiers() const;
|
||||
const Qt::KeyboardModifiers& GetModifiers() const;
|
||||
|
||||
/**
|
||||
* @brief Gets the time at this cursor point
|
||||
|
||||
@@ -50,14 +50,14 @@ void TimelineViewRect::SetTrack(const TrackReference &track)
|
||||
|
||||
void TimelineViewRect::ScaleChangedEvent(const double &scale)
|
||||
{
|
||||
TimelineScaledObject::ScaleChangedEvent(scale);
|
||||
TimeScaledObject::ScaleChangedEvent(scale);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
void TimelineViewRect::TimebaseChangedEvent(const rational &tb)
|
||||
{
|
||||
TimelineScaledObject::TimebaseChangedEvent(tb);
|
||||
TimeScaledObject::TimebaseChangedEvent(tb);
|
||||
|
||||
UpdateRect();
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
#include <QGraphicsRectItem>
|
||||
|
||||
#include "timeline/timelinecoordinate.h"
|
||||
#include "../timelinescaledobject.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
/**
|
||||
* @brief A base class for graphical representations of Block nodes
|
||||
*/
|
||||
class TimelineViewRect : public QGraphicsRectItem, public TimelineScaledObject
|
||||
class TimelineViewRect : public QGraphicsRectItem, public TimeScaledObject
|
||||
{
|
||||
public:
|
||||
TimelineViewRect(QGraphicsItem* parent = nullptr);
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#include "common/rational.h"
|
||||
#include "timeline/timelinepoints.h"
|
||||
#include "widget/timelinewidget/snapservice.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
#include "widget/snapservice/snapservice.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
@@ -75,20 +75,20 @@ void FootageViewerWidget::SetFootage(Footage *footage)
|
||||
sequence_.set_parameters_from_footage({footage_});
|
||||
|
||||
// Use first of each stream
|
||||
VideoStreamPtr video_stream = nullptr;
|
||||
AudioStreamPtr audio_stream = nullptr;
|
||||
VideoStream* video_stream = nullptr;
|
||||
AudioStream* audio_stream = nullptr;
|
||||
|
||||
foreach (StreamPtr s, footage_->streams()) {
|
||||
foreach (Stream* s, footage_->streams()) {
|
||||
if (!s->enabled()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!audio_stream && s->type() == Stream::kAudio) {
|
||||
audio_stream = std::static_pointer_cast<AudioStream>(s);
|
||||
audio_stream = static_cast<AudioStream*>(s);
|
||||
}
|
||||
|
||||
if (!video_stream && s->type() == Stream::kVideo) {
|
||||
video_stream = std::static_pointer_cast<VideoStream>(s);
|
||||
video_stream = static_cast<VideoStream*>(s);
|
||||
}
|
||||
|
||||
if (audio_stream && video_stream) {
|
||||
@@ -142,7 +142,7 @@ void FootageViewerWidget::StartFootageDragInternal(bool enable_video, bool enabl
|
||||
if (!enable_video || !enable_audio) {
|
||||
quint64 stream_disabler = 0x1;
|
||||
|
||||
foreach (StreamPtr s, GetFootage()->streams()) {
|
||||
foreach (Stream* s, GetFootage()->streams()) {
|
||||
if ((s->type() == Stream::kVideo && !enable_video)
|
||||
|| (s->type() == Stream::kAudio && !enable_audio)) {
|
||||
enabled_stream_flags &= ~stream_disabler;
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
|
||||
namespace olive {
|
||||
|
||||
QVariant GizmoTraverser::ProcessVideoFootage(StreamPtr stream, const rational &input_time)
|
||||
QVariant GizmoTraverser::ProcessVideoFootage(VideoStream *stream, const rational &input_time)
|
||||
{
|
||||
Q_UNUSED(input_time)
|
||||
|
||||
VideoStreamPtr image_stream = std::static_pointer_cast<VideoStream>(stream);
|
||||
VideoStream* image_stream = static_cast<VideoStream*>(stream);
|
||||
|
||||
return QVector2D(image_stream->width() * image_stream->pixel_aspect_ratio().toDouble(),
|
||||
image_stream->height());
|
||||
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual QVariant ProcessVideoFootage(StreamPtr stream, const rational &input_time) override;
|
||||
virtual QVariant ProcessVideoFootage(VideoStream* stream, const rational &input_time) override;
|
||||
|
||||
virtual QVariant ProcessShader(const Node *node, const TimeRange &range, const ShaderJob& job) override;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include "viewersizer.h"
|
||||
#include "viewerwindow.h"
|
||||
#include "widget/playbackcontrols/playbackcontrols.h"
|
||||
#include "widget/timebased/timebased.h"
|
||||
#include "widget/timebased/timebasedwidget.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user