status-desktop/ui/app/AppLayouts/Profile/popups/ENSPopup.qml

106 lines
2.8 KiB
QML
Raw Normal View History

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import QtQml.Models 2.15
import StatusQ.Core 0.1
import StatusQ.Core.Theme 0.1
import StatusQ.Controls 0.1
import StatusQ.Popups.Dialog 0.1
import utils 1.0
import shared 1.0
import shared.panels 1.0
import shared.popups 1.0
2020-08-06 18:19:26 +00:00
import AppLayouts.Profile.stores 1.0
StatusDialog {
id: root
2020-08-06 18:19:26 +00:00
property EnsUsernamesStore ensUsernamesStore
2020-08-06 18:19:26 +00:00
title: qsTr("Primary username")
standardButtons: Dialog.ApplyRole
implicitWidth: 400
2020-08-06 18:19:26 +00:00
onApplied: {
ensUsernamesStore.setPrefferedEnsUsername(d.newUsername);
close();
2020-08-06 18:19:26 +00:00
}
footer: StatusDialogFooter {
rightButtons: ObjectModel {
StatusButton {
enabled: d.newUsername !== root.ensUsernamesStore.preferredUsername
text: qsTr("Apply")
onClicked: {
root.applied()
}
}
}
}
QtObject {
id: d
property string newUsername: root.ensUsernamesStore.preferredUsername
2020-08-06 18:19:26 +00:00
}
2022-02-09 09:43:23 +00:00
ColumnLayout {
2020-08-06 18:19:26 +00:00
anchors.fill: parent
spacing: Theme.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 wont 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
StyledText {
visible: root.ensUsernamesStore.preferredUsername
text: root.ensUsernamesStore.preferredUsername
font.pixelSize: 17
font.weight: Font.Bold
}
2020-08-06 18:19:26 +00:00
StatusListView {
id: ensNamesListView
Layout.fillWidth: true
Layout.fillHeight: true
implicitHeight: contentHeight
2023-01-11 16:10:13 +00:00
model: root.ensUsernamesStore.currentChainEnsUsernamesModel
2020-08-06 18:19:26 +00:00
delegate: RadioDelegate {
id: radioDelegate
width: ListView.view.width
text: ensUsername
checked: root.ensUsernamesStore.preferredUsername === ensUsername
2020-09-29 11:04:14 +00:00
2020-09-29 11:36:31 +00:00
contentItem: StyledText {
color: Theme.palette.textColor
2020-09-29 11:04:14 +00:00
text: radioDelegate.text
rightPadding: radioDelegate.indicator.width + radioDelegate.spacing
topPadding: Theme.halfPadding
2020-09-29 11:04:14 +00:00
}
2020-08-06 18:19:26 +00:00
MouseArea {
anchors.fill: parent
onClicked: {
parent.checked = true
d.newUsername = ensUsername;
2020-08-06 18:19:26 +00:00
}
}
}
}
}
}