finished merge of viewer and footage

This commit is contained in:
itsmattkc
2021-04-06 13:08:56 +10:00
parent 57ddae8920
commit 898ea25e89
58 changed files with 783 additions and 719 deletions
+7 -26
View File
@@ -35,41 +35,22 @@ FootageViewerPanel::FootageViewerPanel(QWidget *parent) :
// Set strings
Retranslate();
// Show and raise on connect
SetShowAndRaiseOnConnect();
}
QVector<Footage *> FootageViewerPanel::GetSelectedFootage() const
QVector<ViewerOutput *> FootageViewerPanel::GetSelectedFootage() const
{
QVector<Footage *> list;
Footage* f = static_cast<FootageViewerWidget*>(GetTimeBasedWidget())->GetFootage();
QVector<ViewerOutput *> list;
if (f) {
list.append(f);
if (GetConnectedViewer()) {
list.append(GetConnectedViewer());
}
return list;
}
void FootageViewerPanel::SetFootage(Footage *f)
{
if (f && !f->IsValid()) {
// Do nothing if footage is invalid
return;
}
static_cast<FootageViewerWidget*>(GetTimeBasedWidget())->SetFootage(f);
if (f) {
// SetSubtitle() will call Retranslate(), so we don't need to call it here
SetSubtitle(f->GetLabel());
// Pop this panel up so the user doesn't think nothing's happening if it's behind another tab
this->show();
this->raise();
} else {
Retranslate();
}
}
void FootageViewerPanel::Retranslate()
{
ViewerPanelBase::Retranslate();
+1 -3
View File
@@ -36,9 +36,7 @@ class FootageViewerPanel : public ViewerPanelBase, public FootageManagementPanel
public:
FootageViewerPanel(QWidget* parent);
virtual QVector<Footage *> GetSelectedFootage() const override;
void SetFootage(Footage* f);
virtual QVector<ViewerOutput *> GetSelectedFootage() const override;
protected:
virtual void Retranslate() override;
+1 -1
View File
@@ -29,7 +29,7 @@ namespace olive {
class FootageManagementPanel {
public:
virtual QVector<Footage*> GetSelectedFootage() const = 0;
virtual QVector<ViewerOutput *> GetSelectedFootage() const = 0;
};
}
+16 -5
View File
@@ -57,6 +57,7 @@ ProjectPanel::ProjectPanel(QWidget *parent) :
explorer_ = new ProjectExplorer(this);
layout->addWidget(explorer_);
connect(explorer_, &ProjectExplorer::DoubleClickedItem, this, &ProjectPanel::ItemDoubleClickSlot);
connect(explorer_, &ProjectExplorer::ItemRemoved, this, &ProjectPanel::ItemRemoved);
// Set toolbar's view to the explorer's view
toolbar->SetView(explorer_->view_type());
@@ -186,7 +187,7 @@ void ProjectPanel::ItemDoubleClickSlot(Node *item)
Core::instance()->DialogImportShow();
} else if (dynamic_cast<Footage*>(item)) {
// Open this footage in a FootageViewer
PanelManager::instance()->MostRecentlyFocused<FootageViewerPanel>()->SetFootage(static_cast<Footage*>(item));
PanelManager::instance()->MostRecentlyFocused<FootageViewerPanel>()->ConnectViewerNode(static_cast<Footage*>(item));
} else if (dynamic_cast<Sequence*>(item)) {
// Open this sequence in the Timeline
Core::instance()->main_window()->OpenSequence(static_cast<Sequence*>(item));
@@ -232,14 +233,24 @@ void ProjectPanel::SaveConnectedProject()
Core::instance()->SaveProject(this->project());
}
QVector<Footage *> ProjectPanel::GetSelectedFootage() const
void ProjectPanel::ItemRemoved(Node *item)
{
// Open this footage in a FootageViewer
FootageViewerPanel* panel = PanelManager::instance()->MostRecentlyFocused<FootageViewerPanel>();
if (panel->GetConnectedViewer() == item) {
panel->DisconnectViewerNode();
}
}
QVector<ViewerOutput *> ProjectPanel::GetSelectedFootage() const
{
QVector<Node*> items = SelectedItems();
QVector<Footage*> footage;
QVector<ViewerOutput*> footage;
foreach (Node* i, items) {
if (dynamic_cast<Footage*>(i)) {
footage.append(static_cast<Footage*>(i));
if (dynamic_cast<ViewerOutput*>(i)) {
footage.append(static_cast<ViewerOutput*>(i));
}
}
+3 -1
View File
@@ -48,7 +48,7 @@ public:
Folder* GetSelectedFolder() const;
virtual QVector<Footage *> GetSelectedFootage() const override;
virtual QVector<ViewerOutput *> GetSelectedFootage() const override;
ProjectViewModel* model() const;
@@ -80,6 +80,8 @@ private slots:
void SaveConnectedProject();
void ItemRemoved(Node* item);
};
}
+7 -1
View File
@@ -24,7 +24,8 @@ namespace olive {
TimeBasedPanel::TimeBasedPanel(const QString &object_name, QWidget *parent) :
PanelWidget(object_name, parent),
widget_(nullptr)
widget_(nullptr),
show_and_raise_on_connect_(false)
{
}
@@ -122,6 +123,11 @@ void TimeBasedPanel::ConnectViewerNode(ViewerOutput *node)
if (node) {
connect(node, &ViewerOutput::LabelChanged, this, &TimeBasedPanel::SetSubtitle);
if (show_and_raise_on_connect_) {
this->show();
this->raise();
}
}
// Update strings
+11 -1
View File
@@ -34,7 +34,10 @@ public:
void ConnectViewerNode(ViewerOutput *node);
void DisconnectViewerNode();
void DisconnectViewerNode()
{
ConnectViewerNode(nullptr);
}
rational GetTime();
@@ -122,9 +125,16 @@ protected:
virtual void Retranslate() override;
void SetShowAndRaiseOnConnect()
{
show_and_raise_on_connect_ = true;
}
private:
TimeBasedWidget* widget_;
bool show_and_raise_on_connect_;
};
}
+2 -2
View File
@@ -170,12 +170,12 @@ void TimelinePanel::SetColorLabel(int index)
static_cast<TimelineWidget*>(GetTimeBasedWidget())->SetColorLabel(index);
}
void TimelinePanel::InsertFootageAtPlayhead(const QVector<Footage *> &footage)
void TimelinePanel::InsertFootageAtPlayhead(const QVector<ViewerOutput *> &footage)
{
static_cast<TimelineWidget*>(GetTimeBasedWidget())->InsertFootageAtPlayhead(footage);
}
void TimelinePanel::OverwriteFootageAtPlayhead(const QVector<Footage *> &footage)
void TimelinePanel::OverwriteFootageAtPlayhead(const QVector<ViewerOutput *> &footage)
{
static_cast<TimelineWidget*>(GetTimeBasedWidget())->OverwriteFootageAtPlayhead(footage);
}
+2 -2
View File
@@ -85,9 +85,9 @@ public:
virtual void SetColorLabel(int index) override;
void InsertFootageAtPlayhead(const QVector<Footage *> &footage);
void InsertFootageAtPlayhead(const QVector<ViewerOutput *> &footage);
void OverwriteFootageAtPlayhead(const QVector<Footage *> &footage);
void OverwriteFootageAtPlayhead(const QVector<ViewerOutput *> &footage);
protected:
virtual void Retranslate() override;