created widget bridge
This commit is contained in:
@@ -84,8 +84,6 @@ public:
|
||||
*/
|
||||
virtual bool Probe(Footage* f) = 0;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Open media/allocate memory
|
||||
*
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "project/item/footage/footage.h"
|
||||
|
||||
MediaInput::MediaInput() :
|
||||
texture_(nullptr)
|
||||
{
|
||||
@@ -63,9 +65,23 @@ void MediaInput::Process(const rational &time)
|
||||
{
|
||||
// FIXME: Use OIIO and OCIO here
|
||||
|
||||
// FIXME: Test code
|
||||
Q_UNUSED(time)
|
||||
// Get currently selected Footage
|
||||
Footage* footage = ValueToPtr<Footage>(footage_input_->get_value(time));
|
||||
|
||||
// If no footage is selected, return nothing
|
||||
if (footage == nullptr) {
|
||||
texture_output_->set_value(0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise try to get frame of footage from decoder
|
||||
|
||||
// Determine which decoder to use
|
||||
|
||||
// Grab frame from decoder
|
||||
|
||||
// FIXME: Test code
|
||||
if (texture_ == nullptr) {
|
||||
QImage img("/home/matt/Desktop/oof.png");
|
||||
|
||||
|
||||
@@ -20,5 +20,7 @@ set(OLIVE_SOURCES
|
||||
widget/nodeparamview/nodeparamview.cpp
|
||||
widget/nodeparamview/nodeparamviewitem.h
|
||||
widget/nodeparamview/nodeparamviewitem.cpp
|
||||
widget/nodeparamview/nodeparamviewwidgetbridge.h
|
||||
widget/nodeparamview/nodeparamviewwidgetbridge.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
|
||||
@@ -22,18 +22,12 @@
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QDebug>
|
||||
#include <QFontComboBox>
|
||||
#include <QLineEdit>
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
#include "nodeparamviewwidgetbridge.h"
|
||||
#include "project/item/sequence/sequence.h"
|
||||
#include "ui/icons/icons.h"
|
||||
#include "widget/footagecombobox/footagecombobox.h"
|
||||
|
||||
// FIXME: Test code only
|
||||
#include "panel/panelmanager.h"
|
||||
#include "panel/project/project.h"
|
||||
// End test code
|
||||
|
||||
NodeParamViewItem::NodeParamViewItem(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
@@ -123,8 +117,11 @@ void NodeParamViewItem::SetupUI()
|
||||
|
||||
content_layout_->addWidget(param_label, row_count, 0);
|
||||
|
||||
// Add widgets for this parameter
|
||||
QList<QWidget*> widgets_for_param = CreateWidget(static_cast<NodeInput*>(param));
|
||||
// Create a widget/input bridge for this input
|
||||
NodeParamViewWidgetBridge* bridge = new NodeParamViewWidgetBridge(this, static_cast<NodeInput*>(param));
|
||||
|
||||
// Add widgets for this parameter ot the layout
|
||||
const QList<QWidget*>& widgets_for_param = bridge->widgets();
|
||||
for (int i=0;i<widgets_for_param.size();i++) {
|
||||
content_layout_->addWidget(widgets_for_param.at(i), row_count, i + 1);
|
||||
}
|
||||
@@ -134,72 +131,6 @@ void NodeParamViewItem::SetupUI()
|
||||
}
|
||||
}
|
||||
|
||||
QList<QWidget*> NodeParamViewItem::CreateWidget(NodeInput* input)
|
||||
{
|
||||
QList<QWidget*> widgets;
|
||||
|
||||
if (input->inputs().isEmpty()) {
|
||||
return widgets;
|
||||
}
|
||||
|
||||
switch (input->inputs().first()) {
|
||||
case NodeParam::kNone:
|
||||
case NodeParam::kAny:
|
||||
case NodeParam::kBlock:
|
||||
case NodeParam::kTexture:
|
||||
case NodeParam::kMatrix:
|
||||
break;
|
||||
case NodeParam::kInt:
|
||||
// FIXME: LabelSlider in INTEGER mode
|
||||
break;
|
||||
case NodeParam::kFloat:
|
||||
// FIXME: LabelSlider in FLOAT mode
|
||||
break;
|
||||
case NodeParam::kFile:
|
||||
// FIXME: File selector
|
||||
break;
|
||||
case NodeParam::kColor:
|
||||
// FIXME: Color selector
|
||||
break;
|
||||
case NodeParam::kString:
|
||||
{
|
||||
QLineEdit* line_edit = new QLineEdit();
|
||||
widgets.append(line_edit);
|
||||
}
|
||||
break;
|
||||
case NodeParam::kBoolean:
|
||||
{
|
||||
QCheckBox* check_box = new QCheckBox();
|
||||
widgets.append(check_box);
|
||||
}
|
||||
break;
|
||||
case NodeParam::kFont:
|
||||
{
|
||||
QFontComboBox* font_combobox = new QFontComboBox();
|
||||
widgets.append(font_combobox);
|
||||
}
|
||||
break;
|
||||
case NodeParam::kFootage:
|
||||
{
|
||||
FootageComboBox* footage_combobox = new FootageComboBox();
|
||||
|
||||
// FIXME: Test code
|
||||
ProjectPanel* pp = olive::panel_focus_manager->MostRecentlyFocused<ProjectPanel>();
|
||||
footage_combobox->SetRoot(pp->project()->root());
|
||||
// End test code
|
||||
|
||||
// Pretty hacky way of getting the root folder for this node's sequence
|
||||
//const Folder* root_folder = static_cast<const Folder*>(static_cast<Sequence*>(input->parent()->parent())->root());
|
||||
//footage_combobox->SetRoot(root_folder);
|
||||
|
||||
widgets.append(footage_combobox);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return widgets;
|
||||
}
|
||||
|
||||
void NodeParamViewItem::SetExpanded(bool e)
|
||||
{
|
||||
expanded_ = e;
|
||||
|
||||
@@ -53,8 +53,6 @@ protected:
|
||||
private:
|
||||
void SetupUI();
|
||||
|
||||
QList<QWidget*> CreateWidget(NodeInput *input);
|
||||
|
||||
bool expanded_;
|
||||
|
||||
NodeParamViewItemTitleBar* title_bar_;
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
#include "nodeparamviewwidgetbridge.h"
|
||||
|
||||
#include <QFontComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include "widget/footagecombobox/footagecombobox.h"
|
||||
|
||||
// FIXME: Test code only
|
||||
#include "panel/panelmanager.h"
|
||||
#include "panel/project/project.h"
|
||||
// End test code
|
||||
|
||||
NodeParamViewWidgetBridge::NodeParamViewWidgetBridge(QObject* parent, NodeInput* input) :
|
||||
QObject(parent),
|
||||
input_(input)
|
||||
{
|
||||
Q_ASSERT(parent != nullptr && input_ != nullptr);
|
||||
|
||||
CreateWidgets();
|
||||
}
|
||||
|
||||
const QList<QWidget *> &NodeParamViewWidgetBridge::widgets()
|
||||
{
|
||||
return widgets_;
|
||||
}
|
||||
|
||||
void NodeParamViewWidgetBridge::CreateWidgets()
|
||||
{
|
||||
// Return empty list if the NodeInput has no actual input data types
|
||||
if (input_->inputs().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We assume the first data type is the "primary" type
|
||||
switch (input_->inputs().first()) {
|
||||
// None of these inputs have applicable UI widgets
|
||||
case NodeParam::kNone:
|
||||
case NodeParam::kAny:
|
||||
case NodeParam::kBlock:
|
||||
case NodeParam::kTexture:
|
||||
case NodeParam::kMatrix:
|
||||
break;
|
||||
case NodeParam::kInt:
|
||||
// FIXME: LabelSlider in INTEGER mode
|
||||
break;
|
||||
case NodeParam::kFloat:
|
||||
// FIXME: LabelSlider in FLOAT mode
|
||||
break;
|
||||
case NodeParam::kFile:
|
||||
// FIXME: File selector
|
||||
break;
|
||||
case NodeParam::kColor:
|
||||
// FIXME: Color selector
|
||||
break;
|
||||
case NodeParam::kString:
|
||||
{
|
||||
QLineEdit* line_edit = new QLineEdit();
|
||||
widgets_.append(line_edit);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kBoolean:
|
||||
{
|
||||
QCheckBox* check_box = new QCheckBox();
|
||||
widgets_.append(check_box);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kFont:
|
||||
{
|
||||
QFontComboBox* font_combobox = new QFontComboBox();
|
||||
widgets_.append(font_combobox);
|
||||
break;
|
||||
}
|
||||
case NodeParam::kFootage:
|
||||
{
|
||||
FootageComboBox* footage_combobox = new FootageComboBox();
|
||||
|
||||
// FIXME: Test code
|
||||
// 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());
|
||||
|
||||
// End test code
|
||||
|
||||
widgets_.append(footage_combobox);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewWidgetBridge::WidgetCallback()
|
||||
{
|
||||
switch (input_->inputs().first()) {
|
||||
// None of these inputs have applicable UI widgets
|
||||
case NodeParam::kNone:
|
||||
case NodeParam::kAny:
|
||||
case NodeParam::kBlock:
|
||||
case NodeParam::kTexture:
|
||||
case NodeParam::kMatrix:
|
||||
break;
|
||||
case NodeParam::kInt:
|
||||
// FIXME: LabelSlider in INTEGER mode
|
||||
break;
|
||||
case NodeParam::kFloat:
|
||||
// FIXME: LabelSlider in FLOAT mode
|
||||
break;
|
||||
case NodeParam::kFile:
|
||||
// FIXME: File selector
|
||||
break;
|
||||
case NodeParam::kColor:
|
||||
// FIXME: Color selector
|
||||
break;
|
||||
case NodeParam::kString:
|
||||
{
|
||||
// Sender is a QLineEdit
|
||||
//QLineEdit* line_edit = static_cast<QLineEdit*>(sender());
|
||||
break;
|
||||
}
|
||||
case NodeParam::kBoolean:
|
||||
{
|
||||
// Widget is a QCheckBox
|
||||
//QCheckBox* check_box = static_cast<QCheckBox*>(sender());
|
||||
break;
|
||||
}
|
||||
case NodeParam::kFont:
|
||||
{
|
||||
// Widget is a QFontComboBox
|
||||
//QFontComboBox* font_combobox = static_cast<QFontComboBox*>(sender());
|
||||
break;
|
||||
}
|
||||
case NodeParam::kFootage:
|
||||
{
|
||||
// Widget is a FootageComboBox
|
||||
//FootageComboBox* footage_combobox = static_cast<FootageComboBox*>(sender());
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
#define NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "node/input.h"
|
||||
|
||||
class NodeParamViewWidgetBridge : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NodeParamViewWidgetBridge(QObject* parent, NodeInput* input);
|
||||
|
||||
const QList<QWidget*>& widgets();
|
||||
|
||||
private:
|
||||
NodeInput* input_;
|
||||
|
||||
QList<QWidget*> widgets_;
|
||||
|
||||
void CreateWidgets();
|
||||
|
||||
private slots:
|
||||
void WidgetCallback();
|
||||
};
|
||||
|
||||
#endif // NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
Reference in New Issue
Block a user