mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
refactor: Remove Node:: queries from GUI
This commit is contained in:
parent
06d519f0b4
commit
a0d0f1c6c3
2 changed files with 10 additions and 4 deletions
|
@ -37,6 +37,7 @@
|
||||||
#include <ui_interface.h>
|
#include <ui_interface.h>
|
||||||
#include <util/system.h>
|
#include <util/system.h>
|
||||||
#include <util/translation.h>
|
#include <util/translation.h>
|
||||||
|
#include <validation.h>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -567,7 +568,7 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
|
||||||
connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive);
|
connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive);
|
||||||
|
|
||||||
modalOverlay->setKnownBestHeight(_clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(_clientModel->getHeaderTipTime()));
|
modalOverlay->setKnownBestHeight(_clientModel->getHeaderTipHeight(), QDateTime::fromTime_t(_clientModel->getHeaderTipTime()));
|
||||||
setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), m_node.getVerificationProgress(), false);
|
setNumBlocks(m_node.getNumBlocks(), QDateTime::fromTime_t(m_node.getLastBlockTime()), m_node.getVerificationProgress(), false, SynchronizationState::INIT_DOWNLOAD);
|
||||||
connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
|
connect(_clientModel, &ClientModel::numBlocksChanged, this, &BitcoinGUI::setNumBlocks);
|
||||||
|
|
||||||
// Receive and report messages from client model
|
// Receive and report messages from client model
|
||||||
|
@ -926,11 +927,15 @@ void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab)
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header)
|
void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header, SynchronizationState sync_state)
|
||||||
{
|
{
|
||||||
// Disabling macOS App Nap on initial sync, disk and reindex operations.
|
// Disabling macOS App Nap on initial sync, disk and reindex operations.
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
(m_node.isInitialBlockDownload() || m_node.getReindex() || m_node.getImporting()) ? m_app_nap_inhibitor->disableAppNap() : m_app_nap_inhibitor->enableAppNap();
|
if (sync_state == SynchronizationState::POST_INIT) {
|
||||||
|
m_app_nap_inhibitor->enableAppNap();
|
||||||
|
} else {
|
||||||
|
m_app_nap_inhibitor->disableAppNap();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (modalOverlay)
|
if (modalOverlay)
|
||||||
|
|
|
@ -38,6 +38,7 @@ class WalletFrame;
|
||||||
class WalletModel;
|
class WalletModel;
|
||||||
class HelpMessageDialog;
|
class HelpMessageDialog;
|
||||||
class ModalOverlay;
|
class ModalOverlay;
|
||||||
|
enum class SynchronizationState;
|
||||||
|
|
||||||
namespace interfaces {
|
namespace interfaces {
|
||||||
class Handler;
|
class Handler;
|
||||||
|
@ -213,7 +214,7 @@ public Q_SLOTS:
|
||||||
/** Set network state shown in the UI */
|
/** Set network state shown in the UI */
|
||||||
void setNetworkActive(bool networkActive);
|
void setNetworkActive(bool networkActive);
|
||||||
/** Set number of blocks and last block date shown in the UI */
|
/** Set number of blocks and last block date shown in the UI */
|
||||||
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers);
|
void setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers, SynchronizationState sync_state);
|
||||||
|
|
||||||
/** Notify the user of an event from the core network or transaction handling code.
|
/** Notify the user of an event from the core network or transaction handling code.
|
||||||
@param[in] title the message box / notification title
|
@param[in] title the message box / notification title
|
||||||
|
|
Loading…
Add table
Reference in a new issue