began work setting several timings to use rational rather than long/double

This commit is contained in:
itsmattkc
2019-06-16 15:13:53 -07:00
parent 0acee942f4
commit 771572f65b
63 changed files with 448 additions and 397 deletions
+4 -9
View File
@@ -29,7 +29,7 @@ BoolField::BoolField(NodeIO *parent) :
EffectField(parent, EffectField::EFFECT_FIELD_BOOL)
{}
bool BoolField::GetBoolAt(double timecode)
bool BoolField::GetBoolAt(const rational &timecode)
{
return GetValueAt(timecode).toBool();
}
@@ -56,7 +56,7 @@ QWidget *BoolField::CreateWidget(QWidget *existing)
return cb;
}
void BoolField::UpdateWidgetValue(QWidget *widget, double timecode)
void BoolField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
{
QCheckBox* cb = static_cast<QCheckBox*>(widget);
@@ -65,13 +65,8 @@ void BoolField::UpdateWidgetValue(QWidget *widget, double timecode)
cb->blockSignals(true);
if (qIsNaN(timecode)) {
cb->setTristate(true);
cb->setCheckState(Qt::PartiallyChecked);
} else {
cb->setTristate(false);
cb->setChecked(GetBoolAt(timecode));
}
cb->setTristate(false);
cb->setChecked(GetBoolAt(timecode));
cb->blockSignals(false);
+2 -2
View File
@@ -50,7 +50,7 @@ public:
*
* The boolean value at this timecode
*/
bool GetBoolAt(double timecode);
bool GetBoolAt(const rational& timecode);
/**
* @brief Reimplementation of EffectField::CreateWidget()
@@ -62,7 +62,7 @@ public:
/**
* @brief Reimplementation of EffectField::UpdateWidgetValue()
*/
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
/**
* @brief Reimplementation of EffectField::ConvertStringToValue()
+2 -2
View File
@@ -30,7 +30,7 @@ ColorField::ColorField(NodeIO* parent) :
EffectField(parent, EffectField::EFFECT_FIELD_COLOR)
{}
QColor ColorField::GetColorAt(double timecode)
QColor ColorField::GetColorAt(const rational& timecode)
{
return GetValueAt(timecode).value<QColor>();
}
@@ -45,7 +45,7 @@ QWidget *ColorField::CreateWidget(QWidget *existing)
return cb;
}
void ColorField::UpdateWidgetValue(QWidget *widget, double timecode)
void ColorField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
{
ColorButton* cb = static_cast<ColorButton*>(widget);
+2 -2
View File
@@ -50,7 +50,7 @@ public:
*
* The color value at this timecode
*/
QColor GetColorAt(double timecode);
QColor GetColorAt(const rational &timecode);
/**
* @brief CreateWidget
@@ -62,7 +62,7 @@ public:
/**
* @brief Reimplementation of EffectField::UpdateWidgetValue()
*/
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
/**
* @brief Reimplementation of EffectField::ConvertStringToValue()
+1 -1
View File
@@ -62,7 +62,7 @@ QWidget *ComboField::CreateWidget(QWidget *existing)
return cb;
}
void ComboField::UpdateWidgetValue(QWidget *widget, double timecode)
void ComboField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
{
QVariant data = GetValueAt(timecode);
+1 -1
View File
@@ -79,7 +79,7 @@ public:
/**
* @brief Reimplementation of EffectField::UpdateWidgetValue()
*/
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
signals:
/**
+6 -6
View File
@@ -36,7 +36,7 @@ DoubleField::DoubleField(NodeIO* parent) :
connect(this, SIGNAL(Changed()), this, SLOT(ValueHasBeenSet()), Qt::DirectConnection);
}
double DoubleField::GetDoubleAt(double timecode)
double DoubleField::GetDoubleAt(const rational& timecode)
{
return GetValueAt(timecode).toDouble();
}
@@ -117,13 +117,13 @@ QWidget *DoubleField::CreateWidget(QWidget *existing)
return ls;
}
void DoubleField::UpdateWidgetValue(QWidget *widget, double timecode)
void DoubleField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
{
if (qIsNaN(timecode)) {
static_cast<LabelSlider*>(widget)->SetValue(qSNaN());
} else {
//if (qIsNaN(timecode)) {
//static_cast<LabelSlider*>(widget)->SetValue(qSNaN());
//} else {
static_cast<LabelSlider*>(widget)->SetValue(GetDoubleAt(timecode));
}
//}
}
void DoubleField::ValueHasBeenSet()
+2 -2
View File
@@ -54,7 +54,7 @@ public:
*
* Double value at the set timecode
*/
double GetDoubleAt(double timecode);
double GetDoubleAt(const rational &timecode);
/**
* @brief Sets the minimum allowed number for the user to set to `minimum`.
@@ -103,7 +103,7 @@ public:
/**
* @brief Reimplementation of EffectField::UpdateWidgetValue()
*/
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
signals:
/**
* @brief Signal emitted when the field's maximum value has changed
+2 -2
View File
@@ -33,7 +33,7 @@ FileField::FileField(NodeIO* parent) :
SetValueAt(0, "");
}
QString FileField::GetFileAt(double timecode)
QString FileField::GetFileAt(const rational& timecode)
{
return GetValueAt(timecode).toString();
}
@@ -48,7 +48,7 @@ QWidget *FileField::CreateWidget(QWidget *existing)
return efc;
}
void FileField::UpdateWidgetValue(QWidget *widget, double timecode)
void FileField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
{
EmbeddedFileChooser* efc = static_cast<EmbeddedFileChooser*>(widget);
+2 -2
View File
@@ -51,7 +51,7 @@ public:
*
* The filename at this timecode
*/
QString GetFileAt(double timecode);
QString GetFileAt(const rational &timecode);
/**
* @brief Reimplementation of EffectField::CreateWidget()
@@ -63,7 +63,7 @@ public:
/**
* @brief Reimplementation of EffectField::UpdateWidgetValue()
*/
virtual void UpdateWidgetValue(QWidget *widget, double timecode) override;
virtual void UpdateWidgetValue(QWidget *widget, const rational& timecode) override;
private slots:
/**
* @brief Internal function connected to any QWidget made from CreateWidget() to update the value based on user input
+2 -2
View File
@@ -37,7 +37,7 @@ FontField::FontField(NodeIO* parent) :
SetValueAt(0, font_list.first());
}
QString FontField::GetFontAt(double timecode)
QString FontField::GetFontAt(const rational& timecode)
{
return GetValueAt(timecode).toString();
}
@@ -66,7 +66,7 @@ QWidget *FontField::CreateWidget(QWidget *existing)
return fcb;
}
void FontField::UpdateWidgetValue(QWidget *widget, double timecode)
void FontField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
{
QVariant data = GetValueAt(timecode);
+2 -2
View File
@@ -52,7 +52,7 @@ public:
*
* The font family name at this timecode
*/
QString GetFontAt(double timecode);
QString GetFontAt(const rational &timecode);
/**
* @brief Reimplementation of EffectField::CreateWidget()
@@ -64,7 +64,7 @@ public:
/**
* @brief Reimplementation of EffectField::UpdateWidgetValue()
*/
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
private:
/**
+2 -2
View File
@@ -36,7 +36,7 @@ StringField::StringField(NodeIO* parent, bool rich_text) :
SetValueAt(0, "");
}
QString StringField::GetStringAt(double timecode)
QString StringField::GetStringAt(const rational& timecode)
{
return GetValueAt(timecode).toString();
}
@@ -69,7 +69,7 @@ QWidget *StringField::CreateWidget(QWidget *existing)
return text_edit;
}
void StringField::UpdateWidgetValue(QWidget *widget, double timecode)
void StringField::UpdateWidgetValue(QWidget *widget, const rational &timecode)
{
TextEditEx* text = static_cast<TextEditEx*>(widget);
+2 -2
View File
@@ -54,7 +54,7 @@ public:
*
* The string at this timecode
*/
QString GetStringAt(double timecode);
QString GetStringAt(const rational &timecode);
/**
* @brief Reimplementation of EffectField::CreateWidget()
@@ -66,7 +66,7 @@ public:
/**
* @brief Reimplementation of EffectField::UpdateWidgetValue()
*/
virtual void UpdateWidgetValue(QWidget* widget, double timecode) override;
virtual void UpdateWidgetValue(QWidget* widget, const rational& timecode) override;
private slots:
/**
* @brief Internal function connected to any QWidget made from CreateWidget() to update the value based on user input