diff options
author | DeepBlueV7.X <nicolas.werner@hotmail.de> | 2021-02-01 19:14:57 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-01 19:14:57 +0100 |
commit | 2b7bd09ad330988301576161d629bca40117bb33 (patch) | |
tree | f9a5bf3f0a4f3ea2b4afd4f2491702735871a04b /resources | |
parent | 50e2b5617fc38381505e68e178e6784ca309d629 (diff) | |
parent | 0ebb2947ef8010a2226237d65fb36fe847e8c5b2 (diff) |
Merge pull request #431 from Jedi18/avatar_username_feature
Username editing (room specific and global)
Diffstat (limited to 'resources')
-rw-r--r-- | resources/qml/UserProfile.qml | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml index a1fbfa41..4cb9eb10 100644 --- a/resources/qml/UserProfile.qml +++ b/resources/qml/UserProfile.qml @@ -17,6 +17,7 @@ ApplicationWindow { minimumHeight: 420 palette: colors color: colors.window + title: profile.isGlobalUserProfile ? "Global User Profile" : "Room User Profile" Shortcut { sequence: StandardKey.Cancel @@ -40,13 +41,42 @@ ApplicationWindow { onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id) } - Label { + TextInput { + id: displayUsername + + property bool isUsernameEditingAllowed + + readOnly: !isUsernameEditingAllowed text: profile.displayName - fontSizeMode: Text.HorizontalFit font.pixelSize: 20 color: TimelineManager.userColor(profile.userid, colors.window) font.bold: true Layout.alignment: Qt.AlignHCenter + selectByMouse: true + + onAccepted: { + profile.changeUsername(displayUsername.text) + displayUsername.isUsernameEditingAllowed = false + } + + ImageButton { + visible: profile.isSelf + anchors.leftMargin: 5 + anchors.left: displayUsername.right + anchors.verticalCenter: displayUsername.verticalCenter + image: displayUsername.isUsernameEditingAllowed ? ":/icons/icons/ui/checkmark.png" : ":/icons/icons/ui/edit.png" + + onClicked: { + if (displayUsername.isUsernameEditingAllowed) { + profile.changeUsername(displayUsername.text) + displayUsername.isUsernameEditingAllowed = false + } else { + displayUsername.isUsernameEditingAllowed = true + displayUsername.focus = true + displayUsername.selectAll() + } + } + } } MatrixText { |