2011-06-05 16:03:29 +02:00
|
|
|
// Copyright (c) 2010 Satoshi Nakamoto
|
2016-12-31 19:01:21 +01:00
|
|
|
// Copyright (c) 2012-2016 The Bitcoin Core developers
|
2014-12-13 05:09:33 +01:00
|
|
|
// Distributed under the MIT software license, see the accompanying
|
2012-05-18 16:02:28 +02:00
|
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2013-04-13 07:13:08 +02:00
|
|
|
|
2012-04-04 13:19:30 +02:00
|
|
|
#ifndef BITCOIN_UI_INTERFACE_H
|
|
|
|
#define BITCOIN_UI_INTERFACE_H
|
2011-06-05 16:03:29 +02:00
|
|
|
|
2013-04-13 07:13:08 +02:00
|
|
|
#include <stdint.h>
|
2011-06-05 16:03:29 +02:00
|
|
|
#include <string>
|
2013-04-13 07:13:08 +02:00
|
|
|
|
2012-05-06 19:40:58 +02:00
|
|
|
#include <boost/signals2/last_value.hpp>
|
2013-04-13 07:13:08 +02:00
|
|
|
#include <boost/signals2/signal.hpp>
|
2011-06-05 16:03:29 +02:00
|
|
|
|
2012-05-05 16:07:14 +02:00
|
|
|
class CWallet;
|
2015-11-26 15:48:26 +01:00
|
|
|
class CBlockIndex;
|
2012-05-05 16:07:14 +02:00
|
|
|
|
2012-05-06 19:40:58 +02:00
|
|
|
/** General change type (added, updated, removed). */
|
2012-05-05 16:07:14 +02:00
|
|
|
enum ChangeType
|
|
|
|
{
|
|
|
|
CT_NEW,
|
|
|
|
CT_UPDATED,
|
2014-07-17 14:09:46 +02:00
|
|
|
CT_DELETED
|
2012-05-05 16:07:14 +02:00
|
|
|
};
|
|
|
|
|
2012-05-06 19:40:58 +02:00
|
|
|
/** Signals for UI communication. */
|
|
|
|
class CClientUIInterface
|
|
|
|
{
|
|
|
|
public:
|
2012-05-19 09:35:26 +02:00
|
|
|
/** Flags for CClientUIInterface::ThreadSafeMessageBox */
|
|
|
|
enum MessageBoxFlags
|
|
|
|
{
|
2012-11-05 08:04:21 +01:00
|
|
|
ICON_INFORMATION = 0,
|
|
|
|
ICON_WARNING = (1U << 0),
|
|
|
|
ICON_ERROR = (1U << 1),
|
|
|
|
/**
|
|
|
|
* Mask of all available icons in CClientUIInterface::MessageBoxFlags
|
|
|
|
* This needs to be updated, when icons are changed there!
|
|
|
|
*/
|
|
|
|
ICON_MASK = (ICON_INFORMATION | ICON_WARNING | ICON_ERROR),
|
|
|
|
|
|
|
|
/** These values are taken from qmessagebox.h "enum StandardButton" to be directly usable */
|
|
|
|
BTN_OK = 0x00000400U, // QMessageBox::Ok
|
|
|
|
BTN_YES = 0x00004000U, // QMessageBox::Yes
|
|
|
|
BTN_NO = 0x00010000U, // QMessageBox::No
|
|
|
|
BTN_ABORT = 0x00040000U, // QMessageBox::Abort
|
|
|
|
BTN_RETRY = 0x00080000U, // QMessageBox::Retry
|
|
|
|
BTN_IGNORE = 0x00100000U, // QMessageBox::Ignore
|
|
|
|
BTN_CLOSE = 0x00200000U, // QMessageBox::Close
|
|
|
|
BTN_CANCEL = 0x00400000U, // QMessageBox::Cancel
|
|
|
|
BTN_DISCARD = 0x00800000U, // QMessageBox::Discard
|
|
|
|
BTN_HELP = 0x01000000U, // QMessageBox::Help
|
|
|
|
BTN_APPLY = 0x02000000U, // QMessageBox::Apply
|
|
|
|
BTN_RESET = 0x04000000U, // QMessageBox::Reset
|
|
|
|
/**
|
|
|
|
* Mask of all available buttons in CClientUIInterface::MessageBoxFlags
|
|
|
|
* This needs to be updated, when buttons are changed there!
|
|
|
|
*/
|
|
|
|
BTN_MASK = (BTN_OK | BTN_YES | BTN_NO | BTN_ABORT | BTN_RETRY | BTN_IGNORE |
|
|
|
|
BTN_CLOSE | BTN_CANCEL | BTN_DISCARD | BTN_HELP | BTN_APPLY | BTN_RESET),
|
|
|
|
|
|
|
|
/** Force blocking, modal message box dialog (not just OS notification) */
|
|
|
|
MODAL = 0x10000000U,
|
|
|
|
|
2014-10-17 01:16:29 +02:00
|
|
|
/** Do not print contents of message to debug log */
|
|
|
|
SECURE = 0x40000000U,
|
|
|
|
|
2012-11-05 08:04:21 +01:00
|
|
|
/** Predefined combinations for certain default usage cases */
|
2012-12-03 13:35:14 +01:00
|
|
|
MSG_INFORMATION = ICON_INFORMATION,
|
2012-11-05 08:04:21 +01:00
|
|
|
MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL),
|
|
|
|
MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL)
|
2012-05-19 09:35:26 +02:00
|
|
|
};
|
|
|
|
|
2012-05-06 19:40:58 +02:00
|
|
|
/** Show message box. */
|
2013-02-16 17:58:45 +01:00
|
|
|
boost::signals2::signal<bool (const std::string& message, const std::string& caption, unsigned int style), boost::signals2::last_value<bool> > ThreadSafeMessageBox;
|
2012-04-04 13:19:30 +02:00
|
|
|
|
2016-06-24 16:35:21 +02:00
|
|
|
/** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */
|
|
|
|
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;
|
|
|
|
|
2012-05-06 19:40:58 +02:00
|
|
|
/** Progress message during initialization. */
|
|
|
|
boost::signals2::signal<void (const std::string &message)> InitMessage;
|
2012-05-05 16:07:14 +02:00
|
|
|
|
2012-05-06 19:40:58 +02:00
|
|
|
/** Number of network connections changed. */
|
|
|
|
boost::signals2::signal<void (int newNumConnections)> NotifyNumConnectionsChanged;
|
|
|
|
|
2013-03-26 03:07:06 +01:00
|
|
|
/** Network activity state changed. */
|
|
|
|
boost::signals2::signal<void (bool networkActive)> NotifyNetworkActiveChanged;
|
|
|
|
|
2012-05-06 19:40:58 +02:00
|
|
|
/**
|
2016-03-06 11:07:25 +01:00
|
|
|
* Status bar alerts changed.
|
2012-05-06 19:40:58 +02:00
|
|
|
*/
|
2016-03-06 11:07:25 +01:00
|
|
|
boost::signals2::signal<void ()> NotifyAlertChanged;
|
2014-03-19 00:26:14 +01:00
|
|
|
|
|
|
|
/** A wallet has been loaded. */
|
|
|
|
boost::signals2::signal<void (CWallet* wallet)> LoadWallet;
|
2014-05-23 18:04:09 +02:00
|
|
|
|
2017-07-07 23:09:55 +02:00
|
|
|
/**
|
|
|
|
* Show progress e.g. for verifychain.
|
|
|
|
* resume_possible indicates shutting down now will result in the current progress action resuming upon restart.
|
|
|
|
*/
|
|
|
|
boost::signals2::signal<void (const std::string &title, int nProgress, bool resume_possible)> ShowProgress;
|
2017-06-23 09:32:38 +02:00
|
|
|
|
2014-08-14 18:32:34 +02:00
|
|
|
/** New block has been accepted */
|
2015-11-26 15:48:26 +01:00
|
|
|
boost::signals2::signal<void (bool, const CBlockIndex *)> NotifyBlockTip;
|
2015-06-20 20:27:28 +02:00
|
|
|
|
2016-04-28 16:18:45 +02:00
|
|
|
/** Best header has changed */
|
|
|
|
boost::signals2::signal<void (bool, const CBlockIndex *)> NotifyHeaderTip;
|
|
|
|
|
2015-06-20 20:27:28 +02:00
|
|
|
/** Banlist did change. */
|
|
|
|
boost::signals2::signal<void (void)> BannedListChanged;
|
2012-05-06 19:40:58 +02:00
|
|
|
};
|
|
|
|
|
2016-03-21 18:29:17 +01:00
|
|
|
/** Show warning message **/
|
|
|
|
void InitWarning(const std::string& str);
|
|
|
|
|
|
|
|
/** Show error message **/
|
|
|
|
bool InitError(const std::string& str);
|
|
|
|
|
2016-01-08 01:14:09 +01:00
|
|
|
std::string AmountHighWarn(const std::string& optname);
|
|
|
|
|
2016-03-21 18:29:17 +01:00
|
|
|
std::string AmountErrMsg(const char* const optname, const std::string& strValue);
|
|
|
|
|
2012-05-06 19:40:58 +02:00
|
|
|
extern CClientUIInterface uiInterface;
|
|
|
|
|
2014-08-28 22:21:03 +02:00
|
|
|
#endif // BITCOIN_UI_INTERFACE_H
|