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

93 lines
2.4 KiB
QML
Raw Normal View History

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
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
StatusDialog {
id: root
2020-08-06 18:19:26 +00:00
property var 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
}
QtObject {
id: d
property string newUsername: ""
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: 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 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
model: root.ensUsernamesStore.ensUsernamesModel
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 {
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
d.newUsername = ensUsername;
2020-08-06 18:19:26 +00:00
}
}
}
}
}
}