Browse Source

qml: use highlight pane for QR codes, refactor ReceiveDialog invoice select UI.

master
Sander van Grieken 2 years ago
parent
commit
3793a6b6b6
  1. 15
      electrum/gui/qml/components/ExportTxDialog.qml
  2. 18
      electrum/gui/qml/components/GenericShareDialog.qml
  3. 84
      electrum/gui/qml/components/ReceiveDialog.qml
  4. 4
      electrum/gui/qml/components/controls/ButtonContainer.qml
  5. 2
      electrum/gui/qml/components/controls/FlatButton.qml

15
electrum/gui/qml/components/ExportTxDialog.qml

@ -38,15 +38,20 @@ ElDialog {
width: parent.width width: parent.width
spacing: constants.paddingMedium spacing: constants.paddingMedium
Item { TextHighlightPane {
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: qr.height Layout.leftMargin: constants.paddingMedium
Layout.topMargin: constants.paddingSmall Layout.rightMargin: constants.paddingMedium
Layout.bottomMargin: constants.paddingSmall padding: constants.paddingMedium
ColumnLayout {
width: parent.width
QRImage { QRImage {
id: qr id: qr
qrdata: dialog.text_qr qrdata: dialog.text_qr
anchors.centerIn: parent Layout.alignment: Qt.AlignHCenter
Layout.topMargin: constants.paddingMedium
Layout.bottomMargin: constants.paddingMedium
}
} }
} }

18
electrum/gui/qml/components/GenericShareDialog.qml

@ -42,20 +42,28 @@ ElDialog {
width: parent.width width: parent.width
spacing: constants.paddingMedium spacing: constants.paddingMedium
TextHighlightPane {
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.leftMargin: constants.paddingMedium
Layout.rightMargin: constants.paddingMedium
ColumnLayout {
width: parent.width
QRImage { QRImage {
id: qr id: qr
render: dialog.enter ? false : true render: dialog.enter ? false : true
qrdata: dialog.text_qr ? dialog.text_qr : dialog.text qrdata: dialog.text_qr ? dialog.text_qr : dialog.text
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.topMargin: constants.paddingSmall Layout.topMargin: constants.paddingMedium
Layout.bottomMargin: constants.paddingSmall Layout.bottomMargin: constants.paddingMedium
} }
TextHighlightPane { TextHighlightPane {
Layout.leftMargin: constants.paddingMedium
Layout.rightMargin: constants.paddingMedium
Layout.fillWidth: true Layout.fillWidth: true
visible: dialog.text visible: dialog.text
Label { Label {
width: parent.width width: parent.width
text: dialog.text text: dialog.text
@ -66,6 +74,8 @@ ElDialog {
elide: Text.ElideRight elide: Text.ElideRight
} }
} }
}
}
InfoTextArea { InfoTextArea {
Layout.leftMargin: constants.paddingMedium Layout.leftMargin: constants.paddingMedium

84
electrum/gui/qml/components/ReceiveDialog.qml

@ -52,20 +52,29 @@ ElDialog {
State { State {
name: 'bolt11' name: 'bolt11'
PropertyChanges { target: qrloader; sourceComponent: qri_bolt11 } PropertyChanges { target: qrloader; sourceComponent: qri_bolt11 }
PropertyChanges { target: bolt11label; color: Material.accentColor; font.underline: true } // PropertyChanges { target: bolt11label; color: Material.accentColor; font.underline: true }
// PropertyChanges { target: bolt11Button; checked: true }
}, },
State { State {
name: 'bip21uri' name: 'bip21uri'
PropertyChanges { target: qrloader; sourceComponent: qri_bip21uri } PropertyChanges { target: qrloader; sourceComponent: qri_bip21uri }
PropertyChanges { target: bip21label; color: Material.accentColor; font.underline: true } // PropertyChanges { target: bip21label; color: Material.accentColor; font.underline: true }
// PropertyChanges { target: bip21Button; checked: true }
}, },
State { State {
name: 'address' name: 'address'
PropertyChanges { target: qrloader; sourceComponent: qri_address } PropertyChanges { target: qrloader; sourceComponent: qri_address }
PropertyChanges { target: addresslabel; color: Material.accentColor; font.underline: true } // PropertyChanges { target: addresslabel; color: Material.accentColor; font.underline: true }
// PropertyChanges { target: addressButton; checked: true }
} }
] ]
TextHighlightPane {
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
ColumnLayout {
width: parent.width
Rectangle { Rectangle {
id: qrbg id: qrbg
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
@ -107,54 +116,56 @@ ElDialog {
} }
} }
RowLayout { ButtonContainer {
Layout.alignment: Qt.AlignHCenter Layout.fillWidth: true
spacing: constants.paddingLarge showSeparator: false
Label { Component {
id: bolt11label id: _ind
Rectangle {
color: Material.dialogColor
opacity: parent.checked ? 1 : 0
radius: 5
width: parent.width
height: parent.height
Behavior on opacity {
NumberAnimation { duration: 200 }
}
}
}
TabButton {
id: bolt11Button
Layout.fillWidth: true
Layout.preferredWidth: 1
text: qsTr('Lightning') text: qsTr('Lightning')
color: _bolt11 ? Material.foreground : constants.mutedForeground
MouseArea {
anchors.fill: parent
enabled: _bolt11 enabled: _bolt11
checked: rootLayout.state == 'bolt11'
indicator: _ind.createObject()
onClicked: { onClicked: {
rootLayout.state = 'bolt11' rootLayout.state = 'bolt11'
Config.preferredRequestType = 'bolt11' Config.preferredRequestType = 'bolt11'
} }
} }
} TabButton {
Rectangle { id: bip21Button
Layout.preferredWidth: constants.paddingXXSmall Layout.fillWidth: true
Layout.preferredHeight: constants.paddingXXSmall Layout.preferredWidth: 1
radius: constants.paddingXXSmall / 2
color: Material.accentColor
}
Label {
id: bip21label
text: qsTr('URI') text: qsTr('URI')
color: _bip21uri ? Material.foreground : constants.mutedForeground
MouseArea {
anchors.fill: parent
enabled: _bip21uri enabled: _bip21uri
checked: rootLayout.state == 'bip21uri'
indicator: _ind.createObject()
onClicked: { onClicked: {
rootLayout.state = 'bip21uri' rootLayout.state = 'bip21uri'
Config.preferredRequestType = 'bip21uri' Config.preferredRequestType = 'bip21uri'
} }
} }
} TabButton {
Rectangle { id: addressButton
Layout.preferredWidth: constants.paddingXXSmall Layout.fillWidth: true
Layout.preferredHeight: constants.paddingXXSmall Layout.preferredWidth: 1
radius: constants.paddingXXSmall / 2
color: Material.accentColor
}
Label {
id: addresslabel
text: qsTr('Address') text: qsTr('Address')
color: _address ? Material.foreground : constants.mutedForeground checked: rootLayout.state == 'address'
MouseArea { indicator: _ind.createObject()
anchors.fill: parent
enabled: _address
onClicked: { onClicked: {
rootLayout.state = 'address' rootLayout.state = 'address'
Config.preferredRequestType = 'address' Config.preferredRequestType = 'address'
@ -162,6 +173,7 @@ ElDialog {
} }
} }
} }
}
Rectangle { Rectangle {
height: 1 height: 1

4
electrum/gui/qml/components/controls/ButtonContainer.qml

@ -6,6 +6,8 @@ import QtQuick.Controls.Material
Container { Container {
id: root id: root
property bool showSeparator: true
property Item _layout property Item _layout
function fillContentItem() { function fillContentItem() {
@ -48,7 +50,7 @@ Container {
required property int pheight required property int pheight
required property int master_idx required property int master_idx
Layout.fillWidth: false Layout.fillWidth: false
Layout.preferredWidth: 2 Layout.preferredWidth: showSeparator ? 2 : 0
Layout.preferredHeight: pheight Layout.preferredHeight: pheight
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
color: constants.darkerBackground color: constants.darkerBackground

2
electrum/gui/qml/components/controls/FlatButton.qml

@ -11,6 +11,8 @@ TabButton {
property bool textUnderIcon: true property bool textUnderIcon: true
font.pixelSize: constants.fontSizeSmall font.pixelSize: constants.fontSizeSmall
icon.width: constants.iconSizeMedium
icon.height: constants.iconSizeMedium
display: textUnderIcon ? IconLabel.TextUnderIcon : IconLabel.TextBesideIcon display: textUnderIcon ? IconLabel.TextUnderIcon : IconLabel.TextBesideIcon
contentItem: IconLabel { contentItem: IconLabel {

Loading…
Cancel
Save