file/folder restructuring

This commit is contained in:
itsmattkc
2019-03-13 16:55:49 +11:00
parent d84b5a7f1d
commit 1cd5dabc07
228 changed files with 1269 additions and 1557 deletions
+52
View File
@@ -0,0 +1,52 @@
#include "boolfield.h"
#include <QCheckBox>
BoolField::BoolField(EffectRow *parent, const QString &id) :
EffectField(parent, id, EFFECT_FIELD_BOOL)
{}
bool BoolField::GetBoolAt(double timecode)
{
return GetValueAt(timecode).toBool();
}
QWidget *BoolField::CreateWidget()
{
QCheckBox* cb = new QCheckBox();
connect(cb, SIGNAL(toggled(bool)), this, SLOT(UpdateFromWidget(bool)));
connect(this, SIGNAL(EnabledChanged(bool)), cb, SLOT(setEnabled(bool)));
connect(cb, SIGNAL(toggled(bool)), this, SIGNAL(Toggled(bool)));
return cb;
}
void BoolField::UpdateWidgetValue(QWidget *widget, double timecode)
{
QCheckBox* cb = static_cast<QCheckBox*>(widget);
// Setting the checked state on the checkbox below normally triggers a change() signal that will then trickle back
// to setting a value on this field. Therefore we block its signals while we're setting this.
cb->blockSignals(true);
cb->setChecked(GetBoolAt(timecode));
cb->blockSignals(false);
}
QVariant BoolField::ConvertStringToValue(const QString &s)
{
return (s == "1");
}
QString BoolField::ConvertValueToString(const QVariant &v)
{
return QString::number(v.toBool());
}
void BoolField::UpdateFromWidget(bool b)
{
SetValueAt(Now(), b);
}