diff --git a/src/utils/Platform.cpp b/src/utils/Platform.cpp index 0fb0be9b..285e621c 100644 --- a/src/utils/Platform.cpp +++ b/src/utils/Platform.cpp @@ -3,12 +3,12 @@ #include #include +#include + #include "Utils.h" #include "../plugin-macros.generated.h" -#include - std::string Utils::Platform::GetLocalAddress() { std::vector validAddresses; @@ -77,3 +77,13 @@ bool Utils::Platform::GetCommandLineFlagSet(QString arg) return parser.isSet(cmdlineOption); } + +void Utils::Platform::SendTrayNotification(QSystemTrayIcon::MessageIcon icon, QString title, QString body) +{ + if (!QSystemTrayIcon::isSystemTrayAvailable() || !QSystemTrayIcon::supportsMessages()) + return; + + void *systemTrayPtr = obs_frontend_get_system_tray(); + auto systemTray = reinterpret_cast(systemTrayPtr); + systemTray->showMessage(title, body, icon); +} diff --git a/src/utils/Utils.h b/src/utils/Utils.h index 43e29d33..fb7a1f7c 100644 --- a/src/utils/Utils.h +++ b/src/utils/Utils.h @@ -3,6 +3,7 @@ #include #include #include +#include #include using json = nlohmann::json; @@ -25,6 +26,7 @@ namespace Utils { std::string GetLocalAddress(); QString GetCommandLineArgument(QString arg); bool GetCommandLineFlagSet(QString arg); + void SendTrayNotification(QSystemTrayIcon::MessageIcon icon, QString title, QString body); } namespace Obs {