Anoncoin  0.9.4
P2P Digital Currency
ui_interface.h
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2012 The Bitcoin developers
3 // Copyright (c) 2013-2014 The Anoncoin Core developers
4 // Distributed under the MIT/X11 software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 #ifndef ANONCOIN_UI_INTERFACE_H
7 #define ANONCOIN_UI_INTERFACE_H
8 
9 // Many builder specific things set in the config file, here we need it.
10 // If ENABLE_I2PSAM is set, we'll support some more signals...
11 #if defined(HAVE_CONFIG_H)
12 #include "config/anoncoin-config.h"
13 #endif
14 
15 #include <stdint.h>
16 #include <string>
17 
18 #include <boost/signals2/last_value.hpp>
19 #include <boost/signals2/signal.hpp>
20 
21 class CBasicKeyStore;
22 class CWallet;
23 class uint256;
24 
27 {
31 };
32 
35 {
36 public:
39  {
41  ICON_WARNING = (1U << 0),
42  ICON_ERROR = (1U << 1),
48 
50  BTN_OK = 0x00000400U, // QMessageBox::Ok
51  BTN_YES = 0x00004000U, // QMessageBox::Yes
52  BTN_NO = 0x00010000U, // QMessageBox::No
53  BTN_ABORT = 0x00040000U, // QMessageBox::Abort
54  BTN_RETRY = 0x00080000U, // QMessageBox::Retry
55  BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
56  BTN_CLOSE = 0x00200000U, // QMessageBox::Close
57  BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
58  BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
59  BTN_HELP = 0x01000000U, // QMessageBox::Help
60  BTN_APPLY = 0x02000000U, // QMessageBox::Apply
61  BTN_RESET = 0x04000000U, // QMessageBox::Reset
68 
70  MODAL = 0x10000000U,
72  NOSHOWGUI = 0x20000000U,
73 
78  };
79 
81  boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox;
82 
84  boost::signals2::signal<void (const std::string &message)> InitMessage;
85 
87  boost::signals2::signal<std::string (const char* psz)> Translate;
88 
90  boost::signals2::signal<void ()> NotifyBlocksChanged;
91 
93  boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged;
94 
99  boost::signals2::signal<void (const uint256 &hash, ChangeType status)> NotifyAlertChanged;
100 
102  boost::signals2::signal<void (CWallet* wallet)> LoadWallet;
103 
107 #ifdef ENABLE_I2PSAM
108  boost::signals2::signal<bool (const std::string& caption,
109  const std::string& pub,
110  const std::string& priv,
111  const std::string& b32,
112  const std::string& configFileName),
113  boost::signals2::last_value<bool> > ThreadSafeShowGeneratedI2PAddress;
114 
115  boost::signals2::signal<void (int newNumI2PConnections)> NotifyNumI2PConnectionsChanged;
116 #endif // ENABLE_I2PSAM
117 };
118 
120 
125 inline std::string _(const char* psz)
126 {
127  boost::optional<std::string> rv = uiInterface.Translate(psz);
128  return rv ? (*rv) : psz;
129 }
130 
131 #endif
CClientUIInterface uiInterface
Definition: util.cpp:100
MessageBoxFlags
Flags for CClientUIInterface::ThreadSafeMessageBox.
Definition: ui_interface.h:38
boost::signals2::signal< void(CWallet *wallet)> LoadWallet
A wallet has been loaded.
Definition: ui_interface.h:102
Mask of all available buttons in CClientUIInterface::MessageBoxFlags This needs to be updated...
Definition: ui_interface.h:66
Don't bring GUI to foreground.
Definition: ui_interface.h:72
Signals for UI communication.
Definition: ui_interface.h:34
Force blocking, modal message box dialog (not just OS notification)
Definition: ui_interface.h:70
ChangeType
General change type (added, updated, removed).
Definition: ui_interface.h:26
boost::signals2::signal< std::string(const char *psz)> Translate
Translate a message to the native language of the user.
Definition: ui_interface.h:87
boost::signals2::signal< void(int newNumConnections)> NotifyNumConnectionsChanged
Number of network connections changed.
Definition: ui_interface.h:93
These values are taken from qmessagebox.h "enum StandardButton" to be directly usable.
Definition: ui_interface.h:50
256-bit unsigned integer
Definition: uint256.h:532
boost::signals2::signal< void(const uint256 &hash, ChangeType status)> NotifyAlertChanged
New, updated or cancelled alert.
Definition: ui_interface.h:99
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a boost::optional result...
Definition: ui_interface.h:125
boost::signals2::signal< void()> NotifyBlocksChanged
Block chain changed.
Definition: ui_interface.h:90
Mask of all available icons in CClientUIInterface::MessageBoxFlags This needs to be updated...
Definition: ui_interface.h:47
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
Definition: wallet.h:101
boost::signals2::signal< bool(const std::string &message, const std::string &caption, unsigned int style), boost::signals2::last_value< bool > > ThreadSafeMessageBox
Show message box.
Definition: ui_interface.h:81
Basic key store, that keeps keys in an address->secret map.
Definition: keystore.h:63
boost::signals2::signal< void(const std::string &message)> InitMessage
Progress message during initialization.
Definition: ui_interface.h:84
Predefined combinations for certain default usage cases.
Definition: ui_interface.h:75