base: Add starting WebSocketServer files

This commit is contained in:
tt2468 2021-04-27 09:18:06 -07:00
parent 927806a432
commit f0dfe72aca
6 changed files with 38 additions and 5 deletions

View File

@ -66,11 +66,13 @@ configure_file(
set(obs-websocket_SOURCES
src/obs-websocket.cpp
src/Config.cpp
src/WebSocketServer.cpp
src/forms/SettingsDialog.cpp)
set(obs-websocket_HEADERS
src/obs-websocket.h
src/Config.h
src/WebSocketServer.h
src/forms/SettingsDialog.h)

1
src/WebSocketServer.cpp Normal file
View File

@ -0,0 +1 @@
#include "WebSocketServer.h"

11
src/WebSocketServer.h Normal file
View File

@ -0,0 +1,11 @@
#pragma once
#include <QObject>
class WebSocketServer : public QObject
{
Q_OBJECT
public:
;
};

View File

@ -1,3 +1,4 @@
#include <obs-module.h>
#include <obs-frontend-api.h>
#include <QtWidgets/QMessageBox>
#include <QClipboard>

View File

@ -8,6 +8,7 @@
#include "obs-websocket.h"
#include "Config.h"
#include "WebSocketServer.h"
#include "forms/SettingsDialog.h"
// Auto release definitions
@ -18,7 +19,8 @@ void ___data_array_dummy_addref(obs_data_array_t*) {}
void ___output_dummy_addref(obs_output_t*) {}
void ___data_item_dummy_addref(obs_data_item_t*) {}
void ___data_item_release(obs_data_item_t* dataItem) {
void ___data_item_release(obs_data_item_t* dataItem)
{
obs_data_item_release(&dataItem);
}
@ -27,9 +29,11 @@ OBS_DECLARE_MODULE()
OBS_MODULE_USE_DEFAULT_LOCALE("obs-websocket", "en-US")
ConfigPtr _config;
WebSocketServerPtr _webSocketServer;
SettingsDialog *_settingsDialog = nullptr;
bool obs_module_load(void) {
bool obs_module_load(void)
{
blog(LOG_INFO, "you can haz websockets (version %s)", OBS_WEBSOCKET_VERSION);
blog(LOG_INFO, "Qt version (compile-time): %s | Qt version (run-time): %s",
QT_VERSION_STR, qVersion());
@ -37,6 +41,8 @@ bool obs_module_load(void) {
_config = ConfigPtr(new Config());
_config->Load();
_webSocketServer = WebSocketServerPtr(new WebSocketServer());
obs_frontend_push_ui_translation(obs_module_get_string);
QMainWindow* mainWindow = (QMainWindow*)obs_frontend_get_main_window();
_settingsDialog = new SettingsDialog(mainWindow);
@ -52,11 +58,18 @@ bool obs_module_load(void) {
return true;
}
void obs_module_unload() {
void obs_module_unload()
{
_config.reset();
blog(LOG_INFO, "Finished shutting down.");
}
ConfigPtr GetConfig() {
ConfigPtr GetConfig()
{
return _config;
}
WebSocketServerPtr GetWebSocketServer()
{
return _webSocketServer;
}

View File

@ -31,4 +31,9 @@ using OBSDataItemAutoRelease =
class Config;
typedef std::shared_ptr<Config> ConfigPtr;
ConfigPtr GetConfig();
class WebSocketServer;
typedef std::shared_ptr<WebSocketServer> WebSocketServerPtr;
ConfigPtr GetConfig();
WebSocketServerPtr GetWebSocketServer();