Browse Source

qml: make request types clickable, some fixes

patch-4
Sander van Grieken 2 years ago
parent
commit
fd791f4fb1
  1. 6
      electrum/gui/qml/components/InvoiceDialog.qml
  2. 10
      electrum/gui/qml/components/Pin.qml
  3. 2
      electrum/gui/qml/components/ReceiveDetailsDialog.qml
  4. 15
      electrum/gui/qml/components/ReceiveDialog.qml
  5. 2
      electrum/gui/qml/qewallet.py

6
electrum/gui/qml/components/InvoiceDialog.qml

@ -227,7 +227,7 @@ ElDialog {
Label { Label {
visible: invoice.invoiceType == Invoice.LightningInvoice visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true Layout.fillWidth: true
text: invoice.lnprops.pubkey text: invoice.lnprops ? invoice.lnprops.pubkey : ''
font.family: FixedFont font.family: FixedFont
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
@ -241,7 +241,7 @@ ElDialog {
Label { Label {
visible: invoice.invoiceType == Invoice.LightningInvoice visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true Layout.fillWidth: true
text: invoice.lnprops.t text: invoice.lnprops ? invoice.lnprops.t : ''
font.family: FixedFont font.family: FixedFont
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }
@ -255,7 +255,7 @@ ElDialog {
Label { Label {
visible: invoice.invoiceType == Invoice.LightningInvoice visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true Layout.fillWidth: true
text: invoice.lnprops.r text: invoice.lnprops ? invoice.lnprops.r : ''
font.family: FixedFont font.family: FixedFont
wrapMode: Text.Wrap wrapMode: Text.Wrap
} }

10
electrum/gui/qml/components/Pin.qml

@ -15,8 +15,7 @@ ElDialog {
width: parent.width * 2/3 width: parent.width * 2/3
height: parent.height * 1/3 height: parent.height * 1/3
x: (parent.width - width) / 2 anchors.centerIn: parent
y: (parent.height - height) / 2
modal: true modal: true
parent: Overlay.overlay parent: Overlay.overlay
@ -121,7 +120,7 @@ ElDialog {
TextField { TextField {
id: pin id: pin
Layout.preferredWidth: root.width *2/3 Layout.preferredWidth: fontMetrics.advanceWidth(passwordCharacter) * 6
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
font.pixelSize: constants.fontSizeXXLarge font.pixelSize: constants.fontSizeXXLarge
maximumLength: 6 maximumLength: 6
@ -146,4 +145,9 @@ ElDialog {
Item { Layout.fillHeight: true; Layout.preferredWidth: 1 } Item { Layout.fillHeight: true; Layout.preferredWidth: 1 }
} }
FontMetrics {
id: fontMetrics
font: pin.font
}
} }

2
electrum/gui/qml/components/ReceiveDetailsDialog.qml

@ -25,6 +25,8 @@ ElDialog {
color: "#aa000000" color: "#aa000000"
} }
implicitWidth: parent.width
GridLayout { GridLayout {
id: form id: form
width: parent.width width: parent.width

15
electrum/gui/qml/components/ReceiveDialog.qml

@ -120,6 +120,11 @@ ElDialog {
id: bolt11label id: bolt11label
text: qsTr('Lightning') text: qsTr('Lightning')
color: _bolt11 ? Material.foreground : constants.mutedForeground color: _bolt11 ? Material.foreground : constants.mutedForeground
MouseArea {
anchors.fill: parent
enabled: _bolt11
onClicked: rootLayout.state = 'bolt11'
}
} }
Rectangle { Rectangle {
Layout.preferredWidth: constants.paddingXXSmall Layout.preferredWidth: constants.paddingXXSmall
@ -131,6 +136,11 @@ ElDialog {
id: bip21label id: bip21label
text: qsTr('URI') text: qsTr('URI')
color: _bip21uri ? Material.foreground : constants.mutedForeground color: _bip21uri ? Material.foreground : constants.mutedForeground
MouseArea {
anchors.fill: parent
enabled: _bip21uri
onClicked: rootLayout.state = 'bip21uri'
}
} }
Rectangle { Rectangle {
Layout.preferredWidth: constants.paddingXXSmall Layout.preferredWidth: constants.paddingXXSmall
@ -142,6 +152,11 @@ ElDialog {
id: addresslabel id: addresslabel
text: qsTr('Address') text: qsTr('Address')
color: _address ? Material.foreground : constants.mutedForeground color: _address ? Material.foreground : constants.mutedForeground
MouseArea {
anchors.fill: parent
enabled: _address
onClicked: rootLayout.state = 'address'
}
} }
} }

2
electrum/gui/qml/qewallet.py

@ -534,7 +534,7 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
def createDefaultRequest(self, ignore_gap: bool = False): def createDefaultRequest(self, ignore_gap: bool = False):
try: try:
default_expiry = self.wallet.config.get('request_expiry', PR_DEFAULT_EXPIRATION_WHEN_CREATING) default_expiry = self.wallet.config.get('request_expiry', PR_DEFAULT_EXPIRATION_WHEN_CREATING)
if self.wallet.lnworker.channels: if self.wallet.lnworker and self.wallet.lnworker.channels:
addr = None addr = None
if self.wallet.config.get('bolt11_fallback', True): if self.wallet.config.get('bolt11_fallback', True):
addr = self.wallet.get_unused_address() addr = self.wallet.get_unused_address()

Loading…
Cancel
Save