From 87490c29cd8af7c17b5a4591798f1f0ebfa9023c Mon Sep 17 00:00:00 2001 From: Jedi18 Date: Thu, 28 Jan 2021 20:03:50 +0530 Subject: Username can be edited by double clicking on text, added global user profile menu action in user info widget --- resources/qml/UserProfile.qml | 51 +++++++++++++------------------------------ 1 file changed, 15 insertions(+), 36 deletions(-) (limited to 'resources/qml/UserProfile.qml') diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml index 2a06b955..0ced5498 100644 --- a/resources/qml/UserProfile.qml +++ b/resources/qml/UserProfile.qml @@ -15,6 +15,7 @@ ApplicationWindow { minimumHeight: 420 palette: colors color: colors.window + title: profile.globalUserProfile ? "Global User Profile" : "Room User Profile" ColumnLayout { id: contentL @@ -33,13 +34,25 @@ ApplicationWindow { onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id) } - Label { + TextInput { + id: displayUsername + readOnly: !profile.isUsernameEditingAllowed text: profile.displayName - fontSizeMode: Text.HorizontalFit font.pixelSize: 20 color: TimelineManager.userColor(profile.userid, colors.window) font.bold: true Layout.alignment: Qt.AlignHCenter + focus: true + + onEditingFinished: profile.changeUsername(displayUsername.text) + + MouseArea { + enabled: !profile.isUsernameEditingAllowed + anchors.fill: parent + onDoubleClicked: { + profile.allowUsernameEditing(true) + } + } } MatrixText { @@ -58,40 +71,6 @@ ApplicationWindow { onClicked: profile.verify() } - Button { - id: changeUsername - - text: (profile.roomid_ == "") ? qsTr("Change global username") : qsTr("Change room username") - Layout.alignment: Qt.AlignHCenter - enabled : profile.isSelf - visible: profile.isSelf - onClicked: changeUsernameDialog.open() - - Dialog { - id: changeUsernameDialog - modal: true - title: (profile.roomid_ == "") ? qsTr("Change global username") : qsTr("Change room username") - onAccepted: profile.changeUsername(usernameEdit.text) - - Column { - anchors.fill: parent - - Text { - text: "New Username" - anchors.horizontalCenter: parent.horizontalCenter - } - TextField { - id: usernameEdit - focus: true - wrapMode: TextEdit.Wrap - anchors.horizontalCenter: parent.horizontalCenter - } - } - - standardButtons: Dialog.Ok | Dialog.Cancel - } - } - Image { Layout.preferredHeight: 16 Layout.preferredWidth: 16 -- cgit 1.5.1