Browse Source

qml: also show proxy in networkstatusindicator and a little gimmick when a fork is detected

patch-4
Sander van Grieken 3 years ago
parent
commit
93392b8917
  1. 23
      electrum/gui/qml/components/controls/NetworkStatusIndicator.qml
  2. 2
      electrum/gui/qml/qenetwork.py

23
electrum/gui/qml/components/controls/NetworkStatusIndicator.qml

@ -10,6 +10,7 @@ Image {
property bool lagging: connected && Network.isLagging
property bool fork: connected && Network.chaintips > 1
property bool syncing: connected && Daemon.currentWallet && Daemon.currentWallet.synchronizing
property bool proxy: connected && Network.proxy
// ?: in order to keep this a binding..
source: !connected
@ -21,29 +22,38 @@ Image {
? '../../../icons/status_lagging_fork.png'
: '../../../icons/status_lagging.png'
: fork
? '../../../icons/status_connected_fork.png'
: '../../../icons/status_connected.png'
? proxy
? '../../../icons/status_connected_proxy_fork.png'
: '../../../icons/status_connected_fork.png'
: proxy
? '../../../icons/status_connected_proxy.png'
: '../../../icons/status_connected.png'
states: [
State {
name: 'disconnected'
when: !connected
PropertyChanges { target: root; rotation: 0 }
PropertyChanges { target: root; scale: 1.0 }
},
State {
name: 'normal'
when: !(syncing || fork)
PropertyChanges { target: root; rotation: 0 }
PropertyChanges { target: root; scale: 1.0 }
},
State {
name: 'syncing'
when: syncing
PropertyChanges { target: spin; running: true }
PropertyChanges { target: root; scale: 1.0 }
},
State {
name: 'forked'
when: fork
PropertyChanges { target: root; rotation: 0 }
PropertyChanges { target: pulse; running: true }
}
]
@ -55,4 +65,13 @@ Image {
duration: 1000
loops: Animation.Infinite
}
SequentialAnimation {
id: pulse
loops: Animation.Infinite
PauseAnimation { duration: 1000 }
NumberAnimation { target: root; property: 'scale'; from: 1.0; to: 1.5; duration: 200; easing.type: Easing.InCubic }
NumberAnimation { target: root; property: 'scale'; to: 1.0; duration: 500; easing.type: Easing.OutCubic }
PauseAnimation { duration: 30000 }
}
}

2
electrum/gui/qml/qenetwork.py

@ -162,7 +162,7 @@ class QENetwork(QObject, QtEventListener):
@pyqtProperty('QVariantMap', notify=proxyChanged)
def proxy(self):
net_params = self.network.get_parameters()
return net_params
return net_params.proxy if net_params.proxy else {}
@proxy.setter
def proxy(self, proxy_settings):

Loading…
Cancel
Save