mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
New request type : TransitionToProgram
This commit is contained in:
parent
b7df1e8596
commit
f0bb941c47
@ -20,6 +20,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
#include <obs-frontend-api.h>
|
#include <obs-frontend-api.h>
|
||||||
#include <obs.hpp>
|
#include <obs.hpp>
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QPainter>
|
||||||
#include "obs-websocket.h"
|
#include "obs-websocket.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(OBSScene);
|
Q_DECLARE_METATYPE(OBSScene);
|
||||||
@ -336,12 +337,14 @@ void Utils::TransitionToProgram()
|
|||||||
// WARNING : if the layout created in OBS' CreateProgramOptions() changes
|
// WARNING : if the layout created in OBS' CreateProgramOptions() changes
|
||||||
// then this won't work as expected
|
// then this won't work as expected
|
||||||
|
|
||||||
|
QMainWindow* main = (QMainWindow*)obs_frontend_get_main_window();
|
||||||
|
|
||||||
// The program options widget is the second item in the left-to-right layout
|
// The program options widget is the second item in the left-to-right layout
|
||||||
QWidget* programOptions = GetPreviewLayout()->itemAt(1)->widget();
|
QWidget* programOptions = GetPreviewLayout()->itemAt(1)->widget();
|
||||||
|
|
||||||
// The "Transition" button lies in the mainButtonLayout
|
// The "Transition" button lies in the mainButtonLayout
|
||||||
// which is the first itemin the program options' layout
|
// which is the first itemin the program options' layout
|
||||||
QLayout* mainButtonLayout = programOptions->layout()->itemAt(0)->layout();
|
QLayout* mainButtonLayout = programOptions->layout()->itemAt(1)->layout();
|
||||||
QWidget* transitionBtnWidget = mainButtonLayout->itemAt(0)->widget();
|
QWidget* transitionBtnWidget = mainButtonLayout->itemAt(0)->widget();
|
||||||
|
|
||||||
// Try to cast that widget into a button
|
// Try to cast that widget into a button
|
||||||
|
@ -73,6 +73,7 @@ WSRequestHandler::WSRequestHandler(QWebSocket *client) :
|
|||||||
|
|
||||||
messageMap["GetStudioModeStatus"] = WSRequestHandler::HandleGetStudioModeStatus;
|
messageMap["GetStudioModeStatus"] = WSRequestHandler::HandleGetStudioModeStatus;
|
||||||
messageMap["SetPreviewScene"] = WSRequestHandler::HandleSetPreviewScene;
|
messageMap["SetPreviewScene"] = WSRequestHandler::HandleSetPreviewScene;
|
||||||
|
messageMap["TransitionToProgram"] = WSRequestHandler::HandleTransitionToProgram;
|
||||||
messageMap["EnableStudioMode"] = WSRequestHandler::HandleEnableStudioMode;
|
messageMap["EnableStudioMode"] = WSRequestHandler::HandleEnableStudioMode;
|
||||||
messageMap["DisableStudioMode"] = WSRequestHandler::HandleDisableStudioMode;
|
messageMap["DisableStudioMode"] = WSRequestHandler::HandleDisableStudioMode;
|
||||||
messageMap["ToggleStudioMode"] = WSRequestHandler::HandleToggleStudioMode;
|
messageMap["ToggleStudioMode"] = WSRequestHandler::HandleToggleStudioMode;
|
||||||
@ -783,6 +784,12 @@ void WSRequestHandler::HandleSetPreviewScene(WSRequestHandler *owner)
|
|||||||
owner->SendOKResponse();
|
owner->SendOKResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WSRequestHandler::HandleTransitionToProgram(WSRequestHandler *owner)
|
||||||
|
{
|
||||||
|
Utils::TransitionToProgram();
|
||||||
|
owner->SendOKResponse();
|
||||||
|
}
|
||||||
|
|
||||||
void WSRequestHandler::HandleEnableStudioMode(WSRequestHandler *owner)
|
void WSRequestHandler::HandleEnableStudioMode(WSRequestHandler *owner)
|
||||||
{
|
{
|
||||||
Utils::EnablePreviewMode();
|
Utils::EnablePreviewMode();
|
||||||
|
@ -90,6 +90,7 @@ class WSRequestHandler : public QObject
|
|||||||
|
|
||||||
static void HandleGetStudioModeStatus(WSRequestHandler *owner);
|
static void HandleGetStudioModeStatus(WSRequestHandler *owner);
|
||||||
static void HandleSetPreviewScene(WSRequestHandler *owner);
|
static void HandleSetPreviewScene(WSRequestHandler *owner);
|
||||||
|
static void HandleTransitionToProgram(WSRequestHandler *owner);
|
||||||
static void HandleEnableStudioMode(WSRequestHandler *owner);
|
static void HandleEnableStudioMode(WSRequestHandler *owner);
|
||||||
static void HandleDisableStudioMode(WSRequestHandler *owner);
|
static void HandleDisableStudioMode(WSRequestHandler *owner);
|
||||||
static void HandleToggleStudioMode(WSRequestHandler *owner);
|
static void HandleToggleStudioMode(WSRequestHandler *owner);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user