1
0

qml: make request types clickable, some fixes

This commit is contained in:
Sander van Grieken
2022-09-30 09:27:55 +02:00
parent ae15c0527b
commit fd791f4fb1
5 changed files with 28 additions and 7 deletions

View File

@@ -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
} }

View File

@@ -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
}
} }

View File

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

View File

@@ -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'
}
} }
} }

View File

@@ -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()