mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
general: style fixes + change request handler lookup
This commit is contained in:
parent
6a6d316e09
commit
5e11d0ea13
@ -43,7 +43,8 @@ Config::Config() :
|
|||||||
AuthRequired(false),
|
AuthRequired(false),
|
||||||
Secret(""),
|
Secret(""),
|
||||||
Salt(""),
|
Salt(""),
|
||||||
SettingsLoaded(false) {
|
SettingsLoaded(false)
|
||||||
|
{
|
||||||
// OBS Config defaults
|
// OBS Config defaults
|
||||||
config_t* obs_config = obs_frontend_get_global_config();
|
config_t* obs_config = obs_frontend_get_global_config();
|
||||||
if (obs_config) {
|
if (obs_config) {
|
||||||
|
@ -20,7 +20,7 @@ with this program. If not, see <https://www.gnu.org/licenses/>
|
|||||||
#ifndef WSREQUESTHANDLER_H
|
#ifndef WSREQUESTHANDLER_H
|
||||||
#define WSREQUESTHANDLER_H
|
#define WSREQUESTHANDLER_H
|
||||||
|
|
||||||
#include <QMap>
|
#include <QHash>
|
||||||
#include <QWebSocket>
|
#include <QWebSocket>
|
||||||
#include <QWebSocketServer>
|
#include <QWebSocketServer>
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ class WSRequestHandler : public QObject {
|
|||||||
const char* _requestType;
|
const char* _requestType;
|
||||||
obs_data_t* data;
|
obs_data_t* data;
|
||||||
|
|
||||||
QMap<QString, void(*)(WSRequestHandler*)> messageMap;
|
QHash<QString, void(*)(WSRequestHandler*)> messageMap;
|
||||||
QSet<QString> authNotRequired;
|
QSet<QString> authNotRequired;
|
||||||
|
|
||||||
void SendOKResponse(obs_data_t* additionalFields = NULL);
|
void SendOKResponse(obs_data_t* additionalFields = NULL);
|
||||||
|
@ -34,7 +34,8 @@ WSServer::WSServer(QObject* parent)
|
|||||||
: QObject(parent),
|
: QObject(parent),
|
||||||
_wsServer(Q_NULLPTR),
|
_wsServer(Q_NULLPTR),
|
||||||
_clients(),
|
_clients(),
|
||||||
_clMutex(QMutex::Recursive) {
|
_clMutex(QMutex::Recursive)
|
||||||
|
{
|
||||||
_wsServer = new QWebSocketServer(
|
_wsServer = new QWebSocketServer(
|
||||||
QStringLiteral("obs-websocket"),
|
QStringLiteral("obs-websocket"),
|
||||||
QWebSocketServer::NonSecureMode);
|
QWebSocketServer::NonSecureMode);
|
||||||
|
@ -41,8 +41,7 @@ SettingsDialog::SettingsDialog(QWidget* parent) :
|
|||||||
AuthCheckboxChanged();
|
AuthCheckboxChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::showEvent(QShowEvent* event)
|
void SettingsDialog::showEvent(QShowEvent* event) {
|
||||||
{
|
|
||||||
Config* conf = Config::Current();
|
Config* conf = Config::Current();
|
||||||
|
|
||||||
ui->serverEnabled->setChecked(conf->ServerEnabled);
|
ui->serverEnabled->setChecked(conf->ServerEnabled);
|
||||||
@ -55,24 +54,21 @@ void SettingsDialog::showEvent(QShowEvent* event)
|
|||||||
ui->password->setText(CHANGE_ME);
|
ui->password->setText(CHANGE_ME);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::ToggleShowHide()
|
void SettingsDialog::ToggleShowHide() {
|
||||||
{
|
|
||||||
if (!isVisible())
|
if (!isVisible())
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
else
|
else
|
||||||
setVisible(false);
|
setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::AuthCheckboxChanged()
|
void SettingsDialog::AuthCheckboxChanged() {
|
||||||
{
|
|
||||||
if (ui->authRequired->isChecked())
|
if (ui->authRequired->isChecked())
|
||||||
ui->password->setEnabled(true);
|
ui->password->setEnabled(true);
|
||||||
else
|
else
|
||||||
ui->password->setEnabled(false);
|
ui->password->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::FormAccepted()
|
void SettingsDialog::FormAccepted() {
|
||||||
{
|
|
||||||
Config* conf = Config::Current();
|
Config* conf = Config::Current();
|
||||||
|
|
||||||
conf->ServerEnabled = ui->serverEnabled->isChecked();
|
conf->ServerEnabled = ui->serverEnabled->isChecked();
|
||||||
@ -109,7 +105,6 @@ void SettingsDialog::FormAccepted()
|
|||||||
WSServer::Instance->Stop();
|
WSServer::Instance->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog()
|
SettingsDialog::~SettingsDialog() {
|
||||||
{
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user