mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
notifications: check if system tray is available before notifying
This commit is contained in:
parent
389ef2aea9
commit
e1ca9a8029
@ -308,13 +308,19 @@ QString Utils::OBSVersionString() {
|
|||||||
|
|
||||||
QSystemTrayIcon* Utils::GetTrayIcon() {
|
QSystemTrayIcon* Utils::GetTrayIcon() {
|
||||||
QMainWindow* main = (QMainWindow*)obs_frontend_get_main_window();
|
QMainWindow* main = (QMainWindow*)obs_frontend_get_main_window();
|
||||||
|
if (!main) return nullptr;
|
||||||
|
|
||||||
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 || !QSystemTrayIcon::supportsMessages())
|
if (!Config::Current()->AlertsEnabled ||
|
||||||
|
!QSystemTrayIcon::isSystemTrayAvailable() ||
|
||||||
|
!QSystemTrayIcon::supportsMessages())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QSystemTrayIcon* trayIcon = GetTrayIcon();
|
QSystemTrayIcon* trayIcon = GetTrayIcon();
|
||||||
if (trayIcon)
|
if (trayIcon)
|
||||||
|
@ -47,8 +47,6 @@ class Utils {
|
|||||||
static obs_data_array_t* GetScenes();
|
static obs_data_array_t* GetScenes();
|
||||||
static obs_data_t* GetSceneData(obs_source_t* source);
|
static obs_data_t* GetSceneData(obs_source_t* source);
|
||||||
|
|
||||||
static obs_data_array_t* GetProfiles();
|
|
||||||
|
|
||||||
static QSpinBox* GetTransitionDurationControl();
|
static QSpinBox* GetTransitionDurationControl();
|
||||||
static int GetTransitionDuration();
|
static int GetTransitionDuration();
|
||||||
static void SetTransitionDuration(int ms);
|
static void SetTransitionDuration(int ms);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user