| 28 | #endif |
| 29 | |
| 30 | Notificator::Notificator(const QString &_programName, QSystemTrayIcon *_trayIcon, QWidget *_parent) : |
| 31 | QObject(_parent), |
| 32 | parent(_parent), |
| 33 | programName(_programName), |
| 34 | mode(None), |
| 35 | trayIcon(_trayIcon) |
| 36 | #ifdef USE_DBUS |
| 37 | ,interface(nullptr) |
| 38 | #endif |
| 39 | { |
| 40 | if(_trayIcon && _trayIcon->supportsMessages()) |
| 41 | { |
| 42 | mode = QSystemTray; |
| 43 | } |
| 44 | #ifdef USE_DBUS |
| 45 | interface = new QDBusInterface("org.freedesktop.Notifications", |
| 46 | "/org/freedesktop/Notifications", "org.freedesktop.Notifications"); |
| 47 | if(interface->isValid()) |
| 48 | { |
| 49 | mode = Freedesktop; |
| 50 | } |
| 51 | #endif |
| 52 | #ifdef Q_OS_MAC |
| 53 | // check if users OS has support for NSUserNotification |
| 54 | if( MacNotificationHandler::instance()->hasUserNotificationCenterSupport()) { |
| 55 | mode = UserNotificationCenter; |
| 56 | } |
| 57 | #endif |
| 58 | } |
| 59 | |
| 60 | Notificator::~Notificator() |
| 61 | { |