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) 2010 Satoshi Nakamoto2// Copyright (c) 2012-present The Bitcoin Core developers3// Distributed under the MIT software license, see the accompanying4// file COPYING or http://www.opensource.org/licenses/mit-license.php.6#ifndef BITCOIN_NODE_INTERFACE_UI_H7#define BITCOIN_NODE_INTERFACE_UI_H9#include <util/btcsignals.h>11#include <cstdint>12#include <functional>13#include <string>14#include <vector>16class CBlockIndex;17enum class SynchronizationState;18struct bilingual_str;20/** Signals for UI communication. */21class CClientUIInterface22{23public:24/** Flags for CClientUIInterface::ThreadSafeMessageBox */25enum MessageBoxFlags : uint32_t {26ICON_INFORMATION = 0,27ICON_WARNING = (1U << 0),28ICON_ERROR = (1U << 1),29/**30* Mask of all available icons in CClientUIInterface::MessageBoxFlags31* This needs to be updated, when icons are changed there!32*/33ICON_MASK = (ICON_INFORMATION | ICON_WARNING | ICON_ERROR),35/** These values are taken from qmessagebox.h "enum StandardButton" to be directly usable */36BTN_OK = 0x00000400U, // QMessageBox::Ok37BTN_YES = 0x00004000U, // QMessageBox::Yes38BTN_NO = 0x00010000U, // QMessageBox::No39BTN_ABORT = 0x00040000U, // QMessageBox::Abort40BTN_RETRY = 0x00080000U, // QMessageBox::Retry41BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore42BTN_CLOSE = 0x00200000U, // QMessageBox::Close43BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel44BTN_DISCARD = 0x00800000U, // QMessageBox::Discard45BTN_HELP = 0x01000000U, // QMessageBox::Help46BTN_APPLY = 0x02000000U, // QMessageBox::Apply47BTN_RESET = 0x04000000U, // QMessageBox::Reset48/**49* Mask of all available buttons in CClientUIInterface::MessageBoxFlags50* This needs to be updated, when buttons are changed there!51*/52BTN_MASK = (BTN_OK | BTN_YES | BTN_NO | BTN_ABORT | BTN_RETRY | BTN_IGNORE |53BTN_CLOSE | BTN_CANCEL | BTN_DISCARD | BTN_HELP | BTN_APPLY | BTN_RESET),55/** Force blocking, modal message box dialog (not just OS notification) */56MODAL = 0x10000000U,58/** Do not print contents of message to debug log */59SECURE = 0x40000000U,61/** Predefined combinations for certain default usage cases */62MSG_INFORMATION = ICON_INFORMATION,63MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL),64MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL)65};67/** Show message box. */68btcsignals::signal<void(const bilingual_str& message, unsigned int style)> ThreadSafeMessageBox;70/** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, style) and returns false. */71btcsignals::signal<bool(const bilingual_str& message, const std::string& noninteractive_message, unsigned int style), btcsignals::any_of> ThreadSafeQuestion;73/** Progress message during initialization. */74btcsignals::signal<void(const std::string& message)> InitMessage;76/** Wallet loader created. */77btcsignals::signal<void()> InitWallet;79/** Number of network connections changed. */80btcsignals::signal<void(int newNumConnections)> NotifyNumConnectionsChanged;82/** Network activity state changed. */83btcsignals::signal<void(bool networkActive)> NotifyNetworkActiveChanged;85/**86* Status bar alerts changed.87*/88btcsignals::signal<void()> NotifyAlertChanged;90/**91* Show progress e.g. for verifychain.92* resume_possible indicates shutting down now will result in the current progress action resuming upon restart.93*/94btcsignals::signal<void(const std::string& title, int nProgress, bool resume_possible)> ShowProgress;96/** New block has been accepted */97btcsignals::signal<void(SynchronizationState, const CBlockIndex& block, double verification_progress)> NotifyBlockTip;99/** Best header has changed */100btcsignals::signal<void(SynchronizationState, int64_t height, int64_t timestamp, bool presync)> NotifyHeaderTip;102/** Banlist did change. */103btcsignals::signal<void(void)> BannedListChanged;104};106/** Show warning message **/107void InitWarning(const bilingual_str& str);109/** Show error message **/110bool InitError(const bilingual_str& str);111bool InitError(const bilingual_str& str, const std::vector<std::string>& details);113extern CClientUIInterface uiInterface;115#endif // BITCOIN_NODE_INTERFACE_UI_H