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,36 +30,39 @@ StatusModal {
enodeInput.text = ""; enodeInput.text = "";
} }
contentItem: Item { contentItem: StatusScrollView {
width: parent.width
height: parent.height height: parent.height
width: parent.width
StatusInput { Column {
id: nameInput id: nodesColumn
label: qsTr("Name") width: parent.width
placeholderText: qsTr("Specify a name") StatusInput {
validators: [StatusMinLengthValidator { id: nameInput
minLength: 1 label: qsTr("Name")
errorMessage: qsTr("You need to enter a name") placeholderText: qsTr("Specify a name")
}] validators: [StatusMinLengthValidator {
validationMode: StatusInput.ValidationMode.OnlyWhenDirty minLength: 1
} errorMessage: qsTr("You need to enter a name")
}]
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: [
minLength: 1 StatusMinLengthValidator {
errorMessage: qsTr("You need to enter the enode address") minLength: 1
}, errorMessage: popup.advancedStore.isWakuV2 ? qsTr("You need to enter the storenode multiaddress") : qsTr("You need to enter the enode address")
StatusRegularExpressionValidator { },
errorMessage: qsTr("The format must be: enode://{enode-id}:{password}@{ip-address}:{port}") StatusRegularExpressionValidator {
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]+/ errorMessage: popup.advancedStore.isWakuV2 ? qsTr('Multiaddress must start with a "/"') : qsTr("The format must be: enode://{enode-id}:{password}@{ip-address}:{port}")
}] 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 }]
anchors.top: nameInput.bottom validationMode: StatusInput.ValidationMode.Always
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
} }
} }