remove more libstatus references from src/app
This commit is contained in:
parent
8bb2dbb82a
commit
000ddf0ddc
|
@ -7,8 +7,7 @@ import
|
|||
import # status-desktop libs
|
||||
../../status/chat/chat as status_chat, ./views/communities,
|
||||
../../status/tasks/marathon,
|
||||
../../status/tasks/marathon/mailserver/worker,
|
||||
../../status/libstatus/mailservers # TODO: needed for MailserverTopic type, remove?
|
||||
../../status/tasks/marathon/mailserver/worker
|
||||
|
||||
proc handleChatEvents(self: ChatController) =
|
||||
# Display already saved messages
|
||||
|
|
|
@ -2,7 +2,6 @@ import NimQml, Tables, json, sequtils, chronicles, times, re, sugar, strutils, o
|
|||
import ../../status/[status, mailservers]
|
||||
import ../../status/libstatus/chat as libstatus_chat
|
||||
import ../../status/constants
|
||||
import ../../status/libstatus/chat as core_chat
|
||||
import ../../status/utils as status_utils
|
||||
import ../../status/chat as status_chat
|
||||
import ../../status/messages as status_messages
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import NimQml
|
||||
import Tables
|
||||
import json, sequtils, sugar
|
||||
import ../../../status/libstatus/settings
|
||||
import ../../../status/settings
|
||||
import ../../../status/types
|
||||
import ../../../status/status
|
||||
|
||||
type
|
||||
CustomNetworkRoles {.pure.} = enum
|
||||
|
@ -13,25 +14,27 @@ const defaultNetworks = @["mainnet_rpc", "testnet_rpc", "rinkeby_rpc", "goerli_r
|
|||
|
||||
QtObject:
|
||||
type CustomNetworkList* = ref object of QAbstractListModel
|
||||
status*: Status
|
||||
|
||||
proc setup(self: CustomNetworkList) = self.QAbstractListModel.setup
|
||||
|
||||
proc delete(self: CustomNetworkList) =
|
||||
self.QAbstractListModel.delete
|
||||
|
||||
proc newCustomNetworkList*(): CustomNetworkList =
|
||||
proc newCustomNetworkList*(status: Status): CustomNetworkList =
|
||||
new(result, delete)
|
||||
result.status = status
|
||||
result.setup
|
||||
|
||||
method rowCount(self: CustomNetworkList, index: QModelIndex = nil): int =
|
||||
let networks = getSetting[JsonNode](Setting.Networks_Networks)
|
||||
let networks = getSetting[JsonNode](self.status.settings, Setting.Networks_Networks)
|
||||
return networks.getElems().filterIt(it["id"].getStr() notin defaultNetworks).len
|
||||
|
||||
method data(self: CustomNetworkList, index: QModelIndex, role: int): QVariant =
|
||||
if not index.isValid:
|
||||
return
|
||||
|
||||
let networks = getSetting[JsonNode](Setting.Networks_Networks).getElems().filterIt(it["id"].getStr() notin defaultNetworks)
|
||||
let networks = getSetting[JsonNode](self.status.settings, Setting.Networks_Networks).getElems().filterIt(it["id"].getStr() notin defaultNetworks)
|
||||
if index.row < 0 or index.row >= networks.len:
|
||||
return
|
||||
let network = networks[index.row]
|
||||
|
|
|
@ -22,7 +22,7 @@ QtObject:
|
|||
proc newNetworkView*(status: Status): NetworkView =
|
||||
new(result, delete)
|
||||
result.status = status
|
||||
result.customNetworkList = newCustomNetworkList()
|
||||
result.customNetworkList = newCustomNetworkList(status)
|
||||
result.setup
|
||||
|
||||
proc networkChanged*(self: NetworkView) {.signal.}
|
||||
|
|
|
@ -309,6 +309,5 @@ QtObject:
|
|||
proc signMessage*(self: Web3ProviderView, payload: string, password: string) {.slot.} =
|
||||
let jsonPayload = payload.parseJson
|
||||
|
||||
|
||||
proc init*(self: Web3ProviderView) =
|
||||
self.setDappsAddress(status_settings.getSetting[string](Setting.DappsAddress))
|
||||
self.setDappsAddress(self.status.settings.getSetting[:string](Setting.DappsAddress))
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import NimQml, os, strformat, strutils, parseUtils, chronicles
|
||||
import stint
|
||||
import ../../status/[status, wallet]
|
||||
import ../../status/[status, wallet, settings]
|
||||
import ../../status/stickers
|
||||
import ../../status/libstatus/tokens
|
||||
import ../../status/tokens as status_tokens
|
||||
import ../../status/types
|
||||
import ../../status/libstatus/settings
|
||||
import ../../status/utils as status_utils
|
||||
import ../../status/ens as status_ens
|
||||
import ../utils/image_utils
|
||||
|
@ -43,11 +42,11 @@ QtObject:
|
|||
result = os.joinPath(start, middle, ending)
|
||||
|
||||
proc getSNTAddress*(self: UtilsView): string {.slot.} =
|
||||
result = getSNTAddress()
|
||||
result = status_tokens.getSNTAddress()
|
||||
|
||||
proc getSNTBalance*(self: UtilsView): string {.slot.} =
|
||||
let currAcct = self.status.wallet.getWalletAccounts()[0]
|
||||
result = getSNTBalance($currAcct.address)
|
||||
result = status_tokens.getSNTBalance($currAcct.address)
|
||||
|
||||
proc eth2Wei*(self: UtilsView, eth: string, decimals: int): string {.slot.} =
|
||||
let uintValue = status_utils.eth2Wei(parseFloat(eth), decimals)
|
||||
|
@ -102,7 +101,7 @@ QtObject:
|
|||
result = self.status.accounts.generateIdenticon(pk)
|
||||
|
||||
proc getNetworkName*(self: UtilsView): string {.slot.} =
|
||||
getCurrentNetworkDetails().name
|
||||
self.status.settings.getCurrentNetworkDetails().name
|
||||
|
||||
proc getFileSize*(self: UtilsView, filename: string): string {.slot.} =
|
||||
var f: File = nil
|
||||
|
|
|
@ -2,7 +2,7 @@ import libstatus/accounts as libstatus_accounts
|
|||
import libstatus/core as libstatus_core
|
||||
import libstatus/settings as libstatus_settings
|
||||
import types as libstatus_types
|
||||
import chat, accounts, wallet, node, network, messages, contacts, profile, stickers, permissions, fleet, settings, mailservers, browser
|
||||
import chat, accounts, wallet, node, network, messages, contacts, profile, stickers, permissions, fleet, settings, mailservers, browser, tokens
|
||||
import ../eventemitter
|
||||
import ./tasks/task_runner_impl
|
||||
|
||||
|
@ -25,6 +25,7 @@ type Status* = ref object
|
|||
settings*: SettingsModel
|
||||
mailservers*: MailserversModel
|
||||
browser*: BrowserModel
|
||||
tokens*: TokensModel
|
||||
|
||||
proc newStatusInstance*(fleetConfig: string): Status =
|
||||
result = Status()
|
||||
|
@ -45,6 +46,7 @@ proc newStatusInstance*(fleetConfig: string): Status =
|
|||
result.settings = settings.newSettingsModel(result.events)
|
||||
result.mailservers = mailservers.newMailserversModel(result.events)
|
||||
result.browser = browser.newBrowserModel(result.events)
|
||||
result.tokens = tokens.newTokensModel(result.events)
|
||||
|
||||
proc initNode*(self: Status) =
|
||||
self.tasks.init()
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
import json, json_serialization
|
||||
|
||||
import
|
||||
sugar, sequtils, strutils, atomics
|
||||
|
||||
import libstatus/tokens as status_tokens
|
||||
import ../eventemitter
|
||||
import signals/types
|
||||
|
||||
#TODO: temporary?
|
||||
import types as LibStatusTypes
|
||||
|
||||
type
|
||||
TokensModel* = ref object
|
||||
events*: EventEmitter
|
||||
|
||||
proc newTokensModel*(events: EventEmitter): TokensModel =
|
||||
result = TokensModel()
|
||||
result.events = events
|
||||
|
||||
proc getSNTAddress*(): string =
|
||||
result = status_tokens.getSNTAddress()
|
||||
|
||||
proc getSNTBalance*(account: string): string =
|
||||
result = status_tokens.getSNTBalance(account)
|
||||
|
Loading…
Reference in New Issue