|
|
|
@ -9,6 +9,10 @@ Item { |
|
|
|
property Amount capacity |
|
|
|
property Amount capacity |
|
|
|
property Amount localCapacity |
|
|
|
property Amount localCapacity |
|
|
|
property Amount remoteCapacity |
|
|
|
property Amount remoteCapacity |
|
|
|
|
|
|
|
property Amount canSend |
|
|
|
|
|
|
|
property Amount canReceive |
|
|
|
|
|
|
|
property bool frozenForSending: false |
|
|
|
|
|
|
|
property bool frozenForReceiving: false |
|
|
|
|
|
|
|
|
|
|
|
height: 10 |
|
|
|
height: 10 |
|
|
|
implicitWidth: 100 |
|
|
|
implicitWidth: 100 |
|
|
|
@ -16,32 +20,56 @@ Item { |
|
|
|
onWidthChanged: { |
|
|
|
onWidthChanged: { |
|
|
|
var cap = capacity.satsInt * 1000 |
|
|
|
var cap = capacity.satsInt * 1000 |
|
|
|
var twocap = cap * 2 |
|
|
|
var twocap = cap * 2 |
|
|
|
b1.width = width * (cap - localCapacity.msatsInt) / twocap |
|
|
|
l1.width = width * (cap - localCapacity.msatsInt) / twocap |
|
|
|
b2.width = width * localCapacity.msatsInt / twocap |
|
|
|
if (frozenForSending) { |
|
|
|
b3.width = width * remoteCapacity.msatsInt / twocap |
|
|
|
l2.width = width * localCapacity.msatsInt / twocap |
|
|
|
b4.width = width * (cap - remoteCapacity.msatsInt) / twocap |
|
|
|
l3.width = 0 |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
l2.width = width * (localCapacity.msatsInt - canSend.msatsInt) / twocap |
|
|
|
|
|
|
|
l3.width = width * canSend.msatsInt / twocap |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (frozenForReceiving) { |
|
|
|
|
|
|
|
r3.width = 0 |
|
|
|
|
|
|
|
r2.width = width * remoteCapacity.msatsInt / twocap |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
r3.width = width * canReceive.msatsInt / twocap |
|
|
|
|
|
|
|
r2.width = width * (remoteCapacity.msatsInt - canReceive.msatsInt) / twocap |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
r1.width = width * (cap - remoteCapacity.msatsInt) / twocap |
|
|
|
} |
|
|
|
} |
|
|
|
Rectangle { |
|
|
|
Rectangle { |
|
|
|
id: b1 |
|
|
|
id: l1 |
|
|
|
x: 0 |
|
|
|
x: 0 |
|
|
|
height: parent.height |
|
|
|
height: parent.height |
|
|
|
color: 'gray' |
|
|
|
color: 'gray' |
|
|
|
} |
|
|
|
} |
|
|
|
Rectangle { |
|
|
|
Rectangle { |
|
|
|
id: b2 |
|
|
|
id: l2 |
|
|
|
anchors.left: b1.right |
|
|
|
anchors.left: l1.right |
|
|
|
|
|
|
|
height: parent.height |
|
|
|
|
|
|
|
color: constants.colorLightningLocalReserve |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
|
|
|
id: l3 |
|
|
|
|
|
|
|
anchors.left: l2.right |
|
|
|
height: parent.height |
|
|
|
height: parent.height |
|
|
|
color: constants.colorLightningLocal |
|
|
|
color: constants.colorLightningLocal |
|
|
|
} |
|
|
|
} |
|
|
|
Rectangle { |
|
|
|
Rectangle { |
|
|
|
id: b3 |
|
|
|
id: r3 |
|
|
|
anchors.left: b2.right |
|
|
|
anchors.left: l3.right |
|
|
|
height: parent.height |
|
|
|
height: parent.height |
|
|
|
color: constants.colorLightningRemote |
|
|
|
color: constants.colorLightningRemote |
|
|
|
} |
|
|
|
} |
|
|
|
Rectangle { |
|
|
|
Rectangle { |
|
|
|
id: b4 |
|
|
|
id: r2 |
|
|
|
anchors.left: b3.right |
|
|
|
anchors.left: r3.right |
|
|
|
|
|
|
|
height: parent.height |
|
|
|
|
|
|
|
color: constants.colorLightningRemoteReserve |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Rectangle { |
|
|
|
|
|
|
|
id: r1 |
|
|
|
|
|
|
|
anchors.left: r2.right |
|
|
|
height: parent.height |
|
|
|
height: parent.height |
|
|
|
color: 'gray' |
|
|
|
color: 'gray' |
|
|
|
} |
|
|
|
} |
|
|
|
|