Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoin.cpp
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
#endif | #endif | ||||
qRegisterMetaType<Amount>(); | qRegisterMetaType<Amount>(); | ||||
// Register typedefs (see | // Register typedefs (see | ||||
// http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType) | // http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType) | ||||
qRegisterMetaType<size_t>("size_t"); | qRegisterMetaType<size_t>("size_t"); | ||||
qRegisterMetaType<std::function<void()>>("std::function<void()>"); | qRegisterMetaType<std::function<void()>>("std::function<void()>"); | ||||
qRegisterMetaType<QMessageBox::Icon>("QMessageBox::Icon"); | qRegisterMetaType<QMessageBox::Icon>("QMessageBox::Icon"); | ||||
qRegisterMetaType<interfaces::BlockAndHeaderTipInfo>( | |||||
"interfaces::BlockAndHeaderTipInfo"); | |||||
// Need to register any types Qt doesn't know about if you intend | // Need to register any types Qt doesn't know about if you intend | ||||
// to use them with the signal/slot mechanism Qt provides. Even pointers. | // to use them with the signal/slot mechanism Qt provides. Even pointers. | ||||
// Note that class Config is noncopyable and so we can't register a | // Note that class Config is noncopyable and so we can't register a | ||||
// non-pointer version of it with Qt, because Qt expects to be able to | // non-pointer version of it with Qt, because Qt expects to be able to | ||||
// copy-construct non-pointers to objects for invoking slots | // copy-construct non-pointers to objects for invoking slots | ||||
// behind-the-scenes in the 'Queued' connection case. | // behind-the-scenes in the 'Queued' connection case. | ||||
qRegisterMetaType<Config *>(); | qRegisterMetaType<Config *>(); | ||||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Lines | Q_EMIT runawayException( | ||||
QString::fromStdString(m_node.getWarnings().translated)); | QString::fromStdString(m_node.getWarnings().translated)); | ||||
} | } | ||||
void BitcoinABC::initialize(Config *config, RPCServer *rpcServer, | void BitcoinABC::initialize(Config *config, RPCServer *rpcServer, | ||||
HTTPRPCRequestProcessor *httpRPCRequestProcessor) { | HTTPRPCRequestProcessor *httpRPCRequestProcessor) { | ||||
try { | try { | ||||
qDebug() << __func__ << ": Running initialization in thread"; | qDebug() << __func__ << ": Running initialization in thread"; | ||||
util::ThreadRename("qt-init"); | util::ThreadRename("qt-init"); | ||||
bool rv = | |||||
m_node.appInitMain(*config, *rpcServer, *httpRPCRequestProcessor); | interfaces::BlockAndHeaderTipInfo tip_info; | ||||
Q_EMIT initializeResult(rv); | bool rv = m_node.appInitMain(*config, *rpcServer, | ||||
*httpRPCRequestProcessor, &tip_info); | |||||
Q_EMIT initializeResult(rv, tip_info); | |||||
} catch (const std::exception &e) { | } catch (const std::exception &e) { | ||||
handleRunawayException(&e); | handleRunawayException(&e); | ||||
} catch (...) { | } catch (...) { | ||||
handleRunawayException(nullptr); | handleRunawayException(nullptr); | ||||
} | } | ||||
} | } | ||||
void BitcoinABC::shutdown() { | void BitcoinABC::shutdown() { | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | void BitcoinApplication::requestShutdown(Config &config) { | ||||
delete clientModel; | delete clientModel; | ||||
clientModel = nullptr; | clientModel = nullptr; | ||||
// Request shutdown from core thread | // Request shutdown from core thread | ||||
Q_EMIT requestedShutdown(); | Q_EMIT requestedShutdown(); | ||||
} | } | ||||
void BitcoinApplication::initializeResult(bool success) { | void BitcoinApplication::initializeResult( | ||||
bool success, interfaces::BlockAndHeaderTipInfo tip_info) { | |||||
qDebug() << __func__ << ": Initialization result: " << success; | qDebug() << __func__ << ": Initialization result: " << success; | ||||
returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE; | returnValue = success ? EXIT_SUCCESS : EXIT_FAILURE; | ||||
if (!success) { | if (!success) { | ||||
// Make sure splash screen doesn't stick around during shutdown. | // Make sure splash screen doesn't stick around during shutdown. | ||||
Q_EMIT splashFinished(); | Q_EMIT splashFinished(); | ||||
// Exit first main loop invocation. | // Exit first main loop invocation. | ||||
quit(); | quit(); | ||||
return; | return; | ||||
} | } | ||||
// Log this only after AppInitMain finishes, as then logging setup is | // Log this only after AppInitMain finishes, as then logging setup is | ||||
// guaranteed complete. | // guaranteed complete. | ||||
qInfo() << "Platform customization:" << platformStyle->getName(); | qInfo() << "Platform customization:" << platformStyle->getName(); | ||||
clientModel = new ClientModel(node(), optionsModel); | clientModel = new ClientModel(node(), optionsModel); | ||||
window->setClientModel(clientModel); | window->setClientModel(clientModel, &tip_info); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
if (WalletModel::isWalletEnabled()) { | if (WalletModel::isWalletEnabled()) { | ||||
m_wallet_controller = | m_wallet_controller = | ||||
new WalletController(*clientModel, platformStyle, this); | new WalletController(*clientModel, platformStyle, this); | ||||
window->setWalletController(m_wallet_controller); | window->setWalletController(m_wallet_controller); | ||||
if (paymentServer) { | if (paymentServer) { | ||||
paymentServer->setOptionsModel(optionsModel); | paymentServer->setOptionsModel(optionsModel); | ||||
#ifdef ENABLE_BIP70 | #ifdef ENABLE_BIP70 | ||||
▲ Show 20 Lines • Show All 387 Lines • Show Last 20 Lines |