feat: add store nodes

Fixes #6591
This commit is contained in:
Richard Ramos 2022-07-28 18:59:58 -04:00
parent 07dbca905c
commit 90a715b69f
5 changed files with 48 additions and 48 deletions

View File

@ -66,11 +66,14 @@ QtObject:
self.delegate.enableAutomaticSelection(value) self.delegate.enableAutomaticSelection(value)
proc useMailserversChanged*(self: View) {.signal.} proc useMailserversChanged*(self: View) {.signal.}
proc getUseMailservers*(self: View): bool {.slot.} = proc getUseMailservers*(self: View): bool {.slot.} =
return self.delegate.getUseMailservers() return self.delegate.getUseMailservers()
QtProperty[bool] useMailservers:
read = getUseMailservers
notify = useMailserversChanged
proc setUseMailservers*(self: View, value: bool) {.slot.} = proc setUseMailservers*(self: View, value: bool) {.slot.} =
self.delegate.setUseMailservers(value) self.delegate.setUseMailservers(value)
QtProperty[bool] useMailservers:
read = getUseMailservers
notify = useMailserversChanged
write = setUseMailservers

View File

@ -129,6 +129,7 @@ StatusAppTwoPanelLayout {
implicitHeight: parent.height implicitHeight: parent.height
messagingStore: profileView.store.messagingStore messagingStore: profileView.store.messagingStore
advancedStore: profileView.store.advancedStore
sectionTitle: profileView.store.getNameForSubsection(Constants.settingsSubsection.messaging) sectionTitle: profileView.store.getNameForSubsection(Constants.settingsSubsection.messaging)
contactsStore: profileView.store.contactsStore contactsStore: profileView.store.contactsStore
contentWidth: d.contentWidth contentWidth: d.contentWidth

View File

@ -19,6 +19,7 @@ StatusModal {
header.title: qsTr("Waku nodes") header.title: qsTr("Waku nodes")
property var messagingStore property var messagingStore
property var advancedStore
onClosed: { onClosed: {
destroy() destroy()
@ -29,10 +30,13 @@ StatusModal {
enodeInput.text = ""; enodeInput.text = "";
} }
contentItem: Item { contentItem: StatusScrollView {
width: parent.width
height: parent.height height: parent.height
width: parent.width
Column {
id: nodesColumn
width: parent.width
StatusInput { StatusInput {
id: nameInput id: nameInput
label: qsTr("Name") label: qsTr("Name")
@ -41,24 +45,24 @@ StatusModal {
minLength: 1 minLength: 1
errorMessage: qsTr("You need to enter a name") errorMessage: qsTr("You need to enter a name")
}] }]
validationMode: StatusInput.ValidationMode.OnlyWhenDirty validationMode: StatusInput.ValidationMode.Always
} }
StatusInput { StatusInput {
id: enodeInput id: enodeInput
label: qsTr("History node address") label: popup.advancedStore.isWakuV2 ? qsTr("Storenode multiaddress") : qsTr("History node address")
placeholderText: "enode://{enode-id}:{password}@{ip-address}:{port-number}" placeholderText: popup.advancedStore.isWakuV2 ? "/ip4/0.0.0.0/tcp/123/..." : "enode://{enode-id}:{password}@{ip-address}:{port-number}"
validators: [StatusMinLengthValidator { validators: [
StatusMinLengthValidator {
minLength: 1 minLength: 1
errorMessage: qsTr("You need to enter the enode address") errorMessage: popup.advancedStore.isWakuV2 ? qsTr("You need to enter the storenode multiaddress") : qsTr("You need to enter the enode address")
}, },
StatusRegularExpressionValidator { StatusRegularExpressionValidator {
errorMessage: qsTr("The format must be: enode://{enode-id}:{password}@{ip-address}:{port}") errorMessage: popup.advancedStore.isWakuV2 ? qsTr('Multiaddress must start with a "/"') : qsTr("The format must be: enode://{enode-id}:{password}@{ip-address}:{port}")
regularExpression: /enode:\/\/[a-z0-9]+:[a-z0-9]+@(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}:[0-9]+/ regularExpression: popup.advancedStore.isWakuV2 ? /\/.+/ : /enode:\/\/[a-z0-9]+:[a-z0-9]+@(\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}:[0-9]+/
}] }]
validationMode: StatusInput.ValidationMode.OnlyWhenDirty validationMode: StatusInput.ValidationMode.Always
anchors.top: nameInput.bottom }
anchors.topMargin: Style.current.bigPadding
} }
} }

View File

@ -18,13 +18,14 @@ import shared.status 1.0
import shared.controls 1.0 import shared.controls 1.0
StatusModal { StatusModal {
id: popup id: root
anchors.centerIn: parent anchors.centerIn: parent
height: 560 height: 560
header.title: qsTr("Waku nodes") header.title: qsTr("Waku nodes")
property var messagingStore property var messagingStore
property var advancedStore
property string nameValidationError: "" property string nameValidationError: ""
property string enodeValidationError: "" property string enodeValidationError: ""
@ -38,16 +39,10 @@ StatusModal {
Column { Column {
id: nodesColumn id: nodesColumn
anchors.left: parent.left width: parent.width
anchors.leftMargin: Style.current.padding
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
StatusListItem { StatusListItem {
anchors.left: parent.left width: parent.width
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
title: qsTr("Use Waku nodes") title: qsTr("Use Waku nodes")
components: [ components: [
StatusSwitch { StatusSwitch {
@ -61,17 +56,11 @@ StatusModal {
} }
Separator { Separator {
anchors.left: parent.left width: parent.width
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
} }
StatusListItem { StatusListItem {
anchors.left: parent.left width: parent.width
anchors.leftMargin: -Style.current.padding
anchors.right: parent.right
anchors.rightMargin: -Style.current.padding
title: qsTr("Select node automatically") title: qsTr("Select node automatically")
components: [ components: [
StatusSwitch { StatusSwitch {
@ -127,7 +116,7 @@ StatusModal {
StatusBaseText { StatusBaseText {
text: qsTr("Add a new node") text: qsTr("Add a new node")
color: Theme.palette.primaryColor1 color: Theme.palette.primaryColor1
width: parent.width
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@ -141,6 +130,7 @@ StatusModal {
id: wakuNodeModalComponent id: wakuNodeModalComponent
AddWakuNodeModal { AddWakuNodeModal {
messagingStore: root.messagingStore messagingStore: root.messagingStore
advancedStore: root.advancedStore
} }
} }
} }

View File

@ -24,6 +24,7 @@ SettingsContentBase {
id: root id: root
property MessagingStore messagingStore property MessagingStore messagingStore
property AdvancedStore advancedStore
property ContactsStore contactsStore property ContactsStore contactsStore
ColumnLayout { ColumnLayout {
@ -426,6 +427,7 @@ SettingsContentBase {
id: wakuNodeModalComponent id: wakuNodeModalComponent
WakuNodesModal { WakuNodesModal {
messagingStore: root.messagingStore messagingStore: root.messagingStore
advancedStore: root.advancedStore
} }
} }