From a03879a12baa9df13d8ec07052209f4c04bdc4aa Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Tue, 9 Apr 2019 23:06:26 +1000 Subject: [PATCH] restored effect field types --- effects/effectfield.cpp | 6 ++--- effects/effectfield.h | 42 ++++++++++++++++++++++++++++++---- effects/fields/boolfield.cpp | 2 +- effects/fields/buttonfield.cpp | 2 +- effects/fields/colorfield.cpp | 2 +- effects/fields/combofield.cpp | 2 +- effects/fields/doublefield.cpp | 2 +- effects/fields/filefield.cpp | 2 +- effects/fields/fontfield.cpp | 2 +- effects/fields/labelfield.cpp | 2 +- effects/fields/stringfield.cpp | 2 +- nodes/nodeplug.cpp | 11 +++++++++ nodes/nodeplug.h | 13 +++++++++++ olive.pro | 6 +++-- ui/nodeview.cpp | 6 +++-- 15 files changed, 82 insertions(+), 20 deletions(-) create mode 100644 nodes/nodeplug.cpp create mode 100644 nodes/nodeplug.h diff --git a/effects/effectfield.cpp b/effects/effectfield.cpp index a9abd46c6..997296628 100644 --- a/effects/effectfield.cpp +++ b/effects/effectfield.cpp @@ -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_; } diff --git a/effects/effectfield.h b/effects/effectfield.h index 1e97a074e..2b94ed99e 100644 --- a/effects/effectfield.h +++ b/effects/effectfield.h @@ -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(). diff --git a/effects/fields/boolfield.cpp b/effects/fields/boolfield.cpp index 1cd44a96b..0dfffd4cf 100644 --- a/effects/fields/boolfield.cpp +++ b/effects/fields/boolfield.cpp @@ -23,7 +23,7 @@ #include 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) diff --git a/effects/fields/buttonfield.cpp b/effects/fields/buttonfield.cpp index 3cb5f1e23..c03c0e1ae 100644 --- a/effects/fields/buttonfield.cpp +++ b/effects/fields/buttonfield.cpp @@ -23,7 +23,7 @@ #include ButtonField::ButtonField(EffectRow *parent, const QString &string) : - EffectField(parent, nullptr, olive::nodes::kUI), + EffectField(parent, nullptr, EffectField::EFFECT_FIELD_UI), button_text_(string) {} diff --git a/effects/fields/colorfield.cpp b/effects/fields/colorfield.cpp index 109a4b4c1..001bb7d77 100644 --- a/effects/fields/colorfield.cpp +++ b/effects/fields/colorfield.cpp @@ -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) diff --git a/effects/fields/combofield.cpp b/effects/fields/combofield.cpp index 08c6a52a5..992c46f14 100644 --- a/effects/fields/combofield.cpp +++ b/effects/fields/combofield.cpp @@ -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) diff --git a/effects/fields/doublefield.cpp b/effects/fields/doublefield.cpp index 537b2bebb..4f273157d 100644 --- a/effects/fields/doublefield.cpp +++ b/effects/fields/doublefield.cpp @@ -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), diff --git a/effects/fields/filefield.cpp b/effects/fields/filefield.cpp index 89e74d119..b9a21bbef 100644 --- a/effects/fields/filefield.cpp +++ b/effects/fields/filefield.cpp @@ -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, ""); diff --git a/effects/fields/fontfield.cpp b/effects/fields/fontfield.cpp index 6618c683d..21c741389 100644 --- a/effects/fields/fontfield.cpp +++ b/effects/fields/fontfield.cpp @@ -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(); diff --git a/effects/fields/labelfield.cpp b/effects/fields/labelfield.cpp index 459ec10dc..117683337 100644 --- a/effects/fields/labelfield.cpp +++ b/effects/fields/labelfield.cpp @@ -23,7 +23,7 @@ #include LabelField::LabelField(EffectRow *parent, const QString &string) : - EffectField(parent, nullptr, olive::nodes::kUI), + EffectField(parent, nullptr, EffectField::EFFECT_FIELD_UI), label_text_(string) {} diff --git a/effects/fields/stringfield.cpp b/effects/fields/stringfield.cpp index fcdc65cf4..e228ea729 100644 --- a/effects/fields/stringfield.cpp +++ b/effects/fields/stringfield.cpp @@ -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 diff --git a/nodes/nodeplug.cpp b/nodes/nodeplug.cpp new file mode 100644 index 000000000..bb60f8397 --- /dev/null +++ b/nodes/nodeplug.cpp @@ -0,0 +1,11 @@ +#include "nodeplug.h" + +NodePlug::NodePlug() +{ + +} + +bool NodePlug::IsConnected() +{ + +} diff --git a/nodes/nodeplug.h b/nodes/nodeplug.h new file mode 100644 index 000000000..764afc716 --- /dev/null +++ b/nodes/nodeplug.h @@ -0,0 +1,13 @@ +#ifndef NODEPLUG_H +#define NODEPLUG_H + + +class NodePlug +{ +public: + NodePlug(); + + bool IsConnected(); +}; + +#endif // NODEPLUG_H diff --git a/olive.pro b/olive.pro index cde79eb5e..e9195da77 100644 --- a/olive.pro +++ b/olive.pro @@ -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 += diff --git a/ui/nodeview.cpp b/ui/nodeview.cpp index 3a3883e5e..f3c8a9ea7 100644 --- a/ui/nodeview.cpp +++ b/ui/nodeview.cpp @@ -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)