mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Add StudioModeSwitched event
This commit is contained in:
parent
a6677edbf5
commit
e241518f8d
@ -22,6 +22,7 @@ The protocol in general is based on the OBS Remote protocol created by Bill Hami
|
|||||||
- ["TransitionListChanged"](#transitionlistchanged)
|
- ["TransitionListChanged"](#transitionlistchanged)
|
||||||
- ["TransitionBegin"](#transitionbegin)
|
- ["TransitionBegin"](#transitionbegin)
|
||||||
- ["PreviewSceneChanged"](#previewscenechanged)
|
- ["PreviewSceneChanged"](#previewscenechanged)
|
||||||
|
- ["StudioModeSwitched"](#studiomodeswitched)
|
||||||
- ["ProfileChanged"](#profilechanged)
|
- ["ProfileChanged"](#profilechanged)
|
||||||
- ["ProfileListChanged"](#profilelistchanged)
|
- ["ProfileListChanged"](#profilelistchanged)
|
||||||
- ["StreamStarting"](#streamstarting)
|
- ["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"
|
#### "ProfileChanged"
|
||||||
Triggered when switching to another profile or when renaming the current profile.
|
Triggered when switching to another profile or when renaming the current profile.
|
||||||
|
|
||||||
|
@ -323,7 +323,6 @@ obs_scene_t* Utils::GetPreviewScene()
|
|||||||
QListWidget* sceneList = GetSceneListControl();
|
QListWidget* sceneList = GetSceneListControl();
|
||||||
|
|
||||||
QList<QListWidgetItem*> selected = sceneList->selectedItems();
|
QList<QListWidgetItem*> selected = sceneList->selectedItems();
|
||||||
blog(LOG_INFO, "GetPreviewSceneName: %d selected item(s)", selected.count());
|
|
||||||
|
|
||||||
// Qt::UserRole == QtUserRole::OBSRef
|
// Qt::UserRole == QtUserRole::OBSRef
|
||||||
obs_scene_t* scene = Utils::SceneListItemToScene(selected.first());
|
obs_scene_t* scene = Utils::SceneListItemToScene(selected.first());
|
||||||
|
14
WSEvents.cpp
14
WSEvents.cpp
@ -19,6 +19,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
|
|
||||||
#include <util/platform.h>
|
#include <util/platform.h>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QPushButton>
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "WSEvents.h"
|
#include "WSEvents.h"
|
||||||
#include "obs-websocket.h"
|
#include "obs-websocket.h"
|
||||||
@ -71,6 +72,9 @@ WSEvents::WSEvents(WSServer *srv)
|
|||||||
QListWidget* sceneList = Utils::GetSceneListControl();
|
QListWidget* sceneList = Utils::GetSceneListControl();
|
||||||
connect(sceneList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this, SLOT(SelectedSceneChanged(QListWidgetItem*, QListWidgetItem*)));
|
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;
|
transition_handler = nullptr;
|
||||||
scene_handler = nullptr;
|
scene_handler = nullptr;
|
||||||
|
|
||||||
@ -590,3 +594,13 @@ void WSEvents::SelectedSceneChanged(QListWidgetItem *current, QListWidgetItem *p
|
|||||||
obs_data_release(data);
|
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);
|
||||||
|
}
|
@ -42,10 +42,11 @@ class WSEvents : public QObject
|
|||||||
const char* GetRecordingTimecode();
|
const char* GetRecordingTimecode();
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
|
void deferredInitOperations();
|
||||||
void StreamStatus();
|
void StreamStatus();
|
||||||
void TransitionDurationChanged(int ms);
|
void TransitionDurationChanged(int ms);
|
||||||
void SelectedSceneChanged(QListWidgetItem *current, QListWidgetItem *prev);
|
void SelectedSceneChanged(QListWidgetItem *current, QListWidgetItem *prev);
|
||||||
void deferredInitOperations();
|
void ModeSwitchClicked(bool checked);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
WSServer *_srv;
|
WSServer *_srv;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user