status-desktop/ui/app/AppLayouts/Profile/views/AdvancedView.qml

516 lines
20 KiB
QML
Raw Normal View History

2020-06-17 19:18:31 +00:00
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
2020-11-03 21:04:57 +00:00
import QtGraphicalEffects 1.13
import utils 1.0
import shared 1.0
import shared.panels 1.0
import shared.popups 1.0
import shared.status 1.0
2020-05-27 21:28:25 +00:00
import "../stores"
import "../controls"
import "../popups"
import "../panels"
SettingsContentBase {
id: root
property AdvancedStore advancedStore
Item {
id: advancedContainer
width: root.contentWidth
height: generalColumn.height
Column {
id: generalColumn
anchors.top: parent.top
anchors.left: parent.left
width: root.contentWidth
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Fleet")
currentValue: root.advancedStore.fleet
onClicked: fleetModal.open()
2021-02-22 22:10:47 +00:00
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Minimize on close")
isSwitch: true
switchChecked: !localAccountSensitiveSettings.quitOnClose
onClicked: function (checked) {
localAccountSensitiveSettings.quitOnClose = !checked
}
}
2021-01-19 20:51:16 +00:00
// TODO: replace with StatusQ component
StyledText {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
text: qsTr("Application Logs")
font.pixelSize: 15
font.underline: mouseArea.containsMouse
color: Style.current.blue
topPadding: 23
MouseArea {
id: mouseArea
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onClicked: {
Qt.openUrlExternally(root.advancedStore.logDir())
}
}
}
Item {
id: spacer1
height: Style.current.bigPadding
width: parent.width
}
Separator {
width: parent.width
}
StatusSectionHeadline {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
text: qsTr("Experimental features")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
2020-09-22 15:12:48 +00:00
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Wallet")
isSwitch: true
switchChecked: localAccountSensitiveSettings.isWalletEnabled
onClicked: {
if (!localAccountSensitiveSettings.isWalletEnabled) {
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.wallet
confirmationPopup.open()
} else {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.wallet)
2021-08-13 20:04:04 +00:00
}
}
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Dapp Browser")
isSwitch: true
switchChecked: localAccountSensitiveSettings.isBrowserEnabled
onClicked: {
if (!localAccountSensitiveSettings.isBrowserEnabled) {
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.browser
confirmationPopup.open()
} else {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.browser)
}
}
}
2020-11-23 19:14:48 +00:00
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Community History Archive Protocol")
isSwitch: true
switchChecked: root.advancedStore.isCommunityHistoryArchiveSupportEnabled
onClicked: {
if (!root.advancedStore.isCommunityHistoryArchiveSupportEnabled) {
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.communityHistoryArchiveSupport
confirmationPopup.open()
} else {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.communityHistoryArchiveSupport)
}
}
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Node Management")
isSwitch: true
switchChecked: localAccountSensitiveSettings.nodeManagementEnabled
onClicked: {
if (!localAccountSensitiveSettings.nodeManagementEnabled) {
confirmationPopup.experimentalFeature = root.advancedStore.experimentalFeatures.nodeManagement
confirmationPopup.open()
} else {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.nodeManagement)
}
}
2021-06-30 18:46:26 +00:00
}
// TODO: replace with StatusQ component
2021-09-22 08:51:04 +00:00
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
2021-09-22 08:51:04 +00:00
text: qsTr("Keycard")
isSwitch: true
switchChecked: localAccountSettings.isKeycardEnabled
2021-09-22 08:51:04 +00:00
onClicked: {
root.advancedStore.toggleExperimentalFeature(root.advancedStore.experimentalFeatures.keycard)
2021-09-22 08:51:04 +00:00
}
2021-07-23 15:08:52 +00:00
}
StatusSectionHeadline {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
visible: !root.advancedStore.isWakuV2
text: qsTr("Bloom filter level")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
2021-07-21 13:11:27 +00:00
Row {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
visible: !root.advancedStore.isWakuV2
spacing: 11
2021-07-12 12:10:12 +00:00
Component {
id: bloomConfirmationDialogComponent
ConfirmationDialog {
property string mode: "normal"
2021-07-12 12:10:12 +00:00
id: confirmDialog
header.title: qsTr("Warning!")
confirmationText: qsTr("The account will be logged out. When you login again, the selected mode will be enabled")
onConfirmButtonClicked: {
root.advancedStore.setBloomLevel(mode)
}
onClosed: {
switch(root.advancedStore.bloomLevel){
case "light": btnBloomLight.click(); break;
case "normal": btnBloomNormal.click(); break;
case "full": btnBloomFull.click(); break;
}
destroy()
2021-07-21 13:11:27 +00:00
}
2021-07-12 12:10:12 +00:00
}
}
2021-07-21 13:11:27 +00:00
ButtonGroup {
id: bloomGroup
}
2021-07-21 13:11:27 +00:00
BloomSelectorButton {
id: btnBloomLight
buttonGroup: bloomGroup
checkedByDefault: root.advancedStore.bloomLevel == "light"
btnText: qsTr("Light Node")
onToggled: {
if (root.advancedStore.bloomLevel != "light") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "light"})
} else {
btnBloomLight.click()
}
2021-07-21 13:11:27 +00:00
}
}
BloomSelectorButton {
id: btnBloomNormal
buttonGroup: bloomGroup
checkedByDefault: root.advancedStore.bloomLevel == "normal"
btnText: qsTr("Normal")
onToggled: {
if (root.advancedStore.bloomLevel != "normal") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "normal"})
} else {
btnBloomNormal.click()
}
2021-07-21 13:11:27 +00:00
}
}
BloomSelectorButton {
id: btnBloomFull
buttonGroup: bloomGroup
checkedByDefault: root.advancedStore.bloomLevel == "full"
btnText: qsTr("Full Node")
onToggled: {
if (root.advancedStore.bloomLevel != "full") {
Global.openPopup(bloomConfirmationDialogComponent, {mode: "full"})
} else {
btnBloomFull.click()
}
2021-07-21 13:11:27 +00:00
}
}
}
2021-09-06 22:31:10 +00:00
StatusSectionHeadline {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
visible: root.advancedStore.isWakuV2
2021-09-06 22:31:10 +00:00
text: qsTr("WakuV2 mode")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
Row {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
2021-09-06 22:31:10 +00:00
spacing: 11
visible: root.advancedStore.isWakuV2
2021-09-06 22:31:10 +00:00
Component {
id: wakuV2ModeConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
id: confirmDialog
confirmationText: qsTr("The account will be logged out. When you login again, the selected mode will be enabled")
2021-09-06 22:31:10 +00:00
onConfirmButtonClicked: {
root.advancedStore.setWakuV2LightClientEnabled(mode)
2021-09-06 22:31:10 +00:00
}
onClosed: {
if(root.advancedStore.wakuV2LightClientEnabled){
2021-09-06 22:31:10 +00:00
btnWakuV2Light.click()
} else {
btnWakuV2Full.click();
}
destroy()
}
}
}
ButtonGroup {
id: wakuV2Group
}
BloomSelectorButton {
id: btnWakuV2Light
buttonGroup: wakuV2Group
checkedByDefault: root.advancedStore.wakuV2LightClientEnabled
btnText: qsTr("Light Node")
2021-09-06 22:31:10 +00:00
onToggled: {
if (!root.advancedStore.wakuV2LightClientEnabled) {
Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: true})
2021-09-06 22:31:10 +00:00
} else {
btnWakuV2Light.click()
}
}
}
BloomSelectorButton {
id: btnWakuV2Full
buttonGroup: wakuV2Group
checkedByDefault: !root.advancedStore.wakuV2LightClientEnabled
btnText: qsTr("Full Node")
2021-09-06 22:31:10 +00:00
onToggled: {
if (root.advancedStore.wakuV2LightClientEnabled) {
Global.openPopup(wakuV2ModeConfirmationDialogComponent, {mode: false})
2021-09-06 22:31:10 +00:00
} else {
btnWakuV2Full.click()
}
}
}
}
StatusSectionHeadline {
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
text: qsTr("Developer features")
topPadding: Style.current.bigPadding
bottomPadding: Style.current.padding
}
Separator {
width: parent.width
}
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Full developer mode")
isEnabled: {
return !localAccountSensitiveSettings.downloadChannelMessagesEnabled ||
!root.advancedStore.isTelemetryEnabled ||
!root.advancedStore.isDebugEnabled ||
!root.advancedStore.isAutoMessageEnabled
}
onClicked: {
Global.openPopup(enableDeveloperFeaturesConfirmationDialogComponent)
}
}
Separator {
width: parent.width
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Download messages")
isSwitch: true
switchChecked: localAccountSensitiveSettings.downloadChannelMessagesEnabled
onClicked: {
localAccountSensitiveSettings.downloadChannelMessagesEnabled = !localAccountSensitiveSettings.downloadChannelMessagesEnabled
}
}
2021-11-24 14:20:05 +00:00
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Telemetry")
isSwitch: true
switchChecked: root.advancedStore.isTelemetryEnabled
onClicked: {
Global.openPopup(enableTelemetryConfirmationDialogComponent)
}
}
2021-11-24 14:20:05 +00:00
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Debug")
2021-11-24 14:20:05 +00:00
isSwitch: true
switchChecked: root.advancedStore.isDebugEnabled
2021-11-24 14:20:05 +00:00
onClicked: {
Global.openPopup(enableDebugComponent)
}
}
// TODO: replace with StatusQ component
StatusSettingsLineButton {
anchors.leftMargin: 0
anchors.rightMargin: 0
text: qsTr("Auto message")
isSwitch: true
switchChecked: root.advancedStore.isAutoMessageEnabled
onClicked: {
Global.openPopup(enableAutoMessageConfirmationDialogComponent)
}
}
}
2020-08-25 09:00:03 +00:00
FleetsModal {
id: fleetModal
advancedStore: root.advancedStore
}
Component {
id: enableDeveloperFeaturesConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
id: confirmDialog
showCancelButton: true
confirmationText: qsTr("Are you sure you want to enable all the develoer features? The app will be restarted.")
onConfirmButtonClicked: {
localAccountSensitiveSettings.downloadChannelMessagesEnabled = true
Qt.callLater(root.advancedStore.enableDeveloperFeatures)
close()
}
onCancelButtonClicked: {
close()
}
}
}
Component {
id: enableTelemetryConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
id: confirmDialog
showCancelButton: true
confirmationText: qsTr("Are you sure you want to enable telemetry? This will reduce your privacy level while using Status. You need to restart the app for this change to take effect.")
onConfirmButtonClicked: {
root.advancedStore.toggleTelemetry()
close()
2021-11-24 14:20:05 +00:00
}
onCancelButtonClicked: {
close()
}
}
}
Component {
id: enableAutoMessageConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
id: confirmDialog
showCancelButton: true
confirmationText: qsTr("Are you sure you want to enable auto message? You need to restart the app for this change to take effect.")
onConfirmButtonClicked: {
root.advancedStore.toggleAutoMessage()
2021-11-24 14:20:05 +00:00
close()
}
onCancelButtonClicked: {
close()
}
}
}
Component {
id: enableDebugComponent
ConfirmationDialog {
property bool mode: false
id: confirmDialog
showCancelButton: true
confirmationText: qsTr("Are you sure you want to %1 debug mode? You need to restart the app for this change to take effect.").arg(root.advancedStore.isDebugEnabled ?
2022-02-09 09:43:23 +00:00
qsTr("disable") :
qsTr("enable"))
onConfirmButtonClicked: {
root.advancedStore.toggleDebug()
close()
}
onCancelButtonClicked: {
close()
}
}
}
ConfirmationDialog {
id: confirmationPopup
property string experimentalFeature: ""
showCancelButton: true
confirmationText: qsTr("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.")
confirmButtonLabel: qsTr("I understand")
onConfirmButtonClicked: {
root.advancedStore.toggleExperimentalFeature(experimentalFeature)
experimentalFeature = ""
close()
}
onCancelButtonClicked: {
close()
}
}
}
}