mocked up a prototype of decoding data into the node graph
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
#include "footagecombobox.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QDebug>
|
||||
#include <QMenu>
|
||||
|
||||
FootageComboBox::FootageComboBox(QWidget *parent) :
|
||||
QComboBox(parent),
|
||||
root_(nullptr)
|
||||
root_(nullptr),
|
||||
footage_(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -25,11 +27,14 @@ void FootageComboBox::showPopup()
|
||||
QAction* selected = menu.exec(parentWidget()->mapToGlobal(pos()));
|
||||
|
||||
if (selected != nullptr) {
|
||||
// Use combobox functions to show the footage name
|
||||
clear();
|
||||
|
||||
addItem(selected->text());
|
||||
|
||||
emit FootageChanged(reinterpret_cast<Footage*>(selected->data().value<quintptr>()));
|
||||
footage_ = reinterpret_cast<Footage*>(selected->data().value<quintptr>());
|
||||
|
||||
emit FootageChanged(footage_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,11 +45,22 @@ void FootageComboBox::SetRoot(const Folder *p)
|
||||
clear();
|
||||
}
|
||||
|
||||
Footage *FootageComboBox::SelectedFootage()
|
||||
{
|
||||
return footage_;
|
||||
}
|
||||
|
||||
void FootageComboBox::SetFootage(Footage *f)
|
||||
{
|
||||
// Remove existing single item used to show the footage name
|
||||
clear();
|
||||
|
||||
addItem(f->name());
|
||||
footage_ = f;
|
||||
|
||||
if (footage_ != nullptr) {
|
||||
// Use combobox functions to show the footage name
|
||||
addItem(footage_->name());
|
||||
}
|
||||
}
|
||||
|
||||
void FootageComboBox::TraverseFolder(const Folder *f, QMenu *m)
|
||||
|
||||
@@ -17,6 +17,8 @@ public:
|
||||
|
||||
void SetRoot(const Folder *p);
|
||||
|
||||
Footage* SelectedFootage();
|
||||
|
||||
public slots:
|
||||
void SetFootage(Footage* f);
|
||||
|
||||
@@ -27,6 +29,8 @@ private:
|
||||
void TraverseFolder(const Folder *f, QMenu* m);
|
||||
|
||||
const Folder* root_;
|
||||
|
||||
Footage* footage_;
|
||||
};
|
||||
|
||||
#endif // FOOTAGECOMBOBOX_H
|
||||
|
||||
@@ -156,6 +156,7 @@ void NodeParamViewItemTitleBar::paintEvent(QPaintEvent *event)
|
||||
QPainter p(this);
|
||||
|
||||
// Draw bottom border using text color
|
||||
int bottom = height() - 1;
|
||||
p.setPen(palette().text().color());
|
||||
p.drawLine(0, height() - 1, width(), height() - 1);
|
||||
p.drawLine(0, bottom, width(), bottom);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <QLineEdit>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "node/node.h"
|
||||
#include "widget/footagecombobox/footagecombobox.h"
|
||||
|
||||
// FIXME: Test code only
|
||||
@@ -79,7 +80,8 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
// Pretty hacky way of getting the root folder for this node's sequence
|
||||
ProjectPanel* pp = olive::panel_focus_manager->MostRecentlyFocused<ProjectPanel>();
|
||||
footage_combobox->SetRoot(pp->project()->root());
|
||||
|
||||
footage_combobox->SetFootage(Node::ValueToPtr<Footage>(input_->get_value(Now())));
|
||||
connect(footage_combobox, SIGNAL(FootageChanged(Footage*)), this, SLOT(WidgetCallback()));
|
||||
// End test code
|
||||
|
||||
widgets_.append(footage_combobox);
|
||||
@@ -89,6 +91,12 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
}
|
||||
}
|
||||
|
||||
rational NodeParamViewWidgetBridge::Now()
|
||||
{
|
||||
// FIXME: Actually implement this
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NodeParamViewWidgetBridge::WidgetCallback()
|
||||
{
|
||||
switch (input_->inputs().first()) {
|
||||
@@ -132,8 +140,8 @@ void NodeParamViewWidgetBridge::WidgetCallback()
|
||||
case NodeParam::kFootage:
|
||||
{
|
||||
// Widget is a FootageComboBox
|
||||
//FootageComboBox* footage_combobox = static_cast<FootageComboBox*>(sender());
|
||||
|
||||
FootageComboBox* footage_combobox = static_cast<FootageComboBox*>(sender());
|
||||
input_->set_value(Now(), Node::PtrToValue(footage_combobox->SelectedFootage()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ private:
|
||||
|
||||
void CreateWidgets();
|
||||
|
||||
rational Now();
|
||||
|
||||
private slots:
|
||||
void WidgetCallback();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user