mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
New request types to get and set the status of Studio Mode
This commit is contained in:
parent
07c868edcd
commit
8c4bd91c78
@ -262,6 +262,7 @@ bool Utils::IsPreviewModeActive()
|
||||
|
||||
// Clue 2 : Preview layout has more than one item
|
||||
int previewChildCount = GetPreviewLayout()->children().count();
|
||||
blog(LOG_INFO, "preview layout children count : %d", previewChildCount);
|
||||
|
||||
return buttonToggledOn || (previewChildCount >= 2);
|
||||
}
|
||||
|
@ -71,6 +71,11 @@ WSRequestHandler::WSRequestHandler(QWebSocket *client) :
|
||||
messageMap["GetCurrentProfile"] = WSRequestHandler::HandleGetCurrentProfile;
|
||||
messageMap["ListProfiles"] = WSRequestHandler::HandleListProfiles;
|
||||
|
||||
messageMap["GetStudioModeStatus"] = WSRequestHandler::HandleGetStudioModeStatus;
|
||||
messageMap["EnableStudioMode"] = WSRequestHandler::HandleEnableStudioMode;
|
||||
messageMap["DisableStudioMode"] = WSRequestHandler::HandleDisableStudioMode;
|
||||
messageMap["ToggleStudioMode"] = WSRequestHandler::HandleToggleStudioMode;
|
||||
|
||||
authNotRequired.insert("GetVersion");
|
||||
authNotRequired.insert("GetAuthRequired");
|
||||
authNotRequired.insert("Authenticate");
|
||||
@ -746,6 +751,41 @@ void WSRequestHandler::HandleListProfiles(WSRequestHandler *owner)
|
||||
obs_data_array_release(profiles);
|
||||
}
|
||||
|
||||
void WSRequestHandler::HandleGetStudioModeStatus(WSRequestHandler *owner)
|
||||
{
|
||||
bool previewActive = Utils::IsPreviewModeActive();
|
||||
|
||||
obs_data_t* response = obs_data_create();
|
||||
obs_data_set_bool(response, "studio-mode", previewActive);
|
||||
|
||||
if (previewActive) {
|
||||
//const char* currentPreviewScene = Utils::GetPreviewSceneName();
|
||||
//obs_data_set_string(response, "preview-scene", currentPreviewScene);
|
||||
}
|
||||
|
||||
owner->SendOKResponse(response);
|
||||
|
||||
obs_data_release(response);
|
||||
}
|
||||
|
||||
void WSRequestHandler::HandleEnableStudioMode(WSRequestHandler *owner)
|
||||
{
|
||||
Utils::EnablePreviewMode();
|
||||
owner->SendOKResponse();
|
||||
}
|
||||
|
||||
void WSRequestHandler::HandleDisableStudioMode(WSRequestHandler *owner)
|
||||
{
|
||||
Utils::DisablePreviewMode();
|
||||
owner->SendOKResponse();
|
||||
}
|
||||
|
||||
void WSRequestHandler::HandleToggleStudioMode(WSRequestHandler *owner)
|
||||
{
|
||||
Utils::TogglePreviewMode();
|
||||
owner->SendOKResponse();
|
||||
}
|
||||
|
||||
void WSRequestHandler::ErrNotImplemented(WSRequestHandler *owner)
|
||||
{
|
||||
owner->SendErrorResponse("not implemented");
|
||||
|
@ -87,6 +87,11 @@ class WSRequestHandler : public QObject
|
||||
|
||||
static void HandleSetTransitionDuration(WSRequestHandler *owner);
|
||||
static void HandleGetTransitionDuration(WSRequestHandler *owner);
|
||||
|
||||
static void HandleGetStudioModeStatus(WSRequestHandler *owner);
|
||||
static void HandleEnableStudioMode(WSRequestHandler *owner);
|
||||
static void HandleDisableStudioMode(WSRequestHandler *owner);
|
||||
static void HandleToggleStudioMode(WSRequestHandler *owner);
|
||||
};
|
||||
|
||||
#endif // WSPROTOCOL_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user