[GUI] Fixes in transfer form

This commit is contained in:
Nathan Hourt 2015-07-17 16:06:07 -04:00
parent 0fe9276c44
commit e221fabe39
2 changed files with 8 additions and 7 deletions

View file

@ -28,9 +28,10 @@ RowLayout {
Layout.fillWidth: true Layout.fillWidth: true
TextField { TextField {
id: accountNameField id: accountNameField
width: parent.width width: parent.width
onEditingFinished: accountDetails.update(text) onEditingFinished: accountDetails.update(text)
onTextChanged: if (account && account.name !== text) accountDetails.update("")
} }
Text { Text {
id: accountDetails id: accountDetails
@ -57,8 +58,8 @@ RowLayout {
var text = qsTr("Account ID: %1").arg(account.id < 0? qsTr("Loading...") var text = qsTr("Account ID: %1").arg(account.id < 0? qsTr("Loading...")
: account.id) : account.id)
if (showBalance >= 0) { if (showBalance >= 0) {
text += "\n" + qsTr("Balance: %1 %2").arg(balances[showBalance].amountReal()) var bal = balances[showBalance]
.arg(balances[showBalance].type.symbol) text += "\n" + qsTr("Balance: %1 %2").arg(String(bal.amountReal())).arg(bal.type.symbol)
} }
return text return text
}) })

View file

@ -58,13 +58,13 @@ Rectangle {
maximumValue: maxBalance? maxBalance.amountReal() : 0 maximumValue: maxBalance? maxBalance.amountReal() : 0
decimals: maxBalance? maxBalance.type.precision : 0 decimals: maxBalance? maxBalance.type.precision : 0
property Balance maxBalance: senderPicker.balances && senderPicker.showBalance >= 0? property Balance maxBalance: assetField.enabled && senderPicker.showBalance >= 0?
senderPicker.balances[senderPicker.showBalance] : null senderPicker.balances[senderPicker.showBalance] : null
} }
ComboBox { ComboBox {
id: assetField id: assetField
Layout.minimumWidth: Scaling.cm(3) Layout.minimumWidth: Scaling.cm(3)
enabled: Boolean(senderPicker.balances) enabled: senderPicker.balances instanceof Array && senderPicker.balances.length > 0
model: enabled? senderPicker.balances.filter(function(balance) { return balance.amount > 0 }) model: enabled? senderPicker.balances.filter(function(balance) { return balance.amount > 0 })
.map(function(balance) { return balance.type.symbol }) .map(function(balance) { return balance.type.symbol })
: ["Asset Type"] : ["Asset Type"]
@ -76,7 +76,7 @@ Rectangle {
} }
Button { Button {
text: qsTr("Transfer") text: qsTr("Transfer")
enabled: senderPicker.account enabled: senderPicker.account && recipientPicker.account && senderPicker.account !== recipientPicker.account && amountField.value
onClicked: console.log(amountField.value) onClicked: console.log(amountField.value)
} }
} }