mirror of
https://github.com/dashpay/dash.git
synced 2024-12-30 14:25:53 +01:00
3c5dcb036a
084e17cebd424b8e8ced674bc810eef4e6ee5d3b Remove unused includes (practicalswift) Pull request description: As requested by MarcoFalke in https://github.com/bitcoin/bitcoin/pull/16273#issuecomment-521332089: This PR removes unused includes. Please note that in contrast to #16273 I'm limiting the scope to the trivial cases of pure removals (i.e. no includes added) to make reviewing easier. I'm seeking "Concept ACK":s for this obviously non-urgent minor cleanup. Rationale: * Avoids unnecessary re-compiles in case of header changes. * Makes reasoning about code dependencies easier. * Reduces compile-time memory usage. * Reduces compilation time. * Warm fuzzy feeling of being lean :-) ACKs for top commit: ryanofsky: Code review ACK 084e17cebd424b8e8ced674bc810eef4e6ee5d3b. PR only removes include lines and it still compiles. In the worst case someone might have to explicitly add an include later for something now included implicitly. But maybe some effort was taken to avoid this, and it wouldn't be a tragedy anyway. Tree-SHA512: 89de56edc6ceea4696e9579bccff10c80080821685b9fb4e8c5ef593b6e43cf662f358788701bb09f84867693f66b2e4db035b92b522a0a775f50b7ecffd6a6d
146 lines
5.5 KiB
C++
146 lines
5.5 KiB
C++
// Copyright (c) 2010 Satoshi Nakamoto
|
|
// Copyright (c) 2012-2015 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_UI_INTERFACE_H
|
|
#define BITCOIN_UI_INTERFACE_H
|
|
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
class CBlockIndex;
|
|
class CDeterministicMNList;
|
|
namespace boost {
|
|
namespace signals2 {
|
|
class connection;
|
|
}
|
|
} // namespace boost
|
|
|
|
namespace interfaces {
|
|
class Wallet;
|
|
} // namespace interfaces
|
|
|
|
/** General change type (added, updated, removed). */
|
|
enum ChangeType
|
|
{
|
|
CT_NEW,
|
|
CT_UPDATED,
|
|
CT_DELETED
|
|
};
|
|
|
|
/** Signals for UI communication. */
|
|
class CClientUIInterface
|
|
{
|
|
public:
|
|
/** Flags for CClientUIInterface::ThreadSafeMessageBox */
|
|
enum MessageBoxFlags
|
|
{
|
|
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,
|
|
|
|
/** Do not prepend error/warning prefix */
|
|
MSG_NOPREFIX = 0x20000000U,
|
|
|
|
/** Do not print contents of message to debug log */
|
|
SECURE = 0x40000000U,
|
|
|
|
/** Predefined combinations for certain default usage cases */
|
|
MSG_INFORMATION = ICON_INFORMATION,
|
|
MSG_WARNING = (ICON_WARNING | BTN_OK | MODAL),
|
|
MSG_ERROR = (ICON_ERROR | BTN_OK | MODAL)
|
|
};
|
|
|
|
#define ADD_SIGNALS_DECL_WRAPPER(signal_name, rtype, args...) \
|
|
rtype signal_name(args); \
|
|
using signal_name##Sig = rtype(args); \
|
|
boost::signals2::connection signal_name##_connect(std::function<signal_name##Sig> fn);
|
|
|
|
/** Show message box. */
|
|
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeMessageBox, bool, const std::string& message, const std::string& caption, unsigned int style);
|
|
|
|
/** If possible, ask the user a question. If not, falls back to ThreadSafeMessageBox(noninteractive_message, caption, style) and returns false. */
|
|
ADD_SIGNALS_DECL_WRAPPER(ThreadSafeQuestion, bool, const std::string& message, const std::string& noninteractive_message, const std::string& caption, unsigned int style);
|
|
|
|
/** Progress message during initialization. */
|
|
ADD_SIGNALS_DECL_WRAPPER(InitMessage, void, const std::string& message);
|
|
|
|
/** Number of network connections changed. */
|
|
ADD_SIGNALS_DECL_WRAPPER(NotifyNumConnectionsChanged, void, int newNumConnections);
|
|
|
|
/** Network activity state changed. */
|
|
ADD_SIGNALS_DECL_WRAPPER(NotifyNetworkActiveChanged, void, bool networkActive);
|
|
|
|
/**
|
|
* Status bar alerts changed.
|
|
*/
|
|
ADD_SIGNALS_DECL_WRAPPER(NotifyAlertChanged, void, );
|
|
|
|
/** A wallet has been loaded. */
|
|
ADD_SIGNALS_DECL_WRAPPER(LoadWallet, void, std::unique_ptr<interfaces::Wallet>& wallet);
|
|
|
|
/**
|
|
* Show progress e.g. for verifychain.
|
|
* resume_possible indicates shutting down now will result in the current progress action resuming upon restart.
|
|
*/
|
|
ADD_SIGNALS_DECL_WRAPPER(ShowProgress, void, const std::string& title, int nProgress, bool resume_possible);
|
|
|
|
/** New block has been accepted */
|
|
ADD_SIGNALS_DECL_WRAPPER(NotifyBlockTip, void, bool, const CBlockIndex*);
|
|
|
|
/** New chainlock block has been accepted */
|
|
ADD_SIGNALS_DECL_WRAPPER(NotifyChainLock, void, const std::string& bestChainLockHash, int bestChainLockHeight);
|
|
|
|
/** Best header has changed */
|
|
ADD_SIGNALS_DECL_WRAPPER(NotifyHeaderTip, void, bool, const CBlockIndex*);
|
|
|
|
/** Masternode list has changed */
|
|
ADD_SIGNALS_DECL_WRAPPER(NotifyMasternodeListChanged, void, const CDeterministicMNList&);
|
|
|
|
/** Additional data sync progress changed */
|
|
ADD_SIGNALS_DECL_WRAPPER(NotifyAdditionalDataSyncProgressChanged, void, double nSyncProgress);
|
|
|
|
/** Banlist did change. */
|
|
ADD_SIGNALS_DECL_WRAPPER(BannedListChanged, void, void);
|
|
};
|
|
|
|
/** Show warning message **/
|
|
void InitWarning(const std::string& str);
|
|
|
|
/** Show error message **/
|
|
bool InitError(const std::string& str);
|
|
|
|
extern CClientUIInterface uiInterface;
|
|
|
|
#endif // BITCOIN_UI_INTERFACE_H
|