|
25 | 25 | #ifdef ENABLE_WALLET
|
26 | 26 | #include <qt/paymentserver.h>
|
27 | 27 | #include <qt/walletcontroller.h>
|
28 |
| -#endif |
| 28 | +#include <qt/walletmodel.h> |
| 29 | +#endif // ENABLE_WALLET |
29 | 30 |
|
30 | 31 | #include <interfaces/handler.h>
|
31 | 32 | #include <interfaces/node.h>
|
@@ -210,12 +211,6 @@ BitcoinApplication::~BitcoinApplication()
|
210 | 211 |
|
211 | 212 | delete window;
|
212 | 213 | window = nullptr;
|
213 |
| -#ifdef ENABLE_WALLET |
214 |
| - delete paymentServer; |
215 |
| - paymentServer = nullptr; |
216 |
| - delete m_wallet_controller; |
217 |
| - m_wallet_controller = nullptr; |
218 |
| -#endif |
219 | 214 | delete optionsModel;
|
220 | 215 | optionsModel = nullptr;
|
221 | 216 | delete platformStyle;
|
@@ -331,24 +326,21 @@ void BitcoinApplication::initializeResult(bool success)
|
331 | 326 | {
|
332 | 327 | // Log this only after AppInitMain finishes, as then logging setup is guaranteed complete
|
333 | 328 | qInfo() << "Platform customization:" << platformStyle->getName();
|
334 |
| -#ifdef ENABLE_WALLET |
335 |
| - m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this); |
336 |
| -#ifdef ENABLE_BIP70 |
337 |
| - PaymentServer::LoadRootCAs(); |
338 |
| -#endif |
339 |
| - if (paymentServer) { |
340 |
| - paymentServer->setOptionsModel(optionsModel); |
341 |
| -#ifdef ENABLE_BIP70 |
342 |
| - connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK); |
343 |
| -#endif |
344 |
| - } |
345 |
| -#endif |
346 |
| - |
347 | 329 | clientModel = new ClientModel(m_node, optionsModel);
|
348 | 330 | window->setClientModel(clientModel);
|
349 | 331 | #ifdef ENABLE_WALLET
|
350 |
| - window->setWalletController(m_wallet_controller); |
| 332 | + if (WalletModel::isWalletEnabled()) { |
| 333 | + m_wallet_controller = new WalletController(m_node, platformStyle, optionsModel, this); |
| 334 | + window->setWalletController(m_wallet_controller); |
| 335 | + if (paymentServer) { |
| 336 | + paymentServer->setOptionsModel(optionsModel); |
| 337 | +#ifdef ENABLE_BIP70 |
| 338 | + PaymentServer::LoadRootCAs(); |
| 339 | + connect(m_wallet_controller, &WalletController::coinsSent, paymentServer, &PaymentServer::fetchPaymentACK); |
351 | 340 | #endif
|
| 341 | + } |
| 342 | + } |
| 343 | +#endif // ENABLE_WALLET |
352 | 344 |
|
353 | 345 | // If -min option passed, start window minimized (iconified) or minimized to tray
|
354 | 346 | if (!gArgs.GetBoolArg("-min", false)) {
|
@@ -546,8 +538,10 @@ int GuiMain(int argc, char* argv[])
|
546 | 538 |
|
547 | 539 | // Start up the payment server early, too, so impatient users that click on
|
548 | 540 | // bitcoin: links repeatedly have their payment requests routed to this process:
|
549 |
| - app.createPaymentServer(); |
550 |
| -#endif |
| 541 | + if (WalletModel::isWalletEnabled()) { |
| 542 | + app.createPaymentServer(); |
| 543 | + } |
| 544 | +#endif // ENABLE_WALLET |
551 | 545 |
|
552 | 546 | /// 9. Main GUI initialization
|
553 | 547 | // Install global event filter that makes sure that long tooltips can be word-wrapped
|
|
0 commit comments