9 #import <objc/runtime.h>
10 #include <Cocoa/Cocoa.h>
14 - (NSString *)__bundleIdentifier
16 if (
self == [NSBundle mainBundle]) {
17 return @"io.pivx.Pivx-Qt";
19 return [
self __bundleIdentifier];
27 if(this->hasUserNotificationCenterSupport()) {
28 NSUserNotification* userNotification = [[NSUserNotification alloc] init];
29 userNotification.title = title.toNSString();
30 userNotification.informativeText = text.toNSString();
31 [[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification: userNotification];
32 [userNotification release];
38 Class possibleClass = NSClassFromString(
@"NSUserNotificationCenter");
41 if(possibleClass!=nil) {
54 Class aPossibleClass = objc_getClass(
"NSBundle");
58 method_exchangeImplementations(class_getInstanceMethod(aPossibleClass,
@selector(bundleIdentifier)),
59 class_getInstanceMethod(aPossibleClass,
@selector(__bundleIdentifier)));
Macintosh-specific notification handler (supports UserNotificationCenter).
bool hasUserNotificationCenterSupport(void)
check if OS can handle UserNotifications
static MacNotificationHandler * instance()
void showNotification(const QString &title, const QString &text)
shows a 10.8+ UserNotification in the UserNotificationCenter