UI: Add Frontend API function to get value of T-bar

Also add a Frontend API event for when the T-bar's value changes.
This commit is contained in:
Christopher P Yarger 2021-03-02 18:32:17 -05:00 • committed by Jim
commit 25a335dc3c
6 changed files with 31 additions and 0 deletions

View file

@ -840,6 +840,8 @@ void OBSBasic::CreateProgramOptions()
tBar->setProperty("themeID", "tBarSlider");
connect(tBar, SIGNAL(sliderMoved(int)), this, SLOT(TBarChanged(int)));
connect(tBar, SIGNAL(valueChanged(int)), this,
SLOT(on_tbar_position_valueChanged(int)));
connect(tBar, SIGNAL(sliderReleased()), this, SLOT(TBarReleased()));
layout->addStretch(0);
@ -993,6 +995,19 @@ void OBSBasic::TBarChanged(int value)
(float)value / T_BAR_PRECISION_F);
}
int OBSBasic::GetTbarPosition()
{
return tBar->value();
}
void OBSBasic::on_tbar_position_valueChanged(int value)
{
if (api) {
api->on_event(OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED);
}
UNUSED_PARAMETER(value);
}
void OBSBasic::on_modeSwitch_clicked()
{
SetPreviewProgramMode(!IsPreviewProgramMode());