remove hasIcon and image props

This commit is contained in:
Iuri Matias 2020-06-11 16:12:01 -04:00
parent 36b2ae5a66
commit b1ce63b64c
4 changed files with 6 additions and 13 deletions

View File

@ -7,9 +7,7 @@ type
Name = UserRole + 1,
Symbol = UserRole + 2,
Value = UserRole + 3,
FiatValue = UserRole + 4,
Image = UserRole + 5
HasIcon = UserRole + 6
FiatValue = UserRole + 4
QtObject:
type AssetList* = ref object of QAbstractListModel
@ -41,16 +39,12 @@ QtObject:
of AssetRoles.Symbol: result = newQVariant(asset.symbol)
of AssetRoles.Value: result = newQVariant(asset.value)
of AssetRoles.FiatValue: result = newQVariant(asset.fiatValue)
of AssetRoles.Image: result = newQVariant(asset.image)
of AssetRoles.HasIcon: result = newQVariant(asset.hasIcon)
method roleNames(self: AssetList): Table[int, string] =
{ AssetRoles.Name.int:"name",
AssetRoles.Symbol.int:"symbol",
AssetRoles.Value.int:"value",
AssetRoles.FiatValue.int:"fiatValue",
AssetRoles.Image.int:"image",
AssetRoles.Image.int:"hasIcon" }.toTable
AssetRoles.FiatValue.int:"fiatValue" }.toTable
proc addAssetToList*(self: AssetList, asset: Asset) =
self.beginInsertRows(newQModelIndex(), self.assets.len, self.assets.len)

View File

@ -53,11 +53,11 @@ proc setDefaultCurrency*(self: WalletModel, currency: string) =
proc generateAccountConfiguredAssets*(self: WalletModel, accountAddress: string): seq[Asset] =
var assets: seq[Asset] = @[]
var asset = Asset(name:"Ethereum", symbol: "ETH", value: "0.0", fiatValue: "0.0", image: fmt"../../img/token-icons/eth.svg", hasIcon: true, accountAddress: accountAddress)
var asset = Asset(name:"Ethereum", symbol: "ETH", value: "0.0", fiatValue: "0.0", accountAddress: accountAddress)
assets.add(asset)
for token in self.tokens:
var symbol = token["symbol"].getStr
var existingToken = Asset(name: token["name"].getStr, symbol: symbol, value: fmt"0.0", fiatValue: "$0.0", image: fmt"../../img/token-icons/{toLowerAscii(symbol)}.svg", hasIcon: true, accountAddress: accountAddress, address: token["address"].getStr)
var existingToken = Asset(name: token["name"].getStr, symbol: symbol, value: fmt"0.0", fiatValue: "$0.0", accountAddress: accountAddress, address: token["address"].getStr)
assets.add(existingToken)
assets

View File

@ -4,8 +4,7 @@ type CurrencyArgs* = ref object of Args
currency*: string
type Asset* = ref object
name*, symbol*, value*, fiatValue*, image*, accountAddress*, address*: string
hasIcon*: bool
name*, symbol*, value*, fiatValue*, accountAddress*, address*: string
type WalletAccount* = ref object
name*, address*, iconColor*, balance*, path*, walletType*, publicKey*: string

View File

@ -17,7 +17,7 @@ Item {
id: assetInfoImage
width: 36
height: 36
source: hasIcon ? "../../img/tokens/" + symbol + ".png" : "../../img/tokens/0-native.png"
source: "../../img/tokens/" + symbol + ".png"
anchors.left: parent.left
anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter