moved ID from field to row

This commit is contained in:
itsmattkc
2019-04-10 10:36:31 +10:00
parent c281e5a6ff
commit 14ae903000
18 changed files with 70 additions and 49 deletions
+1 -1
View File
@@ -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),
+1 -13
View File
@@ -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
+3 -2
View File
@@ -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)
+26 -14
View File
@@ -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
*
+2 -2
View File
@@ -22,8 +22,8 @@
#include <QCheckBox>
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)
+1 -1
View File
@@ -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
+2 -2
View File
@@ -22,8 +22,8 @@
#include <QPushButton>
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)
{}
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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),
+1 -1
View File
@@ -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
+2 -2
View File
@@ -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
+6
View File
@@ -0,0 +1,6 @@
#include "doubleinput.h"
DoubleInput::DoubleInput()
{
}
+12
View File
@@ -0,0 +1,12 @@
#ifndef DOUBLEINPUT_H
#define DOUBLEINPUT_H
#include "effects/effectrow.h"
class DoubleInput : public EffectRow
{
public:
DoubleInput();
};
#endif // DOUBLEINPUT_H
+4 -2
View File
@@ -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 +=