Settings list simplified

- UI simplified, made independent from the backend
- dedicated model created, filtering on the level of model instead of
  per delegate
- using ListView instead of mutliple Repeaters
- UI models removed from ProfileSectionStore

Closes: #16675
This commit is contained in:
Michał Cieślak 2024-10-31 13:41:52 +01:00 committed by Michał
parent b62aad6b34
commit 5238074ed3
8 changed files with 358 additions and 331 deletions

View File

@ -3,33 +3,34 @@ import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15 import QtQuick.Layouts 1.15
import QtQuick.Window 2.15 import QtQuick.Window 2.15
import utils 1.0
import shared 1.0 import shared 1.0
import shared.panels 1.0 import shared.panels 1.0
import shared.stores 1.0 as SharedStores
import shared.popups.keycard 1.0 import shared.popups.keycard 1.0
import shared.stores 1.0 as SharedStores
import shared.stores.send 1.0 import shared.stores.send 1.0
import utils 1.0
import StatusQ.Core.Theme 0.1
import AppLayouts.Wallet.controls 1.0
import AppLayouts.Wallet.stores 1.0
import "stores"
import "popups" import "popups"
import "views" import "views"
import "views/profile" import "views/profile"
import StatusQ 0.1 import StatusQ 0.1
import StatusQ.Core 0.1
import StatusQ.Layout 0.1
import StatusQ.Controls 0.1 import StatusQ.Controls 0.1
import StatusQ.Popups.Dialog 0.1 import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Core.Utils 0.1 as SQUtils import StatusQ.Core.Utils 0.1 as SQUtils
import StatusQ.Layout 0.1
import StatusQ.Popups.Dialog 0.1
import AppLayouts.Communities.stores 1.0 as CommunitiesStore
import AppLayouts.Profile.helpers 1.0
import AppLayouts.Profile.stores 1.0 as ProfileStores
import AppLayouts.Wallet.controls 1.0
import AppLayouts.Wallet.stores 1.0
import AppLayouts.stores 1.0 as AppLayoutsStores
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
import AppLayouts.stores 1.0 as AppLayoutsStores
import AppLayouts.Communities.stores 1.0 as CommunitiesStore
StatusSectionLayout { StatusSectionLayout {
id: root id: root
@ -41,7 +42,7 @@ StatusSectionLayout {
property SharedStores.RootStore sharedRootStore property SharedStores.RootStore sharedRootStore
property SharedStores.UtilsStore utilsStore property SharedStores.UtilsStore utilsStore
property ProfileSectionStore store property ProfileStores.ProfileSectionStore store
property AppLayoutsStores.RootStore globalStore property AppLayoutsStores.RootStore globalStore
property CommunitiesStore.CommunitiesStore communitiesStore property CommunitiesStore.CommunitiesStore communitiesStore
required property var sendModalPopup required property var sendModalPopup
@ -99,6 +100,17 @@ StatusSectionLayout {
readonly property bool toastClashesWithDirtyBubble: root.Window.width <= 1650 // design readonly property bool toastClashesWithDirtyBubble: root.Window.width <= 1650 // design
} }
SettingsEntriesModel {
id: settingsEntriesModel
showWalletEntries: root.store.walletMenuItemEnabled
showBackUpSeed: !root.store.privacyStore.mnemonicBackedUp
syncingBadgeCount: root.store.devicesStore.devicesModel.count -
root.store.devicesStore.devicesModel.pairedCount
messagingBadgeCount: root.store.contactsStore.receivedContactRequestsModel.count
}
headerBackground: AccountHeaderGradient { headerBackground: AccountHeaderGradient {
width: parent.width width: parent.width
overview: root.store.walletStore.selectedAccount overview: root.store.walletStore.selectedAccount
@ -106,8 +118,10 @@ StatusSectionLayout {
} }
leftPanel: LeftTabView { leftPanel: LeftTabView {
store: root.store
anchors.fill: parent anchors.fill: parent
model: settingsEntriesModel
onMenuItemClicked: { onMenuItemClicked: {
if (profileContainer.currentItem.dirty && !profileContainer.currentItem.ignoreDirty) { if (profileContainer.currentItem.dirty && !profileContainer.currentItem.ignoreDirty) {
event.accepted = true; event.accepted = true;
@ -137,9 +151,9 @@ StatusSectionLayout {
root.store.backButtonName = "" root.store.backButtonName = ""
if (currentIndex === Constants.settingsSubsection.contacts) { if (currentIndex === Constants.settingsSubsection.contacts) {
root.store.backButtonName = root.store.getNameForSubsection(Constants.settingsSubsection.messaging) root.store.backButtonName = settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.messaging)
} else if (currentIndex === Constants.settingsSubsection.about_privacy || currentIndex === Constants.settingsSubsection.about_terms) { } else if (currentIndex === Constants.settingsSubsection.about_privacy || currentIndex === Constants.settingsSubsection.about_terms) {
root.store.backButtonName = root.store.getNameForSubsection(Constants.settingsSubsection.about) root.store.backButtonName = settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.about)
} else if (currentIndex === Constants.settingsSubsection.wallet) { } else if (currentIndex === Constants.settingsSubsection.wallet) {
walletView.item.resetStack() walletView.item.resetStack()
} else if (currentIndex === Constants.settingsSubsection.keycard) { } else if (currentIndex === Constants.settingsSubsection.keycard) {
@ -161,7 +175,7 @@ StatusSectionLayout {
utilsStore: root.utilsStore utilsStore: root.utilsStore
sendToAccountEnabled: root.networkConnectionStore.sendBuyBridgeEnabled sendToAccountEnabled: root.networkConnectionStore.sendBuyBridgeEnabled
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.profile) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.profile)
contentWidth: d.contentWidth contentWidth: d.contentWidth
sideBySidePreview: d.sideBySidePreviewAvailable sideBySidePreview: d.sideBySidePreviewAvailable
toastClashesWithDirtyBubble: d.toastClashesWithDirtyBubble toastClashesWithDirtyBubble: d.toastClashesWithDirtyBubble
@ -205,7 +219,7 @@ StatusSectionLayout {
privacyStore: root.store.privacyStore privacyStore: root.store.privacyStore
passwordStrengthScoreFunction: root.sharedRootStore.getPasswordStrengthScore passwordStrengthScoreFunction: root.sharedRootStore.getPasswordStrengthScore
contentWidth: d.contentWidth contentWidth: d.contentWidth
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.password) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.password)
} }
} }
@ -249,7 +263,7 @@ StatusSectionLayout {
implicitWidth: parent.width implicitWidth: parent.width
implicitHeight: parent.height implicitHeight: parent.height
messagingStore: root.store.messagingStore messagingStore: root.store.messagingStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.messaging) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.messaging)
contactsStore: root.store.contactsStore contactsStore: root.store.contactsStore
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
@ -276,7 +290,7 @@ StatusSectionLayout {
currencySymbol: root.sharedRootStore.currencyStore.currentCurrency currencySymbol: root.sharedRootStore.currencyStore.currentCurrency
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
sendModalPopup: root.sendModalPopup sendModalPopup: root.sendModalPopup
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.wallet) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.wallet)
} }
onLoaded: root.store.backButtonName = "" onLoaded: root.store.backButtonName = ""
} }
@ -289,7 +303,7 @@ StatusSectionLayout {
implicitHeight: parent.height implicitHeight: parent.height
appearanceStore: root.store.appearanceStore appearanceStore: root.store.appearanceStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.appearance) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.appearance)
contentWidth: d.contentWidth contentWidth: d.contentWidth
systemPalette: root.systemPalette systemPalette: root.systemPalette
} }
@ -305,7 +319,7 @@ StatusSectionLayout {
languageSelectionEnabled: localAppSettings.translationsEnabled languageSelectionEnabled: localAppSettings.translationsEnabled
languageStore: root.store.languageStore languageStore: root.store.languageStore
currencyStore: root.currencyStore currencyStore: root.currencyStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.language) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.language)
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
} }
@ -318,7 +332,7 @@ StatusSectionLayout {
implicitHeight: parent.height implicitHeight: parent.height
notificationsStore: root.store.notificationsStore notificationsStore: root.store.notificationsStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.notifications) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.notifications)
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
} }
@ -335,7 +349,7 @@ StatusSectionLayout {
devicesStore: root.store.devicesStore devicesStore: root.store.devicesStore
privacyStore: root.store.privacyStore privacyStore: root.store.privacyStore
advancedStore: root.store.advancedStore advancedStore: root.store.advancedStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.syncingSettings) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.syncingSettings)
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
} }
@ -351,7 +365,7 @@ StatusSectionLayout {
advancedStore: root.store.advancedStore advancedStore: root.store.advancedStore
walletStore: root.store.walletStore walletStore: root.store.walletStore
isFleetSelectionEnabled: fleetSelectionEnabled isFleetSelectionEnabled: fleetSelectionEnabled
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.advanced) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.advanced)
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
} }
@ -362,7 +376,7 @@ StatusSectionLayout {
sourceComponent: AboutView { sourceComponent: AboutView {
implicitWidth: parent.width implicitWidth: parent.width
implicitHeight: parent.height implicitHeight: parent.height
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.about) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.about)
contentWidth: d.contentWidth contentWidth: d.contentWidth
store: QtObject { store: QtObject {
@ -411,7 +425,7 @@ StatusSectionLayout {
rootStore: root.globalStore rootStore: root.globalStore
currencyStore: root.currencyStore currencyStore: root.currencyStore
walletAssetsStore: root.walletAssetsStore walletAssetsStore: root.walletAssetsStore
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.communitiesSettings) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.communitiesSettings)
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
} }
@ -427,8 +441,8 @@ StatusSectionLayout {
profileSectionStore: root.store profileSectionStore: root.store
keycardStore: root.store.keycardStore keycardStore: root.store.keycardStore
emojiPopup: root.emojiPopup emojiPopup: root.emojiPopup
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.keycard) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.keycard)
mainSectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.keycard) mainSectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.keycard)
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
} }
@ -483,7 +497,7 @@ StatusSectionLayout {
implicitWidth: parent.width implicitWidth: parent.width
implicitHeight: parent.height implicitHeight: parent.height
sectionTitle: root.store.getNameForSubsection(Constants.settingsSubsection.privacyAndSecurity) sectionTitle: settingsEntriesModel.getNameForSubsection(Constants.settingsSubsection.privacyAndSecurity)
contentWidth: d.contentWidth contentWidth: d.contentWidth
} }
} }

View File

@ -0,0 +1,78 @@
import QtQuick 2.15
import StatusQ.Components 0.1
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
/*!
\qmltype SettingsList
\inherits StatusListView
\inqmlmodule AppLayouts.Profile.controls
\brief List view rendering setting entries
Expected model structure:
subsection [int] - identifier of the entry (Constants.settingsSubsection)
text [string] - readable name of the entry
icon [string] - icon name
badgeCount [int] - number presented on the badge
isExperimental [bool] - indicates if the beta tag should be presented
experimentalTooltip [string] - tooltip text for the beta tag
*/
StatusListView {
id: root
property int currenctSubsection
readonly property int availableWidth: width - leftMargin - rightMargin
signal clicked(int subsection)
spacing: Theme.halfPadding
delegate: StatusNavigationListItem {
id: delegate
objectName: model.subsection + "-MenuItem"
width: ListView.view.availableWidth
title: model.text
asset.name: model.icon
selected: root.currenctSubsection === model.subsection
highlighted: !!betaTagLoader.item && betaTagLoader.item.hovered
badge.value: model.badgeCount
Loader {
id: betaTagLoader
active: model.isExperimental
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Theme.padding +
(delegate.badge.visible
? delegate.badge.width + Theme.halfPadding : 0)
sourceComponent: StatusBetaTag {
tooltipText: model.experimentalTooltip
cursorShape: Qt.PointingHandCursor
}
}
onClicked: root.clicked(model.subsection)
}
section.property: "group"
section.delegate: StatusBaseText {
text: section
color: Theme.palette.baseColor1
width: ListView.view.availableWidth
leftPadding: Theme.padding
rightPadding: Theme.padding
topPadding: Theme.smallPadding
bottomPadding: Theme.smallPadding
}
}

View File

@ -1,7 +1,8 @@
AddMoreAccountsLink 1.0 AddMoreAccountsLink.qml AddMoreAccountsLink 1.0 AddMoreAccountsLink.qml
ProfileShowcasePanelDelegate 1.0 ProfileShowcasePanelDelegate.qml ProfileShowcasePanelDelegate 1.0 ProfileShowcasePanelDelegate.qml
SettingsList 1.0 SettingsList.qml
ShowcaseDelegate 1.0 ShowcaseDelegate.qml ShowcaseDelegate 1.0 ShowcaseDelegate.qml
StaticSocialLinkInput 1.0 StaticSocialLinkInput.qml StaticSocialLinkInput 1.0 StaticSocialLinkInput.qml
WalletAccountDelegate 1.0 WalletAccountDelegate.qml WalletAccountDelegate 1.0 WalletAccountDelegate.qml
WalletKeyPairDelegate 1.0 WalletKeyPairDelegate.qml
WalletAccountDetailsKeypairItem 1.0 WalletAccountDetailsKeypairItem.qml WalletAccountDetailsKeypairItem 1.0 WalletAccountDetailsKeypairItem.qml
WalletKeyPairDelegate 1.0 WalletKeyPairDelegate.qml

View File

@ -0,0 +1,197 @@
import QtQuick 2.15
import StatusQ 0.1
import utils 1.0
import SortFilterProxyModel 0.2
/*!
\qmltype SettingsEntriesModel
\inherits SortFilterProxyModel
\inqmlmodule AppLayouts.Profile.helpers
Model providing entries to the settings section.
Model structure:
subsection [int] - identifier of the entry (Constants.settingsSubsection)
text [string] - readable name of the entry
icon [string] - icon name
badgeCount [int] - number presented on the badge
isExperimental [bool] - indicates if the beta tag should be presented
experimentalTooltip [string] - tooltip text for the beta tag
*/
SortFilterProxyModel {
id: root
// Determines if wallet-related entries should be included
property bool showWalletEntries
// Determines if back up seed phrase entry should be included
property bool showBackUpSeed
// Badge count for the syncing entry
property int syncingBadgeCount: 0
// Badge count for the messaging section
property int messagingBadgeCount: 0
readonly property string appsGroupTitle: qsTr("Apps")
readonly property string preferencesGroupTitle: qsTr("Preferences")
readonly property string aboutAndHelpGroupTitle: qsTr("About & Help")
readonly property var entries: [
{
subsection: Constants.settingsSubsection.backUpSeed,
text: qsTr("Back up seed phrase"),
icon: "seed-phrase"
},
{
subsection: Constants.settingsSubsection.profile,
text: qsTr("Profile"),
icon: "profile"
},
{
subsection: Constants.settingsSubsection.password,
text: qsTr("Password"),
icon: "password"
},
{
subsection: Constants.settingsSubsection.keycard,
text: qsTr("Keycard"),
icon: "keycard"
},
{
subsection: Constants.settingsSubsection.ensUsernames,
text: qsTr("ENS usernames"),
icon: "username",
isExperimental: true,
experimentalTooltip: qsTr("This section is going through a redesign.")
},
{
subsection: Constants.settingsSubsection.syncingSettings,
text: qsTr("Syncing"),
icon: "rotate",
isExperimental: true,
experimentalTooltip: qsTr("Connection problems can happen.<br>If they do, please use the Enter a Seed Phrase feature instead.")
},
{
subsection: Constants.settingsSubsection.messaging,
text: qsTr("Messaging"),
icon: "chat",
group: root.appsGroupTitle
},
{
subsection: Constants.settingsSubsection.wallet,
text: qsTr("Wallet"),
icon: "wallet",
group: root.appsGroupTitle
},
{
subsection: Constants.settingsSubsection.communitiesSettings,
text: qsTr("Communities"),
icon: "communities",
group: root.appsGroupTitle
},
{
subsection: Constants.settingsSubsection.privacyAndSecurity,
text: qsTr("Privacy and security"),
icon: "security",
group: root.preferencesGroupTitle
},
{
subsection: Constants.settingsSubsection.appearance,
text: qsTr("Appearance"),
icon: "appearance",
group: root.preferencesGroupTitle
},
{
subsection: Constants.settingsSubsection.notifications,
text: qsTr("Notifications & Sounds"),
icon: "notification",
group: root.preferencesGroupTitle
},
{
subsection: Constants.settingsSubsection.language,
text: qsTr("Language & Currency"),
icon: "language",
group: root.preferencesGroupTitle
},
{
subsection: Constants.settingsSubsection.advanced,
text: qsTr("Advanced"),
icon: "settings",
group: root.preferencesGroupTitle
},
{
subsection: Constants.settingsSubsection.about,
text: qsTr("About"),
icon: "info",
group: root.aboutAndHelpGroupTitle
},
{
subsection: Constants.settingsSubsection.signout,
text: qsTr("Sign out & Quit"),
icon: "logout",
group: root.aboutAndHelpGroupTitle
}
]
// Update model after retranslation
onEntriesChanged: {
entries.forEach((elem, index) => {
baseModel.setProperty(index, "text", elem.text)
if (elem.group)
baseModel.setProperty(index, "group", elem.group)
})
}
function getNameForSubsection(subsection) {
const entry = root.entries.find(entry => entry.subsection === subsection)
return entry ? entry.text : ""
}
sourceModel: ObjectProxyModel {
sourceModel: ListModel {
id: baseModel
Component.onCompleted: append(root.entries)
}
delegate: QtObject {
readonly property bool visible: {
switch (model.subsection) {
case Constants.settingsSubsection.ensUsernames:
case Constants.settingsSubsection.wallet:
return root.showWalletEntries
case Constants.settingsSubsection.backUpSeed:
return root.showBackUpSeed
default: return true
}
}
readonly property int badgeCount: {
switch (model.subsection) {
case Constants.settingsSubsection.backUpSeed:
return root.showBackUpSeed
case Constants.settingsSubsection.syncingSettings:
return root.syncingBadgeCount
case Constants.settingsSubsection.messaging:
return root.messagingBadgeCount
default: return 0
}
}
}
expectedRoles: ["subsection"]
exposedRoles: ["visible", "badgeCount"]
}
filters: ValueFilter {
roleName: "visible"
value: true
}
}

View File

@ -1,6 +1,7 @@
ContactDetails 1.0 ContactDetails.qml
ProfileShowcaseDirtyState 1.0 ProfileShowcaseDirtyState.qml ProfileShowcaseDirtyState 1.0 ProfileShowcaseDirtyState.qml
ProfileShowcaseModelAdapter 1.0 ProfileShowcaseModelAdapter.qml ProfileShowcaseModelAdapter 1.0 ProfileShowcaseModelAdapter.qml
ProfileShowcaseSettingsModelAdapter 1.0 ProfileShowcaseSettingsModelAdapter.qml
ProfileShowcaseModels 1.0 ProfileShowcaseModels.qml ProfileShowcaseModels 1.0 ProfileShowcaseModels.qml
ProfileShowcaseSettingsModelAdapter 1.0 ProfileShowcaseSettingsModelAdapter.qml
SettingsEntriesModel 1.0 SettingsEntriesModel.qml
VisibilityAndPositionDirtyStateModel 1.0 VisibilityAndPositionDirtyStateModel.qml VisibilityAndPositionDirtyStateModel 1.0 VisibilityAndPositionDirtyStateModel.qml
ContactDetails 1.0 ContactDetails.qml

View File

@ -1,144 +0,0 @@
import QtQuick 2.15
import QtQuick.Layouts 1.15
import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
import shared 1.0
import utils 1.0
import "../stores"
Column {
id: root
spacing: 8
property PrivacyStore privacyStore
property ContactsStore contactsStore
property DevicesStore devicesStore
property alias mainMenuItems: mainMenuItems.model
property alias settingsMenuItems: settingsMenuItems.model
property alias extraMenuItems: extraMenuItems.model
property alias appsMenuItems: appsMenuItems.model
property bool walletMenuItemEnabled: false
property int settingsSubsection
signal menuItemClicked(var menu_item)
Repeater {
id: mainMenuItems
delegate: StatusNavigationListItem {
id: navigationItem
objectName: itemId + "-MainMenuItem"
width: root.width
itemId: model.subsection
title: model.text
asset.name: model.icon
selected: root.settingsSubsection === model.subsection
highlighted: !!betaTagLoader.item && betaTagLoader.item.hovered
onClicked: root.menuItemClicked(model)
badge.value: {
switch (model.subsection) {
case Constants.settingsSubsection.backUpSeed:
return !root.privacyStore.mnemonicBackedUp
case Constants.settingsSubsection.syncingSettings:
return root.devicesStore.devicesModel.count - root.devicesStore.devicesModel.pairedCount
default: return 0
}
}
visible: {
switch (model.subsection) {
case Constants.settingsSubsection.ensUsernames:
return root.walletMenuItemEnabled;
case Constants.settingsSubsection.backUpSeed:
return !root.privacyStore.mnemonicBackedUp;
default: return true;
}
}
Loader {
id: betaTagLoader
readonly property string experimentalTooltip: model.experimentalTooltip ?? ""
active: model.isExperimental
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: Theme.padding + (navigationItem.badge.visible ? navigationItem.badge.width + Theme.halfPadding : 0)
sourceComponent: StatusBetaTag {
tooltipText: betaTagLoader.experimentalTooltip
cursorShape: Qt.PointingHandCursor
}
}
}
}
StatusListSectionHeadline {
text: qsTr("Apps")
width: root.width
}
Repeater {
id: appsMenuItems
delegate: StatusNavigationListItem {
id: appsMenuDelegate
objectName: itemId + "-AppMenuItem"
width: root.width
itemId: model.subsection
title: model.text
asset.name: model.icon
selected: root.settingsSubsection === model.subsection
onClicked: root.menuItemClicked(model)
visible: {
(model.subsection !== Constants.settingsSubsection.wallet) ||
(model.subsection === Constants.settingsSubsection.communitiesSettings) ||
(model.subsection === Constants.settingsSubsection.wallet && root.walletMenuItemEnabled)
}
badge.value: {
switch (model.subsection) {
case Constants.settingsSubsection.messaging:
return root.contactsStore.receivedContactRequestsModel.count
default: return ""
}
}
}
}
StatusListSectionHeadline {
text: qsTr("Preferences")
width: root.width
}
Repeater {
id: settingsMenuItems
delegate: StatusNavigationListItem {
id: settingsMenuDelegate
objectName: itemId + "-SettingsMenuItem"
width: root.width
itemId: model.subsection
title: model.text
asset.name: model.icon
selected: root.settingsSubsection === model.subsection
onClicked: root.menuItemClicked(model)
}
}
StatusListSectionHeadline {
text: qsTr("About & Help")
width: root.width
}
Repeater {
id: extraMenuItems
delegate: StatusNavigationListItem {
objectName: itemId + "-ExtraMenuItem"
width: root.width
itemId: model.subsection
title: model.text
asset.name: model.icon
selected: root.settingsSubsection === model.subsection
onClicked: root.menuItemClicked(model)
}
}
}

View File

@ -1,11 +1,11 @@
import QtQuick 2.13 import QtQuick 2.15
import utils 1.0
import StatusQ.Core.Utils 0.1
import AppLayouts.Chat.stores 1.0 import AppLayouts.Chat.stores 1.0
import AppLayouts.Communities.stores 1.0 import AppLayouts.Communities.stores 1.0
import AppLayouts.Profile.helpers 1.0 import AppLayouts.Profile.helpers 1.0
import utils 1.0
import StatusQ.Core.Utils 0.1
import SortFilterProxyModel 0.2 import SortFilterProxyModel 0.2
@ -88,80 +88,6 @@ QtObject {
} }
property var communitiesProfileModule: profileSectionModuleInst.communitiesModule property var communitiesProfileModule: profileSectionModuleInst.communitiesModule
property ListModel mainMenuItems: ListModel {
Component.onCompleted: {
append({subsection: Constants.settingsSubsection.backUpSeed,
text: qsTr("Back up seed phrase"),
icon: "seed-phrase"})
append({subsection: Constants.settingsSubsection.profile,
text: qsTr("Profile"),
icon: "profile"})
append({subsection: Constants.settingsSubsection.password,
text: qsTr("Password"),
icon: "password"})
append({subsection: Constants.settingsSubsection.keycard,
text: qsTr("Keycard"),
icon: "keycard"})
append({subsection: Constants.settingsSubsection.ensUsernames,
text: qsTr("ENS usernames"),
icon: "username",
isExperimental: true,
experimentalTooltip: qsTr("This section is going through a redesign.")
})
append({subsection: Constants.settingsSubsection.syncingSettings,
text: qsTr("Syncing"),
icon: "rotate",
isExperimental: true,
experimentalTooltip: qsTr("Connection problems can happen.<br>If they do, please use the Enter a Seed Phrase feature instead.")
})
}
}
property ListModel appsMenuItems: ListModel {
Component.onCompleted: {
append({subsection: Constants.settingsSubsection.messaging,
text: qsTr("Messaging"),
icon: "chat"})
append({subsection: Constants.settingsSubsection.wallet,
text: qsTr("Wallet"),
icon: "wallet"})
append({subsection: Constants.settingsSubsection.communitiesSettings,
text: qsTr("Communities"),
icon: "communities"})
}
}
property ListModel settingsMenuItems: ListModel {
Component.onCompleted: {
append({subsection: Constants.settingsSubsection.privacyAndSecurity,
text: qsTr("Privacy and security"),
icon: "security"})
append({subsection: Constants.settingsSubsection.appearance,
text: qsTr("Appearance"),
icon: "appearance"})
append({subsection: Constants.settingsSubsection.notifications,
text: qsTr("Notifications & Sounds"),
icon: "notification"})
append({subsection: Constants.settingsSubsection.language,
text: qsTr("Language & Currency"),
icon: "language"})
append({subsection: Constants.settingsSubsection.advanced,
text: qsTr("Advanced"),
icon: "settings"})
}
}
property ListModel extraMenuItems: ListModel {
Component.onCompleted: {
append({subsection: Constants.settingsSubsection.about,
text: qsTr("About"),
icon: "info"})
append({subsection: Constants.settingsSubsection.signout,
text: qsTr("Sign out & Quit"),
icon: "logout"})
}
}
readonly property alias ownShowcaseCommunitiesModel: ownShowcaseModels.adaptedCommunitiesSourceModel readonly property alias ownShowcaseCommunitiesModel: ownShowcaseModels.adaptedCommunitiesSourceModel
readonly property alias ownShowcaseAccountsModel: ownShowcaseModels.adaptedAccountsSourceModel readonly property alias ownShowcaseAccountsModel: ownShowcaseModels.adaptedAccountsSourceModel
readonly property alias ownShowcaseCollectiblesModel: ownShowcaseModels.adaptedCollectiblesSourceModel readonly property alias ownShowcaseCollectiblesModel: ownShowcaseModels.adaptedCollectiblesSourceModel
@ -224,35 +150,6 @@ QtObject {
aboutModuleInst.checkForUpdates() aboutModuleInst.checkForUpdates()
} }
function getNameForSubsection(subsection) {
let i = 0;
for (; i < mainMenuItems.count; i++) {
let elem = mainMenuItems.get(i)
if(elem.subsection === subsection)
return elem.text
}
for (i=0; i < appsMenuItems.count; i++) {
let elem = appsMenuItems.get(i)
if(elem.subsection === subsection)
return elem.text
}
for (i=0; i < settingsMenuItems.count; i++) {
let elem = settingsMenuItems.get(i)
if(elem.subsection === subsection)
return elem.text
}
for (i=0; i < extraMenuItems.count; i++) {
let elem = extraMenuItems.get(i)
if(elem.subsection === subsection)
return elem.text
}
return ""
}
function addressWasShown(address) { function addressWasShown(address) {
return root.mainModuleInst.addressWasShown(address) return root.mainModuleInst.addressWasShown(address)
} }

View File

@ -1,25 +1,21 @@
import QtQuick 2.15 import QtQuick 2.15
import QtQuick.Controls 2.15
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Components 0.1 import StatusQ.Components 0.1
import StatusQ.Core.Theme 0.1
import utils 1.0 import utils 1.0
import shared 1.0
import shared.popups 1.0 import shared.popups 1.0
import "../panels" import AppLayouts.Profile.controls 1.0
import AppLayouts.Profile.stores 1.0
Item { Item {
id: root id: root
property ProfileSectionStore store property alias model: settingsList.model
signal menuItemClicked(var event) signal menuItemClicked(var event)
property alias settingsSubsection: profileMenu.settingsSubsection property alias settingsSubsection: settingsList.currenctSubsection
StatusNavigationPanelHeadline { StatusNavigationPanelHeadline {
id: title id: title
@ -30,49 +26,38 @@ Item {
anchors.leftMargin: Theme.bigPadding anchors.leftMargin: Theme.bigPadding
} }
StatusScrollView { SettingsList {
id: scrollView id: settingsList
contentWidth: availableWidth
contentHeight: profileMenu.height + Theme.bigPadding
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
leftPadding: Theme.halfPadding
anchors.top: title.bottom anchors.top: title.bottom
anchors.topMargin: Theme.halfPadding
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
MenuPanel { anchors.topMargin: Theme.bigPadding
id: profileMenu anchors.bottomMargin: Theme.padding
width: scrollView.availableWidth
privacyStore: store.privacyStore
contactsStore: store.contactsStore
devicesStore: store.devicesStore
mainMenuItems: store.mainMenuItems
settingsMenuItems: store.settingsMenuItems
extraMenuItems: store.extraMenuItems
appsMenuItems: store.appsMenuItems
walletMenuItemEnabled: store.walletMenuItemEnabled
objectName: "leftTabViewProfileMenu" leftMargin: Theme.halfPadding
rightMargin: Theme.padding
bottomMargin: Theme.bigPadding
onMenuItemClicked: { onClicked: {
if (menu_item.subsection === Constants.settingsSubsection.backUpSeed) { if (subsection === Constants.settingsSubsection.backUpSeed) {
Global.openBackUpSeedPopup(); Global.openBackUpSeedPopup()
return; return
} }
let event = { accepted: false, item: menu_item.subsection }; const event = { accepted: false, item: subsection };
root.menuItemClicked(event); root.menuItemClicked(event)
if (event.accepted) if (event.accepted)
return; return
if (menu_item.subsection === Constants.settingsSubsection.signout) if (subsection === Constants.settingsSubsection.signout)
return confirmDialog.open() return confirmDialog.open()
profileMenu.settingsSubsection = menu_item.subsection root.settingsSubsection = subsection
}
} }
} }
@ -82,8 +67,6 @@ Item {
headerSettings.title: qsTr("Sign out") headerSettings.title: qsTr("Sign out")
confirmationText: qsTr("Make sure you have your account password and seed phrase stored. Without them you can lock yourself out of your account and lose funds.") confirmationText: qsTr("Make sure you have your account password and seed phrase stored. Without them you can lock yourself out of your account and lose funds.")
confirmButtonLabel: qsTr("Sign out & Quit") confirmButtonLabel: qsTr("Sign out & Quit")
onConfirmButtonClicked: { onConfirmButtonClicked: Qt.quit()
Qt.quit()
}
} }
} }