MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / setClientModel

Method setClientModel

src/qt/bitcoingui.cpp:438–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438void BitcoinGUI::setClientModel(ClientModel *_clientModel)
439{
440 this->clientModel = _clientModel;
441 if(_clientModel)
442 {
443 // Create system tray menu (or setup the dock menu) that late to prevent users from calling actions,
444 // while the client has not yet fully loaded
445 createTrayIconMenu();
446
447 // Keep up to date with client
448 updateNetworkState();
449 connect(_clientModel, SIGNAL(numConnectionsChanged(int)), this, SLOT(setNumConnections(int)));
450 connect(_clientModel, SIGNAL(networkActiveChanged(bool)), this, SLOT(setNetworkActive(bool)));
451
452 modalOverlay->setKnownBestHeight(_clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(_clientModel->getHeaderTipTime()));
453 setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), m_node.getVerificationProgress(), false);
454 connect(_clientModel, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,double,bool)));
455
456 // Receive and report messages from client model
457 connect(_clientModel, SIGNAL(message(QString,QString,unsigned int)), this, SLOT(message(QString,QString,unsigned int)));
458
459 // Show progress dialog
460 connect(_clientModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int)));
461
462 rpcConsole->setClientModel(_clientModel);
463
464 updateProxyIcon();
465
466#ifdef ENABLE_WALLET
467 if(walletFrame)
468 {
469 walletFrame->setClientModel(_clientModel);
470 }
471#endif // ENABLE_WALLET
472 unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());
473
474 OptionsModel* optionsModel = _clientModel->getOptionsModel();
475 if(optionsModel)
476 {
477 // be aware of the tray icon disable state change reported by the OptionsModel object.
478 connect(optionsModel,SIGNAL(hideTrayIconChanged(bool)),this,SLOT(setTrayIconVisible(bool)));
479
480 // initialize the disable state of the tray icon with the current value in the model.
481 setTrayIconVisible(optionsModel->getHideTrayIcon());
482 }
483 } else {
484 // Disable possibility to show main window via action
485 toggleHideAction->setEnabled(false);
486 if(trayIconMenu)
487 {
488 // Disable context menu on tray icon
489 trayIconMenu->clear();
490 }
491 // Propagate cleared model to child objects
492 rpcConsole->setClientModel(nullptr);
493#ifdef ENABLE_WALLET
494 if (walletFrame)
495 {

Callers

nothing calls this directly

Calls 11

setKnownBestHeightMethod · 0.80
getHeaderTipHeightMethod · 0.80
getHeaderTipTimeMethod · 0.80
getNumBlocksMethod · 0.80
getLastBlockTimeMethod · 0.80
getHideTrayIconMethod · 0.80
setOptionsModelMethod · 0.45
getOptionsModelMethod · 0.45
setEnabledMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected