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
2021-09-28 15:04:06 +00:00
import utils 1.0
2021-10-27 21:27:49 +00:00
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
2021-10-06 09:16:39 +00:00
import "../controls"
import "../popups"
import "../panels"
2021-08-06 12:25:51 +00:00
ScrollView {
2021-10-06 09:16:39 +00:00
id: root
2021-08-06 12:25:51 +00:00
height: parent . height
width: parent . width
contentHeight: advancedContainer . height + 100
2021-04-08 15:44:58 +00:00
clip: true
2021-10-06 09:16:39 +00:00
property bool isWakuV2: store . fleet == Constants . waku_prod || store . fleet === Constants . waku_test
property var store
2020-05-27 21:28:25 +00:00
2021-08-06 12:25:51 +00:00
Item {
id: advancedContainer
2021-04-08 15:44:58 +00:00
width: profileContainer . profileContentWidth
2021-03-18 09:33:39 +00:00
anchors.horizontalCenter: parent . horizontalCenter
2021-08-06 12:25:51 +00:00
height: generalColumn . height
2021-01-05 16:36:42 +00:00
2021-08-06 12:25:51 +00:00
Column {
id: generalColumn
anchors.top: parent . top
2021-10-06 09:16:39 +00:00
anchors.topMargin: 64
2021-08-06 12:25:51 +00:00
anchors.left: parent . left
anchors.right: parent . right
2021-01-14 14:12:37 +00:00
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
StatusSettingsLineButton {
//% "Network"
text: qsTrId ( "network" )
2021-10-06 09:16:39 +00:00
currentValue: root . store . getNetworkName ( )
2021-08-06 12:25:51 +00:00
onClicked: networksModal . open ( )
}
2021-01-05 16:36:42 +00:00
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
StatusSettingsLineButton {
//% "Fleet"
text: qsTrId ( "fleet" )
2021-10-06 09:16:39 +00:00
currentValue: root . store . fleet
2021-08-06 12:25:51 +00:00
onClicked: fleetModal . open ( )
2021-02-22 22:10:47 +00:00
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
StatusSettingsLineButton {
//% "Minimize on close"
text: qsTrId ( "minimize-on-close" )
isSwitch: true
switchChecked: ! appSettings . quitOnClose
onClicked: function ( checked ) {
appSettings . quitOnClose = ! checked
}
}
2021-01-19 20:51:16 +00:00
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-09-14 16:17:35 +00:00
StyledText {
//% "Application Logs"
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: {
2021-10-06 09:16:39 +00:00
Qt . openUrlExternally ( root . store . logDir ( ) )
2021-09-14 16:17:35 +00:00
}
}
}
2021-08-06 12:25:51 +00:00
Item {
id: spacer1
height: Style . current . bigPadding
width: parent . width
}
2020-08-18 19:10:30 +00:00
2021-08-06 12:25:51 +00:00
Separator {
anchors.topMargin: Style . current . bigPadding
anchors.left: parent . left
anchors.leftMargin: - Style . current . padding
anchors.right: parent . right
anchors.rightMargin: - Style . current . padding
}
2020-06-26 14:08:08 +00:00
2021-08-06 12:25:51 +00:00
StatusSectionHeadline {
//% "Experimental features"
text: qsTrId ( "experimental-features" )
topPadding: Style . current . bigPadding
bottomPadding: Style . current . padding
2020-09-22 15:12:48 +00:00
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
StatusSettingsLineButton {
//% "Wallet"
text: qsTrId ( "wallet" )
isSwitch: true
switchChecked: appSettings . isWalletEnabled
onClicked: {
if ( ! appSettings . isWalletEnabled ) {
confirmationPopup . settingsProp = "isWalletEnabled"
confirmationPopup . open ( )
} else {
appSettings . isWalletEnabled = false
}
2021-04-23 10:22:07 +00:00
}
2020-06-18 12:03:11 +00:00
}
2020-11-23 19:14:48 +00:00
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-13 20:04:04 +00:00
StatusSettingsLineButton {
2021-09-09 12:06:57 +00:00
text: qsTr ( "Wallet v2 - do not use, under active development" )
2021-08-13 20:04:04 +00:00
isSwitch: true
switchChecked: appSettings . isWalletV2Enabled
onClicked: {
if ( ! appSettings . isWalletV2Enabled ) {
confirmationPopup . settingsProp = "isWalletV2Enabled"
confirmationPopup . open ( )
} else {
appSettings . isWalletV2Enabled = false
}
}
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
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
}
2021-04-23 10:22:07 +00:00
}
2021-01-14 14:12:37 +00:00
}
2020-11-23 19:14:48 +00:00
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
StatusSettingsLineButton {
//% "Communities"
text: qsTrId ( "communities" )
isSwitch: true
switchChecked: appSettings . communitiesEnabled
onClicked: {
if ( ! appSettings . communitiesEnabled ) {
confirmationPopup . settingsProp = "communitiesEnabled"
confirmationPopup . open ( )
} else {
appSettings . communitiesEnabled = false
}
2021-06-14 16:39:49 +00:00
}
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
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
}
2021-07-23 15:08:52 +00:00
}
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
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
}
}
2021-06-30 18:46:26 +00:00
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
StatusSettingsLineButton {
id: onlineUsers
//% "Online users"
text: qsTrId ( "online-users" )
2021-07-11 22:40:06 +00:00
isSwitch: true
2021-08-06 12:25:51 +00:00
switchChecked: appSettings . showOnlineUsers
onClicked: {
appSettings . showOnlineUsers = ! appSettings . showOnlineUsers
}
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-06 12:25:51 +00:00
StatusSettingsLineButton {
//% "GIF Widget"
text: qsTrId ( "gif-widget" )
isSwitch: true
switchChecked: appSettings . isGifWidgetEnabled
onClicked: {
appSettings . isGifWidgetEnabled = ! appSettings . isGifWidgetEnabled
}
2021-09-22 08:51:04 +00:00
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-09-22 08:51:04 +00:00
StatusSettingsLineButton {
//% "Keycard"
text: qsTr ( "Keycard" )
isSwitch: true
switchChecked: appSettings . isKeycardEnabled
onClicked: {
appSettings . isKeycardEnabled = ! appSettings . isKeycardEnabled
}
2021-07-23 15:08:52 +00:00
}
2021-08-06 12:25:51 +00:00
StatusSectionHeadline {
2021-09-06 22:31:10 +00:00
visible: ! isWakuV2
2021-08-06 12:25:51 +00:00
//% "Bloom filter level"
text: qsTrId ( "bloom-filter-level" )
topPadding: Style . current . bigPadding
bottomPadding: Style . current . padding
}
2021-07-21 13:11:27 +00:00
2021-08-06 12:25:51 +00:00
Row {
2021-09-06 22:31:10 +00:00
visible: ! isWakuV2
2021-08-06 12:25:51 +00:00
spacing: 11
2021-07-12 12:10:12 +00:00
2021-08-06 12:25:51 +00:00
Component {
id: bloomConfirmationDialogComponent
ConfirmationDialog {
property string mode: "normal"
2021-07-12 12:10:12 +00:00
2021-08-06 12:25:51 +00:00
id: confirmDialog
//% "Warning!"
2021-09-09 09:10:29 +00:00
header.title: qsTrId ( "close-app-title" )
2021-08-06 12:25:51 +00:00
//% "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: {
2021-10-06 09:16:39 +00:00
root . store . setBloomLevel ( mode )
2021-08-06 12:25:51 +00:00
}
onClosed: {
2021-10-06 09:16:39 +00:00
switch ( root . store . nodeModelInst . bloomLevel ) {
2021-08-06 12:25:51 +00:00
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
2021-08-06 12:25:51 +00:00
ButtonGroup {
id: bloomGroup
}
2021-07-21 13:11:27 +00:00
2021-08-06 12:25:51 +00:00
BloomSelectorButton {
id: btnBloomLight
buttonGroup: bloomGroup
2021-10-06 09:16:39 +00:00
checkedByDefault: root . store . bloomLevel == "light"
2021-08-06 12:25:51 +00:00
//% "Light Node"
btnText: qsTrId ( "light-node" )
onToggled: {
2021-10-06 09:16:39 +00:00
if ( root . store . bloomLevel != "light" ) {
2021-08-06 12:25:51 +00:00
openPopup ( bloomConfirmationDialogComponent , { mode: "light" } )
} else {
btnBloomLight . click ( )
}
2021-07-21 13:11:27 +00:00
}
}
2021-08-06 12:25:51 +00:00
BloomSelectorButton {
id: btnBloomNormal
buttonGroup: bloomGroup
2021-10-06 09:16:39 +00:00
checkedByDefault: root . store . bloomLevel == "normal"
2021-08-06 12:25:51 +00:00
//% "Normal"
btnText: qsTrId ( "normal" )
onToggled: {
2021-10-06 09:16:39 +00:00
if ( root . store . bloomLevel != "normal" ) {
2021-08-06 12:25:51 +00:00
openPopup ( bloomConfirmationDialogComponent , { mode: "normal" } )
} else {
btnBloomNormal . click ( )
}
2021-07-21 13:11:27 +00:00
}
}
2021-08-06 12:25:51 +00:00
BloomSelectorButton {
id: btnBloomFull
buttonGroup: bloomGroup
2021-10-06 09:16:39 +00:00
checkedByDefault: root . store . bloomLevel == "full"
2021-08-06 12:25:51 +00:00
//% "Full Node"
btnText: qsTrId ( "full-node" )
onToggled: {
2021-10-06 09:16:39 +00:00
if ( root . store . bloomLevel != "full" ) {
2021-08-06 12:25:51 +00:00
openPopup ( bloomConfirmationDialogComponent , { mode: "full" } )
} else {
btnBloomFull . click ( )
}
2021-07-21 13:11:27 +00:00
}
}
2021-08-09 15:23:44 +00:00
}
2021-09-06 22:31:10 +00:00
StatusSectionHeadline {
visible: isWakuV2
text: qsTr ( "WakuV2 mode" )
topPadding: Style . current . bigPadding
bottomPadding: Style . current . padding
}
Row {
spacing: 11
visible: isWakuV2
Component {
id: wakuV2ModeConfirmationDialogComponent
ConfirmationDialog {
property bool mode: false
id: confirmDialog
//% "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: {
2021-10-06 09:16:39 +00:00
root . store . setWakuV2LightClient ( mode )
2021-09-06 22:31:10 +00:00
}
onClosed: {
2021-10-06 09:16:39 +00:00
if ( root . store . isWakuV2LightClient ) {
2021-09-06 22:31:10 +00:00
btnWakuV2Light . click ( )
} else {
btnWakuV2Full . click ( ) ;
}
destroy ( )
}
}
}
ButtonGroup {
id: wakuV2Group
}
BloomSelectorButton {
id: btnWakuV2Light
buttonGroup: wakuV2Group
2021-10-06 09:16:39 +00:00
checkedByDefault: root . store . isWakuV2LightClient
2021-09-06 22:31:10 +00:00
//% "Light Node"
btnText: qsTrId ( "light-node" )
onToggled: {
2021-10-06 09:16:39 +00:00
if ( ! root . store . isWakuV2LightClient ) {
2021-09-06 22:31:10 +00:00
openPopup ( wakuV2ModeConfirmationDialogComponent , { light: true } )
} else {
btnWakuV2Light . click ( )
}
}
}
BloomSelectorButton {
id: btnWakuV2Full
buttonGroup: wakuV2Group
2021-10-06 09:16:39 +00:00
checkedByDefault: ! root . store . isWakuV2LightClient
2021-09-06 22:31:10 +00:00
//% "Full Node"
btnText: qsTrId ( "full-node" )
onToggled: {
2021-10-06 09:16:39 +00:00
if ( root . store . isWakuV2LightClient ) {
2021-09-06 22:31:10 +00:00
openPopup ( wakuV2ModeConfirmationDialogComponent , { light: false } )
} else {
btnWakuV2Full . click ( )
}
}
}
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-09-15 10:59:01 +00:00
StatusSettingsLineButton {
text: qsTr ( "Download messages" )
isSwitch: true
switchChecked: appSettings . downloadChannelMessagesEnabled
onClicked: {
appSettings . downloadChannelMessagesEnabled = ! appSettings . downloadChannelMessagesEnabled
}
}
2021-10-06 09:16:39 +00:00
// TODO: replace with StatusQ component
2021-08-09 15:23:44 +00:00
StatusSettingsLineButton {
text: qsTr ( "Stickers/ENS on ropsten" )
2021-10-06 09:16:39 +00:00
visible: root . store . currentNetwork === Constants . networkRopsten
2021-08-09 15:23:44 +00:00
isSwitch: true
switchChecked: appSettings . stickersEnsRopsten
onClicked: {
appSettings . stickersEnsRopsten = ! appSettings . stickersEnsRopsten
}
}
2021-08-06 12:25:51 +00:00
}
2020-11-03 21:04:57 +00:00
2021-08-06 12:25:51 +00:00
NetworksModal {
id: networksModal
}
2020-08-25 09:00:03 +00:00
2021-08-06 12:25:51 +00:00
FleetsModal {
id: fleetModal
2021-04-23 10:22:07 +00:00
}
2020-08-27 17:28:31 +00:00
2021-08-06 12:25:51 +00:00
ConfirmationDialog {
id: confirmationPopup
property string settingsProp: ""
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."
2021-09-09 12:06:57 +00:00
confirmationText: ( settingsProp === "isWalletV2Enabled" ? qsTr ( "<b>--DO NOT USE - UNDER ACTIVE DEVELOPMENT--</b>\n" ) : "" ) +
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-" )
2021-08-06 12:25:51 +00:00
//% "I understand"
confirmButtonLabel: qsTrId ( "i-understand" )
onConfirmButtonClicked: {
appSettings [ settingsProp ] = true
settingsProp = ""
close ( )
}
onCancelButtonClicked: {
close ( )
}
2021-04-23 10:22:07 +00:00
}
}
2020-06-18 12:03:11 +00:00
}
/ * # # ^ # #
Designer {
D { i: 0 ; height: 400 ; width: 700 }
2020-05-27 21:28:25 +00:00
}
2020-06-18 12:03:11 +00:00
# # ^ # # * /