Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoin.cpp
Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | |||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
void BitcoinApplication::createPaymentServer() { | void BitcoinApplication::createPaymentServer() { | ||||
paymentServer = new PaymentServer(this); | paymentServer = new PaymentServer(this); | ||||
} | } | ||||
#endif | #endif | ||||
void BitcoinApplication::createOptionsModel(bool resetSettings) { | void BitcoinApplication::createOptionsModel(bool resetSettings) { | ||||
optionsModel = new OptionsModel(nullptr, resetSettings); | optionsModel = new OptionsModel(nullptr, resetSettings); | ||||
optionsModel->setNode(node()); | |||||
} | } | ||||
void BitcoinApplication::createWindow(const Config *config, | void BitcoinApplication::createWindow(const Config *config, | ||||
const NetworkStyle *networkStyle) { | const NetworkStyle *networkStyle) { | ||||
window = | window = | ||||
new BitcoinGUI(node(), config, platformStyle, networkStyle, nullptr); | new BitcoinGUI(node(), config, platformStyle, networkStyle, nullptr); | ||||
pollShutdownTimer = new QTimer(window); | pollShutdownTimer = new QTimer(window); | ||||
connect(pollShutdownTimer, &QTimer::timeout, window, | connect(pollShutdownTimer, &QTimer::timeout, window, | ||||
&BitcoinGUI::detectShutdown); | &BitcoinGUI::detectShutdown); | ||||
} | } | ||||
void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle) { | void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle) { | ||||
assert(!m_splash); | assert(!m_splash); | ||||
m_splash = new SplashScreen(networkStyle); | m_splash = new SplashScreen(networkStyle); | ||||
m_splash->setNode(node()); | |||||
// We don't hold a direct pointer to the splash screen after creation, but | // We don't hold a direct pointer to the splash screen after creation, but | ||||
// the splash screen will take care of deleting itself when finish() | // the splash screen will take care of deleting itself when finish() | ||||
// happens. | // happens. | ||||
m_splash->show(); | m_splash->show(); | ||||
connect(this, &BitcoinApplication::splashFinished, m_splash, | connect(this, &BitcoinApplication::splashFinished, m_splash, | ||||
&SplashScreen::finish); | &SplashScreen::finish); | ||||
connect(this, &BitcoinApplication::requestedShutdown, m_splash, | connect(this, &BitcoinApplication::requestedShutdown, m_splash, | ||||
&QWidget::close); | &QWidget::close); | ||||
} | } | ||||
void BitcoinApplication::setNode(interfaces::Node &node) { | void BitcoinApplication::setNode(interfaces::Node &node) { | ||||
assert(!m_node); | assert(!m_node); | ||||
m_node = &node; | m_node = &node; | ||||
if (optionsModel) { | |||||
optionsModel->setNode(*m_node); | |||||
} | |||||
if (m_splash) { | |||||
m_splash->setNode(*m_node); | |||||
} | |||||
} | } | ||||
bool BitcoinApplication::baseInitialize(Config &config) { | bool BitcoinApplication::baseInitialize(Config &config) { | ||||
return node().baseInitialize(config); | return node().baseInitialize(config); | ||||
} | } | ||||
void BitcoinApplication::startThread() { | void BitcoinApplication::startThread() { | ||||
if (coreThread) { | if (coreThread) { | ||||
▲ Show 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | #endif | ||||
// Generate high-dpi pixmaps | // Generate high-dpi pixmaps | ||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); | QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); | ||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); | ||||
#ifdef Q_OS_MAC | #ifdef Q_OS_MAC | ||||
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); | QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); | ||||
#endif | #endif | ||||
BitcoinApplication app; | BitcoinApplication app; | ||||
app.setNode(*node); | |||||
// Register meta types used for QMetaObject::invokeMethod and | // Register meta types used for QMetaObject::invokeMethod and | ||||
// Qt::QueuedConnection | // Qt::QueuedConnection | ||||
qRegisterMetaType<bool *>(); | qRegisterMetaType<bool *>(); | ||||
qRegisterMetaType<SynchronizationState>(); | qRegisterMetaType<SynchronizationState>(); | ||||
#ifdef ENABLE_WALLET | #ifdef ENABLE_WALLET | ||||
qRegisterMetaType<WalletModel *>(); | qRegisterMetaType<WalletModel *>(); | ||||
#endif | #endif | ||||
▲ Show 20 Lines • Show All 189 Lines • ▼ Show 20 Lines | #endif | ||||
// Get global config | // Get global config | ||||
Config &config = const_cast<Config &>(GetConfig()); | Config &config = const_cast<Config &>(GetConfig()); | ||||
if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && | if (gArgs.GetBoolArg("-splash", DEFAULT_SPLASHSCREEN) && | ||||
!gArgs.GetBoolArg("-min", false)) { | !gArgs.GetBoolArg("-min", false)) { | ||||
app.createSplashScreen(networkStyle.data()); | app.createSplashScreen(networkStyle.data()); | ||||
} | } | ||||
app.setNode(*node); | |||||
RPCServer rpcServer; | RPCServer rpcServer; | ||||
util::Ref context{node_context}; | util::Ref context{node_context}; | ||||
HTTPRPCRequestProcessor httpRPCRequestProcessor(config, rpcServer, context); | HTTPRPCRequestProcessor httpRPCRequestProcessor(config, rpcServer, context); | ||||
try { | try { | ||||
app.createWindow(&config, networkStyle.data()); | app.createWindow(&config, networkStyle.data()); | ||||
// Perform base initialization before spinning up | // Perform base initialization before spinning up | ||||
// initialization/shutdown thread. This is acceptable because this | // initialization/shutdown thread. This is acceptable because this | ||||
Show All 27 Lines |