From d5847e797b232d1ceec2aaf36d70ab60101a952c Mon Sep 17 00:00:00 2001 From: Black Hat Date: Sat, 20 Oct 2018 09:08:28 +0800 Subject: [PATCH] Update notification for mac. --- src/notifications/managermac.mm | 55 +++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/notifications/managermac.mm b/src/notifications/managermac.mm index 2b1d362..782be1f 100644 --- a/src/notifications/managermac.mm +++ b/src/notifications/managermac.mm @@ -7,27 +7,42 @@ - (void)set_identityImage:(NSImage *)image; @end -NotificationsManager::NotificationsManager(QObject *parent) : QObject(parent) {} +NotificationsManager::NotificationsManager(QObject *parent): QObject(parent) +{ -void NotificationsManager::postNotification(const QString &roomId, const QString &eventId, - const QString &roomName, const QString &senderName, - const QString &text, const QImage &icon) { - Q_UNUSED(roomId); - Q_UNUSED(eventId); - Q_UNUSED(icon); - - NSUserNotification *notif = [[NSUserNotification alloc] init]; - - notif.title = roomName.toNSString(); - notif.subtitle = QString("%1 sent a message").arg(senderName).toNSString(); - notif.informativeText = text.toNSString(); - notif.soundName = NSUserNotificationDefaultSoundName; - - [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notif]; - [notif autorelease]; } -// unused -void NotificationsManager::actionInvoked(uint, QString) {} +void +NotificationsManager::postNotification( + const QString &roomId, + const QString &eventId, + const QString &roomName, + const QString &senderName, + const QString &text, + const QImage &icon) +{ + Q_UNUSED(roomId); + Q_UNUSED(eventId); + Q_UNUSED(icon); -void NotificationsManager::notificationClosed(uint, uint) {} + NSUserNotification * notif = [[NSUserNotification alloc] init]; + + notif.title = roomName.toNSString(); + notif.subtitle = QString("%1 sent a message").arg(senderName).toNSString(); + notif.informativeText = text.toNSString(); + notif.soundName = NSUserNotificationDefaultSoundName; + + [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: notif]; + [notif autorelease]; +} + +//unused +void +NotificationsManager::actionInvoked(uint, QString) +{ +} + +void +NotificationsManager::notificationClosed(uint, uint) +{ +}