2020-08-06 18:19:26 +00:00
|
|
|
|
import QtQuick 2.12
|
|
|
|
|
import QtQuick.Controls 2.3
|
|
|
|
|
import QtQuick.Layouts 1.3
|
|
|
|
|
import QtQml.Models 2.3
|
2021-09-28 15:04:06 +00:00
|
|
|
|
|
2022-07-13 12:29:38 +00:00
|
|
|
|
import StatusQ.Core 0.1
|
2022-12-05 19:24:55 +00:00
|
|
|
|
import StatusQ.Core.Theme 0.1
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Popups.Dialog 0.1
|
2022-07-13 12:29:38 +00:00
|
|
|
|
|
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
|
2020-08-06 18:19:26 +00:00
|
|
|
|
|
2022-12-05 19:24:55 +00:00
|
|
|
|
StatusDialog {
|
|
|
|
|
id: root
|
2020-08-06 18:19:26 +00:00
|
|
|
|
|
2022-01-17 08:56:44 +00:00
|
|
|
|
property var ensUsernamesStore
|
2020-08-06 18:19:26 +00:00
|
|
|
|
|
2022-12-05 19:24:55 +00:00
|
|
|
|
title: qsTr("Primary username")
|
|
|
|
|
standardButtons: Dialog.ApplyRole
|
|
|
|
|
implicitWidth: 400
|
2020-08-06 18:19:26 +00:00
|
|
|
|
|
2022-12-05 19:24:55 +00:00
|
|
|
|
onApplied: {
|
|
|
|
|
ensUsernamesStore.setPrefferedEnsUsername(d.newUsername);
|
|
|
|
|
close();
|
2020-08-06 18:19:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
2022-12-13 09:37:27 +00:00
|
|
|
|
footer: StatusDialogFooter {
|
|
|
|
|
rightButtons: ObjectModel {
|
|
|
|
|
StatusButton {
|
|
|
|
|
enabled: d.newUsername !== root.ensUsernamesStore.preferredUsername
|
|
|
|
|
text: qsTr("Apply")
|
|
|
|
|
onClicked: {
|
|
|
|
|
root.applied()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-05 19:24:55 +00:00
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
|
|
|
|
|
2022-12-13 09:37:27 +00:00
|
|
|
|
property string newUsername: root.ensUsernamesStore.preferredUsername
|
2020-08-06 18:19:26 +00:00
|
|
|
|
}
|
2022-02-09 09:43:23 +00:00
|
|
|
|
|
2022-12-05 19:24:55 +00:00
|
|
|
|
ColumnLayout {
|
2020-08-06 18:19:26 +00:00
|
|
|
|
anchors.fill: parent
|
2022-12-05 19:24:55 +00:00
|
|
|
|
spacing: Style.current.padding
|
|
|
|
|
|
|
|
|
|
StyledText {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
text: root.ensUsernamesStore.preferredUsername ?
|
|
|
|
|
qsTr("Your messages are displayed to others with this username:")
|
|
|
|
|
:
|
|
|
|
|
qsTr("Once you select a username, you won’t be able to disable it afterwards. You will only be able choose a different username to display.")
|
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
wrapMode: Text.WordWrap
|
|
|
|
|
}
|
2020-08-06 18:19:26 +00:00
|
|
|
|
|
2022-12-05 19:24:55 +00:00
|
|
|
|
StyledText {
|
|
|
|
|
visible: root.ensUsernamesStore.preferredUsername
|
|
|
|
|
text: root.ensUsernamesStore.preferredUsername
|
|
|
|
|
font.pixelSize: 17
|
|
|
|
|
font.weight: Font.Bold
|
|
|
|
|
}
|
2020-08-06 18:19:26 +00:00
|
|
|
|
|
2022-07-14 11:03:36 +00:00
|
|
|
|
StatusListView {
|
2022-12-05 19:24:55 +00:00
|
|
|
|
id: ensNamesListView
|
|
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
implicitHeight: contentHeight
|
2023-01-11 16:10:13 +00:00
|
|
|
|
model: root.ensUsernamesStore.currentChainEnsUsernamesModel
|
2022-12-05 19:24:55 +00:00
|
|
|
|
|
2020-08-06 18:19:26 +00:00
|
|
|
|
delegate: RadioDelegate {
|
|
|
|
|
id: radioDelegate
|
2022-12-05 19:24:55 +00:00
|
|
|
|
|
|
|
|
|
width: ListView.view.width
|
2022-01-17 08:56:44 +00:00
|
|
|
|
text: ensUsername
|
2022-12-05 19:24:55 +00:00
|
|
|
|
checked: root.ensUsernamesStore.preferredUsername === ensUsername
|
2020-09-29 11:04:14 +00:00
|
|
|
|
|
2020-09-29 11:36:31 +00:00
|
|
|
|
contentItem: StyledText {
|
2020-09-29 11:04:14 +00:00
|
|
|
|
color: Style.current.textColor
|
|
|
|
|
text: radioDelegate.text
|
|
|
|
|
rightPadding: radioDelegate.indicator.width + radioDelegate.spacing
|
|
|
|
|
topPadding: Style.current.halfPadding
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-06 18:19:26 +00:00
|
|
|
|
MouseArea {
|
|
|
|
|
anchors.fill: parent
|
|
|
|
|
onClicked: {
|
|
|
|
|
parent.checked = true
|
2022-12-05 19:24:55 +00:00
|
|
|
|
d.newUsername = ensUsername;
|
2020-08-06 18:19:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|