add fiat<->sat conversion methods and hook up UI
This commit is contained in:
@@ -81,16 +81,20 @@ Pane {
|
||||
|
||||
TextField {
|
||||
id: amountFiat
|
||||
visible: Config.fiatCurrency != ''
|
||||
font.family: FixedFont
|
||||
Layout.fillWidth: true
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
}
|
||||
|
||||
Label {
|
||||
text: qsTr('EUR')
|
||||
visible: Config.fiatCurrency != ''
|
||||
text: Config.fiatCurrency
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
Item { visible: Config.fiatCurrency == ''; width: 1; height: 1; Layout.columnSpan: 2 }
|
||||
|
||||
RowLayout {
|
||||
Layout.columnSpan: 4
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
@@ -346,4 +350,29 @@ 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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user