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