nodeparamview: correctly show video and audio node options
This commit is contained in:
@@ -85,6 +85,7 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent) :
|
||||
NodeParamViewItemTitleBar *title_bar = static_cast<NodeParamViewItemTitleBar*>(c->titleBarWidget());
|
||||
|
||||
if (i == Track::kVideo || i == Track::kAudio) {
|
||||
c->SetEffectType(static_cast<Track::Type>(i));
|
||||
title_bar->SetAddEffectButtonVisible(true);
|
||||
title_bar->SetText(tr("%1 Nodes").arg(Footage::GetStreamTypeName(static_cast<Track::Type>(i))));
|
||||
} else {
|
||||
|
||||
@@ -31,7 +31,8 @@ namespace olive {
|
||||
#define super NodeParamViewItemBase
|
||||
|
||||
NodeParamViewContext::NodeParamViewContext(QWidget *parent) :
|
||||
super(parent)
|
||||
super(parent),
|
||||
type_(Track::kNone)
|
||||
{
|
||||
QWidget *body = new QWidget();
|
||||
QHBoxLayout *body_layout = new QHBoxLayout(body);
|
||||
@@ -126,13 +127,30 @@ void NodeParamViewContext::SetTime(const rational &time)
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewContext::SetEffectType(Track::Type type)
|
||||
{
|
||||
type_ = type;
|
||||
}
|
||||
|
||||
void NodeParamViewContext::Retranslate()
|
||||
{
|
||||
}
|
||||
|
||||
void NodeParamViewContext::AddEffectButtonClicked()
|
||||
{
|
||||
Menu *m = NodeFactory::CreateMenu(this, false, Node::kCategoryUnknown, Node::kVideoEffect);
|
||||
Node::Flag flag = Node::kNone;
|
||||
|
||||
if (type_ == Track::kVideo) {
|
||||
flag = Node::kVideoEffect;
|
||||
} else {
|
||||
flag = Node::kAudioEffect;
|
||||
}
|
||||
|
||||
if (flag == Node::kNone) {
|
||||
return;
|
||||
}
|
||||
|
||||
Menu *m = NodeFactory::CreateMenu(this, false, Node::kCategoryUnknown, flag);
|
||||
connect(m, &Menu::triggered, this, &NodeParamViewContext::AddEffectMenuItemTriggered);
|
||||
m->exec(QCursor::pos());
|
||||
delete m;
|
||||
|
||||
@@ -64,6 +64,8 @@ public:
|
||||
|
||||
void SetTime(const rational &time);
|
||||
|
||||
void SetEffectType(Track::Type type);
|
||||
|
||||
signals:
|
||||
void AboutToDeleteItem(NodeParamViewItem *item);
|
||||
|
||||
@@ -88,6 +90,8 @@ private:
|
||||
|
||||
QVector<NodeParamViewItem*> items_;
|
||||
|
||||
Track::Type type_;
|
||||
|
||||
private slots:
|
||||
void AddEffectButtonClicked();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user