fix(@desktop/profile): Add scroll bar for advance settings

This commit is contained in:
Anthony Laibe 2021-08-06 14:25:51 +02:00 committed by Iuri Matias
parent 7c407305d2
commit 7df028df77
1 changed files with 257 additions and 251 deletions

View File

@ -6,288 +6,294 @@ import "../../../../imports"
import "../../../../shared"
import "../../../../shared/status"
Item {
id: advancedContainer
Layout.fillHeight: true
Layout.fillWidth: true
ScrollView {
height: parent.height
width: parent.width
contentHeight: advancedContainer.height + 100
clip: true
Column {
id: generalColumn
anchors.top: parent.top
anchors.topMargin: topMargin
Item {
id: advancedContainer
width: profileContainer.profileContentWidth
anchors.horizontalCenter: parent.horizontalCenter
height: generalColumn.height
StatusSettingsLineButton {
//% "Network"
text: qsTrId("network")
currentValue: utilsModel.getNetworkName()
onClicked: networksModal.open()
}
StatusSettingsLineButton {
//% "Fleet"
text: qsTrId("fleet")
currentValue: profileModel.fleets.fleet
onClicked: fleetModal.open()
}
StatusSettingsLineButton {
//% "Minimize on close"
text: qsTrId("minimize-on-close")
isSwitch: true
switchChecked: !appSettings.quitOnClose
onClicked: function (checked) {
appSettings.quitOnClose = !checked
}
}
Item {
id: spacer1
height: Style.current.bigPadding
width: parent.width
}
Separator {
anchors.topMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
}
StatusSectionHeadline {
//% "Experimental features"
text: qsTrId("experimental-features")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
StatusSettingsLineButton {
//% "Wallet"
text: qsTrId("wallet")
isSwitch: true
switchChecked: appSettings.isWalletEnabled
onClicked: {
if (!appSettings.isWalletEnabled) {
confirmationPopup.settingsProp = "isWalletEnabled"
confirmationPopup.open()
} else {
appSettings.isWalletEnabled = false
}
}
}
StatusSettingsLineButton {
//% "Dapp Browser"
text: qsTrId("dapp-browser")
isSwitch: true
switchChecked: appSettings.isBrowserEnabled
onClicked: {
if (!appSettings.isBrowserEnabled) {
confirmationPopup.settingsProp = "isBrowserEnabled"
confirmationPopup.open()
} else {
appSettings.isBrowserEnabled = false
}
}
}
StatusSettingsLineButton {
//% "Communities"
text: qsTrId("communities")
isSwitch: true
switchChecked: appSettings.communitiesEnabled
onClicked: {
if (!appSettings.communitiesEnabled) {
confirmationPopup.settingsProp = "communitiesEnabled"
confirmationPopup.open()
} else {
appSettings.communitiesEnabled = false
}
}
}
StatusSettingsLineButton {
//% "Activity Center"
text: qsTrId("activity-center")
isSwitch: true
switchChecked: appSettings.isActivityCenterEnabled
onClicked: {
if (!appSettings.isActivityCenterEnabled) {
confirmationPopup.settingsProp = "isActivityCenterEnabled"
confirmationPopup.open()
} else {
appSettings.isActivityCenterEnabled = false
}
}
}
StatusSettingsLineButton {
//% "Node Management"
text: qsTrId("node-management")
isSwitch: true
switchChecked: appSettings.nodeManagementEnabled
onClicked: {
if (!appSettings.nodeManagementEnabled) {
confirmationPopup.settingsProp = "nodeManagementEnabled"
confirmationPopup.open()
} else {
appSettings.nodeManagementEnabled = false
}
}
}
StatusSettingsLineButton {
id: onlineUsers
//% "Online users"
text: qsTrId("online-users")
isSwitch: true
switchChecked: appSettings.showOnlineUsers
onClicked: {
appSettings.showOnlineUsers = !appSettings.showOnlineUsers
}
}
Loader {
active: onlineUsers.switchChecked
Column {
id: generalColumn
anchors.top: parent.top
anchors.topMargin: topMargin
anchors.left: parent.left
anchors.right: parent.right
sourceComponent: StatusSettingsLineButton {
//% "Broadcast user status"
text: qsTrId("broadcast-user-status")
StatusSettingsLineButton {
//% "Network"
text: qsTrId("network")
currentValue: utilsModel.getNetworkName()
onClicked: networksModal.open()
}
StatusSettingsLineButton {
//% "Fleet"
text: qsTrId("fleet")
currentValue: profileModel.fleets.fleet
onClicked: fleetModal.open()
}
StatusSettingsLineButton {
//% "Minimize on close"
text: qsTrId("minimize-on-close")
isSwitch: true
switchChecked: profileModel.profile.sendUserStatus
switchChecked: !appSettings.quitOnClose
onClicked: function (checked) {
if (profileModel.profile.sendUserStatus !== checked) {
profileModel.setSendUserStatus(checked)
appSettings.quitOnClose = !checked
}
}
Item {
id: spacer1
height: Style.current.bigPadding
width: parent.width
}
Separator {
anchors.topMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
}
StatusSectionHeadline {
//% "Experimental features"
text: qsTrId("experimental-features")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
StatusSettingsLineButton {
//% "Wallet"
text: qsTrId("wallet")
isSwitch: true
switchChecked: appSettings.isWalletEnabled
onClicked: {
if (!appSettings.isWalletEnabled) {
confirmationPopup.settingsProp = "isWalletEnabled"
confirmationPopup.open()
} else {
appSettings.isWalletEnabled = false
}
}
}
}
StatusSettingsLineButton {
//% "GIF Widget"
text: qsTrId("gif-widget")
isSwitch: true
switchChecked: appSettings.isGifWidgetEnabled
onClicked: {
appSettings.isGifWidgetEnabled = !appSettings.isGifWidgetEnabled
}
}
StatusSectionHeadline {
//% "Bloom filter level"
text: qsTrId("bloom-filter-level")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
Row {
spacing: 11
Component {
id: bloomConfirmationDialogComponent
ConfirmationDialog {
property string mode: "normal"
id: confirmDialog
//% "Warning!"
title: qsTrId("close-app-title")
//% "The account will be logged out. When you login again, the selected mode will be enabled"
confirmationText: qsTrId("the-account-will-be-logged-out--when-you-login-again--the-selected-mode-will-be-enabled")
onConfirmButtonClicked: {
nodeModel.setBloomLevel(mode)
StatusSettingsLineButton {
//% "Dapp Browser"
text: qsTrId("dapp-browser")
isSwitch: true
switchChecked: appSettings.isBrowserEnabled
onClicked: {
if (!appSettings.isBrowserEnabled) {
confirmationPopup.settingsProp = "isBrowserEnabled"
confirmationPopup.open()
} else {
appSettings.isBrowserEnabled = false
}
onClosed: {
switch(nodeModel.bloomLevel){
case "light": btnBloomLight.click(); break;
case "normal": btnBloomNormal.click(); break;
case "full": btnBloomFull.click(); break;
}
}
StatusSettingsLineButton {
//% "Communities"
text: qsTrId("communities")
isSwitch: true
switchChecked: appSettings.communitiesEnabled
onClicked: {
if (!appSettings.communitiesEnabled) {
confirmationPopup.settingsProp = "communitiesEnabled"
confirmationPopup.open()
} else {
appSettings.communitiesEnabled = false
}
}
}
StatusSettingsLineButton {
//% "Activity Center"
text: qsTrId("activity-center")
isSwitch: true
switchChecked: appSettings.isActivityCenterEnabled
onClicked: {
if (!appSettings.isActivityCenterEnabled) {
confirmationPopup.settingsProp = "isActivityCenterEnabled"
confirmationPopup.open()
} else {
appSettings.isActivityCenterEnabled = false
}
}
}
StatusSettingsLineButton {
//% "Node Management"
text: qsTrId("node-management")
isSwitch: true
switchChecked: appSettings.nodeManagementEnabled
onClicked: {
if (!appSettings.nodeManagementEnabled) {
confirmationPopup.settingsProp = "nodeManagementEnabled"
confirmationPopup.open()
} else {
appSettings.nodeManagementEnabled = false
}
}
}
StatusSettingsLineButton {
id: onlineUsers
//% "Online users"
text: qsTrId("online-users")
isSwitch: true
switchChecked: appSettings.showOnlineUsers
onClicked: {
appSettings.showOnlineUsers = !appSettings.showOnlineUsers
}
}
Loader {
active: onlineUsers.switchChecked
anchors.left: parent.left
anchors.right: parent.right
sourceComponent: StatusSettingsLineButton {
//% "Broadcast user status"
text: qsTrId("broadcast-user-status")
isSwitch: true
switchChecked: profileModel.profile.sendUserStatus
onClicked: function (checked) {
if (profileModel.profile.sendUserStatus !== checked) {
profileModel.setSendUserStatus(checked)
}
destroy()
}
}
}
ButtonGroup {
id: bloomGroup
}
BloomSelectorButton {
id: btnBloomLight
buttonGroup: bloomGroup
checkedByDefault: nodeModel.bloomLevel == "light"
//% "Light Node"
btnText: qsTrId("light-node")
onToggled: {
if (nodeModel.bloomLevel != "light") {
openPopup(bloomConfirmationDialogComponent, {mode: "light"})
} else {
btnBloomLight.click()
}
StatusSettingsLineButton {
//% "GIF Widget"
text: qsTrId("gif-widget")
isSwitch: true
switchChecked: appSettings.isGifWidgetEnabled
onClicked: {
appSettings.isGifWidgetEnabled = !appSettings.isGifWidgetEnabled
}
}
BloomSelectorButton {
id: btnBloomNormal
buttonGroup: bloomGroup
checkedByDefault: nodeModel.bloomLevel == "normal"
//% "Normal"
btnText: qsTrId("normal")
onToggled: {
if (nodeModel.bloomLevel != "normal") {
openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
} else {
btnBloomNormal.click()
}
}
StatusSectionHeadline {
//% "Bloom filter level"
text: qsTrId("bloom-filter-level")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
BloomSelectorButton {
id: btnBloomFull
buttonGroup: bloomGroup
checkedByDefault: nodeModel.bloomLevel == "full"
//% "Full Node"
btnText: qsTrId("full-node")
onToggled: {
if (nodeModel.bloomLevel != "full") {
openPopup(bloomConfirmationDialogComponent, {mode: "full"})
} else {
btnBloomFull.click()
Row {
spacing: 11
Component {
id: bloomConfirmationDialogComponent
ConfirmationDialog {
property string mode: "normal"
id: confirmDialog
//% "Warning!"
title: qsTrId("close-app-title")
//% "The account will be logged out. When you login again, the selected mode will be enabled"
confirmationText: qsTrId("the-account-will-be-logged-out--when-you-login-again--the-selected-mode-will-be-enabled")
onConfirmButtonClicked: {
nodeModel.setBloomLevel(mode)
}
onClosed: {
switch(nodeModel.bloomLevel){
case "light": btnBloomLight.click(); break;
case "normal": btnBloomNormal.click(); break;
case "full": btnBloomFull.click(); break;
}
destroy()
}
}
}
}
}
}
NetworksModal {
id: networksModal
}
ButtonGroup {
id: bloomGroup
}
FleetsModal {
id: fleetModal
}
BloomSelectorButton {
id: btnBloomLight
buttonGroup: bloomGroup
checkedByDefault: nodeModel.bloomLevel == "light"
//% "Light Node"
btnText: qsTrId("light-node")
onToggled: {
if (nodeModel.bloomLevel != "light") {
openPopup(bloomConfirmationDialogComponent, {mode: "light"})
} else {
btnBloomLight.click()
}
}
}
ConfirmationDialog {
id: confirmationPopup
property string settingsProp: ""
height: 310
showCancelButton: true
//% "This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk."
confirmationText: qsTrId("this-feature-is-experimental-and-is-meant-for-testing-purposes-by-core-contributors-and-the-community--it-s-not-meant-for-real-use-and-makes-no-claims-of-security-or-integrity-of-funds-or-data--use-at-your-own-risk-")
//% "I understand"
confirmButtonLabel: qsTrId("i-understand")
onConfirmButtonClicked: {
appSettings[settingsProp] = true
settingsProp = ""
close()
BloomSelectorButton {
id: btnBloomNormal
buttonGroup: bloomGroup
checkedByDefault: nodeModel.bloomLevel == "normal"
//% "Normal"
btnText: qsTrId("normal")
onToggled: {
if (nodeModel.bloomLevel != "normal") {
openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
} else {
btnBloomNormal.click()
}
}
}
BloomSelectorButton {
id: btnBloomFull
buttonGroup: bloomGroup
checkedByDefault: nodeModel.bloomLevel == "full"
//% "Full Node"
btnText: qsTrId("full-node")
onToggled: {
if (nodeModel.bloomLevel != "full") {
openPopup(bloomConfirmationDialogComponent, {mode: "full"})
} else {
btnBloomFull.click()
}
}
}
}
}
onCancelButtonClicked: {
close()
NetworksModal {
id: networksModal
}
FleetsModal {
id: fleetModal
}
ConfirmationDialog {
id: confirmationPopup
property string settingsProp: ""
height: 310
showCancelButton: true
//% "This feature is experimental and is meant for testing purposes by core contributors and the community. It's not meant for real use and makes no claims of security or integrity of funds or data. Use at your own risk."
confirmationText: qsTrId("this-feature-is-experimental-and-is-meant-for-testing-purposes-by-core-contributors-and-the-community--it-s-not-meant-for-real-use-and-makes-no-claims-of-security-or-integrity-of-funds-or-data--use-at-your-own-risk-")
//% "I understand"
confirmButtonLabel: qsTrId("i-understand")
onConfirmButtonClicked: {
appSettings[settingsProp] = true
settingsProp = ""
close()
}
onCancelButtonClicked: {
close()
}
}
}
}