parent
a57fb330bd
commit
defefa1bfe
|
@ -1 +1 @@
|
|||
Subproject commit ce8d3231be71f26c4fb7de9a510edbd6c31a7800
|
||||
Subproject commit 2040d0f8578e5adadeb9d291511d25a1eda79595
|
|
@ -50,9 +50,9 @@ StatusModal {
|
|||
|
||||
StatusAccountSelector {
|
||||
id: selectFromAccount
|
||||
accounts: root.store.walletModelInst.accountsView.accounts
|
||||
accounts: root.store.accounts
|
||||
selectedAccount: {
|
||||
const currAcc = root.store.walletModelInst.accountsView.currentAccount
|
||||
const currAcc = root.store.currentAccount
|
||||
if (currAcc.walletType !== Constants.watchWalletType) {
|
||||
return currAcc
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ StatusModal {
|
|||
id: txtAmount
|
||||
selectedAccount: selectFromAccount.selectedAccount
|
||||
defaultCurrency: root.store.walletModelInst.balanceView.defaultCurrency
|
||||
currentCurrency: root.store.currentCurrency
|
||||
getFiatValue: root.store.walletModelInst.balanceView.getFiatValue
|
||||
getCryptoValue: root.store.walletModelInst.balanceView.getCryptoValue
|
||||
validateBalance: !root.isRequested
|
||||
|
|
|
@ -18,6 +18,10 @@ QtObject {
|
|||
|
||||
property var activeCommunity: chatsModelInst.communities.activeCommunity
|
||||
|
||||
property var accounts: walletSectionAccounts.model
|
||||
property var currentAccount: walletSectionCurrent
|
||||
property var currentCurrency: walletSection.currentCurrency
|
||||
|
||||
function copyToClipboard(text) {
|
||||
chatsModelInst.copyToClipboard(text);
|
||||
}
|
||||
|
|
|
@ -5,9 +5,10 @@ import QtGraphicalEffects 1.13
|
|||
|
||||
import utils 1.0
|
||||
|
||||
import StatusQ.Controls 0.1
|
||||
|
||||
import "../"
|
||||
import "../panels"
|
||||
import "../controls"
|
||||
import "."
|
||||
|
||||
Item {
|
||||
|
@ -20,6 +21,7 @@ Item {
|
|||
//% "Please enter an amount"
|
||||
property string noInputErrorMessage: qsTrId("please-enter-an-amount")
|
||||
property string defaultCurrency: "USD"
|
||||
property string currentCurrency: ""
|
||||
property alias selectedFiatAmount: txtFiatBalance.text
|
||||
property alias selectedAmount: inputAmount.text
|
||||
property var selectedAccount
|
||||
|
@ -165,22 +167,29 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
AssetSelector {
|
||||
id: selectAsset
|
||||
width: 86
|
||||
height: 28
|
||||
anchors.top: inputAmount.top
|
||||
anchors.topMargin: Style.current.bigPadding + 14
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.current.smallPadding
|
||||
onSelectedAssetChanged: {
|
||||
if (!selectAsset.selectedAsset) {
|
||||
return
|
||||
}
|
||||
txtBalance.text = Utils.stripTrailingZeros(selectAsset.selectedAsset.value)
|
||||
if (inputAmount.text === "" || isNaN(inputAmount.text)) {
|
||||
return
|
||||
}
|
||||
StatusAssetSelector {
|
||||
id: selectAsset
|
||||
width: 86
|
||||
height: 28
|
||||
anchors.top: inputAmount.top
|
||||
anchors.topMargin: Style.current.bigPadding + 14
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: Style.current.smallPadding
|
||||
defaultToken: Style.png("tokens/DEFAULT-TOKEN@3x")
|
||||
getCurrencyBalanceString: function (currencyBalance) {
|
||||
return Utils.toLocaleString(currencyBalance.toFixed(2), localAppSettings.locale, {"currency": true}) + " " + root.currentCurrency.toUpperCase()
|
||||
}
|
||||
tokenAssetSourceFn: function (symbol) {
|
||||
return symbol ? Style.png("tokens/" + symbol) : defaultToken
|
||||
}
|
||||
onSelectedAssetChanged: {
|
||||
if (!selectAsset.selectedAsset) {
|
||||
return
|
||||
}
|
||||
txtBalance.text = Utils.stripTrailingZeros(parseFloat(selectAsset.selectedAsset.balance).toFixed(4))
|
||||
if (inputAmount.text === "" || isNaN(inputAmount.text)) {
|
||||
return
|
||||
}
|
||||
txtFiatBalance.text = root.getFiatValue(inputAmount.text, selectAsset.selectedAsset.symbol, root.defaultCurrency)
|
||||
root.validate(true)
|
||||
}
|
||||
|
|
|
@ -1,151 +0,0 @@
|
|||
import QtQuick 2.13
|
||||
import QtQuick.Controls 2.13
|
||||
import QtQuick.Layouts 1.13
|
||||
import QtGraphicalEffects 1.13
|
||||
|
||||
import StatusQ.Core 0.1
|
||||
import StatusQ.Core.Theme 0.1
|
||||
import StatusQ.Controls 0.1
|
||||
import StatusQ.Components 0.1
|
||||
|
||||
import utils 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
property var assets
|
||||
property var selectedAsset
|
||||
width: 86
|
||||
height: 24
|
||||
|
||||
function resetInternal() {
|
||||
assets = undefined
|
||||
selectedAsset = undefined
|
||||
}
|
||||
|
||||
onSelectedAssetChanged: {
|
||||
if (selectedAsset && selectedAsset.symbol) {
|
||||
iconImg.image.source = Style.png("tokens/" + selectedAsset.symbol.toUpperCase())
|
||||
selectedTextField.text = selectedAsset.symbol.toUpperCase()
|
||||
}
|
||||
}
|
||||
|
||||
onAssetsChanged: {
|
||||
if (!assets) {
|
||||
return
|
||||
}
|
||||
|
||||
selectedAsset = {
|
||||
name: assets.rowData(0, "name"),
|
||||
symbol: assets.rowData(0, "symbol"),
|
||||
value: assets.rowData(0, "balance"),
|
||||
fiatBalanceDisplay: assets.rowData(0, "currencyBalance"),
|
||||
address: assets.rowData(0, "address"),
|
||||
fiatBalance: assets.rowData(0, "currencyBalance")
|
||||
}
|
||||
}
|
||||
|
||||
StatusSelect {
|
||||
id: select
|
||||
width: parent.width
|
||||
bgColor: Style.current.transparent
|
||||
bgColorHover: Style.current.secondaryHover
|
||||
model: root.assets
|
||||
caretRightMargin: 0
|
||||
select.radius: 6
|
||||
select.height: root.height
|
||||
selectMenu.width: 342
|
||||
selectedItemComponent: Item {
|
||||
anchors.fill: parent
|
||||
StatusRoundedImage {
|
||||
id: iconImg
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 4
|
||||
width: 24
|
||||
height: 24
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
StatusBaseText {
|
||||
id: selectedTextField
|
||||
anchors.left: iconImg.right
|
||||
anchors.leftMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font.pixelSize: 15
|
||||
height: 22
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
color: Theme.palette.directColor1
|
||||
}
|
||||
}
|
||||
selectMenu.delegate: menuItem
|
||||
}
|
||||
|
||||
Component {
|
||||
id: menuItem
|
||||
MenuItem {
|
||||
id: itemContainer
|
||||
property bool isFirstItem: index === 0
|
||||
property bool isLastItem: index === assets.count - 1
|
||||
|
||||
width: parent.width
|
||||
height: 72
|
||||
StatusRoundedImage {
|
||||
id: iconImg
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
image.source: Style.png("tokens/" + symbol.toUpperCase())
|
||||
}
|
||||
Column {
|
||||
anchors.left: iconImg.right
|
||||
anchors.leftMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
StatusBaseText {
|
||||
text: symbol.toUpperCase()
|
||||
font.pixelSize: 15
|
||||
color: Theme.palette.directColor1
|
||||
}
|
||||
|
||||
StatusBaseText {
|
||||
text: name
|
||||
color: Theme.palette.baseColor1
|
||||
font.pixelSize: 15
|
||||
}
|
||||
}
|
||||
Column {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 16
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
StatusBaseText {
|
||||
font.pixelSize: 15
|
||||
text: parseFloat(balance).toFixed(4) + " " + symbol
|
||||
color: Theme.palette.directColor1
|
||||
}
|
||||
StatusBaseText {
|
||||
font.pixelSize: 15
|
||||
anchors.right: parent.right
|
||||
height: 22
|
||||
text: currencyBalance.toString().toUpperCase()
|
||||
color: Theme.palette.baseColor1
|
||||
}
|
||||
}
|
||||
background: Rectangle {
|
||||
color: itemContainer.highlighted ? Theme.palette.statusSelect.menuItemHoverBackgroundColor : Theme.palette.statusSelect.menuItemBackgroundColor
|
||||
}
|
||||
MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
anchors.fill: itemContainer
|
||||
onClicked: {
|
||||
root.selectedAsset = { address, name, balance, symbol, currencyBalance, fiatBalanceDisplay: "" }
|
||||
select.selectMenu.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*##^##
|
||||
Designer {
|
||||
D{i:0;autoSize:true;height:480;width:640}
|
||||
}
|
||||
##^##*/
|
|
@ -1,7 +1,6 @@
|
|||
AddressInput 1.0 AddressInput.qml
|
||||
AddressSourceSelector 1.0 AddressSourceSelector.qml
|
||||
AssetAndAmountInput 1.0 AssetAndAmountInput.qml
|
||||
AssetSelector 1.0 AssetSelector.qml
|
||||
ContactSelector 1.0 ContactSelector.qml
|
||||
ContactsListAndSearch 1.0 ContactsListAndSearch.qml
|
||||
CopyToClipBoardButton 1.0 CopyToClipBoardButton.qml
|
||||
|
|
|
@ -127,6 +127,7 @@ ModalPopup {
|
|||
id: txtAmount
|
||||
selectedAccount: selectFromAccount.selectedAccount
|
||||
defaultCurrency: walletModel.balanceView.defaultCurrency
|
||||
currentCurrency: walletSection.currentCurrency
|
||||
getFiatValue: walletModel.balanceView.getFiatValue
|
||||
getCryptoValue: walletModel.balanceView.getCryptoValue
|
||||
width: stack.width
|
||||
|
|
Loading…
Reference in New Issue