add fiat<->sat conversion methods and hook up UI
This commit is contained in:
@@ -8,10 +8,10 @@ Pane {
|
||||
|
||||
GridLayout {
|
||||
width: parent.width
|
||||
columns: 4
|
||||
columns: 6
|
||||
|
||||
BalanceSummary {
|
||||
Layout.columnSpan: 4
|
||||
Layout.columnSpan: 6
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ Pane {
|
||||
|
||||
TextField {
|
||||
id: address
|
||||
Layout.columnSpan: 2
|
||||
Layout.columnSpan: 4
|
||||
Layout.fillWidth: true
|
||||
font.family: FixedFont
|
||||
placeholderText: qsTr('Paste address or invoice')
|
||||
@@ -46,11 +46,26 @@ Pane {
|
||||
}
|
||||
|
||||
Label {
|
||||
text: Config.baseUnit
|
||||
text: Config.baseUnit + ' ' // add spaces for easy right margin
|
||||
color: Material.accentColor
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: amountFiat
|
||||
visible: Config.fiatCurrency != ''
|
||||
font.family: FixedFont
|
||||
placeholderText: qsTr('Amount')
|
||||
inputMethodHints: Qt.ImhPreferNumbers
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: Config.fiatCurrency != ''
|
||||
text: Config.fiatCurrency
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
Item { visible: Config.fiatCurrency == ''; height: 1; Layout.columnSpan: 2; Layout.fillWidth: true }
|
||||
|
||||
Item { width: 1; height: 1 } // workaround colspan on baseunit messing up row above
|
||||
|
||||
Label {
|
||||
@@ -61,11 +76,11 @@ Pane {
|
||||
id: fee
|
||||
font.family: FixedFont
|
||||
placeholderText: qsTr('sat/vB')
|
||||
Layout.columnSpan: 3
|
||||
Layout.columnSpan: 5
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.columnSpan: 4
|
||||
Layout.columnSpan: 6
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
spacing: 10
|
||||
|
||||
@@ -94,6 +109,31 @@ Pane {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: amount
|
||||
function onTextChanged() {
|
||||
if (amountFiat.activeFocus)
|
||||
return
|
||||
var a = Config.unitsToSats(amount.text)
|
||||
amountFiat.text = Daemon.fiatValue(a)
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: amountFiat
|
||||
function onTextChanged() {
|
||||
if (amountFiat.activeFocus) {
|
||||
amount.text = Daemon.satoshiValue(amountFiat.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: Network
|
||||
function onFiatUpdated() {
|
||||
var a = Config.unitsToSats(amount.text)
|
||||
amountFiat.text = Daemon.fiatValue(a)
|
||||
}
|
||||
}
|
||||
|
||||
// make clicking the dialog background move the scope away from textedit fields
|
||||
// so the keyboard goes away
|
||||
MouseArea {
|
||||
|
||||
Reference in New Issue
Block a user