config: show message if server is stopped after profile change

This commit is contained in:
Stéphane L 2019-04-21 18:59:04 +02:00
parent a63b6a0e3d
commit f022e09938
3 changed files with 11 additions and 4 deletions

View File

@ -211,8 +211,15 @@ void Config::OnFrontendEvent(enum obs_frontend_event event, void* param)
if (config->ServerEnabled) { if (config->ServerEnabled) {
server->start(config->ServerPort); server->start(config->ServerPort);
QString message = "Profile changed, WebSockets server restarted"; Utils::SysTrayNotify(
Utils::SysTrayNotify(message, QSystemTrayIcon::MessageIcon::Information); QString("Profile changed, WebSockets server restarted"),
QSystemTrayIcon::MessageIcon::Information
);
} else {
Utils::SysTrayNotify(
QString("Profile changed, WebSockets server stopped"),
QSystemTrayIcon::MessageIcon::Information
);
} }
} }
} }

View File

@ -390,7 +390,7 @@ QSystemTrayIcon* Utils::GetTrayIcon() {
return main->findChildren<QSystemTrayIcon*>().first(); return main->findChildren<QSystemTrayIcon*>().first();
} }
void Utils::SysTrayNotify(QString &text, void Utils::SysTrayNotify(QString text,
QSystemTrayIcon::MessageIcon icon, QString title) { QSystemTrayIcon::MessageIcon icon, QString title) {
if (!Config::Current()->AlertsEnabled || if (!Config::Current()->AlertsEnabled ||
!QSystemTrayIcon::isSystemTrayAvailable() || !QSystemTrayIcon::isSystemTrayAvailable() ||

View File

@ -71,7 +71,7 @@ class Utils {
static QSystemTrayIcon* GetTrayIcon(); static QSystemTrayIcon* GetTrayIcon();
static void SysTrayNotify( static void SysTrayNotify(
QString &text, QString text,
QSystemTrayIcon::MessageIcon n, QSystemTrayIcon::MessageIcon n,
QString title = QString("obs-websocket")); QString title = QString("obs-websocket"));