Enable getting varaible values from conditions and actions

This commit is contained in:
WarmUpTill
2023-01-07 02:04:21 +01:00
committed by WarmUpTill
parent 1fd6f75ee1
commit 42773790e4
6 changed files with 91 additions and 11 deletions

View File

@@ -8,6 +8,11 @@
#include <QLabel>
#include <QScrollBar>
MacroSegment::MacroSegment(Macro *m, bool supportsVariableValue)
: _supportsVariableValue(supportsVariableValue), _macro(m)
{
}
bool MacroSegment::Save(obs_data_t *obj) const
{
obs_data_set_bool(obj, "collapsed", static_cast<int>(_collapsed));
@@ -39,6 +44,37 @@ bool MacroSegment::Highlight()
return false;
}
std::string MacroSegment::GetVariableValue() const
{
if (_supportsVariableValue) {
return _variableValue;
}
return "";
}
void MacroSegment::SetVariableValue(const std::string &value)
{
if (_variableRefs > 0) {
_variableValue = value;
}
}
void MacroSegment::IncrementVariableRef()
{
if (!_supportsVariableValue) {
return;
}
_variableRefs++;
}
void MacroSegment::DecrementVariableRef()
{
if (!_supportsVariableValue || _variableRefs == 0) {
return;
}
_variableRefs--;
}
MouseWheelWidgetAdjustmentGuard::MouseWheelWidgetAdjustmentGuard(QObject *parent)
: QObject(parent)
{