Raven Core  3.0.0
P2P Digital Currency
notificator.h
Go to the documentation of this file.
1 // Copyright (c) 2011-2015 The Bitcoin Core developers
2 // Copyright (c) 2017-2019 The Raven Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef RAVEN_QT_NOTIFICATOR_H
7 #define RAVEN_QT_NOTIFICATOR_H
8 
9 #if defined(HAVE_CONFIG_H)
10 #include "config/raven-config.h"
11 #endif
12 
13 #include <QIcon>
14 #include <QObject>
15 
16 QT_BEGIN_NAMESPACE
17 class QSystemTrayIcon;
18 
19 #ifdef USE_DBUS
20 class QDBusInterface;
21 #endif
22 QT_END_NAMESPACE
23 
25 class Notificator: public QObject
26 {
27  Q_OBJECT
28 
29 public:
33  Notificator(const QString &programName, QSystemTrayIcon *trayIcon, QWidget *parent);
34  ~Notificator();
35 
36  // Message class
37  enum Class
38  {
42  };
43 
44 public Q_SLOTS:
53  void notify(Class cls, const QString &title, const QString &text,
54  const QIcon &icon = QIcon(), int millisTimeout = 10000);
55 
56 private:
57  QWidget *parent;
58  enum Mode {
59  None,
63  };
64  QString programName;
66  QSystemTrayIcon *trayIcon;
67 #ifdef USE_DBUS
68  QDBusInterface *interface;
69 
70  void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
71 #endif
72  void notifySystray(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
73 #ifdef Q_OS_MAC
74  void notifyMacUserNotificationCenter(Class cls, const QString &title, const QString &text, const QIcon &icon);
75 #endif
76 };
77 
78 #endif // RAVEN_QT_NOTIFICATOR_H
QString programName
Definition: notificator.h:64
Use DBus org.freedesktop.Notifications.
Definition: notificator.h:60
QWidget * parent
Definition: notificator.h:57
Notificator(const QString &programName, QSystemTrayIcon *trayIcon, QWidget *parent)
Create a new notificator.
Definition: notificator.cpp:37
Notify user of potential problem.
Definition: notificator.h:40
Ignore informational notifications, and show a modal pop-up dialog for Critical notifications.
Definition: notificator.h:59
Use the 10.8+ User Notification Center (Mac only)
Definition: notificator.h:62
void notify(Class cls, const QString &title, const QString &text, const QIcon &icon=QIcon(), int millisTimeout=10000)
Show notification message.
Cross-platform desktop notification client.
Definition: notificator.h:25
Informational message.
Definition: notificator.h:39
An error occurred.
Definition: notificator.h:41
QSystemTrayIcon * trayIcon
Definition: notificator.h:66
Use QSystemTray::showMessage.
Definition: notificator.h:61
void notifySystray(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout)