Update CMakeLists.txt - play with openssl
[novacoin.git] / src / qt / notificator.h
1 // Copyright (c) 2011-2013 The Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5 #ifndef BITCOIN_QT_NOTIFICATOR_H
6 #define BITCOIN_QT_NOTIFICATOR_H
7
8 #if defined(HAVE_CONFIG_H)
9 #include "config/bitcoin-config.h"
10 #endif
11
12 #include <QIcon>
13 #include <QObject>
14
15 QT_BEGIN_NAMESPACE
16 class QSystemTrayIcon;
17
18 #ifdef USE_DBUS
19 class QDBusInterface;
20 #endif
21 QT_END_NAMESPACE
22
23 /** Cross-platform desktop notification client. */
24 class Notificator: public QObject
25 {
26     Q_OBJECT
27
28 public:
29     /** Create a new notificator.
30        @note Ownership of trayIcon is not transferred to this object.
31     */
32     Notificator(const QString &programName, QSystemTrayIcon *trayIcon, QWidget *parent);
33     ~Notificator();
34
35     // Message class
36     enum Class
37     {
38         Information,    /**< Informational message */
39         Warning,        /**< Notify user of potential problem */
40         Critical        /**< An error occurred */
41     };
42
43 public slots:
44     /** Show notification message.
45        @param[in] cls    general message class
46        @param[in] title  title shown with message
47        @param[in] text   message content
48        @param[in] icon   optional icon to show with message
49        @param[in] millisTimeout notification timeout in milliseconds (defaults to 10 seconds)
50        @note Platform implementations are free to ignore any of the provided fields except for \a text.
51      */
52     void notify(Class cls, const QString &title, const QString &text,
53                 const QIcon &icon = QIcon(), int millisTimeout = 10000);
54
55 private:
56     QWidget *parent;
57     enum Mode {
58         None,                       /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */
59         Freedesktop,                /**< Use DBus org.freedesktop.Notifications */
60         QSystemTray,                /**< Use QSystemTray::showMessage */
61         Growl12,                    /**< Use the Growl 1.2 notification system (Mac only) */
62         Growl13,                    /**< Use the Growl 1.3 notification system (Mac only) */
63         UserNotificationCenter      /**< Use the 10.8+ User Notification Center (Mac only) */
64     };
65     QString programName;
66     Mode mode;
67     QSystemTrayIcon *trayIcon;
68 #ifdef USE_DBUS
69     QDBusInterface *interface;
70
71     void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
72 #endif
73     void notifySystray(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);
74 #ifdef Q_OS_MAC
75     void notifyGrowl(Class cls, const QString &title, const QString &text, const QIcon &icon);
76     void notifyMacUserNotificationCenter(Class cls, const QString &title, const QString &text, const QIcon &icon);
77 #endif
78 };
79
80 #endif // BITCOIN_QT_NOTIFICATOR_H