mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Utils: Add platform util to send tray notification
This commit is contained in:
parent
57794a2bf5
commit
0de3f304f0
@ -3,12 +3,12 @@
|
|||||||
#include <QNetworkInterface>
|
#include <QNetworkInterface>
|
||||||
#include <QHostAddress>
|
#include <QHostAddress>
|
||||||
|
|
||||||
|
#include <obs-frontend-api.h>
|
||||||
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
#include "../plugin-macros.generated.h"
|
#include "../plugin-macros.generated.h"
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
std::string Utils::Platform::GetLocalAddress()
|
std::string Utils::Platform::GetLocalAddress()
|
||||||
{
|
{
|
||||||
std::vector<QString> validAddresses;
|
std::vector<QString> validAddresses;
|
||||||
@ -77,3 +77,13 @@ bool Utils::Platform::GetCommandLineFlagSet(QString arg)
|
|||||||
|
|
||||||
return parser.isSet(cmdlineOption);
|
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<QSystemTrayIcon*>(systemTrayPtr);
|
||||||
|
systemTray->showMessage(title, body, icon);
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <obs.hpp>
|
#include <obs.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QSystemTrayIcon>
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
@ -25,6 +26,7 @@ namespace Utils {
|
|||||||
std::string GetLocalAddress();
|
std::string GetLocalAddress();
|
||||||
QString GetCommandLineArgument(QString arg);
|
QString GetCommandLineArgument(QString arg);
|
||||||
bool GetCommandLineFlagSet(QString arg);
|
bool GetCommandLineFlagSet(QString arg);
|
||||||
|
void SendTrayNotification(QSystemTrayIcon::MessageIcon icon, QString title, QString body);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Obs {
|
namespace Obs {
|
||||||
|
Loading…
Reference in New Issue
Block a user