parent
ab487d40a5
commit
5a9ff99aad
|
@ -386,3 +386,8 @@ QtObject:
|
|||
|
||||
QtProperty[QVariant] status:
|
||||
read = getStatus
|
||||
|
||||
proc globalFilterChanged*(self: Controller, addresses: seq[string], chainIds: seq[int]) =
|
||||
self.setFilterAddresses(addresses)
|
||||
self.setFilterChains(chainIds)
|
||||
self.updateFilter()
|
|
@ -1,22 +1,18 @@
|
|||
import strformat, sequtils, sugar
|
||||
|
||||
import ./controller
|
||||
import ./activity/controller as activityc
|
||||
|
||||
type Filter* = ref object
|
||||
controller: controller.Controller
|
||||
activityController: activityc.Controller
|
||||
addresses*: seq[string]
|
||||
chainIds*: seq[int]
|
||||
allAddresses*: bool
|
||||
|
||||
proc initFilter*(
|
||||
controller: controller.Controller,
|
||||
activityController: activityc.Controller
|
||||
): Filter =
|
||||
result = Filter()
|
||||
result.controller = controller
|
||||
result.activityController = activityController
|
||||
result.addresses = @[]
|
||||
result.chainIds = @[]
|
||||
result.allAddresses = false
|
||||
|
@ -30,8 +26,6 @@ proc `$`*(self: Filter): string =
|
|||
proc setFillterAllAddresses*(self: Filter) =
|
||||
self.allAddresses = true
|
||||
self.addresses = self.controller.getWalletAccounts().map(a => a.address)
|
||||
self.activityController.setFilterAddresses(self.addresses)
|
||||
self.activityController.updateFilter()
|
||||
|
||||
proc toggleWatchOnlyAccounts*(self: Filter) =
|
||||
self.controller.toggleIncludeWatchOnlyAccount()
|
||||
|
@ -42,20 +36,14 @@ proc includeWatchOnlyToggled*(self: Filter) =
|
|||
self.setFillterAllAddresses()
|
||||
else:
|
||||
self.addresses = self.controller.getWalletAccounts().filter(a => a.walletType != "watch").map(a => a.address)
|
||||
self.activityController.setFilterAddresses(self.addresses)
|
||||
self.activityController.updateFilter()
|
||||
|
||||
proc load*(self: Filter) =
|
||||
self.includeWatchOnlyToggled()
|
||||
self.chainIds = self.controller.getEnabledChainIds()
|
||||
self.activityController.setFilterChains(self.chainIds)
|
||||
self.activityController.updateFilter()
|
||||
|
||||
proc setAddress*(self: Filter, address: string) =
|
||||
self.allAddresses = false
|
||||
self.addresses = @[address]
|
||||
self.activityController.setFilterAddresses(@[address])
|
||||
self.activityController.updateFilter()
|
||||
|
||||
proc removeAddress*(self: Filter, address: string) =
|
||||
self.allAddresses = false
|
||||
|
@ -67,10 +55,7 @@ proc removeAddress*(self: Filter, address: string) =
|
|||
let ind = self.addresses.find(address)
|
||||
if ind > -1:
|
||||
self.addresses.delete(ind)
|
||||
self.activityController.setFilterAddresses(@[address])
|
||||
self.activityController.updateFilter()
|
||||
|
||||
|
||||
proc updateNetworks*(self: Filter) =
|
||||
self.chainIds = self.controller.getEnabledChainIds()
|
||||
self.activityController.setFilterChains(self.chainIds)
|
||||
self.activityController.updateFilter()
|
||||
|
|
|
@ -102,7 +102,7 @@ proc newModule*(
|
|||
result.networksModule = networks_module.newModule(result, events, networkService, walletAccountService, settingsService)
|
||||
result.networksService = networkService
|
||||
result.activityController = activityc.newController(result.transactionsModule, currencyService, tokenService, events)
|
||||
result.filter = initFilter(result.controller, result.activityController)
|
||||
result.filter = initFilter(result.controller)
|
||||
|
||||
result.view = newView(result, result.activityController)
|
||||
|
||||
|
@ -147,6 +147,7 @@ method notifyFilterChanged(self: Module) =
|
|||
self.transactionsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||
self.accountsModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||
self.sendModule.filterChanged(self.filter.addresses, self.filter.chainIds)
|
||||
self.activityController.globalFilterChanged(self.filter.addresses, self.filter.chainIds)
|
||||
if self.filter.addresses.len > 0:
|
||||
self.view.filterChanged(self.filter.addresses[0], includeWatchOnly, self.filter.allAddresses)
|
||||
|
||||
|
|
|
@ -132,21 +132,11 @@ Item {
|
|||
font.pixelSize: 28
|
||||
font.bold: true
|
||||
customColor: Theme.palette.directColor1
|
||||
text: loading ? Constants.dummyText : LocaleUtils.currencyAmountToLocaleString(root.overview.currencyBalance, {noSymbol: true})
|
||||
text: loading ? Constants.dummyText : LocaleUtils.currencyAmountToLocaleString(root.overview.currencyBalance)
|
||||
loading: root.overview.balanceLoading
|
||||
lineHeightMode: Text.FixedHeight
|
||||
lineHeight: 38
|
||||
}
|
||||
StatusTextWithLoadingState {
|
||||
Layout.alignment: Qt.AlignBottom
|
||||
font.pixelSize: 15
|
||||
font.bold: true
|
||||
customColor: Theme.palette.directColor1
|
||||
text: loading ? Constants.dummyText : root.overview.currencyBalance.symbol
|
||||
loading: root.overview.balanceLoading
|
||||
lineHeightMode: Text.FixedHeight
|
||||
lineHeight: 25
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue