various: encapsulate all code in the olive namespace to avoid name collisions
Large-scale code cleanup. Also adds a license to the top of all files that were missing it.
This commit is contained in:
@@ -1,9 +1,31 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
#include "core.h"
|
||||
#include "node/factory.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::AddTool::AddTool(TimelineWidget *parent) :
|
||||
Tool(parent),
|
||||
ghost_(nullptr)
|
||||
@@ -22,18 +44,18 @@ void TimelineWidget::AddTool::MousePress(TimelineViewMouseEvent *event)
|
||||
Timeline::TrackType add_type = Timeline::kTrackTypeNone;
|
||||
|
||||
switch (Core::instance()->selected_addable_object()) {
|
||||
case ::Tool::kAddableBars:
|
||||
case ::Tool::kAddableSolid:
|
||||
case ::Tool::kAddableTitle:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableBars:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableSolid:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableTitle:
|
||||
add_type = Timeline::kTrackTypeVideo;
|
||||
break;
|
||||
case ::Tool::kAddableTone:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableTone:
|
||||
add_type = Timeline::kTrackTypeAudio;
|
||||
break;
|
||||
case ::Tool::kAddableEmpty:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableEmpty:
|
||||
// Leave as "none", which means this block can be placed on any track
|
||||
break;
|
||||
case ::Tool::kAddableCount:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableCount:
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -73,7 +95,7 @@ void TimelineWidget::AddTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
|
||||
ClipBlock* clip = new ClipBlock();
|
||||
clip->set_length_and_media_out(ghost_->AdjustedLength());
|
||||
clip->set_block_name(::Tool::GetAddableObjectName(Core::instance()->selected_addable_object()));
|
||||
clip->set_block_name(OLIVE_NAMESPACE::Tool::GetAddableObjectName(Core::instance()->selected_addable_object()));
|
||||
|
||||
NodeGraph* graph = static_cast<NodeGraph*>(parent()->GetConnectedNode()->parent());
|
||||
|
||||
@@ -88,10 +110,10 @@ void TimelineWidget::AddTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
command);
|
||||
|
||||
switch (Core::instance()->selected_addable_object()) {
|
||||
case ::Tool::kAddableEmpty:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableEmpty:
|
||||
// Empty, nothing to be done
|
||||
break;
|
||||
case ::Tool::kAddableSolid:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableSolid:
|
||||
{
|
||||
Node* solid = NodeFactory::CreateFromID(QStringLiteral("org.olivevideoeditor.Olive.solidgenerator"));
|
||||
|
||||
@@ -102,13 +124,13 @@ void TimelineWidget::AddTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
new NodeEdgeAddCommand(solid->output(), clip->texture_input(), command);
|
||||
break;
|
||||
}
|
||||
case ::Tool::kAddableBars:
|
||||
case ::Tool::kAddableTitle:
|
||||
case ::Tool::kAddableTone:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableBars:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableTitle:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableTone:
|
||||
// Not implemented yet
|
||||
qWarning() << "Unimplemented add object:" << Core::instance()->selected_addable_object();
|
||||
break;
|
||||
case ::Tool::kAddableCount:
|
||||
case OLIVE_NAMESPACE::Tool::kAddableCount:
|
||||
// Invalid value, do nothing
|
||||
break;
|
||||
}
|
||||
@@ -155,3 +177,5 @@ void TimelineWidget::AddTool::MouseMoveInternal(const rational &cursor_frame, bo
|
||||
ghost_->SetOutAdjustment(outwards ? -movement : 0);
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::EditTool::EditTool(TimelineWidget* parent) :
|
||||
Tool(parent)
|
||||
{
|
||||
@@ -19,3 +41,5 @@ void TimelineWidget::EditTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
#include "window/mainwindow/mainwindow.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
Timeline::TrackType TrackTypeFromStreamType(Stream::Type stream_type)
|
||||
{
|
||||
switch (stream_type) {
|
||||
@@ -451,3 +453,5 @@ void TimelineWidget::ImportTool::DropGhosts(bool insert)
|
||||
Core::instance()->main_window()->OpenSequence(open_sequence);
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::PointerTool::PointerTool(TimelineWidget *parent) :
|
||||
Tool(parent),
|
||||
movement_allowed_(true),
|
||||
@@ -714,3 +716,5 @@ rational TimelineWidget::PointerTool::ValidateOutTrimming(rational movement,
|
||||
|
||||
return movement;
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::RazorTool::RazorTool(TimelineWidget* parent) :
|
||||
Tool(parent)
|
||||
{
|
||||
@@ -90,3 +92,5 @@ void TimelineWidget::RazorTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
|
||||
dragging_ = false;
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::RippleTool::RippleTool(TimelineWidget* parent) :
|
||||
PointerTool(parent)
|
||||
{
|
||||
@@ -152,3 +154,5 @@ void TimelineWidget::RippleTool::InitiateGhosts(TimelineViewBlockItem *clicked_i
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::RollingTool::RollingTool(TimelineWidget* parent) :
|
||||
PointerTool(parent)
|
||||
{
|
||||
@@ -99,3 +101,5 @@ void TimelineWidget::RollingTool::InitiateGhosts(TimelineViewBlockItem *clicked_
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "node/block/gap/gap.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::SlideTool::SlideTool(TimelineWidget* parent) :
|
||||
PointerTool(parent)
|
||||
{
|
||||
@@ -89,3 +91,4 @@ void TimelineWidget::SlideTool::InitiateGhosts(TimelineViewBlockItem *clicked_it
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "common/timecodefunctions.h"
|
||||
#include "config/config.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::SlipTool::SlipTool(TimelineWidget *parent) :
|
||||
PointerTool(parent)
|
||||
{
|
||||
@@ -80,3 +82,4 @@ void TimelineWidget::SlipTool::MouseReleaseInternal(TimelineViewMouseEvent *even
|
||||
Core::instance()->undo_stack()->pushIfHasChildren(command);
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::Tool::Tool(TimelineWidget *parent) :
|
||||
dragging_(false),
|
||||
parent_(parent)
|
||||
@@ -224,3 +226,5 @@ void TimelineWidget::Tool::InsertGapsAtGhostDestination(const QVector<TimelineVi
|
||||
|
||||
parent()->InsertGapsAt(earliest_point, latest_point - earliest_point, command);
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -1,9 +1,31 @@
|
||||
/***
|
||||
|
||||
Olive - Non-Linear Video Editor
|
||||
Copyright (C) 2019 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 "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
#include "node/block/transition/transition.h"
|
||||
#include "node/factory.h"
|
||||
#include "widget/nodeview/nodeviewundo.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::TransitionTool::TransitionTool(TimelineWidget *parent) :
|
||||
AddTool(parent)
|
||||
{
|
||||
@@ -152,3 +174,5 @@ void TimelineWidget::TransitionTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
ghost_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
#include "widget/timelinewidget/timelinewidget.h"
|
||||
|
||||
OLIVE_NAMESPACE_ENTER
|
||||
|
||||
TimelineWidget::ZoomTool::ZoomTool(TimelineWidget *parent) :
|
||||
Tool(parent)
|
||||
{
|
||||
@@ -90,3 +92,5 @@ void TimelineWidget::ZoomTool::MouseRelease(TimelineViewMouseEvent *event)
|
||||
// (using a hacky singleShot so the scroll occurs after the scene and its scrollbars have updated)
|
||||
QTimer::singleShot(0, parent(), &TimelineWidget::DeferredScrollAction);
|
||||
}
|
||||
|
||||
OLIVE_NAMESPACE_EXIT
|
||||
|
||||
Reference in New Issue
Block a user