@@ -284,4 +284,9 @@ void ClipBlock::Retranslate()
|
||||
SetInputName(kMaintainAudioPitchInput, tr("Maintain Audio Pitch"));
|
||||
}
|
||||
|
||||
TimeRange ClipBlock::media_range() const
|
||||
{
|
||||
return InputTimeAdjustment(kBufferIn, -1, range());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -119,6 +119,8 @@ public:
|
||||
return connected_viewer_;
|
||||
}
|
||||
|
||||
TimeRange media_range() const;
|
||||
|
||||
static const QString kBufferIn;
|
||||
static const QString kMediaInInput;
|
||||
static const QString kSpeedInput;
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
|
||||
#include "footageviewer.h"
|
||||
|
||||
#include "widget/viewer/footageviewer.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
#define super ViewerPanelBase
|
||||
|
||||
FootageViewerPanel::FootageViewerPanel(QWidget *parent) :
|
||||
ViewerPanelBase(QStringLiteral("FootageViewerPanel"), parent)
|
||||
super(QStringLiteral("FootageViewerPanel"), parent)
|
||||
{
|
||||
// Set ViewerWidget as the central widget
|
||||
FootageViewerWidget* fvw = new FootageViewerWidget();
|
||||
@@ -38,6 +38,11 @@ FootageViewerPanel::FootageViewerPanel(QWidget *parent) :
|
||||
SetShowAndRaiseOnConnect();
|
||||
}
|
||||
|
||||
void FootageViewerPanel::OverrideWorkArea(const TimeRange &r)
|
||||
{
|
||||
GetFootageViewerWidget()->OverrideWorkArea(r);
|
||||
}
|
||||
|
||||
QVector<ViewerOutput *> FootageViewerPanel::GetSelectedFootage() const
|
||||
{
|
||||
QVector<ViewerOutput *> list;
|
||||
@@ -51,7 +56,7 @@ QVector<ViewerOutput *> FootageViewerPanel::GetSelectedFootage() const
|
||||
|
||||
void FootageViewerPanel::Retranslate()
|
||||
{
|
||||
ViewerPanelBase::Retranslate();
|
||||
super::Retranslate();
|
||||
|
||||
SetTitle(tr("Footage Viewer"));
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "panel/viewer/viewerbase.h"
|
||||
#include "panel/project/footagemanagementpanel.h"
|
||||
#include "widget/viewer/footageviewer.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -36,6 +37,13 @@ class FootageViewerPanel : public ViewerPanelBase, public FootageManagementPanel
|
||||
public:
|
||||
FootageViewerPanel(QWidget* parent);
|
||||
|
||||
void OverrideWorkArea(const TimeRange &r);
|
||||
|
||||
FootageViewerWidget *GetFootageViewerWidget() const
|
||||
{
|
||||
return static_cast<FootageViewerWidget*>(GetTimeBasedWidget());
|
||||
}
|
||||
|
||||
virtual QVector<ViewerOutput *> GetSelectedFootage() const override;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -1073,6 +1073,11 @@ void TimelineWidget::ShowContextMenu()
|
||||
|
||||
if (ClipBlock *clip = dynamic_cast<ClipBlock*>(selected.first())) {
|
||||
if (clip->connected_viewer()) {
|
||||
QAction *reveal_in_footage_viewer = menu.addAction(tr("Reveal in Footage Viewer"));
|
||||
reveal_in_footage_viewer->setData(reinterpret_cast<quintptr>(clip->connected_viewer()));
|
||||
reveal_in_footage_viewer->setProperty("range", QVariant::fromValue(clip->media_range()));
|
||||
connect(reveal_in_footage_viewer, &QAction::triggered, this, &TimelineWidget::RevealInFootageViewer);
|
||||
|
||||
QAction *reveal_in_project = menu.addAction(tr("Reveal in Project"));
|
||||
reveal_in_project->setData(reinterpret_cast<quintptr>(clip->connected_viewer()));
|
||||
connect(reveal_in_project, &QAction::triggered, this, &TimelineWidget::RevealInProject);
|
||||
@@ -1203,6 +1208,16 @@ void TimelineWidget::SignalBlockSelectionChange()
|
||||
signal_block_change_timer_->start();
|
||||
}
|
||||
|
||||
void TimelineWidget::RevealInFootageViewer()
|
||||
{
|
||||
QAction *a = static_cast<QAction*>(sender());
|
||||
|
||||
ViewerOutput *item_to_reveal = reinterpret_cast<ViewerOutput*>(a->data().value<quintptr>());
|
||||
TimeRange r = a->property("range").value<TimeRange>();
|
||||
|
||||
emit RevealViewerInFootageViewer(item_to_reveal, r);
|
||||
}
|
||||
|
||||
void TimelineWidget::RevealInProject()
|
||||
{
|
||||
QAction *a = static_cast<QAction*>(sender());
|
||||
|
||||
@@ -277,6 +277,7 @@ signals:
|
||||
|
||||
void RequestCaptureStart(const TimeRange &time, const Track::Reference &track);
|
||||
|
||||
void RevealViewerInFootageViewer(ViewerOutput *r, const TimeRange &range);
|
||||
void RevealViewerInProject(ViewerOutput *r);
|
||||
|
||||
protected:
|
||||
@@ -425,6 +426,7 @@ private slots:
|
||||
|
||||
void SignalBlockSelectionChange();
|
||||
|
||||
void RevealInFootageViewer();
|
||||
void RevealInProject();
|
||||
|
||||
void RenameSelectedBlocks();
|
||||
|
||||
@@ -38,6 +38,22 @@ FootageViewerWidget::FootageViewerWidget(QWidget *parent) :
|
||||
controls_->SetAudioVideoDragButtonsVisible(true);
|
||||
connect(controls_, &PlaybackControls::VideoPressed, this, &FootageViewerWidget::StartVideoDrag);
|
||||
connect(controls_, &PlaybackControls::AudioPressed, this, &FootageViewerWidget::StartAudioDrag);
|
||||
|
||||
override_workarea_ = new TimelineWorkArea(this);
|
||||
}
|
||||
|
||||
void FootageViewerWidget::OverrideWorkArea(const TimeRange &r)
|
||||
{
|
||||
override_workarea_->set_enabled(true);
|
||||
override_workarea_->set_range(r);
|
||||
this->ConnectWorkArea(override_workarea_);
|
||||
}
|
||||
|
||||
void FootageViewerWidget::ResetWorkArea()
|
||||
{
|
||||
if (GetConnectedWorkArea() == override_workarea_) {
|
||||
this->ConnectWorkArea(GetConnectedNode() ? GetConnectedNode()->GetWorkArea() : nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void FootageViewerWidget::ConnectNodeEvent(ViewerOutput *n)
|
||||
|
||||
@@ -32,6 +32,9 @@ class FootageViewerWidget : public ViewerWidget
|
||||
public:
|
||||
FootageViewerWidget(QWidget* parent = nullptr);
|
||||
|
||||
void OverrideWorkArea(const TimeRange &r);
|
||||
void ResetWorkArea();
|
||||
|
||||
protected:
|
||||
virtual void ConnectNodeEvent(ViewerOutput *) override;
|
||||
|
||||
@@ -42,6 +45,8 @@ private:
|
||||
|
||||
QHash<ViewerOutput*, rational> cached_timestamps_;
|
||||
|
||||
TimelineWorkArea *override_workarea_;
|
||||
|
||||
private slots:
|
||||
void StartFootageDrag();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "dialog/about/about.h"
|
||||
#include "mainmenu.h"
|
||||
#include "mainstatusbar.h"
|
||||
#include "widget/timelinewidget/undo/timelineundoworkarea.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
@@ -489,6 +490,20 @@ void MainWindow::RevealViewerInProject(ViewerOutput *r)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::RevealViewerInFootageViewer(ViewerOutput *r, const TimeRange &range)
|
||||
{
|
||||
footage_viewer_panel_->ConnectViewerNode(r);
|
||||
|
||||
auto command = new MultiUndoCommand();
|
||||
if (!r->GetWorkArea()->enabled()) {
|
||||
command->add_child(new WorkareaSetEnabledCommand(r->project(), r->GetWorkArea(), true));
|
||||
}
|
||||
command->add_child(new WorkareaSetRangeCommand(r->GetWorkArea(), range));
|
||||
Core::instance()->undo_stack()->push(command);
|
||||
|
||||
footage_viewer_panel_->SetTime(range.in());
|
||||
}
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
void MainWindow::ShowNouveauWarning()
|
||||
{
|
||||
@@ -568,6 +583,7 @@ TimelinePanel* MainWindow::AppendTimelinePanel()
|
||||
connect(panel, &TimelinePanel::RequestCaptureStart, sequence_viewer_panel_, &SequenceViewerPanel::StartCapture);
|
||||
connect(panel, &TimelinePanel::BlockSelectionChanged, this, &MainWindow::TimelinePanelSelectionChanged);
|
||||
connect(panel, &TimelinePanel::RevealViewerInProject, this, &MainWindow::RevealViewerInProject);
|
||||
connect(panel, &TimelinePanel::RevealViewerInFootageViewer, this, &MainWindow::RevealViewerInFootageViewer);
|
||||
connect(param_panel_, &ParamPanel::TimeChanged, panel, &TimelinePanel::SetTime);
|
||||
connect(curve_panel_, &ParamPanel::TimeChanged, panel, &TimelinePanel::SetTime);
|
||||
connect(sequence_viewer_panel_, &SequenceViewerPanel::TimeChanged, panel, &TimelinePanel::SetTime);
|
||||
|
||||
@@ -196,6 +196,7 @@ private slots:
|
||||
void ShowWelcomeDialog();
|
||||
|
||||
void RevealViewerInProject(ViewerOutput *r);
|
||||
void RevealViewerInFootageViewer(ViewerOutput *r, const TimeRange &range);
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user