From 14ae9030003292fa366d5ca100cf72c61e445657 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 10 Apr 2019 10:36:31 +1000 Subject: [PATCH] moved ID from field to row --- effects/effectfield.cpp | 2 +- effects/effectfield.h | 14 +----------- effects/effectrow.cpp | 5 +++-- effects/effectrow.h | 40 ++++++++++++++++++++++------------ effects/fields/boolfield.cpp | 4 ++-- effects/fields/boolfield.h | 2 +- effects/fields/buttonfield.cpp | 4 ++-- effects/fields/buttonfield.h | 2 +- effects/fields/colorfield.cpp | 4 ++-- effects/fields/colorfield.h | 2 +- effects/fields/combofield.cpp | 4 ++-- effects/fields/combofield.h | 2 +- effects/fields/doublefield.cpp | 4 ++-- effects/fields/doublefield.h | 2 +- effects/fields/stringfield.cpp | 4 ++-- nodes/inputs/doubleinput.cpp | 6 +++++ nodes/inputs/doubleinput.h | 12 ++++++++++ olive.pro | 6 +++-- 18 files changed, 70 insertions(+), 49 deletions(-) create mode 100644 nodes/inputs/doubleinput.cpp create mode 100644 nodes/inputs/doubleinput.h diff --git a/effects/effectfield.cpp b/effects/effectfield.cpp index 7446fbc5f..46883e9b9 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, EffectFieldType t) : +EffectField::EffectField(EffectRow* parent, EffectFieldType t) : QObject(parent), type_(t), id_(i), diff --git a/effects/effectfield.h b/effects/effectfield.h index 2b94ed99e..9fd1b07b4 100644 --- a/effects/effectfield.h +++ b/effects/effectfield.h @@ -103,18 +103,11 @@ public: * using the QObject parent/child system to automate memory management. EffectFields are never expected * to change parent during their lifetime. * - * @param i - * - * Field ID. Must be non-empty. Must also be unique within this Effect. Used for saving/loading values into project - * files so that if ordering of fields are changed, or fields are added/removed from Effects later in development, - * saved values in project files will still link with the correct field. Also used as the uniform variable name - * in GLSL shaders. - * * @param t * * The type of data contained within this field. This is expected to be filled by a derived class. */ - EffectField(EffectRow* parent, const QString& i, EffectFieldType t); + EffectField(EffectRow* parent, EffectFieldType t); /** * @brief Get the EffectRow that this field is a member of. @@ -434,11 +427,6 @@ private: */ EffectFieldType type_; - /** - * @brief Internal unique identifier for this field set in the constructor. Access with id(). - */ - QString id_; - /** * @brief Used by GetValueAt() to determine whether to use keyframe data or persistent data * @return diff --git a/effects/effectrow.cpp b/effects/effectrow.cpp index 02305a7f8..8a4ab9fcb 100644 --- a/effects/effectrow.cpp +++ b/effects/effectrow.cpp @@ -37,9 +37,10 @@ #include "ui/keyframenavigator.h" #include "ui/clickablelabel.h" -EffectRow::EffectRow(Effect *parent, const QString &n, bool savable, bool keyframable) : +EffectRow::EffectRow(Effect *parent, const QString &id, const QString &name, bool savable, bool keyframable) : QObject(parent), - name_(n), + id_(id), + name_(name), keyframable_(keyframable), keyframing_(false), savable_(savable) diff --git a/effects/effectrow.h b/effects/effectrow.h index 5248a997c..779b437e6 100644 --- a/effects/effectrow.h +++ b/effects/effectrow.h @@ -60,7 +60,14 @@ public: * EffectRow and automatically frees it through the QObject parent/child system. EffectRows are never intended to * change parents throughout their lifetimes. * - * @param n + * @param id + * + * Field ID. Must be non-empty. Must also be unique within this Effect. Used for saving/loading values into project + * files so that if ordering of fields are changed, or fields are added/removed from Effects later in development, + * saved values in project files will still link with the correct field. Also used as the uniform variable name + * in GLSL shaders. + * + * @param name * * Row name. This is not used as an internal identifier, it's just for the user interface, so it can be translated * with no issue. @@ -75,19 +82,7 @@ public: * Whether keyframing can be enabled on this row or not. This is true by default. Some values you may want to prevent * the user from keyframing (e.g. the filename of a VST plugin), which can be done by setting this to false. */ - EffectRow(Effect* parent, const QString& n, bool savable = true, bool keyframable = true); - - /** - * @brief Add a field to this row - * - * Ownership of the EffectField is transferred to this row and the row will free its memory. In the Effect's UI, this - * will add the field to an additional column. - * - * @param Field - * - * The field to add to this row. - */ - void AddField(EffectField* Field); + EffectRow(Effect* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true); /** * @brief Retrieve the EffectField at this index. Must be less than FieldCount(). @@ -222,6 +217,23 @@ private slots: */ void SetKeyframingEnabled(bool); private: + /** + * @brief Add a field to this row + * + * Ownership of the EffectField is transferred to this row and the row will free its memory. In the Effect's UI, this + * will add the field to an additional column. + * + * @param Field + * + * The field to add to this row. + */ + void AddField(EffectField* Field); + + /** + * @brief Internal unique identifier for this field set in the constructor. Access with id(). + */ + QString id_; + /** * @brief Internal variable for the row's name * diff --git a/effects/fields/boolfield.cpp b/effects/fields/boolfield.cpp index 0dfffd4cf..873b5f26e 100644 --- a/effects/fields/boolfield.cpp +++ b/effects/fields/boolfield.cpp @@ -22,8 +22,8 @@ #include -BoolField::BoolField(EffectRow *parent, const QString &id) : - EffectField(parent, id, EffectField::EFFECT_FIELD_BOOL) +BoolField::BoolField(EffectRow *parent) : + EffectField(parent, EffectField::EFFECT_FIELD_BOOL) {} bool BoolField::GetBoolAt(double timecode) diff --git a/effects/fields/boolfield.h b/effects/fields/boolfield.h index 4e73ee364..1e8e891ae 100644 --- a/effects/fields/boolfield.h +++ b/effects/fields/boolfield.h @@ -35,7 +35,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - BoolField(EffectRow* parent, const QString& id); + BoolField(EffectRow* parent); /** * @brief Get the boolean value at a given timecode diff --git a/effects/fields/buttonfield.cpp b/effects/fields/buttonfield.cpp index c03c0e1ae..15cb436a0 100644 --- a/effects/fields/buttonfield.cpp +++ b/effects/fields/buttonfield.cpp @@ -22,8 +22,8 @@ #include -ButtonField::ButtonField(EffectRow *parent, const QString &string) : - EffectField(parent, nullptr, EffectField::EFFECT_FIELD_UI), +ButtonField::ButtonField(EffectRow *parent) : + EffectField(parent, EffectField::EFFECT_FIELD_UI), button_text_(string) {} diff --git a/effects/fields/buttonfield.h b/effects/fields/buttonfield.h index 0cea15459..a59def70d 100644 --- a/effects/fields/buttonfield.h +++ b/effects/fields/buttonfield.h @@ -42,7 +42,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - ButtonField(EffectRow* parent, const QString& string); + ButtonField(EffectRow* parent); /** * @brief Set whether this pushbutton is checkable diff --git a/effects/fields/colorfield.cpp b/effects/fields/colorfield.cpp index 001bb7d77..10b2e1d0d 100644 --- a/effects/fields/colorfield.cpp +++ b/effects/fields/colorfield.cpp @@ -24,8 +24,8 @@ #include "ui/colorbutton.h" -ColorField::ColorField(EffectRow* parent, const QString& id) : - EffectField(parent, id, EffectField::EFFECT_FIELD_COLOR) +ColorField::ColorField(EffectRow* parent) : + EffectField(parent, EffectField::EFFECT_FIELD_COLOR) {} QColor ColorField::GetColorAt(double timecode) diff --git a/effects/fields/colorfield.h b/effects/fields/colorfield.h index 6ca9e8294..235e831dc 100644 --- a/effects/fields/colorfield.h +++ b/effects/fields/colorfield.h @@ -35,7 +35,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - ColorField(EffectRow* parent, const QString& id); + ColorField(EffectRow* parent); /** * @brief Get the color value at a given timecode diff --git a/effects/fields/combofield.cpp b/effects/fields/combofield.cpp index 992c46f14..173daba45 100644 --- a/effects/fields/combofield.cpp +++ b/effects/fields/combofield.cpp @@ -24,8 +24,8 @@ #include "ui/comboboxex.h" -ComboField::ComboField(EffectRow* parent, const QString& id) : - EffectField(parent, id, EffectField::EFFECT_FIELD_COMBO) +ComboField::ComboField(EffectRow* parent) : + EffectField(parent, EffectField::EFFECT_FIELD_COMBO) {} void ComboField::AddItem(const QString &text, const QVariant &data) diff --git a/effects/fields/combofield.h b/effects/fields/combofield.h index 915c9e58c..f7bedb54d 100644 --- a/effects/fields/combofield.h +++ b/effects/fields/combofield.h @@ -48,7 +48,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - ComboField(EffectRow* parent, const QString& id); + ComboField(EffectRow* parent); /** * @brief Add an item to this ComboField diff --git a/effects/fields/doublefield.cpp b/effects/fields/doublefield.cpp index 4f273157d..09fda4fcb 100644 --- a/effects/fields/doublefield.cpp +++ b/effects/fields/doublefield.cpp @@ -22,8 +22,8 @@ #include "effects/effectrow.h" -DoubleField::DoubleField(EffectRow* parent, const QString& id) : - EffectField(parent, id, EffectField::EFFECT_FIELD_DOUBLE), +DoubleField::DoubleField(EffectRow* parent) : + EffectField(parent, EffectField::EFFECT_FIELD_DOUBLE), min_(qSNaN()), max_(qSNaN()), default_(0), diff --git a/effects/fields/doublefield.h b/effects/fields/doublefield.h index 6aac63a9a..7c1b962e2 100644 --- a/effects/fields/doublefield.h +++ b/effects/fields/doublefield.h @@ -37,7 +37,7 @@ public: /** * @brief Reimplementation of EffectField::EffectField(). */ - DoubleField(EffectRow* parent, const QString& id); + DoubleField(EffectRow* parent); /** * @brief Get double value at timecode diff --git a/effects/fields/stringfield.cpp b/effects/fields/stringfield.cpp index e228ea729..8b2acdb62 100644 --- a/effects/fields/stringfield.cpp +++ b/effects/fields/stringfield.cpp @@ -26,8 +26,8 @@ #include "ui/texteditex.h" #include "global/config.h" -StringField::StringField(EffectRow* parent, const QString& id, bool rich_text) : - EffectField(parent, id, EffectField::EFFECT_FIELD_STRING), +StringField::StringField(EffectRow* parent, bool rich_text) : + EffectField(parent, EffectField::EFFECT_FIELD_STRING), rich_text_(rich_text) { // Set default value to an empty string diff --git a/nodes/inputs/doubleinput.cpp b/nodes/inputs/doubleinput.cpp new file mode 100644 index 000000000..dded84c1f --- /dev/null +++ b/nodes/inputs/doubleinput.cpp @@ -0,0 +1,6 @@ +#include "doubleinput.h" + +DoubleInput::DoubleInput() +{ + +} diff --git a/nodes/inputs/doubleinput.h b/nodes/inputs/doubleinput.h new file mode 100644 index 000000000..58e468496 --- /dev/null +++ b/nodes/inputs/doubleinput.h @@ -0,0 +1,12 @@ +#ifndef DOUBLEINPUT_H +#define DOUBLEINPUT_H + +#include "effects/effectrow.h" + +class DoubleInput : public EffectRow +{ +public: + DoubleInput(); +}; + +#endif // DOUBLEINPUT_H diff --git a/olive.pro b/olive.pro index e9195da77..d9d2f8f17 100644 --- a/olive.pro +++ b/olive.pro @@ -193,7 +193,8 @@ SOURCES += \ ui/nodeui.cpp \ panels/effectspanel.cpp \ nodes/nodedatatypes.cpp \ - nodes/nodeplug.cpp + nodes/nodeplug.cpp \ + nodes/inputs/doubleinput.cpp HEADERS += \ ui/mainwindow.h \ @@ -341,7 +342,8 @@ HEADERS += \ ui/nodeui.h \ panels/effectspanel.h \ nodes/nodedatatypes.h \ - nodes/nodeplug.h + nodes/nodeplug.h \ + nodes/inputs/doubleinput.h FORMS +=