mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 05:34:57 +01:00
Merge #8996: Network activity toggle
19f46f1Qt: New network_disabled icon (Luke Dashjr)54cf997RPC/Net: Use boolean consistently for networkactive, and remove from getinfo (Luke Dashjr)b2b33d9Overhaul network activity toggle (Jonas Schnelli)32efa79Qt: Add GUI feedback and control of network activity state. (Jon Lund Steffensen)e38993bRPC: Add "togglenetwork" method to toggle network activity temporarily (Jon Lund Steffensen)7c9a98aAllow network activity to be temporarily suspended. (Jon Lund Steffensen)
This commit is contained in:
@@ -145,6 +145,11 @@ void ClientModel::updateNumConnections(int numConnections)
|
||||
Q_EMIT numConnectionsChanged(numConnections);
|
||||
}
|
||||
|
||||
void ClientModel::updateNetworkActive(bool networkActive)
|
||||
{
|
||||
Q_EMIT networkActiveChanged(networkActive);
|
||||
}
|
||||
|
||||
void ClientModel::updateAlert()
|
||||
{
|
||||
Q_EMIT alertsChanged(getStatusBarWarnings());
|
||||
@@ -167,6 +172,21 @@ enum BlockSource ClientModel::getBlockSource() const
|
||||
return BLOCK_SOURCE_NONE;
|
||||
}
|
||||
|
||||
void ClientModel::setNetworkActive(bool active)
|
||||
{
|
||||
if (g_connman) {
|
||||
g_connman->SetNetworkActive(active);
|
||||
}
|
||||
}
|
||||
|
||||
bool ClientModel::getNetworkActive() const
|
||||
{
|
||||
if (g_connman) {
|
||||
return g_connman->GetNetworkActive();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString ClientModel::getStatusBarWarnings() const
|
||||
{
|
||||
return QString::fromStdString(GetWarnings("gui"));
|
||||
@@ -233,6 +253,12 @@ static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConn
|
||||
Q_ARG(int, newNumConnections));
|
||||
}
|
||||
|
||||
static void NotifyNetworkActiveChanged(ClientModel *clientmodel, bool networkActive)
|
||||
{
|
||||
QMetaObject::invokeMethod(clientmodel, "updateNetworkActive", Qt::QueuedConnection,
|
||||
Q_ARG(bool, networkActive));
|
||||
}
|
||||
|
||||
static void NotifyAlertChanged(ClientModel *clientmodel)
|
||||
{
|
||||
qDebug() << "NotifyAlertChanged";
|
||||
@@ -273,6 +299,7 @@ void ClientModel::subscribeToCoreSignals()
|
||||
// Connect signals to client
|
||||
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
|
||||
uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1));
|
||||
uiInterface.NotifyNetworkActiveChanged.connect(boost::bind(NotifyNetworkActiveChanged, this, _1));
|
||||
uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this));
|
||||
uiInterface.BannedListChanged.connect(boost::bind(BannedListChanged, this));
|
||||
uiInterface.NotifyBlockTip.connect(boost::bind(BlockTipChanged, this, _1, _2, false));
|
||||
@@ -284,6 +311,7 @@ void ClientModel::unsubscribeFromCoreSignals()
|
||||
// Disconnect signals from client
|
||||
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
|
||||
uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1));
|
||||
uiInterface.NotifyNetworkActiveChanged.disconnect(boost::bind(NotifyNetworkActiveChanged, this, _1));
|
||||
uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this));
|
||||
uiInterface.BannedListChanged.disconnect(boost::bind(BannedListChanged, this));
|
||||
uiInterface.NotifyBlockTip.disconnect(boost::bind(BlockTipChanged, this, _1, _2, false));
|
||||
|
||||
Reference in New Issue
Block a user