Browse Source

qml: move (un)freeze buttons next to can send/receive info

master
Sander van Grieken 3 years ago
parent
commit
58e5891eff
  1. 139
      electrum/gui/qml/components/ChannelDetails.qml
  2. 2
      electrum/gui/qml/components/Constants.qml

139
electrum/gui/qml/components/ChannelDetails.qml

@ -102,15 +102,30 @@ Pane {
color: Material.accentColor
}
FormattedAmount {
visible: !channeldetails.frozenForSending && channeldetails.isOpen
amount: channeldetails.canSend
RowLayout {
visible: channeldetails.isOpen
FormattedAmount {
visible: !channeldetails.frozenForSending
amount: channeldetails.canSend
singleLine: false
}
Label {
visible: channeldetails.frozenForSending
text: qsTr('n/a (frozen)')
}
Item {
Layout.fillWidth: true
Layout.preferredHeight: 1
}
FlatButton {
Layout.minimumWidth: implicitWidth
// icon.source: '../../icons/warning.png'
// icon.color: 'transparent'
text: channeldetails.frozenForSending ? qsTr('Unfreeze') : qsTr('Freeze')
onClicked: channeldetails.freezeForSending()
}
}
Label {
visible: channeldetails.frozenForSending && channeldetails.isOpen
text: qsTr('n/a (frozen)')
}
Label {
visible: !channeldetails.isOpen
text: qsTr('n/a (channel not open)')
@ -121,15 +136,31 @@ Pane {
color: Material.accentColor
}
FormattedAmount {
visible: !channeldetails.frozenForReceiving && channeldetails.isOpen
amount: channeldetails.canReceive
}
RowLayout {
visible: channeldetails.isOpen
FormattedAmount {
visible: !channeldetails.frozenForReceiving
amount: channeldetails.canReceive
singleLine: false
}
Label {
visible: channeldetails.frozenForReceiving && channeldetails.isOpen
text: qsTr('n/a (frozen)')
Label {
visible: channeldetails.frozenForReceiving
text: qsTr('n/a (frozen)')
}
Item {
Layout.fillWidth: true
Layout.preferredHeight: 1
}
FlatButton {
Layout.minimumWidth: implicitWidth
// icon.source: '../../icons/warning.png'
// icon.color: 'transparent'
text: channeldetails.frozenForReceiving ? qsTr('Unfreeze') : qsTr('Freeze')
onClicked: channeldetails.freezeForReceiving()
}
}
Label {
visible: !channeldetails.isOpen
text: qsTr('n/a (channel not open)')
@ -198,66 +229,40 @@ Pane {
icon.source: '../../icons/file.png'
}
RowLayout {
FlatButton {
Layout.fillWidth: true
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Close channel');
enabled: channeldetails.canClose
onClicked: {
var dialog = closechannel.createObject(root, { 'channelid': channelid })
dialog.open()
}
icon.source: '../../icons/closebutton.png'
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Delete channel');
enabled: channeldetails.canDelete
onClicked: {
var dialog = app.messageDialog.createObject(root,
{
'text': qsTr('Are you sure you want to delete this channel? This will purge associated transactions from your wallet history.'),
'yesno': true
}
)
dialog.yesClicked.connect(function() {
channeldetails.deleteChannel()
app.stack.pop()
Daemon.currentWallet.historyModel.init_model() // needed here?
Daemon.currentWallet.channelModel.remove_channel(channelid)
})
dialog.open()
}
icon.source: '../../icons/delete.png'
Layout.preferredWidth: 1
text: qsTr('Close channel');
visible: channeldetails.canClose
onClicked: {
var dialog = closechannel.createObject(root, { 'channelid': channelid })
dialog.open()
}
icon.source: '../../icons/closebutton.png'
}
RowLayout {
FlatButton {
Layout.fillWidth: true
visible: channeldetails.isOpen
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
enabled: channeldetails.isOpen
text: channeldetails.frozenForSending ? qsTr('Unfreeze (for sending)') : qsTr('Freeze (for sending)')
icon.source: '../../icons/seal.png'
onClicked: channeldetails.freezeForSending()
}
FlatButton {
Layout.fillWidth: true
Layout.preferredWidth: 1
enabled: channeldetails.isOpen
text: channeldetails.frozenForReceiving ? qsTr('Unfreeze (for receiving)') : qsTr('Freeze (for receiving)')
icon.source: '../../icons/seal.png'
onClicked: channeldetails.freezeForReceiving()
Layout.preferredWidth: 1
text: qsTr('Delete channel');
visible: channeldetails.canDelete
onClicked: {
var dialog = app.messageDialog.createObject(root,
{
'text': qsTr('Are you sure you want to delete this channel? This will purge associated transactions from your wallet history.'),
'yesno': true
}
)
dialog.yesClicked.connect(function() {
channeldetails.deleteChannel()
app.stack.pop()
Daemon.currentWallet.historyModel.init_model() // needed here?
Daemon.currentWallet.channelModel.remove_channel(channelid)
})
dialog.open()
}
icon.source: '../../icons/delete.png'
}
}
ChannelDetails {

2
electrum/gui/qml/components/Constants.qml

@ -47,7 +47,7 @@ Item {
property color colorAddressInternal: Qt.rgba(1,0.93,0,0.75)
property color colorAddressUsed: Qt.rgba(0.5,0.5,0.5,1)
property color colorAddressUsedWithBalance: Qt.rgba(0.75,0.75,0.75,1)
property color colorAddressFrozen: Qt.rgba(0.5,0.5,1,0.75)
property color colorAddressFrozen: Qt.rgba(0.5,0.5,1,1)
function colorAlpha(baseColor, alpha) {
return Qt.rgba(baseColor.r, baseColor.g, baseColor.b, alpha)

Loading…
Cancel
Save