Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2011-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#ifndef BITCOIN_QT_NOTIFICATOR_H6#define BITCOIN_QT_NOTIFICATOR_H8#include <bitcoin-build-config.h> // IWYU pragma: keep10#include <QIcon>11#include <QObject>13QT_BEGIN_NAMESPACE14class QSystemTrayIcon;16#ifdef USE_DBUS17class QDBusInterface;18#endif19QT_END_NAMESPACE21/** Cross-platform desktop notification client. */22class Notificator: public QObject23{24Q_OBJECT26public:27/** Create a new notificator.28@note Ownership of trayIcon is not transferred to this object.29*/30Notificator(const QString &programName, QSystemTrayIcon *trayIcon, QWidget *parent);31~Notificator();33// Message class34enum Class35{36Information, /**< Informational message */37Warning, /**< Notify user of potential problem */38Critical /**< An error occurred */39};41public Q_SLOTS:42/** Show notification message.43@param[in] cls general message class44@param[in] title title shown with message45@param[in] text message content46@param[in] icon optional icon to show with message47@param[in] millisTimeout notification timeout in milliseconds (defaults to 10 seconds)48@note Platform implementations are free to ignore any of the provided fields except for \a text.49*/50void notify(Class cls, const QString &title, const QString &text,51const QIcon &icon = QIcon(), int millisTimeout = 10000);53private:54QWidget *parent;55enum Mode {56None, /**< Ignore informational notifications, and show a modal pop-up dialog for Critical notifications. */57Freedesktop, /**< Use DBus org.freedesktop.Notifications */58QSystemTray, /**< Use QSystemTrayIcon::showMessage() */59UserNotificationCenter /**< Use the 10.8+ User Notification Center (Mac only) */60};61QString programName;62Mode mode{None};63QSystemTrayIcon *trayIcon;64#ifdef USE_DBUS65QDBusInterface* interface{nullptr};67void notifyDBus(Class cls, const QString &title, const QString &text, const QIcon &icon, int millisTimeout);68#endif69void notifySystray(Class cls, const QString &title, const QString &text, int millisTimeout);70#ifdef Q_OS_MACOS71void notifyMacUserNotificationCenter(const QString &title, const QString &text);72#endif73};75#endif // BITCOIN_QT_NOTIFICATOR_H
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.