various small code cleanups and improvements
Largely refactoring work to make the code somewhat nicer to work with.
This commit is contained in:
@@ -24,18 +24,14 @@
|
||||
#include "panel/panelmanager.h"
|
||||
#include "panel/timeline/timeline.h"
|
||||
|
||||
MenuShared olive::menu_shared;
|
||||
MenuShared* MenuShared::instance_ = nullptr;
|
||||
|
||||
MenuShared::MenuShared()
|
||||
{
|
||||
}
|
||||
|
||||
void MenuShared::Initialize()
|
||||
{
|
||||
// "New" menu shared items
|
||||
new_project_item_ = Menu::CreateItem(this, "newproj", nullptr, nullptr, "Ctrl+N");
|
||||
new_sequence_item_ = Menu::CreateItem(this, "newseq", &olive::core, SLOT(CreateNewSequence()), "Ctrl+Shift+N");
|
||||
new_folder_item_ = Menu::CreateItem(this, "newfolder", &olive::core, SLOT(CreateNewFolder()));
|
||||
new_sequence_item_ = Menu::CreateItem(this, "newseq", Core::instance(), SLOT(CreateNewSequence()), "Ctrl+Shift+N");
|
||||
new_folder_item_ = Menu::CreateItem(this, "newfolder", Core::instance(), SLOT(CreateNewFolder()));
|
||||
|
||||
// "Edit" menu shared items
|
||||
edit_cut_item_ = Menu::CreateItem(this, "cut", nullptr, nullptr, "Ctrl+X");
|
||||
@@ -63,6 +59,16 @@ void MenuShared::Initialize()
|
||||
Retranslate();
|
||||
}
|
||||
|
||||
void MenuShared::CreateInstance()
|
||||
{
|
||||
instance_ = new MenuShared();
|
||||
}
|
||||
|
||||
void MenuShared::DestroyInstance()
|
||||
{
|
||||
delete instance_;
|
||||
}
|
||||
|
||||
void MenuShared::AddItemsForNewMenu(Menu *m)
|
||||
{
|
||||
m->addAction(new_project_item_);
|
||||
@@ -101,6 +107,11 @@ void MenuShared::AddItemsForClipEditMenu(Menu *m)
|
||||
m->addAction(clip_nest_item_);
|
||||
}
|
||||
|
||||
MenuShared *MenuShared::instance()
|
||||
{
|
||||
return instance_;
|
||||
}
|
||||
|
||||
void MenuShared::SplitAtPlayhead()
|
||||
{
|
||||
TimelinePanel* timeline = PanelManager::instance()->MostRecentlyFocused<TimelinePanel>();
|
||||
|
||||
@@ -31,7 +31,9 @@ class MenuShared : public QObject {
|
||||
public:
|
||||
MenuShared();
|
||||
|
||||
void Initialize();
|
||||
static void CreateInstance();
|
||||
static void DestroyInstance();
|
||||
|
||||
void Retranslate();
|
||||
|
||||
void AddItemsForNewMenu(Menu* m);
|
||||
@@ -39,6 +41,8 @@ public:
|
||||
void AddItemsForInOutMenu(Menu* m);
|
||||
void AddItemsForClipEditMenu(Menu* m);
|
||||
|
||||
static MenuShared* instance();
|
||||
|
||||
private:
|
||||
// "New" menu shared items
|
||||
QAction* new_project_item_;
|
||||
@@ -68,6 +72,8 @@ private:
|
||||
QAction* clip_enable_disable_item_;
|
||||
QAction* clip_nest_item_;
|
||||
|
||||
static MenuShared* instance_;
|
||||
|
||||
private slots:
|
||||
void SplitAtPlayhead();
|
||||
|
||||
@@ -75,8 +81,4 @@ private slots:
|
||||
|
||||
};
|
||||
|
||||
namespace olive {
|
||||
extern MenuShared menu_shared;
|
||||
}
|
||||
|
||||
#endif // MENUSHARED_H
|
||||
|
||||
@@ -26,10 +26,10 @@
|
||||
#include <QMessageBox>
|
||||
#include <QPainter>
|
||||
|
||||
#include "core.h"
|
||||
#include "nodeparamviewundo.h"
|
||||
#include "project/item/sequence/sequence.h"
|
||||
#include "ui/icons/icons.h"
|
||||
#include "undo/undostack.h"
|
||||
|
||||
NodeParamViewItem::NodeParamViewItem(Node *node, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
@@ -260,7 +260,7 @@ void NodeParamViewItem::UserChangedKeyframeEnable(bool e)
|
||||
}
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
void NodeParamViewItem::UserToggledKeyframe(bool e)
|
||||
@@ -283,7 +283,7 @@ void NodeParamViewItem::UserToggledKeyframe(bool e)
|
||||
new NodeParamRemoveKeyframeCommand(input, key, command);
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
void NodeParamViewItem::InputKeyframeEnableChanged(bool e)
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <QVector3D>
|
||||
#include <QVector4D>
|
||||
|
||||
#include "core.h"
|
||||
#include "node/node.h"
|
||||
#include "nodeparamviewundo.h"
|
||||
#include "project/item/sequence/sequence.h"
|
||||
@@ -262,7 +263,7 @@ void NodeParamViewWidgetBridge::SetInputValue(const QVariant &value)
|
||||
new NodeParamSetKeyframeValueCommand(input_->keyframes().first(), value, command);
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
void NodeParamViewWidgetBridge::WidgetCallback()
|
||||
|
||||
@@ -20,9 +20,9 @@
|
||||
|
||||
#include "nodeview.h"
|
||||
|
||||
#include "core.h"
|
||||
#include "nodeviewundo.h"
|
||||
#include "node/factory.h"
|
||||
#include "undo/undostack.h"
|
||||
|
||||
NodeView::NodeView(QWidget *parent) :
|
||||
QGraphicsView(parent),
|
||||
@@ -142,7 +142,7 @@ void NodeView::DeleteSelected()
|
||||
return;
|
||||
}
|
||||
|
||||
olive::undo_stack.push(new NodeRemoveCommand(graph_, selected_nodes));
|
||||
Core::instance()->undo_stack()->push(new NodeRemoveCommand(graph_, selected_nodes));
|
||||
}
|
||||
|
||||
void NodeView::AddNode(Node* node)
|
||||
@@ -244,6 +244,6 @@ void NodeView::CreateNodeSlot(QAction *action)
|
||||
Node* new_node = NodeFactory::CreateFromMenuAction(action);
|
||||
|
||||
if (new_node) {
|
||||
olive::undo_stack.push(new NodeAddCommand(graph_, new_node));
|
||||
Core::instance()->undo_stack()->push(new NodeAddCommand(graph_, new_node));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "nodeview.h"
|
||||
#include "nodeviewundo.h"
|
||||
#include "ui/icons/icons.h"
|
||||
#include "undo/undostack.h"
|
||||
#include "window/mainwindow/mainwindow.h"
|
||||
|
||||
NodeViewItem::NodeViewItem(QGraphicsItem *parent) :
|
||||
@@ -169,7 +168,7 @@ void NodeViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
{
|
||||
// HACK for getting the main QWidget palette color (the `widget`'s palette uses the NodeView color instead which we
|
||||
// don't want here)
|
||||
QPalette app_pal = olive::core.main_window()->palette();
|
||||
QPalette app_pal = Core::instance()->main_window()->palette();
|
||||
|
||||
// Set up border, which will change color if selected
|
||||
QPen border_pen(css_proxy_.BorderColor(), node_border_width_);
|
||||
@@ -460,7 +459,7 @@ void NodeViewItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
|
||||
dragging_edge_ = nullptr;
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(node_edge_change_command_);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(node_edge_change_command_);
|
||||
node_edge_change_command_ = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/projectexplorer/projectexplorer.h
|
||||
widget/projectexplorer/projectexplorer.cpp
|
||||
widget/projectexplorer/projectexplorerdefines.h
|
||||
widget/projectexplorer/projectexplorertreeview.h
|
||||
widget/projectexplorer/projectexplorertreeview.cpp
|
||||
widget/projectexplorer/projectexplorerlistview.h
|
||||
|
||||
@@ -24,12 +24,11 @@
|
||||
#include <QMenu>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "common/define.h"
|
||||
#include "dialog/footageproperties/footageproperties.h"
|
||||
#include "projectexplorerdefines.h"
|
||||
|
||||
ProjectExplorer::ProjectExplorer(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
view_type_(olive::TreeView),
|
||||
model_(this)
|
||||
{
|
||||
// Create layout
|
||||
@@ -63,40 +62,40 @@ ProjectExplorer::ProjectExplorer(QWidget *parent) :
|
||||
AddView(icon_view_);
|
||||
|
||||
// Set default view to tree view
|
||||
set_view_type(olive::TreeView);
|
||||
set_view_type(ProjectToolbar::TreeView);
|
||||
|
||||
// Set default icon size
|
||||
SizeChangedSlot(olive::kProjectIconSizeDefault);
|
||||
SizeChangedSlot(kProjectIconSizeDefault);
|
||||
|
||||
// Set rename timer timeout
|
||||
rename_timer_.setInterval(500);
|
||||
connect(&rename_timer_, SIGNAL(timeout()), this, SLOT(RenameTimerSlot()));
|
||||
connect(&rename_timer_, &QTimer::timeout, this, &ProjectExplorer::RenameTimerSlot);
|
||||
|
||||
connect(tree_view_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu()));
|
||||
connect(list_view_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu()));
|
||||
connect(icon_view_, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(ShowContextMenu()));
|
||||
connect(tree_view_, &ProjectExplorerTreeView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||
connect(list_view_, &ProjectExplorerListView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||
connect(icon_view_, &ProjectExplorerIconView::customContextMenuRequested, this, &ProjectExplorer::ShowContextMenu);
|
||||
}
|
||||
|
||||
const olive::ProjectViewType &ProjectExplorer::view_type()
|
||||
const ProjectToolbar::ViewType &ProjectExplorer::view_type()
|
||||
{
|
||||
return view_type_;
|
||||
}
|
||||
|
||||
void ProjectExplorer::set_view_type(olive::ProjectViewType type)
|
||||
void ProjectExplorer::set_view_type(ProjectToolbar::ViewType type)
|
||||
{
|
||||
view_type_ = type;
|
||||
|
||||
// Set widget based on view type
|
||||
switch (view_type_) {
|
||||
case olive::TreeView:
|
||||
case ProjectToolbar::TreeView:
|
||||
stacked_widget_->setCurrentWidget(tree_view_);
|
||||
nav_bar_->setVisible(false);
|
||||
break;
|
||||
case olive::ListView:
|
||||
case ProjectToolbar::ListView:
|
||||
stacked_widget_->setCurrentWidget(list_view_);
|
||||
nav_bar_->setVisible(true);
|
||||
break;
|
||||
case olive::IconView:
|
||||
case ProjectToolbar::IconView:
|
||||
stacked_widget_->setCurrentWidget(icon_view_);
|
||||
nav_bar_->setVisible(true);
|
||||
break;
|
||||
@@ -172,7 +171,7 @@ void ProjectExplorer::DoubleClickViewSlot(const QModelIndex &index)
|
||||
|
||||
// If the item is a folder, browse to it
|
||||
if (i->CanHaveChildren()
|
||||
&& (view_type() == olive::ListView || view_type() == olive::IconView)) {
|
||||
&& (view_type() == ProjectToolbar::ListView || view_type() == ProjectToolbar::IconView)) {
|
||||
|
||||
BrowseToFolder(index);
|
||||
|
||||
@@ -232,12 +231,12 @@ void ProjectExplorer::ShowContextMenu()
|
||||
if (selected_items.isEmpty()) {
|
||||
// FIXME: These are both duplicates of items from MainMenu, is there any way to re-use the code?
|
||||
QAction* import_action = menu.addAction(tr("&Import..."));
|
||||
connect(import_action, SIGNAL(triggered(bool)), &olive::core, SLOT(DialogImportShow()));
|
||||
connect(import_action, SIGNAL(triggered(bool)), Core::instance(), SLOT(DialogImportShow()));
|
||||
|
||||
menu.addSeparator();
|
||||
|
||||
QAction* project_properties = menu.addAction(tr("&Project Properties..."));
|
||||
connect(project_properties, SIGNAL(triggered(bool)), &olive::core, SLOT(DialogProjectPropertiesShow()));
|
||||
connect(project_properties, SIGNAL(triggered(bool)), Core::instance(), SLOT(DialogProjectPropertiesShow()));
|
||||
} else {
|
||||
QAction* properties_action = menu.addAction(tr("P&roperties"));
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@
|
||||
|
||||
#include "project/project.h"
|
||||
#include "project/projectviewmodel.h"
|
||||
#include "project/projectviewtype.h"
|
||||
#include "widget/projectexplorer/projectexplorericonview.h"
|
||||
#include "widget/projectexplorer/projectexplorerlistview.h"
|
||||
#include "widget/projectexplorer/projectexplorertreeview.h"
|
||||
#include "widget/projectexplorer/projectexplorernavigation.h"
|
||||
#include "widget/projecttoolbar/projecttoolbar.h"
|
||||
|
||||
/**
|
||||
* @brief A widget for browsing through a Project structure.
|
||||
@@ -47,7 +47,7 @@ class ProjectExplorer : public QWidget
|
||||
public:
|
||||
ProjectExplorer(QWidget* parent);
|
||||
|
||||
const olive::ProjectViewType& view_type();
|
||||
const ProjectToolbar::ViewType& view_type();
|
||||
|
||||
Project* project();
|
||||
void set_project(Project* p);
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
ProjectViewModel* model();
|
||||
|
||||
public slots:
|
||||
void set_view_type(olive::ProjectViewType type);
|
||||
void set_view_type(ProjectToolbar::ViewType type);
|
||||
|
||||
void Edit(Item* item);
|
||||
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
ProjectExplorerListView* list_view_;
|
||||
ProjectExplorerTreeView* tree_view_;
|
||||
|
||||
olive::ProjectViewType view_type_;
|
||||
ProjectToolbar::ViewType view_type_;
|
||||
|
||||
ProjectViewModel model_;
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#ifndef PROJECTEXPLORERDEFINES_H
|
||||
#define PROJECTEXPLORERDEFINES_H
|
||||
|
||||
namespace olive {
|
||||
|
||||
/// The minimum size an icon in ProjectExplorer can be
|
||||
const int kProjectIconSizeMinimum = 16;
|
||||
|
||||
/// The maximum size an icon in ProjectExplorer can be
|
||||
const int kProjectIconSizeMaximum = 256;
|
||||
|
||||
/// The default size an icon in ProjectExplorer can be
|
||||
const int kProjectIconSizeDefault = 64;
|
||||
|
||||
}
|
||||
|
||||
#endif // PROJECTEXPLORERDEFINES_H
|
||||
@@ -23,8 +23,8 @@
|
||||
#include <QEvent>
|
||||
#include <QHBoxLayout>
|
||||
|
||||
#include "common/define.h"
|
||||
#include "ui/icons/icons.h"
|
||||
#include "widget/projectexplorer/projectexplorerdefines.h"
|
||||
|
||||
ProjectExplorerNavigation::ProjectExplorerNavigation(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
@@ -89,7 +89,7 @@ void ProjectExplorerNavigation::Retranslate()
|
||||
void ProjectExplorerNavigation::UpdateIcons()
|
||||
{
|
||||
dir_up_btn_->setIcon(icon::DirUp);
|
||||
size_slider_->setMinimum(olive::kProjectIconSizeMinimum);
|
||||
size_slider_->setMaximum(olive::kProjectIconSizeMaximum);
|
||||
size_slider_->setValue(olive::kProjectIconSizeDefault);
|
||||
size_slider_->setMinimum(kProjectIconSizeMinimum);
|
||||
size_slider_->setMaximum(kProjectIconSizeMaximum);
|
||||
size_slider_->setValue(kProjectIconSizeDefault);
|
||||
}
|
||||
|
||||
@@ -35,15 +35,15 @@
|
||||
* * Double clicking a Folder in those views will enter that folder
|
||||
* * This navigation bar offers a "directory up" button for leaving a folder
|
||||
*
|
||||
* This navbar also provides an icon size slider for those views (between olive::kProjectIconSizeMinimum and
|
||||
* olive::kProjectIconSizeMaximum) as well as text that's intended to be set to the current Folder's name (or
|
||||
* This navbar also provides an icon size slider for those views (between kProjectIconSizeMinimum and
|
||||
* kProjectIconSizeMaximum) as well as text that's intended to be set to the current Folder's name (or
|
||||
* empty for the root folder).
|
||||
*
|
||||
* This widget does not actually communicate to Project or ProjectExplorer classes. It is simply UI widgets that are
|
||||
* intended to be connected in ways that do. This is the primarily responsibility of ProjectExplorer.
|
||||
*
|
||||
* By default, the directory up button is disabled (assuming root folder), the text is empty, and the icon size slider
|
||||
* is set to olive::kProjectIconSizeDefault.
|
||||
* is set to kProjectIconSizeDefault.
|
||||
*/
|
||||
class ProjectExplorerNavigation : public QWidget
|
||||
{
|
||||
|
||||
@@ -84,16 +84,16 @@ ProjectToolbar::ProjectToolbar(QWidget *parent) :
|
||||
UpdateIcons();
|
||||
}
|
||||
|
||||
void ProjectToolbar::SetView(olive::ProjectViewType type)
|
||||
void ProjectToolbar::SetView(ViewType type)
|
||||
{
|
||||
switch (type) {
|
||||
case olive::TreeView:
|
||||
case TreeView:
|
||||
tree_button_->setChecked(true);
|
||||
break;
|
||||
case olive::IconView:
|
||||
case IconView:
|
||||
icon_button_->setChecked(true);
|
||||
break;
|
||||
case olive::ListView:
|
||||
case ListView:
|
||||
list_button_->setChecked(true);
|
||||
break;
|
||||
}
|
||||
@@ -140,11 +140,11 @@ void ProjectToolbar::ViewButtonClicked()
|
||||
{
|
||||
// Determine which view button triggered this slot and emit a signal accordingly
|
||||
if (sender() == tree_button_) {
|
||||
emit ViewChanged(olive::TreeView);
|
||||
emit ViewChanged(ProjectToolbar::TreeView);
|
||||
} else if (sender() == icon_button_) {
|
||||
emit ViewChanged(olive::IconView);
|
||||
emit ViewChanged(ProjectToolbar::IconView);
|
||||
} else if (sender() == list_button_) {
|
||||
emit ViewChanged(olive::ListView);
|
||||
emit ViewChanged(ProjectToolbar::ListView);
|
||||
} else {
|
||||
// Assert that it was one of the above buttons
|
||||
abort();
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include <QLineEdit>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "project/projectviewtype.h"
|
||||
|
||||
/**
|
||||
* @brief The ProjectToolbar class
|
||||
*
|
||||
@@ -41,8 +39,14 @@ class ProjectToolbar : public QWidget
|
||||
public:
|
||||
ProjectToolbar(QWidget* parent);
|
||||
|
||||
enum ViewType {
|
||||
TreeView,
|
||||
ListView,
|
||||
IconView
|
||||
};
|
||||
|
||||
public slots:
|
||||
void SetView(olive::ProjectViewType type);
|
||||
void SetView(ViewType type);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *) override;
|
||||
@@ -57,7 +61,7 @@ signals:
|
||||
|
||||
void SearchChanged(const QString&);
|
||||
|
||||
void ViewChanged(olive::ProjectViewType type);
|
||||
void ViewChanged(ViewType type);
|
||||
|
||||
private:
|
||||
void Retranslate();
|
||||
|
||||
@@ -256,22 +256,22 @@ void TimelineWidget::DeselectAll()
|
||||
|
||||
void TimelineWidget::RippleToIn()
|
||||
{
|
||||
RippleEditTo(olive::timeline::kTrimIn, false);
|
||||
RippleEditTo(Timeline::kTrimIn, false);
|
||||
}
|
||||
|
||||
void TimelineWidget::RippleToOut()
|
||||
{
|
||||
RippleEditTo(olive::timeline::kTrimOut, false);
|
||||
RippleEditTo(Timeline::kTrimOut, false);
|
||||
}
|
||||
|
||||
void TimelineWidget::EditToIn()
|
||||
{
|
||||
RippleEditTo(olive::timeline::kTrimIn, true);
|
||||
RippleEditTo(Timeline::kTrimIn, true);
|
||||
}
|
||||
|
||||
void TimelineWidget::EditToOut()
|
||||
{
|
||||
RippleEditTo(olive::timeline::kTrimOut, true);
|
||||
RippleEditTo(Timeline::kTrimOut, true);
|
||||
}
|
||||
|
||||
void TimelineWidget::GoToPrevCut()
|
||||
@@ -382,7 +382,7 @@ void TimelineWidget::SplitAtPlayhead()
|
||||
}
|
||||
|
||||
if (!blocks_to_split.isEmpty()) {
|
||||
olive::undo_stack.push(new BlockSplitPreservingLinksCommand(blocks_to_split, {playhead_time}));
|
||||
Core::instance()->undo_stack()->push(new BlockSplitPreservingLinksCommand(blocks_to_split, {playhead_time}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,7 +470,7 @@ void TimelineWidget::DeleteSelected()
|
||||
|
||||
DeleteSelectedInternal(blocks_to_delete, true, command);
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
QList<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
||||
@@ -492,12 +492,12 @@ QList<TimelineViewBlockItem *> TimelineWidget::GetSelectedBlocks()
|
||||
return list;
|
||||
}
|
||||
|
||||
void TimelineWidget::RippleEditTo(olive::timeline::MovementMode mode, bool insert_gaps)
|
||||
void TimelineWidget::RippleEditTo(Timeline::MovementMode mode, bool insert_gaps)
|
||||
{
|
||||
rational playhead_time = Timecode::timestamp_to_time(playhead_, timebase());
|
||||
|
||||
rational closest_point_to_playhead;
|
||||
if (mode == olive::timeline::kTrimIn) {
|
||||
if (mode == Timeline::kTrimIn) {
|
||||
closest_point_to_playhead = 0;
|
||||
} else {
|
||||
closest_point_to_playhead = RATIONAL_MAX;
|
||||
@@ -507,7 +507,7 @@ void TimelineWidget::RippleEditTo(olive::timeline::MovementMode mode, bool inser
|
||||
Block* b = track->NearestBlockBefore(playhead_time);
|
||||
|
||||
if (b != nullptr) {
|
||||
if (mode == olive::timeline::kTrimIn) {
|
||||
if (mode == Timeline::kTrimIn) {
|
||||
closest_point_to_playhead = qMax(b->in(), closest_point_to_playhead);
|
||||
} else {
|
||||
closest_point_to_playhead = qMin(b->out(), closest_point_to_playhead);
|
||||
@@ -519,7 +519,7 @@ void TimelineWidget::RippleEditTo(olive::timeline::MovementMode mode, bool inser
|
||||
|
||||
if (closest_point_to_playhead == playhead_time) {
|
||||
// Remove one frame only
|
||||
if (mode == olive::timeline::kTrimIn) {
|
||||
if (mode == Timeline::kTrimIn) {
|
||||
playhead_time += timebase();
|
||||
} else {
|
||||
playhead_time -= timebase();
|
||||
@@ -548,9 +548,9 @@ void TimelineWidget::RippleEditTo(olive::timeline::MovementMode mode, bool inser
|
||||
}
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
|
||||
if (mode == olive::timeline::kTrimIn && !insert_gaps) {
|
||||
if (mode == Timeline::kTrimIn && !insert_gaps) {
|
||||
int64_t new_time = Timecode::time_to_timestamp(closest_point_to_playhead, timebase());
|
||||
|
||||
SetTimeAndSignal(new_time);
|
||||
@@ -639,7 +639,7 @@ void TimelineWidget::UpdateTimelineLength(const rational &length)
|
||||
|
||||
TimelineWidget::Tool *TimelineWidget::GetActiveTool()
|
||||
{
|
||||
return tools_.at(olive::core.tool()).get();
|
||||
return tools_.at(Core::instance()->tool()).get();
|
||||
}
|
||||
|
||||
void TimelineWidget::ViewMousePressed(TimelineViewMouseEvent *event)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QRubberBand>
|
||||
#include <QWidget>
|
||||
|
||||
#include "core.h"
|
||||
#include "timelineandtrackview.h"
|
||||
#include "widget/slider/timeslider.h"
|
||||
#include "widget/timelinewidget/timelinescaledobject.h"
|
||||
@@ -83,7 +84,7 @@ private:
|
||||
|
||||
TimelineWidget* parent();
|
||||
|
||||
static olive::timeline::MovementMode FlipTrimMode(const olive::timeline::MovementMode& trim_mode);
|
||||
static Timeline::MovementMode FlipTrimMode(const Timeline::MovementMode& trim_mode);
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -147,12 +148,12 @@ private:
|
||||
virtual rational FrameValidateInternal(rational time_movement, const QVector<TimelineViewGhostItem *> &ghosts);
|
||||
|
||||
virtual void InitiateGhosts(TimelineViewBlockItem* clicked_item,
|
||||
olive::timeline::MovementMode trim_mode,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool allow_gap_trimming);
|
||||
|
||||
TimelineViewGhostItem* AddGhostFromBlock(Block *block, const TrackReference& track, olive::timeline::MovementMode mode);
|
||||
TimelineViewGhostItem* AddGhostFromBlock(Block *block, const TrackReference& track, Timeline::MovementMode mode);
|
||||
|
||||
TimelineViewGhostItem* AddGhostFromNull(const rational& in, const rational& out, const TrackReference& track, olive::timeline::MovementMode mode);
|
||||
TimelineViewGhostItem* AddGhostFromNull(const rational& in, const rational& out, const TrackReference& track, Timeline::MovementMode mode);
|
||||
|
||||
/**
|
||||
* @brief Validates Ghosts that are getting their in points trimmed
|
||||
@@ -175,11 +176,11 @@ private:
|
||||
private:
|
||||
void InitiateDrag(const TimelineCoordinate &mouse_pos);
|
||||
|
||||
void AddGhostInternal(TimelineViewGhostItem* ghost, olive::timeline::MovementMode mode);
|
||||
void AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::MovementMode mode);
|
||||
|
||||
bool IsClipTrimmable(TimelineViewBlockItem* clip,
|
||||
const QList<TimelineViewBlockItem*>& items,
|
||||
const olive::timeline::MovementMode& mode);
|
||||
const Timeline::MovementMode& mode);
|
||||
|
||||
TrackReference track_start_;
|
||||
bool movement_allowed_;
|
||||
@@ -225,7 +226,7 @@ private:
|
||||
virtual rational FrameValidateInternal(rational time_movement, const QVector<TimelineViewGhostItem*>& ghosts) override;
|
||||
|
||||
virtual void InitiateGhosts(TimelineViewBlockItem* clicked_item,
|
||||
olive::timeline::MovementMode trim_mode,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool allow_gap_trimming) override;
|
||||
};
|
||||
|
||||
@@ -239,7 +240,7 @@ private:
|
||||
virtual rational FrameValidateInternal(rational time_movement, const QVector<TimelineViewGhostItem*>& ghosts) override;
|
||||
|
||||
virtual void InitiateGhosts(TimelineViewBlockItem* clicked_item,
|
||||
olive::timeline::MovementMode trim_mode,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool allow_gap_trimming) override;
|
||||
};
|
||||
|
||||
@@ -252,7 +253,7 @@ private:
|
||||
virtual void MouseReleaseInternal(TimelineViewMouseEvent *event) override;
|
||||
virtual rational FrameValidateInternal(rational time_movement, const QVector<TimelineViewGhostItem*>& ghosts) override;
|
||||
virtual void InitiateGhosts(TimelineViewBlockItem* clicked_item,
|
||||
olive::timeline::MovementMode trim_mode,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool allow_gap_trimming) override;
|
||||
};
|
||||
|
||||
@@ -353,7 +354,7 @@ private:
|
||||
|
||||
QMap<Block*, TimelineViewBlockItem*> block_items_;
|
||||
|
||||
void RippleEditTo(olive::timeline::MovementMode mode, bool insert_gaps);
|
||||
void RippleEditTo(Timeline::MovementMode mode, bool insert_gaps);
|
||||
|
||||
void SetTimeAndSignal(const int64_t& t);
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ void TimelineWidget::AddTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
ghost_->GetAdjustedIn(),
|
||||
command);
|
||||
|
||||
olive::undo_stack.push(command);
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
}
|
||||
|
||||
parent()->ClearGhosts();
|
||||
|
||||
@@ -139,7 +139,7 @@ void TimelineWidget::ImportTool::DragEnter(TimelineViewMouseEvent *event)
|
||||
snap_points_.append(ghost->Out());
|
||||
|
||||
ghost->setData(TimelineViewGhostItem::kAttachedFootage, QVariant::fromValue(stream));
|
||||
ghost->SetMode(olive::timeline::kMove);
|
||||
ghost->SetMode(Timeline::kMove);
|
||||
|
||||
parent()->AddGhost(ghost);
|
||||
}
|
||||
@@ -163,7 +163,7 @@ void TimelineWidget::ImportTool::DragMove(TimelineViewMouseEvent *event)
|
||||
int track_movement = event->GetCoordinates().GetTrack().index() - drag_start_.GetTrack().index();
|
||||
|
||||
// If snapping is enabled, check for snap points
|
||||
if (olive::core.snapping()) {
|
||||
if (Core::instance()->snapping()) {
|
||||
SnapPoint(snap_points_, &time_movement);
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ void TimelineWidget::ImportTool::DragDrop(TimelineViewMouseEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
|
||||
parent()->ClearGhosts();
|
||||
|
||||
|
||||
@@ -193,11 +193,11 @@ void TimelineWidget::PointerTool::MouseReleaseInternal(TimelineViewMouseEvent *e
|
||||
Block* b = Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock));
|
||||
|
||||
// Normal blocks work in conjunction with the gap made above
|
||||
if (ghost->mode() == olive::timeline::kTrimIn || ghost->mode() == olive::timeline::kTrimOut) {
|
||||
if (ghost->mode() == Timeline::kTrimIn || ghost->mode() == Timeline::kTrimOut) {
|
||||
// If we were trimming, we'll need to change the length
|
||||
|
||||
// If we were trimming the in point, we'll need to adjust the media in too
|
||||
if (ghost->mode() == olive::timeline::kTrimIn) {
|
||||
if (ghost->mode() == Timeline::kTrimIn) {
|
||||
new BlockResizeWithMediaInCommand(b, ghost->AdjustedLength(), command);
|
||||
} else {
|
||||
new BlockResizeCommand(b, ghost->AdjustedLength(), command);
|
||||
@@ -213,7 +213,7 @@ void TimelineWidget::PointerTool::MouseReleaseInternal(TimelineViewMouseEvent *e
|
||||
command);
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
rational TimelineWidget::PointerTool::FrameValidateInternal(rational time_movement, const QVector<TimelineViewGhostItem *>& ghosts)
|
||||
@@ -245,7 +245,7 @@ void TimelineWidget::PointerTool::InitiateDrag(const TimelineCoordinate &mouse_p
|
||||
track_start_ = mouse_pos.GetTrack();
|
||||
|
||||
// Determine whether we're trimming or moving based on the position of the cursor
|
||||
olive::timeline::MovementMode trim_mode = olive::timeline::kNone;
|
||||
Timeline::MovementMode trim_mode = Timeline::kNone;
|
||||
|
||||
// FIXME: Hardcoded number
|
||||
const int kTrimHandle = 10;
|
||||
@@ -253,21 +253,21 @@ void TimelineWidget::PointerTool::InitiateDrag(const TimelineCoordinate &mouse_p
|
||||
qreal mouse_x = parent()->TimeToScene(mouse_pos.GetFrame());
|
||||
|
||||
if (trimming_allowed_ && mouse_x < clicked_item->x() + kTrimHandle) {
|
||||
trim_mode = olive::timeline::kTrimIn;
|
||||
trim_mode = Timeline::kTrimIn;
|
||||
} else if (trimming_allowed_ && mouse_x > clicked_item->x() + clicked_item->rect().right() - kTrimHandle) {
|
||||
trim_mode = olive::timeline::kTrimOut;
|
||||
trim_mode = Timeline::kTrimOut;
|
||||
} else if (movement_allowed_) {
|
||||
// Some derived classes don't allow movement
|
||||
trim_mode = olive::timeline::kMove;
|
||||
trim_mode = Timeline::kMove;
|
||||
}
|
||||
|
||||
// Gaps can't be moved, only trimmed
|
||||
if (clicked_item->block()->type() == Block::kGap && trim_mode == olive::timeline::kMove) {
|
||||
trim_mode = olive::timeline::kNone;
|
||||
if (clicked_item->block()->type() == Block::kGap && trim_mode == Timeline::kMove) {
|
||||
trim_mode = Timeline::kNone;
|
||||
}
|
||||
|
||||
// Make sure we can actually perform an action here
|
||||
if (trim_mode != olive::timeline::kNone) {
|
||||
if (trim_mode != Timeline::kNone) {
|
||||
InitiateGhosts(clicked_item, trim_mode, false);
|
||||
}
|
||||
}
|
||||
@@ -287,7 +287,7 @@ void TimelineWidget::PointerTool::ProcessDrag(const TimelineCoordinate &mouse_po
|
||||
rational time_movement = mouse_pos.GetFrame() - drag_start_.GetFrame();
|
||||
|
||||
// Perform snapping if enabled (adjusts time_movement if it's close to any potential snap points)
|
||||
if (olive::core.snapping()) {
|
||||
if (Core::instance()->snapping()) {
|
||||
SnapPoint(snap_points_, &time_movement);
|
||||
}
|
||||
|
||||
@@ -298,15 +298,15 @@ void TimelineWidget::PointerTool::ProcessDrag(const TimelineCoordinate &mouse_po
|
||||
// Perform movement
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
|
||||
switch (ghost->mode()) {
|
||||
case olive::timeline::kNone:
|
||||
case Timeline::kNone:
|
||||
break;
|
||||
case olive::timeline::kTrimIn:
|
||||
case Timeline::kTrimIn:
|
||||
ghost->SetInAdjustment(time_movement);
|
||||
break;
|
||||
case olive::timeline::kTrimOut:
|
||||
case Timeline::kTrimOut:
|
||||
ghost->SetOutAdjustment(time_movement);
|
||||
break;
|
||||
case olive::timeline::kMove:
|
||||
case Timeline::kMove:
|
||||
{
|
||||
ghost->SetInAdjustment(time_movement);
|
||||
ghost->SetOutAdjustment(time_movement);
|
||||
@@ -341,7 +341,7 @@ void TimelineWidget::PointerTool::ProcessDrag(const TimelineCoordinate &mouse_po
|
||||
}
|
||||
|
||||
void TimelineWidget::PointerTool::InitiateGhosts(TimelineViewBlockItem* clicked_item,
|
||||
olive::timeline::MovementMode trim_mode,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool allow_gap_trimming)
|
||||
{
|
||||
// Convert selected items list to clips list
|
||||
@@ -352,8 +352,8 @@ void TimelineWidget::PointerTool::InitiateGhosts(TimelineViewBlockItem* clicked_
|
||||
bool multitrim_enabled = true;
|
||||
|
||||
// Determine if the clicked item is the earliest/latest in the track for in/out trimming respectively
|
||||
if (trim_mode == olive::timeline::kTrimIn
|
||||
|| trim_mode == olive::timeline::kTrimOut) {
|
||||
if (trim_mode == Timeline::kTrimIn
|
||||
|| trim_mode == Timeline::kTrimOut) {
|
||||
multitrim_enabled = IsClipTrimmable(clicked_item, clips, trim_mode);
|
||||
}
|
||||
|
||||
@@ -367,16 +367,16 @@ void TimelineWidget::PointerTool::InitiateGhosts(TimelineViewBlockItem* clicked_
|
||||
bool include_this_clip = true;
|
||||
|
||||
if (clip_item != clicked_item
|
||||
&& (trim_mode == olive::timeline::kTrimIn || trim_mode == olive::timeline::kTrimOut)) {
|
||||
&& (trim_mode == Timeline::kTrimIn || trim_mode == Timeline::kTrimOut)) {
|
||||
include_this_clip = multitrim_enabled ? IsClipTrimmable(clip_item, clips, trim_mode) : false;
|
||||
}
|
||||
|
||||
if (include_this_clip) {
|
||||
Block* block = clip_item->block();
|
||||
olive::timeline::MovementMode block_mode = trim_mode;
|
||||
Timeline::MovementMode block_mode = trim_mode;
|
||||
|
||||
if (block->type() == Block::kGap && !allow_gap_trimming) {
|
||||
if (trim_mode == olive::timeline::kTrimIn) {
|
||||
if (trim_mode == Timeline::kTrimIn) {
|
||||
// Trim the previous clip's out point instead
|
||||
block = block->previous();
|
||||
} else {
|
||||
@@ -393,7 +393,7 @@ void TimelineWidget::PointerTool::InitiateGhosts(TimelineViewBlockItem* clicked_
|
||||
}
|
||||
}
|
||||
|
||||
TimelineViewGhostItem* TimelineWidget::PointerTool::AddGhostFromBlock(Block* block, const TrackReference& track, olive::timeline::MovementMode mode)
|
||||
TimelineViewGhostItem* TimelineWidget::PointerTool::AddGhostFromBlock(Block* block, const TrackReference& track, Timeline::MovementMode mode)
|
||||
{
|
||||
TimelineViewGhostItem* ghost = TimelineViewGhostItem::FromBlock(block,
|
||||
track,
|
||||
@@ -405,7 +405,7 @@ TimelineViewGhostItem* TimelineWidget::PointerTool::AddGhostFromBlock(Block* blo
|
||||
return ghost;
|
||||
}
|
||||
|
||||
TimelineViewGhostItem* TimelineWidget::PointerTool::AddGhostFromNull(const rational &in, const rational &out, const TrackReference& track, olive::timeline::MovementMode mode)
|
||||
TimelineViewGhostItem* TimelineWidget::PointerTool::AddGhostFromNull(const rational &in, const rational &out, const TrackReference& track, Timeline::MovementMode mode)
|
||||
{
|
||||
TimelineViewGhostItem* ghost = new TimelineViewGhostItem();
|
||||
|
||||
@@ -419,20 +419,20 @@ TimelineViewGhostItem* TimelineWidget::PointerTool::AddGhostFromNull(const ratio
|
||||
return ghost;
|
||||
}
|
||||
|
||||
void TimelineWidget::PointerTool::AddGhostInternal(TimelineViewGhostItem* ghost, olive::timeline::MovementMode mode)
|
||||
void TimelineWidget::PointerTool::AddGhostInternal(TimelineViewGhostItem* ghost, Timeline::MovementMode mode)
|
||||
{
|
||||
ghost->SetMode(mode);
|
||||
|
||||
// Prepare snap points (optimizes snapping for later)
|
||||
switch (mode) {
|
||||
case olive::timeline::kMove:
|
||||
case Timeline::kMove:
|
||||
snap_points_.append(ghost->In());
|
||||
snap_points_.append(ghost->Out());
|
||||
break;
|
||||
case olive::timeline::kTrimIn:
|
||||
case Timeline::kTrimIn:
|
||||
snap_points_.append(ghost->In());
|
||||
break;
|
||||
case olive::timeline::kTrimOut:
|
||||
case Timeline::kTrimOut:
|
||||
snap_points_.append(ghost->Out());
|
||||
break;
|
||||
default:
|
||||
@@ -444,13 +444,13 @@ void TimelineWidget::PointerTool::AddGhostInternal(TimelineViewGhostItem* ghost,
|
||||
|
||||
bool TimelineWidget::PointerTool::IsClipTrimmable(TimelineViewBlockItem* clip,
|
||||
const QList<TimelineViewBlockItem*>& items,
|
||||
const olive::timeline::MovementMode& mode)
|
||||
const Timeline::MovementMode& mode)
|
||||
{
|
||||
foreach (TimelineViewBlockItem* compare, items) {
|
||||
if (clip->Track() == compare->Track()
|
||||
&& clip != compare
|
||||
&& ((compare->block()->in() < clip->block()->in() && mode == olive::timeline::kTrimIn)
|
||||
|| (compare->block()->out() > clip->block()->out() && mode == olive::timeline::kTrimOut))) {
|
||||
&& ((compare->block()->in() < clip->block()->in() && mode == Timeline::kTrimIn)
|
||||
|| (compare->block()->out() > clip->block()->out() && mode == Timeline::kTrimOut))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -463,7 +463,7 @@ rational TimelineWidget::PointerTool::ValidateInTrimming(rational movement,
|
||||
bool prevent_overwriting)
|
||||
{
|
||||
foreach (TimelineViewGhostItem* ghost, ghosts) {
|
||||
if (ghost->mode() != olive::timeline::kTrimIn) {
|
||||
if (ghost->mode() != Timeline::kTrimIn) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -508,7 +508,7 @@ rational TimelineWidget::PointerTool::ValidateOutTrimming(rational movement,
|
||||
bool prevent_overwriting)
|
||||
{
|
||||
foreach (TimelineViewGhostItem* ghost, ghosts) {
|
||||
if (ghost->mode() != olive::timeline::kTrimOut) {
|
||||
if (ghost->mode() != Timeline::kTrimOut) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ void TimelineWidget::RazorTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
|
||||
split_tracks_.clear();
|
||||
|
||||
olive::undo_stack.push(new BlockSplitPreservingLinksCommand(blocks_to_split, {split_time}));
|
||||
Core::instance()->undo_stack()->push(new BlockSplitPreservingLinksCommand(blocks_to_split, {split_time}));
|
||||
|
||||
dragging_ = false;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ void TimelineWidget::RippleTool::MouseReleaseInternal(TimelineViewMouseEvent *ev
|
||||
Q_UNUSED(event)
|
||||
|
||||
// For ripple operations, all ghosts will be moving the same way
|
||||
olive::timeline::MovementMode movement_mode = parent()->ghost_items_.first()->mode();
|
||||
Timeline::MovementMode movement_mode = parent()->ghost_items_.first()->mode();
|
||||
|
||||
QUndoCommand* command = new QUndoCommand();
|
||||
|
||||
@@ -62,7 +62,7 @@ void TimelineWidget::RippleTool::MouseReleaseInternal(TimelineViewMouseEvent *ev
|
||||
} else {
|
||||
// This was a Block that already existed
|
||||
if (ghost->AdjustedLength() > 0) {
|
||||
if (movement_mode == olive::timeline::kTrimIn) {
|
||||
if (movement_mode == Timeline::kTrimIn) {
|
||||
// We'll need to shift the media in point too
|
||||
new BlockResizeWithMediaInCommand(b, ghost->AdjustedLength(), command);
|
||||
} else {
|
||||
@@ -77,7 +77,7 @@ void TimelineWidget::RippleTool::MouseReleaseInternal(TimelineViewMouseEvent *ev
|
||||
}
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
rational TimelineWidget::RippleTool::FrameValidateInternal(rational time_movement, const QVector<TimelineViewGhostItem *> &ghosts)
|
||||
@@ -90,7 +90,7 @@ rational TimelineWidget::RippleTool::FrameValidateInternal(rational time_movemen
|
||||
}
|
||||
|
||||
void TimelineWidget::RippleTool::InitiateGhosts(TimelineViewBlockItem *clicked_item,
|
||||
olive::timeline::MovementMode trim_mode,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool allow_gap_trimming)
|
||||
{
|
||||
Q_UNUSED(allow_gap_trimming)
|
||||
@@ -107,7 +107,7 @@ void TimelineWidget::RippleTool::InitiateGhosts(TimelineViewBlockItem *clicked_i
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
|
||||
rational ghost_ripple_point;
|
||||
|
||||
if (trim_mode == olive::timeline::kTrimIn) {
|
||||
if (trim_mode == Timeline::kTrimIn) {
|
||||
ghost_ripple_point = ghost->In();
|
||||
} else {
|
||||
ghost_ripple_point = ghost->Out();
|
||||
|
||||
@@ -39,7 +39,7 @@ void TimelineWidget::RollingTool::MouseReleaseInternal(TimelineViewMouseEvent *e
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
|
||||
Block* b = Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock));
|
||||
|
||||
if (ghost->mode() == olive::timeline::kTrimIn) {
|
||||
if (ghost->mode() == Timeline::kTrimIn) {
|
||||
if (b->previous() == nullptr) {
|
||||
// We'll need to insert a gap here, so we'll do a Place command instead
|
||||
GapBlock* gap = new GapBlock();
|
||||
@@ -62,12 +62,12 @@ void TimelineWidget::RollingTool::MouseReleaseInternal(TimelineViewMouseEvent *e
|
||||
ghost->GetAdjustedIn(),
|
||||
command);
|
||||
}
|
||||
} else if (ghost->mode() == olive::timeline::kTrimOut) {
|
||||
} else if (ghost->mode() == Timeline::kTrimOut) {
|
||||
new BlockResizeCommand(b, ghost->AdjustedLength(), command);
|
||||
}
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
rational TimelineWidget::RollingTool::FrameValidateInternal(rational time_movement, const QVector<TimelineViewGhostItem *> &ghosts)
|
||||
@@ -80,7 +80,7 @@ rational TimelineWidget::RollingTool::FrameValidateInternal(rational time_moveme
|
||||
}
|
||||
|
||||
void TimelineWidget::RollingTool::InitiateGhosts(TimelineViewBlockItem *clicked_item,
|
||||
olive::timeline::MovementMode trim_mode,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool allow_gap_trimming)
|
||||
{
|
||||
Q_UNUSED(allow_gap_trimming)
|
||||
@@ -91,11 +91,11 @@ void TimelineWidget::RollingTool::InitiateGhosts(TimelineViewBlockItem *clicked_
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
|
||||
Block* ghost_block = Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock));
|
||||
|
||||
if (ghost->mode() == olive::timeline::kTrimIn && ghost_block->previous() != nullptr) {
|
||||
if (ghost->mode() == Timeline::kTrimIn && ghost_block->previous() != nullptr) {
|
||||
// Add an extra Ghost for the previous block
|
||||
AddGhostFromBlock(ghost_block->previous(), ghost->Track(), olive::timeline::kTrimOut);
|
||||
} else if (ghost->mode() == olive::timeline::kTrimOut && ghost_block->next() != nullptr) {
|
||||
AddGhostFromBlock(ghost_block->next(), ghost->Track(), olive::timeline::kTrimIn);
|
||||
AddGhostFromBlock(ghost_block->previous(), ghost->Track(), Timeline::kTrimOut);
|
||||
} else if (ghost->mode() == Timeline::kTrimOut && ghost_block->next() != nullptr) {
|
||||
AddGhostFromBlock(ghost_block->next(), ghost->Track(), Timeline::kTrimIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +40,11 @@ void TimelineWidget::SlideTool::MouseReleaseInternal(TimelineViewMouseEvent *eve
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
|
||||
Block* b = Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock));
|
||||
|
||||
if (ghost->mode() == olive::timeline::kTrimIn) {
|
||||
if (ghost->mode() == Timeline::kTrimIn) {
|
||||
new BlockResizeWithMediaInCommand(b, ghost->AdjustedLength(), command);
|
||||
} else if (ghost->mode() == olive::timeline::kTrimOut) {
|
||||
} else if (ghost->mode() == Timeline::kTrimOut) {
|
||||
new BlockResizeCommand(b, ghost->AdjustedLength(), command);
|
||||
} else if (ghost->mode() == olive::timeline::kMove && b->previous() == nullptr) {
|
||||
} else if (ghost->mode() == Timeline::kMove && b->previous() == nullptr) {
|
||||
GapBlock* gap = new GapBlock();
|
||||
gap->set_length_and_media_out(ghost->InAdjustment());
|
||||
new NodeAddCommand(static_cast<NodeGraph*>(b->parent()), gap, command);
|
||||
@@ -52,7 +52,7 @@ void TimelineWidget::SlideTool::MouseReleaseInternal(TimelineViewMouseEvent *eve
|
||||
}
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
rational TimelineWidget::SlideTool::FrameValidateInternal(rational time_movement, const QVector<TimelineViewGhostItem *> &ghosts)
|
||||
@@ -65,7 +65,7 @@ rational TimelineWidget::SlideTool::FrameValidateInternal(rational time_movement
|
||||
}
|
||||
|
||||
void TimelineWidget::SlideTool::InitiateGhosts(TimelineViewBlockItem *clicked_item,
|
||||
olive::timeline::MovementMode trim_mode,
|
||||
Timeline::MovementMode trim_mode,
|
||||
bool allow_gap_trimming)
|
||||
{
|
||||
Q_UNUSED(allow_gap_trimming)
|
||||
@@ -80,11 +80,11 @@ void TimelineWidget::SlideTool::InitiateGhosts(TimelineViewBlockItem *clicked_it
|
||||
|
||||
if (ghost_block->previous() != nullptr) {
|
||||
// Add an extra Ghost for the previous block
|
||||
AddGhostFromBlock(ghost_block->previous(), ghost->Track(), olive::timeline::kTrimOut);
|
||||
AddGhostFromBlock(ghost_block->previous(), ghost->Track(), Timeline::kTrimOut);
|
||||
}
|
||||
|
||||
if (ghost_block->next() != nullptr) {
|
||||
AddGhostFromBlock(ghost_block->next(), ghost->Track(), olive::timeline::kTrimIn);
|
||||
AddGhostFromBlock(ghost_block->next(), ghost->Track(), Timeline::kTrimIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,6 @@ void TimelineWidget::SlipTool::MouseReleaseInternal(TimelineViewMouseEvent *even
|
||||
new BlockSetMediaOutCommand(b, ghost->GetAdjustedMediaIn() + b->media_length(), command);
|
||||
}
|
||||
|
||||
olive::undo_stack.pushIfHasChildren(command);
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,14 +39,14 @@ TimelineWidget *TimelineWidget::Tool::parent()
|
||||
return parent_;
|
||||
}
|
||||
|
||||
olive::timeline::MovementMode TimelineWidget::Tool::FlipTrimMode(const olive::timeline::MovementMode &trim_mode)
|
||||
Timeline::MovementMode TimelineWidget::Tool::FlipTrimMode(const Timeline::MovementMode &trim_mode)
|
||||
{
|
||||
if (trim_mode == olive::timeline::kTrimIn) {
|
||||
return olive::timeline::kTrimOut;
|
||||
if (trim_mode == Timeline::kTrimIn) {
|
||||
return Timeline::kTrimOut;
|
||||
}
|
||||
|
||||
if (trim_mode == olive::timeline::kTrimOut) {
|
||||
return olive::timeline::kTrimIn;
|
||||
if (trim_mode == Timeline::kTrimOut) {
|
||||
return Timeline::kTrimIn;
|
||||
}
|
||||
|
||||
return trim_mode;
|
||||
@@ -97,7 +97,7 @@ void AttemptSnap(const QList<double>& proposed_pts,
|
||||
rational TimelineWidget::Tool::ValidateFrameMovement(rational movement, const QVector<TimelineViewGhostItem *> ghosts)
|
||||
{
|
||||
foreach (TimelineViewGhostItem* ghost, ghosts) {
|
||||
if (ghost->mode() != olive::timeline::kMove) {
|
||||
if (ghost->mode() != Timeline::kMove) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ int TimelineWidget::Tool::ValidateTrackMovement(int movement, const QVector<Time
|
||||
foreach (TimelineViewGhostItem* ghost, ghosts) {
|
||||
// Prevents any ghosts from going to a non-existent negative track
|
||||
if (ghost->Track().index() + movement < 0) {
|
||||
if (ghost->mode() != olive::timeline::kMove) {
|
||||
if (ghost->mode() != Timeline::kMove) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,13 +26,13 @@ void TimelineWidget::TransitionTool::MousePress(TimelineViewMouseEvent *event)
|
||||
|
||||
// Determine which side of the clip the transition belongs to
|
||||
rational transition_start_point;
|
||||
olive::timeline::MovementMode trim_mode;
|
||||
Timeline::MovementMode trim_mode;
|
||||
rational halfway_point = block_at_time->in() + block_at_time->length() / 2;
|
||||
rational tenth_point = block_at_time->in() + block_at_time->length() / 10;
|
||||
Block* other_block = nullptr;
|
||||
if (cursor_frame < halfway_point) {
|
||||
transition_start_point = block_at_time->in();
|
||||
trim_mode = olive::timeline::kTrimIn;
|
||||
trim_mode = Timeline::kTrimIn;
|
||||
|
||||
if (cursor_frame < tenth_point
|
||||
&& block_at_time->previous()
|
||||
@@ -41,7 +41,7 @@ void TimelineWidget::TransitionTool::MousePress(TimelineViewMouseEvent *event)
|
||||
}
|
||||
} else {
|
||||
transition_start_point = block_at_time->out();
|
||||
trim_mode = olive::timeline::kTrimOut;
|
||||
trim_mode = Timeline::kTrimOut;
|
||||
dual_transition_ = (cursor_frame > block_at_time->length() - tenth_point);
|
||||
|
||||
if (cursor_frame > block_at_time->length() - tenth_point
|
||||
@@ -113,8 +113,8 @@ void TimelineWidget::TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
Block* friend_block = Node::ValueToPtr<Block>(ghost_->data(TimelineViewGhostItem::kReferenceBlock));
|
||||
|
||||
// Use ghost mode to determine which block is which
|
||||
Block* out_block = (ghost_->mode() == olive::timeline::kTrimIn) ? friend_block : active_block;
|
||||
Block* in_block = (ghost_->mode() == olive::timeline::kTrimIn) ? active_block : friend_block;
|
||||
Block* out_block = (ghost_->mode() == Timeline::kTrimIn) ? friend_block : active_block;
|
||||
Block* in_block = (ghost_->mode() == Timeline::kTrimIn) ? active_block : friend_block;
|
||||
|
||||
// Connect block to transition
|
||||
new NodeEdgeAddCommand(out_block->output(),
|
||||
@@ -128,7 +128,7 @@ void TimelineWidget::TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
Block* block_to_transition = Node::ValueToPtr<Block>(ghost_->data(TimelineViewGhostItem::kAttachedBlock));
|
||||
NodeInput* transition_input_to_connect;
|
||||
|
||||
if (ghost_->mode() == olive::timeline::kTrimIn) {
|
||||
if (ghost_->mode() == Timeline::kTrimIn) {
|
||||
transition->set_in_and_out_offset(ghost_->AdjustedLength(), 0);
|
||||
transition_input_to_connect = transition->in_block_input();
|
||||
} else {
|
||||
@@ -142,7 +142,7 @@ void TimelineWidget::TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
command);
|
||||
}
|
||||
|
||||
olive::undo_stack.push(command);
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
}
|
||||
|
||||
parent()->ClearGhosts();
|
||||
|
||||
@@ -26,7 +26,7 @@ TimelineViewGhostItem::TimelineViewGhostItem(QGraphicsItem *parent) :
|
||||
TimelineViewRect(parent),
|
||||
track_adj_(0),
|
||||
stream_(nullptr),
|
||||
mode_(olive::timeline::kNone),
|
||||
mode_(Timeline::kNone),
|
||||
can_have_zero_length_(true)
|
||||
{
|
||||
SetInvisible(false);
|
||||
@@ -174,12 +174,12 @@ TrackReference TimelineViewGhostItem::GetAdjustedTrack() const
|
||||
return TrackReference(track_.type(), track_.index() + track_adj_);
|
||||
}
|
||||
|
||||
const olive::timeline::MovementMode &TimelineViewGhostItem::mode() const
|
||||
const Timeline::MovementMode &TimelineViewGhostItem::mode() const
|
||||
{
|
||||
return mode_;
|
||||
}
|
||||
|
||||
void TimelineViewGhostItem::SetMode(const olive::timeline::MovementMode &mode)
|
||||
void TimelineViewGhostItem::SetMode(const Timeline::MovementMode &mode)
|
||||
{
|
||||
mode_ = mode;
|
||||
}
|
||||
|
||||
@@ -74,8 +74,8 @@ public:
|
||||
rational GetAdjustedMediaIn() const;
|
||||
TrackReference GetAdjustedTrack() const;
|
||||
|
||||
const olive::timeline::MovementMode& mode() const;
|
||||
void SetMode(const olive::timeline::MovementMode& mode);
|
||||
const Timeline::MovementMode& mode() const;
|
||||
void SetMode(const Timeline::MovementMode& mode);
|
||||
|
||||
bool HasBeenAdjusted() const;
|
||||
|
||||
@@ -96,7 +96,7 @@ private:
|
||||
|
||||
StreamPtr stream_;
|
||||
|
||||
olive::timeline::MovementMode mode_;
|
||||
Timeline::MovementMode mode_;
|
||||
|
||||
bool can_have_zero_length_;
|
||||
};
|
||||
|
||||
@@ -167,7 +167,7 @@ void ViewerWidget::ConnectViewerNode(ViewerOutput *node)
|
||||
}
|
||||
|
||||
video_renderer_->SetViewerNode(viewer_node_);
|
||||
video_renderer_->SetParameters(VideoRenderingParams(viewer_node_->video_params(), olive::PIX_FMT_RGBA16F, olive::kOffline, 2));
|
||||
video_renderer_->SetParameters(VideoRenderingParams(viewer_node_->video_params(), PixelFormat::PIX_FMT_RGBA16F, RenderMode::kOffline, 2));
|
||||
|
||||
audio_renderer_->SetViewerNode(viewer_node_);
|
||||
audio_renderer_->SetParameters(AudioRenderingParams(viewer_node_->audio_params(), SAMPLE_FMT_FLT));
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <QOpenGLFunctions>
|
||||
#include <QOpenGLTexture>
|
||||
|
||||
#include "render/backend/opengl/functions.h"
|
||||
#include "render/backend/opengl/openglrenderfunctions.h"
|
||||
#include "render/backend/opengl/openglshader.h"
|
||||
|
||||
ViewerGLWidget::ViewerGLWidget(QWidget *parent) :
|
||||
@@ -141,7 +141,7 @@ void ViewerGLWidget::paintGL()
|
||||
f->glBindTexture(GL_TEXTURE_2D, texture_);
|
||||
|
||||
// Blit using the pipeline retrieved in initializeGL()
|
||||
olive::gl::OCIOBlit(pipeline_, ocio_lut_, true, matrix_);
|
||||
OpenGLRenderFunctions::OCIOBlit(pipeline_, ocio_lut_, true, matrix_);
|
||||
|
||||
// Release retrieved texture
|
||||
f->glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
||||
Reference in New Issue
Block a user