2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
import StatusQ.Components 0.1
|
2024-10-15 19:26:12 +00:00
|
|
|
import StatusQ.Core.Theme 0.1
|
2021-10-06 09:16:39 +00:00
|
|
|
|
2021-10-27 21:27:49 +00:00
|
|
|
import shared 1.0
|
2021-10-06 09:16:39 +00:00
|
|
|
import utils 1.0
|
|
|
|
|
2023-06-15 08:53:35 +00:00
|
|
|
import "../stores"
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
Column {
|
|
|
|
id: root
|
2023-04-05 14:39:52 +00:00
|
|
|
spacing: 8
|
2021-10-06 09:16:39 +00:00
|
|
|
|
2023-06-15 08:53:35 +00:00
|
|
|
property PrivacyStore privacyStore
|
|
|
|
property ContactsStore contactsStore
|
|
|
|
property DevicesStore devicesStore
|
2021-10-06 09:16:39 +00:00
|
|
|
property alias mainMenuItems: mainMenuItems.model
|
|
|
|
property alias settingsMenuItems: settingsMenuItems.model
|
|
|
|
property alias extraMenuItems: extraMenuItems.model
|
2022-02-11 09:44:49 +00:00
|
|
|
property alias appsMenuItems: appsMenuItems.model
|
|
|
|
|
2022-03-07 20:34:59 +00:00
|
|
|
property bool walletMenuItemEnabled: false
|
2021-10-06 09:16:39 +00:00
|
|
|
|
2024-10-18 21:43:29 +00:00
|
|
|
property int settingsSubsection
|
|
|
|
|
2021-10-06 09:16:39 +00:00
|
|
|
signal menuItemClicked(var menu_item)
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: mainMenuItems
|
|
|
|
delegate: StatusNavigationListItem {
|
2024-08-03 07:49:14 +00:00
|
|
|
id: navigationItem
|
2022-08-11 13:27:13 +00:00
|
|
|
objectName: itemId + "-MainMenuItem"
|
2023-06-14 15:07:36 +00:00
|
|
|
width: root.width
|
2022-02-25 13:32:46 +00:00
|
|
|
itemId: model.subsection
|
2021-10-06 09:16:39 +00:00
|
|
|
title: model.text
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.name: model.icon
|
2024-10-18 21:43:29 +00:00
|
|
|
selected: root.settingsSubsection === model.subsection
|
2024-08-30 10:19:42 +00:00
|
|
|
highlighted: !!betaTagLoader.item && betaTagLoader.item.hovered
|
2021-10-06 09:16:39 +00:00
|
|
|
onClicked: root.menuItemClicked(model)
|
2022-05-26 13:40:41 +00:00
|
|
|
badge.value: {
|
|
|
|
switch (model.subsection) {
|
|
|
|
case Constants.settingsSubsection.backUpSeed:
|
|
|
|
return !root.privacyStore.mnemonicBackedUp
|
2023-06-15 08:53:35 +00:00
|
|
|
case Constants.settingsSubsection.syncingSettings:
|
|
|
|
return root.devicesStore.devicesModel.count - root.devicesStore.devicesModel.pairedCount
|
2024-08-03 07:49:14 +00:00
|
|
|
default: return 0
|
2022-05-26 13:40:41 +00:00
|
|
|
}
|
|
|
|
}
|
2022-04-21 10:50:01 +00:00
|
|
|
visible: {
|
2022-05-26 13:40:41 +00:00
|
|
|
switch (model.subsection) {
|
|
|
|
case Constants.settingsSubsection.ensUsernames:
|
|
|
|
return root.walletMenuItemEnabled;
|
|
|
|
case Constants.settingsSubsection.backUpSeed:
|
|
|
|
return !root.privacyStore.mnemonicBackedUp;
|
|
|
|
default: return true;
|
|
|
|
}
|
2022-04-21 10:50:01 +00:00
|
|
|
}
|
2024-07-18 20:10:24 +00:00
|
|
|
|
|
|
|
Loader {
|
2024-08-03 07:49:14 +00:00
|
|
|
id: betaTagLoader
|
2024-10-15 19:26:12 +00:00
|
|
|
readonly property string experimentalTooltip: model.experimentalTooltip ?? ""
|
2024-07-18 20:10:24 +00:00
|
|
|
active: model.isExperimental
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.rightMargin: Theme.padding + (navigationItem.badge.visible ? navigationItem.badge.width + Theme.halfPadding : 0)
|
2024-07-18 20:10:24 +00:00
|
|
|
|
2024-08-03 07:49:14 +00:00
|
|
|
sourceComponent: StatusBetaTag {
|
|
|
|
tooltipText: betaTagLoader.experimentalTooltip
|
2024-08-30 10:19:42 +00:00
|
|
|
cursorShape: Qt.PointingHandCursor
|
2024-08-03 07:49:14 +00:00
|
|
|
}
|
2024-07-18 20:10:24 +00:00
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-03 07:49:14 +00:00
|
|
|
StatusListSectionHeadline {
|
2022-02-11 09:44:49 +00:00
|
|
|
text: qsTr("Apps")
|
2023-06-14 15:07:36 +00:00
|
|
|
width: root.width
|
2022-02-11 09:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: appsMenuItems
|
|
|
|
delegate: StatusNavigationListItem {
|
|
|
|
id: appsMenuDelegate
|
2022-08-11 13:27:13 +00:00
|
|
|
objectName: itemId + "-AppMenuItem"
|
2023-06-14 15:07:36 +00:00
|
|
|
width: root.width
|
2022-02-25 13:32:46 +00:00
|
|
|
itemId: model.subsection
|
2022-02-11 09:44:49 +00:00
|
|
|
title: model.text
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.name: model.icon
|
2024-10-18 21:43:29 +00:00
|
|
|
selected: root.settingsSubsection === model.subsection
|
2022-02-11 09:44:49 +00:00
|
|
|
onClicked: root.menuItemClicked(model)
|
2022-03-04 11:09:45 +00:00
|
|
|
visible: {
|
2024-08-05 10:55:28 +00:00
|
|
|
(model.subsection !== Constants.settingsSubsection.wallet) ||
|
2022-06-21 09:00:54 +00:00
|
|
|
(model.subsection === Constants.settingsSubsection.communitiesSettings) ||
|
2022-06-17 09:29:14 +00:00
|
|
|
(model.subsection === Constants.settingsSubsection.wallet && root.walletMenuItemEnabled)
|
2022-03-04 11:09:45 +00:00
|
|
|
}
|
2022-03-21 15:33:14 +00:00
|
|
|
badge.value: {
|
|
|
|
switch (model.subsection) {
|
|
|
|
case Constants.settingsSubsection.messaging:
|
2022-06-28 18:11:18 +00:00
|
|
|
return root.contactsStore.receivedContactRequestsModel.count
|
2022-03-21 15:33:14 +00:00
|
|
|
default: return ""
|
|
|
|
}
|
|
|
|
}
|
2022-02-11 09:44:49 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-14 15:07:36 +00:00
|
|
|
StatusListSectionHeadline {
|
2023-09-22 10:08:28 +00:00
|
|
|
text: qsTr("Preferences")
|
2023-06-14 15:07:36 +00:00
|
|
|
width: root.width
|
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: settingsMenuItems
|
|
|
|
delegate: StatusNavigationListItem {
|
|
|
|
id: settingsMenuDelegate
|
2022-08-11 13:27:13 +00:00
|
|
|
objectName: itemId + "-SettingsMenuItem"
|
2023-06-14 15:07:36 +00:00
|
|
|
width: root.width
|
2022-02-25 13:32:46 +00:00
|
|
|
itemId: model.subsection
|
2021-10-06 09:16:39 +00:00
|
|
|
title: model.text
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.name: model.icon
|
2024-10-18 21:43:29 +00:00
|
|
|
selected: root.settingsSubsection === model.subsection
|
2021-10-06 09:16:39 +00:00
|
|
|
onClicked: root.menuItemClicked(model)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-14 15:07:36 +00:00
|
|
|
StatusListSectionHeadline {
|
|
|
|
text: qsTr("About & Help")
|
|
|
|
width: root.width
|
|
|
|
}
|
2021-10-06 09:16:39 +00:00
|
|
|
|
|
|
|
Repeater {
|
|
|
|
id: extraMenuItems
|
|
|
|
delegate: StatusNavigationListItem {
|
2022-08-11 13:27:13 +00:00
|
|
|
objectName: itemId + "-ExtraMenuItem"
|
2023-06-14 15:07:36 +00:00
|
|
|
width: root.width
|
2022-02-25 13:32:46 +00:00
|
|
|
itemId: model.subsection
|
2021-10-06 09:16:39 +00:00
|
|
|
title: model.text
|
2022-08-11 11:55:08 +00:00
|
|
|
asset.name: model.icon
|
2024-10-18 21:43:29 +00:00
|
|
|
selected: root.settingsSubsection === model.subsection
|
2021-10-06 09:16:39 +00:00
|
|
|
onClicked: root.menuItemClicked(model)
|
|
|
|
}
|
|
|
|
}
|
2023-04-05 14:39:52 +00:00
|
|
|
}
|