[GUI] Add some docs in the QML
This commit is contained in:
parent
e221fabe39
commit
34a3c17af4
2 changed files with 27 additions and 6 deletions
|
|
@ -7,14 +7,21 @@ import Graphene.Client 0.1
|
||||||
|
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
|
/// A component for choosing an Account from the chain
|
||||||
RowLayout {
|
RowLayout {
|
||||||
|
property GrapheneApplication app
|
||||||
|
/// The text to show in the name field when it is empty
|
||||||
|
property alias placeholderText: accountNameField.placeholderText
|
||||||
|
/// Index into the balances Array of the balance to show beneath the name field
|
||||||
|
property int showBalance: -1
|
||||||
|
|
||||||
|
/// The Account object the user has selected
|
||||||
property Account account
|
property Account account
|
||||||
|
/// An Array of Balance objects held by account
|
||||||
property var balances: account? Object.keys(account.balances).map(function(key){return account.balances[key]})
|
property var balances: account? Object.keys(account.balances).map(function(key){return account.balances[key]})
|
||||||
: null
|
: null
|
||||||
|
|
||||||
property alias placeholderText: accountNameField.placeholderText
|
/// Set the name field to have active focus
|
||||||
property int showBalance: -1
|
|
||||||
|
|
||||||
function setFocus() {
|
function setFocus() {
|
||||||
accountNameField.forceActiveFocus()
|
accountNameField.forceActiveFocus()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,21 @@ import Graphene.Client 0.1
|
||||||
|
|
||||||
import "."
|
import "."
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the form for transferring some amount of asset from one account to another.
|
||||||
|
*/
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
id: root
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
property alias senderAccount: senderPicker.account
|
|
||||||
property alias receiverAccount: recipientPicker.account
|
|
||||||
|
|
||||||
property GrapheneApplication app
|
property GrapheneApplication app
|
||||||
signal finished
|
signal finished
|
||||||
|
|
||||||
|
/// The Account object for the sender
|
||||||
|
property alias senderAccount: senderPicker.account
|
||||||
|
/// The Account object for the receiver
|
||||||
|
property alias receiverAccount: recipientPicker.account
|
||||||
|
|
||||||
Component.onCompleted: console.log("Made a transfer form")
|
Component.onCompleted: console.log("Made a transfer form")
|
||||||
Component.onDestruction: console.log("Destroyed a transfer form")
|
Component.onDestruction: console.log("Destroyed a transfer form")
|
||||||
|
|
||||||
|
|
@ -26,6 +32,13 @@ Rectangle {
|
||||||
|
|
||||||
AccountPicker {
|
AccountPicker {
|
||||||
id: senderPicker
|
id: senderPicker
|
||||||
|
// The senderPicker is really the heart of the form. Everything else in the form adjusts based on the account
|
||||||
|
// selected here. The assetField below updates to contain all assets this account has a nonzero balance in.
|
||||||
|
// The amountField updates based on the asset selected in the assetField to have the appropriate precision and
|
||||||
|
// to have a maximum value equal to the account's balance in that asset. The transfer button enables only when
|
||||||
|
// both accounts are set, and a nonzero amount is selected to be transferred.
|
||||||
|
|
||||||
|
app: root.app
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumWidth: Scaling.cm(5)
|
Layout.minimumWidth: Scaling.cm(5)
|
||||||
Component.onCompleted: setFocus()
|
Component.onCompleted: setFocus()
|
||||||
|
|
@ -37,6 +50,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
AccountPicker {
|
AccountPicker {
|
||||||
id: recipientPicker
|
id: recipientPicker
|
||||||
|
app: root.app
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.minimumWidth: Scaling.cm(5)
|
Layout.minimumWidth: Scaling.cm(5)
|
||||||
placeholderText: qsTr("Recipient")
|
placeholderText: qsTr("Recipient")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue