2023-11-29 15:48:33 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
|
2024-04-09 20:26:15 +00:00
|
|
|
import Qt.labs.settings 1.0
|
|
|
|
|
2024-01-17 20:19:58 +00:00
|
|
|
import StatusQ 0.1
|
2024-01-31 18:09:44 +00:00
|
|
|
import StatusQ.Models 0.1
|
2023-11-29 15:48:33 +00:00
|
|
|
import StatusQ.Core 0.1
|
2024-01-17 20:19:58 +00:00
|
|
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
2023-11-29 15:48:33 +00:00
|
|
|
|
|
|
|
import mainui 1.0
|
|
|
|
import utils 1.0
|
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import AppLayouts.stores 1.0 as AppLayoutStores
|
|
|
|
import AppLayouts.Communities.stores 1.0 as CommunitiesStore
|
2023-11-29 15:48:33 +00:00
|
|
|
import AppLayouts.Wallet.views 1.0
|
2024-01-29 15:37:17 +00:00
|
|
|
import AppLayouts.Wallet.stores 1.0
|
2023-11-29 15:48:33 +00:00
|
|
|
|
2024-05-22 08:13:39 +00:00
|
|
|
import shared.stores 1.0
|
2023-11-29 15:48:33 +00:00
|
|
|
import shared.views 1.0
|
|
|
|
|
|
|
|
import Storybook 1.0
|
|
|
|
import Models 1.0
|
|
|
|
|
|
|
|
SplitView {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
Logs { id: logs }
|
|
|
|
|
|
|
|
orientation: Qt.Horizontal
|
|
|
|
|
|
|
|
ManageCollectiblesModel {
|
|
|
|
id: collectiblesModel
|
2023-12-18 10:12:57 +00:00
|
|
|
includeRegularCollectibles: ctrlIncludeRegularCollectibles.checked
|
|
|
|
includeCommunityCollectibles: ctrlIncludeCommunityCollectibles.checked
|
2023-11-29 15:48:33 +00:00
|
|
|
}
|
|
|
|
|
2024-01-29 18:02:59 +00:00
|
|
|
RolesRenamingModel {
|
|
|
|
id: renamedModel
|
|
|
|
sourceModel: collectiblesModel
|
|
|
|
|
|
|
|
mapping: [
|
|
|
|
RoleRename {
|
|
|
|
from: "uid"
|
|
|
|
to: "symbol"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2023-11-29 15:48:33 +00:00
|
|
|
Popups {
|
|
|
|
popupParent: root
|
2024-05-22 08:13:39 +00:00
|
|
|
rootStore: AppLayoutStores.RootStore
|
|
|
|
communityTokensStore: CommunityTokensStore {}
|
2024-01-29 15:37:17 +00:00
|
|
|
walletCollectiblesStore: CollectiblesStore {
|
2024-01-31 18:09:44 +00:00
|
|
|
collectiblesController: collectiblesView.controller
|
2024-01-29 15:37:17 +00:00
|
|
|
}
|
2023-11-29 15:48:33 +00:00
|
|
|
}
|
|
|
|
|
2024-01-17 20:19:58 +00:00
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
readonly property string networksChainsCurrentlySelected: {
|
|
|
|
let supportNwChains = ":"
|
|
|
|
for (let i =0; i< networksRepeater.count; i++) {
|
|
|
|
if (networksRepeater.itemAt(i).checked && networksRepeater.itemAt(i).visible)
|
|
|
|
supportNwChains += networksRepeater.itemAt(i).chainID + ":"
|
|
|
|
}
|
|
|
|
return supportNwChains
|
|
|
|
}
|
|
|
|
|
|
|
|
readonly property string addressesSelected: {
|
|
|
|
let supportedAddresses = ""
|
|
|
|
for (let i =0; i< accountsRepeater.count; i++) {
|
|
|
|
if (accountsRepeater.itemAt(i).checked && accountsRepeater.itemAt(i).visible)
|
|
|
|
supportedAddresses += accountsRepeater.itemAt(i).address + ":"
|
|
|
|
}
|
|
|
|
return supportedAddresses
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-11-29 15:48:33 +00:00
|
|
|
CollectiblesView {
|
2024-01-29 15:37:17 +00:00
|
|
|
id: collectiblesView
|
2024-01-24 12:06:44 +00:00
|
|
|
|
|
|
|
SplitView.fillWidth: true
|
2023-11-29 15:48:33 +00:00
|
|
|
SplitView.fillHeight: true
|
2024-01-24 12:06:44 +00:00
|
|
|
|
2024-01-31 18:09:44 +00:00
|
|
|
controller: ManageTokensController {
|
|
|
|
sourceModel: renamedModel
|
|
|
|
settingsKey: "WalletCollectibles"
|
2024-03-01 02:04:36 +00:00
|
|
|
serializeAsCollectibles: true
|
|
|
|
|
2024-04-09 20:26:15 +00:00
|
|
|
onRequestSaveSettings: (jsonData) => {
|
|
|
|
savingStarted()
|
|
|
|
settingsStore.setValue(settingsKey, jsonData)
|
|
|
|
savingFinished()
|
|
|
|
}
|
|
|
|
onRequestLoadSettings: {
|
|
|
|
loadingStarted()
|
|
|
|
const jsonData = settingsStore.value(settingsKey, null)
|
|
|
|
loadingFinished(jsonData)
|
|
|
|
}
|
|
|
|
onRequestClearSettings: {
|
|
|
|
settingsStore.setValue(settingsKey, null)
|
|
|
|
}
|
2024-03-01 02:04:36 +00:00
|
|
|
|
2024-01-31 18:09:44 +00:00
|
|
|
onTokenHidden: (symbol, name) => Global.displayToastMessage(
|
|
|
|
qsTr("%1 was successfully hidden").arg(name), "", "checkmark-circle",
|
|
|
|
false, Constants.ephemeralNotificationType.success, "")
|
|
|
|
onCommunityTokenGroupHidden: (communityName) => Global.displayToastMessage(
|
|
|
|
qsTr("%1 community collectibles successfully hidden").arg(communityName), "", "checkmark-circle",
|
|
|
|
false, Constants.ephemeralNotificationType.success, "")
|
|
|
|
onTokenShown: (symbol, name) => Global.displayToastMessage(qsTr("%1 is now visible").arg(name), "", "checkmark-circle",
|
|
|
|
false, Constants.ephemeralNotificationType.success, "")
|
|
|
|
onCommunityTokenGroupShown: (communityName) => Global.displayToastMessage(
|
|
|
|
qsTr("%1 community collectibles are now visible").arg(communityName), "", "checkmark-circle",
|
|
|
|
false, Constants.ephemeralNotificationType.success, "")
|
|
|
|
}
|
2024-07-17 14:55:52 +00:00
|
|
|
ownedAccountsModel: WalletAccountsModel {}
|
2024-01-17 20:19:58 +00:00
|
|
|
networkFilters: d.networksChainsCurrentlySelected
|
|
|
|
addressFilters: d.addressesSelected
|
2023-12-06 10:54:36 +00:00
|
|
|
filterVisible: ctrlFilterVisible.checked
|
2023-11-29 15:48:33 +00:00
|
|
|
onCollectibleClicked: logs.logEvent("onCollectibleClicked", ["chainId", "contractAddress", "tokenId", "uid"], arguments)
|
|
|
|
onSendRequested: logs.logEvent("onSendRequested", ["symbol"], arguments)
|
|
|
|
onReceiveRequested: logs.logEvent("onReceiveRequested", ["symbol"], arguments)
|
|
|
|
onSwitchToCommunityRequested: logs.logEvent("onSwitchToCommunityRequested", ["communityId"], arguments)
|
|
|
|
onManageTokensRequested: logs.logEvent("onManageTokensRequested")
|
2024-02-07 22:58:56 +00:00
|
|
|
isUpdating: ctrlUpdatingCheckbox.checked
|
|
|
|
isFetching: ctrlFetchingCheckbox.checked
|
|
|
|
isError: ctrlErrorCheckbox.checked
|
2024-04-09 20:26:15 +00:00
|
|
|
|
|
|
|
Settings {
|
|
|
|
id: settingsStore
|
|
|
|
category: "ManageTokens-" + collectiblesView.controller.settingsKey
|
|
|
|
}
|
2023-11-29 15:48:33 +00:00
|
|
|
}
|
|
|
|
|
2024-01-24 12:06:44 +00:00
|
|
|
LogsAndControlsPanel {
|
|
|
|
id: logsAndControlsPanel
|
|
|
|
|
2024-01-17 20:19:58 +00:00
|
|
|
SplitView.minimumWidth: 300
|
|
|
|
SplitView.preferredWidth: 300
|
2023-11-29 15:48:33 +00:00
|
|
|
|
2024-01-24 12:06:44 +00:00
|
|
|
logsView.logText: logs.logText
|
|
|
|
|
2023-11-29 15:48:33 +00:00
|
|
|
ColumnLayout {
|
2024-01-17 20:19:58 +00:00
|
|
|
spacing: 12
|
|
|
|
anchors.fill: parent
|
|
|
|
|
2023-12-06 10:54:36 +00:00
|
|
|
Switch {
|
|
|
|
id: ctrlFilterVisible
|
|
|
|
text: "Filter visible"
|
|
|
|
checked: true
|
|
|
|
}
|
2023-11-29 15:48:33 +00:00
|
|
|
Switch {
|
2023-12-18 10:12:57 +00:00
|
|
|
id: ctrlIncludeRegularCollectibles
|
|
|
|
text: "Regular collectibles"
|
|
|
|
checked: true
|
|
|
|
}
|
|
|
|
Switch {
|
|
|
|
id: ctrlIncludeCommunityCollectibles
|
|
|
|
text: "Community collectibles"
|
|
|
|
checked: true
|
2023-11-29 15:48:33 +00:00
|
|
|
}
|
2024-01-17 20:19:58 +00:00
|
|
|
|
|
|
|
CheckBox {
|
2024-02-07 22:58:56 +00:00
|
|
|
id: ctrlUpdatingCheckbox
|
2024-01-17 20:19:58 +00:00
|
|
|
checked: false
|
2024-02-07 22:58:56 +00:00
|
|
|
text: "isUpdating"
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: ctrlFetchingCheckbox
|
|
|
|
checked: false
|
|
|
|
text: "isFetching"
|
|
|
|
}
|
|
|
|
CheckBox {
|
|
|
|
id: ctrlErrorCheckbox
|
|
|
|
checked: false
|
|
|
|
text: "isError"
|
2024-01-17 20:19:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Text {
|
|
|
|
text: "select supported network(s)"
|
|
|
|
}
|
|
|
|
Repeater {
|
|
|
|
id: networksRepeater
|
2024-03-13 17:38:16 +00:00
|
|
|
model: NetworksModel.flatNetworks
|
2024-01-17 20:19:58 +00:00
|
|
|
delegate: CheckBox {
|
|
|
|
property int chainID: chainId
|
|
|
|
width: parent.width
|
|
|
|
text: chainName
|
|
|
|
visible: isTest
|
|
|
|
checked: true
|
|
|
|
onToggled: {
|
|
|
|
isEnabled = checked
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Text {
|
|
|
|
text: "select account(s)"
|
|
|
|
}
|
|
|
|
Repeater {
|
|
|
|
id: accountsRepeater
|
|
|
|
model: WalletAccountsModel {}
|
|
|
|
delegate: CheckBox {
|
|
|
|
property string address: model.address
|
|
|
|
checked: true
|
|
|
|
visible: index<2
|
|
|
|
width: parent.width
|
|
|
|
text: name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-24 12:06:44 +00:00
|
|
|
Item {
|
|
|
|
Layout.fillHeight: true
|
|
|
|
}
|
|
|
|
}
|
2024-01-17 20:19:58 +00:00
|
|
|
}
|
2023-11-29 15:48:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// category: Views
|
|
|
|
// https://www.figma.com/file/idUoxN7OIW2Jpp3PMJ1Rl8/%E2%9A%99%EF%B8%8F-Settings-%7C-Desktop?type=design&node-id=19558-95270&mode=design&t=ShZOuMRfiIIl2aR8-0
|
|
|
|
// https://www.figma.com/file/idUoxN7OIW2Jpp3PMJ1Rl8/%E2%9A%99%EF%B8%8F-Settings-%7C-Desktop?type=design&node-id=19558-96427&mode=design&t=ShZOuMRfiIIl2aR8-0
|
2023-12-06 10:54:36 +00:00
|
|
|
// https://www.figma.com/file/FkFClTCYKf83RJWoifWgoX/Wallet-v2?node-id=19087%3A293357&mode=dev
|