Add commenting around JSON error codes
[bitcoinplatinum.git] / src / ui_interface.h
blob065d23fbb4579a262d460a44b6ac0dcab8a33c11
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2012-2016 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.
6 #ifndef BITCOIN_UI_INTERFACE_H
7 #define BITCOIN_UI_INTERFACE_H
9 #include <stdint.h>
10 #include <string>
12 #include <boost/signals2/last_value.hpp>
13 #include <boost/signals2/signal.hpp>
15 class CBasicKeyStore;
16 class CWallet;
17 class uint256;
18 class CBlockIndex;
20 /** General change type (added, updated, removed). */
21 enum ChangeType
23 CT_NEW,
24 CT_UPDATED,
25 CT_DELETED
28 /** Signals for UI communication. */
29 class CClientUIInterface
31 public:
32 /** Flags for CClientUIInterface::ThreadSafeMessageBox */
33 enum MessageBoxFlags
35 ICON_INFORMATION = 0,
36 ICON_WARNING = (1U << 0),
37 ICON_ERROR = (1U << 1),
38 /**
39 * Mask of all available icons in CClientUIInterface::MessageBoxFlags
40 * This needs to be updated, when icons are changed there!
42 ICON_MASK = (ICON_INFORMATION | ICON_WARNING | ICON_ERROR),
44 /** These values are taken from qmessagebox.h "enum StandardButton" to be directly usable */
45 BTN_OK = 0x00000400U, // QMessageBox::Ok
46 BTN_YES = 0x00004000U, // QMessageBox::Yes
47 BTN_NO = 0x00010000U, // QMessageBox::No
48 BTN_ABORT = 0x00040000U, // QMessageBox::Abort
49 BTN_RETRY = 0x00080000U, // QMessageBox::Retry
50 BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
51 BTN_CLOSE = 0x00200000U, // QMessageBox::Close
52 BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
53 BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
54 BTN_HELP = 0x01000000U, // QMessageBox::Help
55 BTN_APPLY = 0x02000000U, // QMessageBox::Apply
56 BTN_RESET = 0x04000000U, // QMessageBox::Reset
57 /**
58 * Mask of all available buttons in CClientUIInterface::MessageBoxFlags
59 * This needs to be updated, when buttons are changed there!
61 BTN_MASK = (BTN_OK | BTN_YES | BTN_NO | BTN_ABORT | BTN_RETRY | BTN_IGNORE |
62 BTN_CLOSE | BTN_CANCEL | BTN_DISCARD | BTN_HELP | BTN_APPLY | BTN_RESET),
64 /** Force blocking, modal message box dialog (not just OS notification) */
65 MODAL = 0x10000000U,
67 /** Do not print contents of message to debug log */
68 SECURE = 0x40000000U,
70 /** Predefined combinations for certain default usage cases */
71 MSG_INFORMATION = ICON_INFORMATION,
72 MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL),
73 MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL)
76 /** Show message box. */
77 boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox;
79 /** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */
80 boost::signals2::signal<bool (const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeQuestion;
82 /** Progress message during initialization. */
83 boost::signals2::signal<void (const std::string &message)> InitMessage;
85 /** Number of network connections changed. */
86 boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged;
88 /** Network activity state changed. */
89 boost::signals2::signal<void (bool networkActive)> NotifyNetworkActiveChanged;
91 /**
92 * Status bar alerts changed.
94 boost::signals2::signal<void ()> NotifyAlertChanged;
96 /** A wallet has been loaded. */
97 boost::signals2::signal<void (CWallet* wallet)> LoadWallet;
99 /** Show progress e.g. for verifychain */
100 boost::signals2::signal<void (const std::string &title, int nProgress)> ShowProgress;
102 /** New block has been accepted */
103 boost::signals2::signal<void (bool, const CBlockIndex *)> NotifyBlockTip;
105 /** Best header has changed */
106 boost::signals2::signal<void (bool, const CBlockIndex *)> NotifyHeaderTip;
108 /** Banlist did change. */
109 boost::signals2::signal<void (void)> BannedListChanged;
112 /** Show warning message **/
113 void InitWarning(const std::string& str);
115 /** Show error message **/
116 bool InitError(const std::string& str);
118 std::string AmountHighWarn(const std::string& optname);
120 std::string AmountErrMsg(const char* const optname, const std::string& strValue);
122 extern CClientUIInterface uiInterface;
124 #endif // BITCOIN_UI_INTERFACE_H