mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
config(profile change): fix notifications
This commit is contained in:
parent
14a43a9cd2
commit
1c17eee125
@ -204,24 +204,37 @@ void Config::OnFrontendEvent(enum obs_frontend_event event, void* param)
|
|||||||
auto config = reinterpret_cast<Config*>(param);
|
auto config = reinterpret_cast<Config*>(param);
|
||||||
|
|
||||||
if (event == OBS_FRONTEND_EVENT_PROFILE_CHANGED) {
|
if (event == OBS_FRONTEND_EVENT_PROFILE_CHANGED) {
|
||||||
auto server = WSServer::Current();
|
auto previousEnabled = config->ServerEnabled;
|
||||||
server->stop();
|
auto previousPort = config->ServerPort;
|
||||||
|
|
||||||
config->SetDefaults();
|
config->SetDefaults();
|
||||||
config->Load();
|
config->Load();
|
||||||
|
|
||||||
|
if (config->ServerEnabled != previousEnabled || config->ServerPort != previousPort) {
|
||||||
|
auto server = WSServer::Current();
|
||||||
|
server->stop();
|
||||||
|
|
||||||
if (config->ServerEnabled) {
|
if (config->ServerEnabled) {
|
||||||
server->start(config->ServerPort);
|
server->start(config->ServerPort);
|
||||||
|
|
||||||
|
if (previousEnabled != config->ServerEnabled) {
|
||||||
Utils::SysTrayNotify(
|
Utils::SysTrayNotify(
|
||||||
QString("Profile changed, WebSockets server restarted"),
|
QString("WebSockets server enabled in this profile. Server started."),
|
||||||
QSystemTrayIcon::MessageIcon::Information
|
QSystemTrayIcon::MessageIcon::Information
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
Utils::SysTrayNotify(
|
Utils::SysTrayNotify(
|
||||||
QString("Profile changed, WebSockets server stopped"),
|
QString("WebSockets server port changed in this profile. Server restarted."),
|
||||||
QSystemTrayIcon::MessageIcon::Information
|
QSystemTrayIcon::MessageIcon::Information
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Utils::SysTrayNotify(
|
||||||
|
QString("WebSockets server disabled in this profile. Server stopped."),
|
||||||
|
QSystemTrayIcon::MessageIcon::Information
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user