Remove direct bitcoin calls from qt/splashscreen.cpp

This commit is contained in:
Russell Yanofsky 2017-04-17 15:10:47 -04:00 committed by John Newbery
parent c2f672fb19
commit 5fba3af21e
10 changed files with 139 additions and 29 deletions

View file

@ -7,6 +7,7 @@
#include <chainparams.h>
#include <init.h>
#include <interface/handler.h>
#include <interface/wallet.h>
#include <net.h>
#include <netaddress.h>
#include <netbase.h>
@ -15,8 +16,19 @@
#include <util.h>
#include <warnings.h>
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#ifdef ENABLE_WALLET
#define CHECK_WALLET(x) x
#else
#define CHECK_WALLET(x) throw std::logic_error("Wallet function called in non-wallet build.")
#endif
#include <boost/thread/thread.hpp>
class CWallet;
namespace interface {
namespace {
@ -69,6 +81,15 @@ class NodeImpl : public Node
{
return MakeHandler(::uiInterface.ThreadSafeQuestion.connect(fn));
}
std::unique_ptr<Handler> handleShowProgress(ShowProgressFn fn) override
{
return MakeHandler(::uiInterface.ShowProgress.connect(fn));
}
std::unique_ptr<Handler> handleLoadWallet(LoadWalletFn fn) override
{
CHECK_WALLET(
return MakeHandler(::uiInterface.LoadWallet.connect([fn](CWallet* wallet) { fn(MakeWallet(*wallet)); })));
}
};
} // namespace