Bitcoin ABC 0.30.5
P2P Digital Currency
notificator.h
Go to the documentation of this file.
1// Copyright (c) 2011-2015 The Bitcoin Core developers
2// Distributed under the MIT 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
15QT_BEGIN_NAMESPACE
16class QSystemTrayIcon;
17
18#ifdef USE_DBUS
19class QDBusInterface;
20#endif
21QT_END_NAMESPACE
22
24class Notificator : public QObject {
25 Q_OBJECT
26
27public:
31 Notificator(const QString &programName, QSystemTrayIcon *trayIcon,
32 QWidget *parent);
34
35 // Message class
36 enum Class {
40 };
41
42public Q_SLOTS:
53 void notify(Class cls, const QString &title, const QString &text,
54 const QIcon &icon = QIcon(), int millisTimeout = 10000);
55
56private:
57 QWidget *parent;
58 enum Mode {
59 None,
65 };
66 QString programName;
68 QSystemTrayIcon *trayIcon;
69#ifdef USE_DBUS
70 QDBusInterface *interface;
71
72 void notifyDBus(Class cls, const QString &title, const QString &text,
73 const QIcon &icon, int millisTimeout);
74#endif
75 void notifySystray(Class cls, const QString &title, const QString &text,
76 int millisTimeout);
77#ifdef Q_OS_MAC
78 void notifyMacUserNotificationCenter(const QString &title,
79 const QString &text);
80#endif
81};
82
83#endif // BITCOIN_QT_NOTIFICATOR_H
Cross-platform desktop notification client.
Definition: notificator.h:24
QString programName
Definition: notificator.h:66
QWidget * parent
Definition: notificator.h:57
@ Information
Informational message.
Definition: notificator.h:37
@ Critical
An error occurred.
Definition: notificator.h:39
@ Warning
Notify user of potential problem.
Definition: notificator.h:38
@ UserNotificationCenter
Use the 10.8+ User Notification Center (Mac only)
Definition: notificator.h:63
@ QSystemTray
Use QSystemTrayIcon::showMessage()
Definition: notificator.h:62
@ Freedesktop
Use DBus org.freedesktop.Notifications.
Definition: notificator.h:61
@ None
Ignore informational notifications, and show a modal pop-up dialog for Critical notifications.
Definition: notificator.h:59
void notifySystray(Class cls, const QString &title, const QString &text, int millisTimeout)
Notificator(const QString &programName, QSystemTrayIcon *trayIcon, QWidget *parent)
Create a new notificator.
Definition: notificator.cpp:30
QSystemTrayIcon * trayIcon
Definition: notificator.h:68
void notify(Class cls, const QString &title, const QString &text, const QIcon &icon=QIcon(), int millisTimeout=10000)
Show notification message.