| 987 | } |
| 988 | |
| 989 | void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header, SynchronizationState sync_state) |
| 990 | { |
| 991 | // Disabling macOS App Nap on initial sync, disk and reindex operations. |
| 992 | #ifdef Q_OS_MAC |
| 993 | if (sync_state == SynchronizationState::POST_INIT) { |
| 994 | m_app_nap_inhibitor->enableAppNap(); |
| 995 | } else { |
| 996 | m_app_nap_inhibitor->disableAppNap(); |
| 997 | } |
| 998 | #endif |
| 999 | |
| 1000 | if (modalOverlay) |
| 1001 | { |
| 1002 | if (header) |
| 1003 | modalOverlay->setKnownBestHeight(count, blockDate); |
| 1004 | else |
| 1005 | modalOverlay->tipUpdate(count, blockDate, nVerificationProgress); |
| 1006 | } |
| 1007 | if (!clientModel) |
| 1008 | return; |
| 1009 | |
| 1010 | // Prevent orphan statusbar messages (e.g. hover Quit in main menu, wait until chain-sync starts -> garbled text) |
| 1011 | statusBar()->clearMessage(); |
| 1012 | |
| 1013 | // Acquire current block source |
| 1014 | enum BlockSource blockSource = clientModel->getBlockSource(); |
| 1015 | switch (blockSource) { |
| 1016 | case BlockSource::NETWORK: |
| 1017 | if (header) { |
| 1018 | updateHeadersSyncProgressLabel(); |
| 1019 | return; |
| 1020 | } |
| 1021 | progressBarLabel->setText(tr("Synchronizing with network…")); |
| 1022 | updateHeadersSyncProgressLabel(); |
| 1023 | break; |
| 1024 | case BlockSource::DISK: |
| 1025 | if (header) { |
| 1026 | progressBarLabel->setText(tr("Indexing blocks on disk…")); |
| 1027 | } else { |
| 1028 | progressBarLabel->setText(tr("Processing blocks on disk…")); |
| 1029 | } |
| 1030 | break; |
| 1031 | case BlockSource::REINDEX: |
| 1032 | progressBarLabel->setText(tr("Reindexing blocks on disk…")); |
| 1033 | break; |
| 1034 | case BlockSource::NONE: |
| 1035 | if (header) { |
| 1036 | return; |
| 1037 | } |
| 1038 | progressBarLabel->setText(tr("Connecting to peers…")); |
| 1039 | break; |
| 1040 | } |
| 1041 | |
| 1042 | QString tooltip; |
| 1043 | |
| 1044 | QDateTime currentDate = QDateTime::currentDateTime(); |
| 1045 | qint64 secs = blockDate.secsTo(currentDate); |
| 1046 |
nothing calls this directly
no test coverage detected