restored effect field types

This commit is contained in:
itsmattkc
2019-04-09 23:06:26 +10:00
parent a4ff6f3b41
commit a03879a12b
15 changed files with 82 additions and 20 deletions
+3 -3
View File
@@ -34,7 +34,7 @@
#include "global/math.h"
#include "global/debug.h"
EffectField::EffectField(EffectRow* parent, const QString &i, olive::nodes::DataType t) :
EffectField::EffectField(EffectRow* parent, const QString &i, EffectFieldType t) :
QObject(parent),
type_(t),
id_(i),
@@ -43,7 +43,7 @@ EffectField::EffectField(EffectRow* parent, const QString &i, olive::nodes::Data
{
// EffectField MUST be created with a parent.
Q_ASSERT(parent != nullptr);
Q_ASSERT(!i.isEmpty() || t == olive::nodes::kUI);
Q_ASSERT(!i.isEmpty() || t == EFFECT_FIELD_UI);
// Add this field to the parent row specified
parent->AddField(this);
@@ -274,7 +274,7 @@ void EffectField::PrepareDataForKeyframing(bool enabled, ComboAction *ca)
}
}
const olive::nodes::DataType &EffectField::type()
const EffectField::EffectFieldType &EffectField::type()
{
return type_;
}
+38 -4
View File
@@ -58,6 +58,40 @@ class EffectField : public QObject {
Q_OBJECT
public:
/**
* @brief The EffectFieldType enum
*
* Predetermined types of fields. Used throughout Olive to identify what kind of data to expect from GetValueAt().
*
* This enum is also currently used to match an external XML effect's fields with the correct derived class (e.g.
* EFFECT_FIELD_DOUBLE matches to DoubleField).
*/
enum EffectFieldType {
/** Values are doubles. Also corresponds to DoubleField. */
EFFECT_FIELD_DOUBLE,
/** Values are colors. Also corresponds to ColorField. */
EFFECT_FIELD_COLOR,
/** Values are strings. Also corresponds to StringField. */
EFFECT_FIELD_STRING,
/** Values are booleans. Also corresponds to BoolField. */
EFFECT_FIELD_BOOL,
/** Values are arbitrary data. Also corresponds to ComboField. */
EFFECT_FIELD_COMBO,
/** Values are font family names (in string). Also corresponds to FontField. */
EFFECT_FIELD_FONT,
/** Values are filenames (in string). Also corresponds to FileField. */
EFFECT_FIELD_FILE,
/** Values is a UI object with no data. Corresponds to nothing. */
EFFECT_FIELD_UI
};
/**
* @brief EffectField Constructor
*
@@ -80,7 +114,7 @@ public:
*
* The type of data contained within this field. This is expected to be filled by a derived class.
*/
EffectField(EffectRow* parent, const QString& i, olive::nodes::DataType t);
EffectField(EffectRow* parent, const QString& i, EffectFieldType t);
/**
* @brief Get the EffectRow that this field is a member of.
@@ -98,9 +132,9 @@ public:
*
* @return
*
* A member of the olive::nodes::DataType enum.
* A member of the EffectFieldType enum.
*/
const olive::nodes::DataType& type();
const EffectFieldType& type();
/**
* @brief Get the unique identifier of this field set in the constructor
@@ -398,7 +432,7 @@ private:
/**
* @brief Internal type variable set in the constructor. Access with type().
*/
olive::nodes::DataType type_;
EffectFieldType type_;
/**
* @brief Internal unique identifier for this field set in the constructor. Access with id().
+1 -1
View File
@@ -23,7 +23,7 @@
#include <QCheckBox>
BoolField::BoolField(EffectRow *parent, const QString &id) :
EffectField(parent, id, olive::nodes::kBoolean)
EffectField(parent, id, EffectField::EFFECT_FIELD_BOOL)
{}
bool BoolField::GetBoolAt(double timecode)
+1 -1
View File
@@ -23,7 +23,7 @@
#include <QPushButton>
ButtonField::ButtonField(EffectRow *parent, const QString &string) :
EffectField(parent, nullptr, olive::nodes::kUI),
EffectField(parent, nullptr, EffectField::EFFECT_FIELD_UI),
button_text_(string)
{}
+1 -1
View File
@@ -25,7 +25,7 @@
#include "ui/colorbutton.h"
ColorField::ColorField(EffectRow* parent, const QString& id) :
EffectField(parent, id, olive::nodes::kColor)
EffectField(parent, id, EffectField::EFFECT_FIELD_COLOR)
{}
QColor ColorField::GetColorAt(double timecode)
+1 -1
View File
@@ -25,7 +25,7 @@
#include "ui/comboboxex.h"
ComboField::ComboField(EffectRow* parent, const QString& id) :
EffectField(parent, id, olive::nodes::kCombo)
EffectField(parent, id, EffectField::EFFECT_FIELD_COMBO)
{}
void ComboField::AddItem(const QString &text, const QVariant &data)
+1 -1
View File
@@ -23,7 +23,7 @@
#include "effects/effectrow.h"
DoubleField::DoubleField(EffectRow* parent, const QString& id) :
EffectField(parent, id, olive::nodes::kFloat),
EffectField(parent, id, EffectField::EFFECT_FIELD_DOUBLE),
min_(qSNaN()),
max_(qSNaN()),
default_(0),
+1 -1
View File
@@ -25,7 +25,7 @@
#include "ui/embeddedfilechooser.h"
FileField::FileField(EffectRow* parent, const QString &id) :
EffectField(parent, id, olive::nodes::kFile)
EffectField(parent, id, EffectField::EFFECT_FIELD_FILE)
{
// Set default value to an empty string
SetValueAt(0, "");
+1 -1
View File
@@ -28,7 +28,7 @@
// NOTE/TODO: This shares a lot of similarity with ComboField, and could probably be a derived class of it
FontField::FontField(EffectRow* parent, const QString &id) :
EffectField(parent, id, olive::nodes::kFont)
EffectField(parent, id, EffectField::EFFECT_FIELD_FONT)
{
font_list = QFontDatabase().families();
+1 -1
View File
@@ -23,7 +23,7 @@
#include <QLabel>
LabelField::LabelField(EffectRow *parent, const QString &string) :
EffectField(parent, nullptr, olive::nodes::kUI),
EffectField(parent, nullptr, EffectField::EFFECT_FIELD_UI),
label_text_(string)
{}
+1 -1
View File
@@ -27,7 +27,7 @@
#include "global/config.h"
StringField::StringField(EffectRow* parent, const QString& id, bool rich_text) :
EffectField(parent, id, olive::nodes::kString),
EffectField(parent, id, EffectField::EFFECT_FIELD_STRING),
rich_text_(rich_text)
{
// Set default value to an empty string
+11
View File
@@ -0,0 +1,11 @@
#include "nodeplug.h"
NodePlug::NodePlug()
{
}
bool NodePlug::IsConnected()
{
}
+13
View File
@@ -0,0 +1,13 @@
#ifndef NODEPLUG_H
#define NODEPLUG_H
class NodePlug
{
public:
NodePlug();
bool IsConnected();
};
#endif // NODEPLUG_H
+4 -2
View File
@@ -192,7 +192,8 @@ SOURCES += \
nodes/medianode.cpp \
ui/nodeui.cpp \
panels/effectspanel.cpp \
nodes/nodedatatypes.cpp
nodes/nodedatatypes.cpp \
nodes/nodeplug.cpp
HEADERS += \
ui/mainwindow.h \
@@ -339,7 +340,8 @@ HEADERS += \
nodes/medianode.h \
ui/nodeui.h \
panels/effectspanel.h \
nodes/nodedatatypes.h
nodes/nodedatatypes.h \
nodes/nodeplug.h
FORMS +=
+4 -2
View File
@@ -41,8 +41,10 @@ void NodeView::mouseMoveEvent(QMouseEvent *event)
void NodeView::mouseReleaseEvent(QMouseEvent *event)
{
hand_moving_ = false;
QGraphicsView::mouseReleaseEvent(event);
if (!hand_moving_) {
hand_moving_ = false;
QGraphicsView::mouseReleaseEvent(event);
}
}
void NodeView::wheelEvent(QWheelEvent *event)