13#include <QSystemTrayIcon>
14#include <QTemporaryFile>
44 "/org/freedesktop/Notifications",
45 "org.freedesktop.Notifications");
53 ->hasUserNotificationCenterSupport()) {
98FreedesktopImage::FreedesktopImage(
const QImage &
img)
103 QImage tmp =
img.convertToFormat(QImage::Format_ARGB32);
109 for (
unsigned int ptr = 0; ptr <
num_pixels; ++ptr) {
119 a << i.width << i.height << i.stride << i.hasAlpha << i.bitsPerSample
120 << i.channels << i.image;
127 a >> i.width >> i.height >> i.stride >> i.hasAlpha >> i.bitsPerSample >>
128 i.channels >> i.image;
133int FreedesktopImage::metaType() {
142void Notificator::notifyDBus(Class
cls,
const QString &title,
175 QStyle::StandardPixmap
sicon = QStyle::SP_MessageBoxQuestion;
178 sicon = QStyle::SP_MessageBoxInformation;
181 sicon = QStyle::SP_MessageBoxWarning;
184 sicon = QStyle::SP_MessageBoxCritical;
193 hints[
"icon_data"] = FreedesktopImage::toVariant(
201 interface->callWithArgumentList(QDBus::NoBlock,
"Notify", args);
207 QSystemTrayIcon::MessageIcon
sicon = QSystemTrayIcon::NoIcon;
211 sicon = QSystemTrayIcon::Information;
214 sicon = QSystemTrayIcon::Warning;
217 sicon = QSystemTrayIcon::Critical;
224void Notificator::notifyMacUserNotificationCenter(
const QString &title,
252 QMessageBox::critical(
parent, title, text, QMessageBox::Ok,
static MacNotificationHandler * instance()
void showNotification(const QString &title, const QString &text)
shows a macOS 10.8+ UserNotification in the UserNotificationCenter
@ Information
Informational message.
@ Critical
An error occurred.
@ Warning
Notify user of potential problem.
@ UserNotificationCenter
Use the 10.8+ User Notification Center (Mac only)
@ QSystemTray
Use QSystemTrayIcon::showMessage()
@ Freedesktop
Use DBus org.freedesktop.Notifications.
void notifySystray(Class cls, const QString &title, const QString &text, int millisTimeout)
Notificator(const QString &programName, QSystemTrayIcon *trayIcon, QWidget *parent)
Create a new notificator.
QSystemTrayIcon * trayIcon
void notify(Class cls, const QString &title, const QString &text, const QIcon &icon=QIcon(), int millisTimeout=10000)
Show notification message.
std::ostream & operator<<(std::ostream &os, const PeerMessagingState &state)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...