From b1ce63b64c70c15eeb61f55a77143b48b0bfc34e Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 11 Jun 2020 16:12:01 -0400 Subject: [PATCH] remove hasIcon and image props --- src/app/wallet/views/asset_list.nim | 10 ++-------- src/status/wallet.nim | 4 ++-- src/status/wallet/account.nim | 3 +-- ui/app/AppLayouts/Wallet/AssetsTab.qml | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/app/wallet/views/asset_list.nim b/src/app/wallet/views/asset_list.nim index 5c3082df6c..abb2773c63 100644 --- a/src/app/wallet/views/asset_list.nim +++ b/src/app/wallet/views/asset_list.nim @@ -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) diff --git a/src/status/wallet.nim b/src/status/wallet.nim index 6238a3b87e..50e91b051c 100644 --- a/src/status/wallet.nim +++ b/src/status/wallet.nim @@ -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 diff --git a/src/status/wallet/account.nim b/src/status/wallet/account.nim index 4b35184ec8..981da8e365 100644 --- a/src/status/wallet/account.nim +++ b/src/status/wallet/account.nim @@ -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 diff --git a/ui/app/AppLayouts/Wallet/AssetsTab.qml b/ui/app/AppLayouts/Wallet/AssetsTab.qml index d466ae41e7..614a92ea90 100644 --- a/ui/app/AppLayouts/Wallet/AssetsTab.qml +++ b/ui/app/AppLayouts/Wallet/AssetsTab.qml @@ -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