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