@@ -128,6 +128,11 @@ void ClientModel::updateNumConnections(int numConnections)
128128 Q_EMIT numConnectionsChanged (numConnections);
129129}
130130
131+ void ClientModel::updateNetworkActive (bool networkActive)
132+ {
133+ Q_EMIT networkActiveChanged (networkActive);
134+ }
135+
131136void ClientModel::updateAlert ()
132137{
133138 Q_EMIT alertsChanged (getStatusBarWarnings ());
@@ -150,6 +155,21 @@ enum BlockSource ClientModel::getBlockSource() const
150155 return BLOCK_SOURCE_NONE;
151156}
152157
158+ void ClientModel::setNetworkActive (bool active)
159+ {
160+ if (g_connman) {
161+ g_connman->SetNetworkActive (active);
162+ }
163+ }
164+
165+ bool ClientModel::getNetworkActive () const
166+ {
167+ if (g_connman) {
168+ return g_connman->GetNetworkActive ();
169+ }
170+ return false ;
171+ }
172+
153173QString ClientModel::getStatusBarWarnings () const
154174{
155175 return QString::fromStdString (GetWarnings (" gui" ));
@@ -216,6 +236,12 @@ static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConn
216236 Q_ARG (int , newNumConnections));
217237}
218238
239+ static void NotifyNetworkActiveChanged (ClientModel *clientmodel, bool networkActive)
240+ {
241+ QMetaObject::invokeMethod (clientmodel, " updateNetworkActive" , Qt::QueuedConnection,
242+ Q_ARG (bool , networkActive));
243+ }
244+
219245static void NotifyAlertChanged (ClientModel *clientmodel)
220246{
221247 qDebug () << " NotifyAlertChanged" ;
@@ -256,6 +282,7 @@ void ClientModel::subscribeToCoreSignals()
256282 // Connect signals to client
257283 uiInterface.ShowProgress .connect (boost::bind (ShowProgress, this , _1, _2));
258284 uiInterface.NotifyNumConnectionsChanged .connect (boost::bind (NotifyNumConnectionsChanged, this , _1));
285+ uiInterface.NotifyNetworkActiveChanged .connect (boost::bind (NotifyNetworkActiveChanged, this , _1));
259286 uiInterface.NotifyAlertChanged .connect (boost::bind (NotifyAlertChanged, this ));
260287 uiInterface.BannedListChanged .connect (boost::bind (BannedListChanged, this ));
261288 uiInterface.NotifyBlockTip .connect (boost::bind (BlockTipChanged, this , _1, _2, false ));
@@ -267,6 +294,7 @@ void ClientModel::unsubscribeFromCoreSignals()
267294 // Disconnect signals from client
268295 uiInterface.ShowProgress .disconnect (boost::bind (ShowProgress, this , _1, _2));
269296 uiInterface.NotifyNumConnectionsChanged .disconnect (boost::bind (NotifyNumConnectionsChanged, this , _1));
297+ uiInterface.NotifyNetworkActiveChanged .disconnect (boost::bind (NotifyNetworkActiveChanged, this , _1));
270298 uiInterface.NotifyAlertChanged .disconnect (boost::bind (NotifyAlertChanged, this ));
271299 uiInterface.BannedListChanged .disconnect (boost::bind (BannedListChanged, this ));
272300 uiInterface.NotifyBlockTip .disconnect (boost::bind (BlockTipChanged, this , _1, _2, false ));
0 commit comments