Add StudioModeSwitched event

This commit is contained in:
Palakis 2017-04-20 09:53:31 +02:00
parent a6677edbf5
commit e241518f8d
4 changed files with 23 additions and 2 deletions

View File

@ -22,6 +22,7 @@ The protocol in general is based on the OBS Remote protocol created by Bill Hami
- ["TransitionListChanged"](#transitionlistchanged)
- ["TransitionBegin"](#transitionbegin)
- ["PreviewSceneChanged"](#previewscenechanged)
- ["StudioModeSwitched"](#studiomodeswitched)
- ["ProfileChanged"](#profilechanged)
- ["ProfileListChanged"](#profilelistchanged)
- ["StreamStarting"](#streamstarting)
@ -166,6 +167,12 @@ The selected Preview scene changed (only in Studio Mode).
---
#### "StudioModeSwitched"
Studio Mode has been switched on or off.
- **"new-state"** (bool) : new state of Studio Mode: true if enabled, false if disabled.
---
#### "ProfileChanged"
Triggered when switching to another profile or when renaming the current profile.

View File

@ -323,7 +323,6 @@ obs_scene_t* Utils::GetPreviewScene()
QListWidget* sceneList = GetSceneListControl();
QList<QListWidgetItem*> selected = sceneList->selectedItems();
blog(LOG_INFO, "GetPreviewSceneName: %d selected item(s)", selected.count());
// Qt::UserRole == QtUserRole::OBSRef
obs_scene_t* scene = Utils::SceneListItemToScene(selected.first());

View File

@ -19,6 +19,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
#include <util/platform.h>
#include <QTimer>
#include <QPushButton>
#include "Utils.h"
#include "WSEvents.h"
#include "obs-websocket.h"
@ -71,6 +72,9 @@ WSEvents::WSEvents(WSServer *srv)
QListWidget* sceneList = Utils::GetSceneListControl();
connect(sceneList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(SelectedSceneChanged(QListWidgetItem*, QListWidgetItem*)));
QPushButton* modeSwitch = Utils::GetPreviewModeButtonControl();
connect(modeSwitch, SIGNAL(clicked(bool)), this, SLOT(ModeSwitchClicked(bool)));
transition_handler = nullptr;
scene_handler = nullptr;
@ -590,3 +594,13 @@ void WSEvents::SelectedSceneChanged(QListWidgetItem *current, QListWidgetItem *p
obs_data_release(data);
}
}
void WSEvents::ModeSwitchClicked(bool checked)
{
obs_data_t* data = obs_data_create();
obs_data_set_bool(data, "new-state", checked);
broadcastUpdate("StudioModeSwitched", data);
obs_data_release(data);
}

View File

@ -42,10 +42,11 @@ class WSEvents : public QObject
const char* GetRecordingTimecode();
private Q_SLOTS:
void deferredInitOperations();
void StreamStatus();
void TransitionDurationChanged(int ms);
void SelectedSceneChanged(QListWidgetItem *current, QListWidgetItem *prev);
void deferredInitOperations();
void ModeSwitchClicked(bool checked);
private:
WSServer *_srv;