LCOV - code coverage report
Current view: top level - src - ui_interface.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 1 1 100.0 %
Date: 2015-10-12 22:39:14 Functions: 2 2 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // Copyright (c) 2010 Satoshi Nakamoto
       2             : // Copyright (c) 2012 The Bitcoin 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 BITCOIN_UI_INTERFACE_H
       7             : #define BITCOIN_UI_INTERFACE_H
       8             : 
       9             : #include <stdint.h>
      10             : #include <string>
      11             : 
      12             : #include <boost/signals2/last_value.hpp>
      13             : #include <boost/signals2/signal.hpp>
      14             : 
      15             : class CBasicKeyStore;
      16             : class CWallet;
      17             : class uint256;
      18             : 
      19             : /** General change type (added, updated, removed). */
      20             : enum ChangeType
      21             : {
      22             :     CT_NEW,
      23             :     CT_UPDATED,
      24             :     CT_DELETED
      25             : };
      26             : 
      27             : /** Signals for UI communication. */
      28        1728 : class CClientUIInterface
      29             : {
      30             : public:
      31             :     /** Flags for CClientUIInterface::ThreadSafeMessageBox */
      32             :     enum MessageBoxFlags
      33             :     {
      34             :         ICON_INFORMATION    = 0,
      35             :         ICON_WARNING        = (1U << 0),
      36             :         ICON_ERROR          = (1U << 1),
      37             :         /**
      38             :          * Mask of all available icons in CClientUIInterface::MessageBoxFlags
      39             :          * This needs to be updated, when icons are changed there!
      40             :          */
      41             :         ICON_MASK = (ICON_INFORMATION | ICON_WARNING | ICON_ERROR),
      42             : 
      43             :         /** These values are taken from qmessagebox.h "enum StandardButton" to be directly usable */
      44             :         BTN_OK      = 0x00000400U, // QMessageBox::Ok
      45             :         BTN_YES     = 0x00004000U, // QMessageBox::Yes
      46             :         BTN_NO      = 0x00010000U, // QMessageBox::No
      47             :         BTN_ABORT   = 0x00040000U, // QMessageBox::Abort
      48             :         BTN_RETRY   = 0x00080000U, // QMessageBox::Retry
      49             :         BTN_IGNORE  = 0x00100000U, // QMessageBox::Ignore
      50             :         BTN_CLOSE   = 0x00200000U, // QMessageBox::Close
      51             :         BTN_CANCEL  = 0x00400000U, // QMessageBox::Cancel
      52             :         BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
      53             :         BTN_HELP    = 0x01000000U, // QMessageBox::Help
      54             :         BTN_APPLY   = 0x02000000U, // QMessageBox::Apply
      55             :         BTN_RESET   = 0x04000000U, // QMessageBox::Reset
      56             :         /**
      57             :          * Mask of all available buttons in CClientUIInterface::MessageBoxFlags
      58             :          * This needs to be updated, when buttons are changed there!
      59             :          */
      60             :         BTN_MASK = (BTN_OK | BTN_YES | BTN_NO | BTN_ABORT | BTN_RETRY | BTN_IGNORE |
      61             :                     BTN_CLOSE | BTN_CANCEL | BTN_DISCARD | BTN_HELP | BTN_APPLY | BTN_RESET),
      62             : 
      63             :         /** Force blocking, modal message box dialog (not just OS notification) */
      64             :         MODAL               = 0x10000000U,
      65             : 
      66             :         /** Do not print contents of message to debug log */
      67             :         SECURE              = 0x40000000U,
      68             : 
      69             :         /** Predefined combinations for certain default usage cases */
      70             :         MSG_INFORMATION = ICON_INFORMATION,
      71             :         MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL),
      72             :         MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL)
      73             :     };
      74             : 
      75             :     /** Show message box. */
      76             :     boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox;
      77             : 
      78             :     /** Progress message during initialization. */
      79             :     boost::signals2::signal<void (const std::string &message)> InitMessage;
      80             : 
      81             :     /** Number of network connections changed. */
      82             :     boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged;
      83             : 
      84             :     /**
      85             :      * New, updated or cancelled alert.
      86             :      * @note called with lock cs_mapAlerts held.
      87             :      */
      88             :     boost::signals2::signal<void (const uint256 &hash, ChangeType status)> NotifyAlertChanged;
      89             : 
      90             :     /** A wallet has been loaded. */
      91             :     boost::signals2::signal<void (CWallet* wallet)> LoadWallet;
      92             : 
      93             :     /** Show progress e.g. for verifychain */
      94             :     boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress;
      95             : 
      96             :     /** New block has been accepted */
      97             :     boost::signals2::signal<void (const uint256& hash)> NotifyBlockTip;
      98             : 
      99             :     /** Banlist did change. */
     100             :     boost::signals2::signal<void (void)> BannedListChanged;
     101             : };
     102             : 
     103             : extern CClientUIInterface uiInterface;
     104             : 
     105             : #endif // BITCOIN_UI_INTERFACE_H

Generated by: LCOV version 1.11