footage combobox returns streams rather than footage
This commit is contained in:
@@ -4,13 +4,14 @@
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
|
||||
#include "ui/icons/icons.h"
|
||||
|
||||
FootageComboBox::FootageComboBox(QWidget *parent) :
|
||||
QComboBox(parent),
|
||||
root_(nullptr),
|
||||
footage_(nullptr),
|
||||
only_show_ready_footage_(true)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void FootageComboBox::showPopup()
|
||||
@@ -33,7 +34,7 @@ void FootageComboBox::showPopup()
|
||||
|
||||
addItem(selected->text());
|
||||
|
||||
footage_ = reinterpret_cast<Footage*>(selected->data().value<quintptr>());
|
||||
footage_ = selected->data().value<StreamPtr>();
|
||||
|
||||
emit FootageChanged(footage_);
|
||||
}
|
||||
@@ -51,12 +52,12 @@ void FootageComboBox::SetOnlyShowReadyFootage(bool e)
|
||||
only_show_ready_footage_ = e;
|
||||
}
|
||||
|
||||
Footage *FootageComboBox::SelectedFootage()
|
||||
StreamPtr FootageComboBox::SelectedFootage()
|
||||
{
|
||||
return footage_;
|
||||
}
|
||||
|
||||
void FootageComboBox::SetFootage(Footage *f)
|
||||
void FootageComboBox::SetFootage(StreamPtr f)
|
||||
{
|
||||
// Remove existing single item used to show the footage name
|
||||
clear();
|
||||
@@ -65,7 +66,7 @@ void FootageComboBox::SetFootage(Footage *f)
|
||||
|
||||
if (footage_ != nullptr) {
|
||||
// Use combobox functions to show the footage name
|
||||
addItem(footage_->name());
|
||||
addItem(footage_->footage()->name());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,8 +84,13 @@ void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
Footage* footage = static_cast<Footage*>(child);
|
||||
|
||||
if (!only_show_ready_footage_ || footage->status() == Footage::kReady) {
|
||||
QAction* footage_action = m->addAction(child->name());
|
||||
footage_action->setData(reinterpret_cast<quintptr>(child));
|
||||
QMenu* stream_menu = m->addMenu(footage->name());
|
||||
|
||||
foreach (StreamPtr stream, footage->streams()) {
|
||||
QAction* stream_action = stream_menu->addAction(stream->description());
|
||||
stream_action->setData(QVariant::fromValue(stream));
|
||||
stream_action->setIcon(Stream::IconFromType(stream->type()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,20 +19,20 @@ public:
|
||||
|
||||
void SetOnlyShowReadyFootage(bool e);
|
||||
|
||||
Footage* SelectedFootage();
|
||||
StreamPtr SelectedFootage();
|
||||
|
||||
public slots:
|
||||
void SetFootage(Footage* f);
|
||||
void SetFootage(StreamPtr f);
|
||||
|
||||
signals:
|
||||
void FootageChanged(Footage* f);
|
||||
void FootageChanged(StreamPtr f);
|
||||
|
||||
private:
|
||||
void TraverseFolder(const Folder *f, QMenu* m);
|
||||
|
||||
const Folder* root_;
|
||||
|
||||
Footage* footage_;
|
||||
StreamPtr footage_;
|
||||
|
||||
bool only_show_ready_footage_;
|
||||
};
|
||||
|
||||
@@ -175,9 +175,9 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
footage_combobox->SetRoot(pp->project()->root());
|
||||
|
||||
// Use multiple values
|
||||
footage_combobox->SetFootage(Node::ValueToPtr<Footage>(base_input->get_value(0)));
|
||||
footage_combobox->SetFootage(base_input->get_value(0).value<StreamPtr>());
|
||||
|
||||
connect(footage_combobox, SIGNAL(FootageChanged(Footage*)), this, SLOT(WidgetCallback()));
|
||||
connect(footage_combobox, SIGNAL(FootageChanged(StreamPtr)), this, SLOT(WidgetCallback()));
|
||||
// End test code
|
||||
|
||||
widgets_.append(footage_combobox);
|
||||
@@ -308,7 +308,7 @@ void NodeParamViewWidgetBridge::WidgetCallback()
|
||||
{
|
||||
// Widget is a FootageComboBox
|
||||
FootageComboBox* footage_combobox = static_cast<FootageComboBox*>(sender());
|
||||
input->set_value(Node::PtrToValue(footage_combobox->SelectedFootage()));
|
||||
input->set_value(QVariant::fromValue(footage_combobox->SelectedFootage()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ void TimelineView::ImportTool::DragDrop(QDropEvent *event)
|
||||
opacity->setParent(&node_memory_manager);
|
||||
|
||||
clip->set_length(ghost->Length());
|
||||
media->SetFootage(ghost->data(0).value<StreamPtr>()->footage());
|
||||
media->SetFootage(ghost->data(0).value<StreamPtr>());
|
||||
|
||||
NodeParam::ConnectEdge(opacity->texture_output(), clip->texture_input());
|
||||
NodeParam::ConnectEdge(media->texture_output(), opacity->texture_input());
|
||||
|
||||
Reference in New Issue
Block a user