mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-08 21:59:10 +02: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:
@@ -458,6 +458,9 @@ void RPCConsole::setClientModel(ClientModel *model)
|
||||
setNumBlocks(model->getNumBlocks(), model->getLastBlockDate(), model->getVerificationProgress(NULL), false);
|
||||
connect(model, SIGNAL(numBlocksChanged(int,QDateTime,double,bool)), this, SLOT(setNumBlocks(int,QDateTime,double,bool)));
|
||||
|
||||
updateNetworkState();
|
||||
connect(model, SIGNAL(networkActiveChanged(bool)), this, SLOT(setNetworkActive(bool)));
|
||||
|
||||
updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent());
|
||||
connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64)));
|
||||
|
||||
@@ -674,16 +677,30 @@ void RPCConsole::message(int category, const QString &message, bool html)
|
||||
ui->messagesWidget->append(out);
|
||||
}
|
||||
|
||||
void RPCConsole::updateNetworkState()
|
||||
{
|
||||
QString connections = QString::number(clientModel->getNumConnections()) + " (";
|
||||
connections += tr("In:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / ";
|
||||
connections += tr("Out:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")";
|
||||
|
||||
if(!clientModel->getNetworkActive()) {
|
||||
connections += " (" + tr("Network activity disabled") + ")";
|
||||
}
|
||||
|
||||
ui->numberOfConnections->setText(connections);
|
||||
}
|
||||
|
||||
void RPCConsole::setNumConnections(int count)
|
||||
{
|
||||
if (!clientModel)
|
||||
return;
|
||||
|
||||
QString connections = QString::number(count) + " (";
|
||||
connections += tr("In:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_IN)) + " / ";
|
||||
connections += tr("Out:") + " " + QString::number(clientModel->getNumConnections(CONNECTIONS_OUT)) + ")";
|
||||
updateNetworkState();
|
||||
}
|
||||
|
||||
ui->numberOfConnections->setText(connections);
|
||||
void RPCConsole::setNetworkActive(bool networkActive)
|
||||
{
|
||||
updateNetworkState();
|
||||
}
|
||||
|
||||
void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers)
|
||||
@@ -1069,3 +1086,8 @@ void RPCConsole::setTabFocus(enum TabTypes tabType)
|
||||
{
|
||||
ui->tabWidget->setCurrentIndex(tabType);
|
||||
}
|
||||
|
||||
void RPCConsole::on_toggleNetworkActiveButton_clicked()
|
||||
{
|
||||
clientModel->setNetworkActive(!clientModel->getNetworkActive());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user