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)
proc useMailserversChanged*(self: View) {.signal.}
proc getUseMailservers*(self: View): bool {.slot.} =
return self.delegate.getUseMailservers()
QtProperty[bool] useMailservers:
read = getUseMailservers
notify = useMailserversChanged
proc setUseMailservers*(self: View, value: bool) {.slot.} =
self.delegate.setUseMailservers(value)
QtProperty[bool] useMailservers:
read = getUseMailservers
notify = useMailserversChanged
write = setUseMailservers

View File

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

View File

@ -19,6 +19,7 @@ StatusModal {
header.title: qsTr("Waku nodes")
property var messagingStore
property var advancedStore
onClosed: {
destroy()
@ -29,36 +30,39 @@ StatusModal {
enodeInput.text = "";
}
contentItem: Item {
width: parent.width
contentItem: StatusScrollView {
height: parent.height
width: parent.width
StatusInput {
id: nameInput
label: qsTr("Name")
placeholderText: qsTr("Specify a name")
validators: [StatusMinLengthValidator {
minLength: 1
errorMessage: qsTr("You need to enter a name")
}]
validationMode: StatusInput.ValidationMode.OnlyWhenDirty
}
Column {
id: nodesColumn
width: parent.width
StatusInput {
id: nameInput
label: qsTr("Name")
placeholderText: qsTr("Specify a name")
validators: [StatusMinLengthValidator {
minLength: 1
errorMessage: qsTr("You need to enter a name")
}]
validationMode: StatusInput.ValidationMode.Always
}
StatusInput {
id: enodeInput
label: qsTr("History node address")
placeholderText: "enode://{enode-id}:{password}@{ip-address}:{port-number}"
validators: [StatusMinLengthValidator {
minLength: 1
errorMessage: qsTr("You need to enter the enode address")
},
StatusRegularExpressionValidator {
errorMessage: 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]+/
}]
validationMode: StatusInput.ValidationMode.OnlyWhenDirty
anchors.top: nameInput.bottom
anchors.topMargin: Style.current.bigPadding
StatusInput {
id: enodeInput
label: popup.advancedStore.isWakuV2 ? qsTr("Storenode multiaddress") : qsTr("History node address")
placeholderText: popup.advancedStore.isWakuV2 ? "/ip4/0.0.0.0/tcp/123/..." : "enode://{enode-id}:{password}@{ip-address}:{port-number}"
validators: [
StatusMinLengthValidator {
minLength: 1
errorMessage: popup.advancedStore.isWakuV2 ? qsTr("You need to enter the storenode multiaddress") : qsTr("You need to enter the enode address")
},
StatusRegularExpressionValidator {
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.Always
}
}
}

View File

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

View File

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