panels: allow insert and overwrite from footageviewerpanel too
Makes FootageViewerPanel and ProjectPanel derive from a common base that TimelinePanel searches for when looking for a source to insert/overwrite from.
This commit is contained in:
@@ -35,6 +35,11 @@ FootageViewerPanel::FootageViewerPanel(QWidget *parent) :
|
||||
Retranslate();
|
||||
}
|
||||
|
||||
QList<Footage *> FootageViewerPanel::GetSelectedFootage()
|
||||
{
|
||||
return {static_cast<FootageViewerWidget*>(GetTimeBasedWidget())->GetFootage()};
|
||||
}
|
||||
|
||||
void FootageViewerPanel::SetFootage(Footage *f)
|
||||
{
|
||||
static_cast<FootageViewerWidget*>(GetTimeBasedWidget())->SetFootage(f);
|
||||
|
||||
@@ -24,15 +24,18 @@
|
||||
#include <QOpenGLFunctions>
|
||||
|
||||
#include "panel/viewer/viewerbase.h"
|
||||
#include "panel/project/footagemanagementpanel.h"
|
||||
|
||||
/**
|
||||
* @brief Dockable wrapper around a ViewerWidget
|
||||
*/
|
||||
class FootageViewerPanel : public ViewerPanelBase {
|
||||
class FootageViewerPanel : public ViewerPanelBase, public FootageManagementPanel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FootageViewerPanel(QWidget* parent);
|
||||
|
||||
virtual QList<Footage*> GetSelectedFootage() override;
|
||||
|
||||
void SetFootage(Footage* f);
|
||||
|
||||
protected:
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
panel/project/footagemanagementpanel.h
|
||||
panel/project/project.h
|
||||
panel/project/project.cpp
|
||||
PARENT_SCOPE
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#ifndef FOOTAGEMANAGEMENTPANEL_H
|
||||
#define FOOTAGEMANAGEMENTPANEL_H
|
||||
|
||||
#include <QList>
|
||||
|
||||
#include "project/item/footage/footage.h"
|
||||
|
||||
class FootageManagementPanel {
|
||||
public:
|
||||
virtual QList<Footage*> GetSelectedFootage() = 0;
|
||||
};
|
||||
|
||||
#endif // FOOTAGEMANAGEMENTPANEL_H
|
||||
@@ -21,6 +21,7 @@
|
||||
#ifndef PROJECT_PANEL_H
|
||||
#define PROJECT_PANEL_H
|
||||
|
||||
#include "footagemanagementpanel.h"
|
||||
#include "project/project.h"
|
||||
#include "widget/panel/panel.h"
|
||||
#include "widget/projectexplorer/projectexplorer.h"
|
||||
@@ -28,7 +29,7 @@
|
||||
/**
|
||||
* @brief A PanelWidget wrapper around a ProjectExplorer and a ProjectToolbar
|
||||
*/
|
||||
class ProjectPanel : public PanelWidget
|
||||
class ProjectPanel : public PanelWidget, public FootageManagementPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -41,7 +42,7 @@ public:
|
||||
|
||||
Folder* GetSelectedFolder();
|
||||
|
||||
QList<Footage*> GetSelectedFootage();
|
||||
virtual QList<Footage*> GetSelectedFootage() override;
|
||||
|
||||
ProjectViewModel* model();
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "timeline.h"
|
||||
|
||||
#include "panel/panelmanager.h"
|
||||
#include "panel/project/project.h"
|
||||
#include "panel/project/footagemanagementpanel.h"
|
||||
|
||||
TimelinePanel::TimelinePanel(QWidget *parent) :
|
||||
TimeBasedPanel(parent)
|
||||
@@ -94,7 +94,7 @@ void TimelinePanel::DecreaseTrackHeight()
|
||||
|
||||
void TimelinePanel::Insert()
|
||||
{
|
||||
ProjectPanel* project_panel = PanelManager::instance()->MostRecentlyFocused<ProjectPanel>();
|
||||
FootageManagementPanel* project_panel = PanelManager::instance()->MostRecentlyFocused<FootageManagementPanel>();
|
||||
|
||||
if (project_panel) {
|
||||
InsertFootageAtPlayhead(project_panel->GetSelectedFootage());
|
||||
@@ -103,7 +103,7 @@ void TimelinePanel::Insert()
|
||||
|
||||
void TimelinePanel::Overwrite()
|
||||
{
|
||||
ProjectPanel* project_panel = PanelManager::instance()->MostRecentlyFocused<ProjectPanel>();
|
||||
FootageManagementPanel* project_panel = PanelManager::instance()->MostRecentlyFocused<FootageManagementPanel>();
|
||||
|
||||
if (project_panel) {
|
||||
OverwriteFootageAtPlayhead(project_panel->GetSelectedFootage());
|
||||
|
||||
Reference in New Issue
Block a user