implemented a footage viewer

Essentially a minor derivation of a viewer type that can automatically view
footage from the project (i.e. not in a sequence).
This commit is contained in:
itsmattkc
2019-12-30 20:17:48 +11:00
parent 55ea4a8177
commit 0db13a96ab
34 changed files with 439 additions and 152 deletions
+1
View File
@@ -16,6 +16,7 @@
add_subdirectory(audiomonitor)
add_subdirectory(curve)
add_subdirectory(footageviewer)
add_subdirectory(node)
add_subdirectory(param)
add_subdirectory(project)
+22
View File
@@ -0,0 +1,22 @@
# 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/>.
set(OLIVE_SOURCES
${OLIVE_SOURCES}
panel/footageviewer/footageviewer.h
panel/footageviewer/footageviewer.cpp
PARENT_SCOPE
)
+58
View File
@@ -0,0 +1,58 @@
/***
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 "footageviewer.h"
#include "widget/viewer/footageviewer.h"
FootageViewerPanel::FootageViewerPanel(QWidget *parent) :
ViewerPanelBase(parent)
{
// FIXME: This won't work if there's ever more than one of this panel
setObjectName("FootageViewerPanel");
// QObject system handles deleting this
viewer_ = new FootageViewerWidget(this);
// Set ViewerWidget as the central widget
setWidget(viewer_);
// Set strings
Retranslate();
}
void FootageViewerPanel::SetFootage(Footage *f)
{
static_cast<FootageViewerWidget*>(viewer_)->SetFootage(f);
}
void FootageViewerPanel::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange) {
Retranslate();
}
PanelWidget::changeEvent(e);
}
void FootageViewerPanel::Retranslate()
{
SetTitle(tr("Footage Viewer"));
SetSubtitle(tr("(none)"));
}
+46
View File
@@ -0,0 +1,46 @@
/***
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/>.
***/
#ifndef FOOTAGE_VIEWER_PANEL_H
#define FOOTAGE_VIEWER_PANEL_H
#include <QOpenGLFunctions>
#include "panel/viewer/viewerbase.h"
/**
* @brief Dockable wrapper around a ViewerWidget
*/
class FootageViewerPanel : public ViewerPanelBase {
Q_OBJECT
public:
FootageViewerPanel(QWidget* parent);
void SetFootage(Footage* f);
protected:
virtual void changeEvent(QEvent* e) override;
private:
void Retranslate();
};
#endif // FOOTAGE_VIEWER_PANEL_H
+7 -2
View File
@@ -24,6 +24,8 @@
#include <QVBoxLayout>
#include "core.h"
#include "panel/footageviewer/footageviewer.h"
#include "panel/panelmanager.h"
#include "widget/menu/menushared.h"
#include "widget/projecttoolbar/projecttoolbar.h"
@@ -121,9 +123,12 @@ void ProjectPanel::ItemDoubleClickSlot(Item *item)
if (item == nullptr) {
// If the user double clicks on empty space, show the import dialog
Core::instance()->DialogImportShow();
} else if (item->type() == Item::kFootage) {
// Open this footage in a FootageViewer
PanelManager::instance()->MostRecentlyFocused<FootageViewerPanel>()->SetFootage(static_cast<Footage*>(item));
} else if (item->type() == Item::kSequence) {
// FIXME: Open this sequence in the Timeline
}
// FIXME: Double click Item should do something
}
void ProjectPanel::ShowNewMenu()
+2
View File
@@ -18,5 +18,7 @@ set(OLIVE_SOURCES
${OLIVE_SOURCES}
panel/viewer/viewer.h
panel/viewer/viewer.cpp
panel/viewer/viewerbase.h
panel/viewer/viewerbase.cpp
PARENT_SCOPE
)
+1 -56
View File
@@ -21,7 +21,7 @@
#include "viewer.h"
ViewerPanel::ViewerPanel(QWidget *parent) :
PanelWidget(parent)
ViewerPanelBase(parent)
{
// FIXME: This won't work if there's ever more than one of this panel
setObjectName("ViewerPanel");
@@ -37,61 +37,6 @@ ViewerPanel::ViewerPanel(QWidget *parent) :
Retranslate();
}
void ViewerPanel::ZoomIn()
{
viewer_->SetScale(viewer_->scale() * 2);
}
void ViewerPanel::ZoomOut()
{
viewer_->SetScale(viewer_->scale() * 0.5);
}
void ViewerPanel::GoToStart()
{
viewer_->GoToStart();
}
void ViewerPanel::PrevFrame()
{
viewer_->PrevFrame();
}
void ViewerPanel::PlayPause()
{
viewer_->TogglePlayPause();
}
void ViewerPanel::NextFrame()
{
viewer_->NextFrame();
}
void ViewerPanel::GoToEnd()
{
viewer_->GoToEnd();
}
void ViewerPanel::ShuttleLeft()
{
viewer_->ShuttleLeft();
}
void ViewerPanel::ShuttleStop()
{
viewer_->ShuttleStop();
}
void ViewerPanel::ShuttleRight()
{
viewer_->ShuttleRight();
}
void ViewerPanel::SetTimebase(const rational &timebase)
{
viewer_->SetTimebase(timebase);
}
void ViewerPanel::ConnectViewerNode(ViewerOutput *node)
{
viewer_->ConnectViewerNode(node);
+2 -26
View File
@@ -23,39 +23,16 @@
#include <QOpenGLFunctions>
#include "widget/panel/panel.h"
#include "widget/viewer/viewer.h"
#include "viewerbase.h"
/**
* @brief Dockable wrapper around a ViewerWidget
*/
class ViewerPanel : public PanelWidget {
class ViewerPanel : public ViewerPanelBase {
Q_OBJECT
public:
ViewerPanel(QWidget* parent);
virtual void ZoomIn() override;
virtual void ZoomOut() override;
virtual void GoToStart() override;
virtual void PrevFrame() override;
virtual void PlayPause() override;
virtual void NextFrame() override;
virtual void GoToEnd() override;
virtual void ShuttleLeft() override;
virtual void ShuttleStop() override;
virtual void ShuttleRight() override;
void SetTimebase(const rational& timebase);
void ConnectViewerNode(ViewerOutput* node);
void DisconnectViewerNode();
@@ -76,7 +53,6 @@ signals:
private:
void Retranslate();
ViewerWidget* viewer_;
};
#endif // VIEWER_PANEL_H
+56
View File
@@ -0,0 +1,56 @@
#include "viewerbase.h"
ViewerPanelBase::ViewerPanelBase(QWidget *parent) :
PanelWidget(parent)
{
}
void ViewerPanelBase::ZoomIn()
{
viewer_->SetScale(viewer_->scale() * 2);
}
void ViewerPanelBase::ZoomOut()
{
viewer_->SetScale(viewer_->scale() * 0.5);
}
void ViewerPanelBase::GoToStart()
{
viewer_->GoToStart();
}
void ViewerPanelBase::PrevFrame()
{
viewer_->PrevFrame();
}
void ViewerPanelBase::PlayPause()
{
viewer_->TogglePlayPause();
}
void ViewerPanelBase::NextFrame()
{
viewer_->NextFrame();
}
void ViewerPanelBase::GoToEnd()
{
viewer_->GoToEnd();
}
void ViewerPanelBase::ShuttleLeft()
{
viewer_->ShuttleLeft();
}
void ViewerPanelBase::ShuttleStop()
{
viewer_->ShuttleStop();
}
void ViewerPanelBase::ShuttleRight()
{
viewer_->ShuttleRight();
}
+40
View File
@@ -0,0 +1,40 @@
#ifndef VIEWERPANELBASE_H
#define VIEWERPANELBASE_H
#include "widget/panel/panel.h"
#include "widget/viewer/viewer.h"
class ViewerPanelBase : public PanelWidget
{
Q_OBJECT
public:
ViewerPanelBase(QWidget* parent = nullptr);
virtual void ZoomIn() override;
virtual void ZoomOut() override;
virtual void GoToStart() override;
virtual void PrevFrame() override;
virtual void PlayPause() override;
virtual void NextFrame() override;
virtual void GoToEnd() override;
virtual void ShuttleLeft() override;
virtual void ShuttleStop() override;
virtual void ShuttleRight() override;
protected:
ViewerWidget* viewer_;
private:
};
#endif // VIEWERPANELBASE_H