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:
parent
9525943bc0
commit
25a335dc3c
@ -166,6 +166,11 @@ struct OBSStudioAPI : obs_frontend_callbacks {
|
||||
Q_ARG(int, position));
|
||||
}
|
||||
|
||||
int obs_frontend_get_tbar_position(void) override
|
||||
{
|
||||
return main->tBar->value();
|
||||
}
|
||||
|
||||
void obs_frontend_get_scene_collections(
|
||||
std::vector<std::string> &strings) override
|
||||
{
|
||||
|
@ -154,6 +154,11 @@ void obs_frontend_set_tbar_position(int position)
|
||||
c->obs_frontend_set_tbar_position(position);
|
||||
}
|
||||
|
||||
int obs_frontend_get_tbar_position(void)
|
||||
{
|
||||
return !!callbacks_valid() ? c->obs_frontend_get_tbar_position() : 0;
|
||||
}
|
||||
|
||||
char **obs_frontend_get_scene_collections(void)
|
||||
{
|
||||
if (!callbacks_valid())
|
||||
|
@ -53,6 +53,8 @@ enum obs_frontend_event {
|
||||
|
||||
OBS_FRONTEND_EVENT_VIRTUALCAM_STARTED,
|
||||
OBS_FRONTEND_EVENT_VIRTUALCAM_STOPPED,
|
||||
|
||||
OBS_FRONTEND_EVENT_TBAR_VALUE_CHANGED,
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------- */
|
||||
@ -106,6 +108,7 @@ EXPORT int obs_frontend_get_transition_duration(void);
|
||||
EXPORT void obs_frontend_set_transition_duration(int duration);
|
||||
EXPORT void obs_frontend_release_tbar(void);
|
||||
EXPORT void obs_frontend_set_tbar_position(int position);
|
||||
EXPORT int obs_frontend_get_tbar_position(void);
|
||||
|
||||
EXPORT char **obs_frontend_get_scene_collections(void);
|
||||
EXPORT char *obs_frontend_get_current_scene_collection(void);
|
||||
|
@ -25,6 +25,7 @@ struct obs_frontend_callbacks {
|
||||
virtual void obs_frontend_set_transition_duration(int duration) = 0;
|
||||
virtual void obs_frontend_release_tbar(void) = 0;
|
||||
virtual void obs_frontend_set_tbar_position(int position) = 0;
|
||||
virtual int obs_frontend_get_tbar_position(void) = 0;
|
||||
|
||||
virtual void obs_frontend_get_scene_collections(
|
||||
std::vector<std::string> &strings) = 0;
|
||||
|
@ -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());
|
||||
|
@ -755,6 +755,7 @@ public:
|
||||
void SetService(obs_service_t *service);
|
||||
|
||||
int GetTransitionDuration();
|
||||
int GetTbarPosition();
|
||||
|
||||
inline bool IsPreviewProgramMode() const
|
||||
{
|
||||
@ -955,6 +956,7 @@ private slots:
|
||||
void RemoveTransitionClicked();
|
||||
void on_transitionProps_clicked();
|
||||
void on_transitionDuration_valueChanged(int value);
|
||||
void on_tbar_position_valueChanged(int value);
|
||||
|
||||
void on_modeSwitch_clicked();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user