Add example OBS websocket message

This commit is contained in:
WarmUpTill 2024-03-19 19:29:25 +01:00 committed by WarmUpTill
parent ea17e8ea08
commit f3996855c3

View File

@ -307,9 +307,32 @@ void MacroActionWebsocketEdit::APITypeChanged(int index)
return;
}
auto lock = LockContext();
_entryData->_api = static_cast<MacroActionWebsocket::API>(index);
{
auto lock = LockContext();
_entryData->_api =
static_cast<MacroActionWebsocket::API>(index);
}
SetWidgetVisibility();
// Set example OBS websocket message if the default message or an empty
// message was entered as neither of those are valid OBS websocket
// messages
if ((std::string(_entryData->_message).empty() ||
std::string(_entryData->_message) ==
obs_module_text("AdvSceneSwitcher.enterText")) &&
_entryData->_api == MacroActionWebsocket::API::OBS_WEBSOCKET) {
static constexpr std::string_view example =
"{\n"
" \"d\": {\n"
" \"requestData\" : {},\n"
" \"requestId\": \"someUniqueIdHere\",\n"
" \"requestType\" : \"StartRecord\"\n"
" },\n"
" \"op\": 6\n"
"}";
_message->setPlainText(QString(example.data()));
}
emit HeaderInfoChanged(
QString::fromStdString(_entryData->GetShortDesc()));
}