Clean up UserProfile a bit

This commit is contained in:
Nicolas Werner 2020-09-13 18:13:08 +02:00
parent f6a47ce72f
commit b934cf329c

View file

@ -13,13 +13,14 @@ ApplicationWindow{
id: userProfileDialog
height: 650
width: 420
minimumHeight: 420
modality: Qt.WindowModal
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
palette: colors
Connections{
target: deviceVerificationList
onUpdateProfile: {
function onUpdateProfile() {
profile.fetchDeviceList(profile.userid)
}
}
@ -33,16 +34,12 @@ ApplicationWindow{
DeviceVerificationFlow {}
}
Item{
id: userProfileItem
width: userProfileDialog.width
height: userProfileDialog.height
// Layout.fillHeight : true
ColumnLayout{
anchors.fill: userProfileItem
width: userProfileDialog.width
id: contentL
anchors.fill: parent
anchors.margins: 10
spacing: 10
Avatar {
@ -52,9 +49,6 @@ ApplicationWindow{
displayName: profile.displayName
userid: profile.userid
Layout.alignment: Qt.AlignHCenter
Layout.margins : {
top: 10
}
}
Label {
@ -66,11 +60,9 @@ ApplicationWindow{
Layout.alignment: Qt.AlignHCenter
}
TextEdit {
MatrixText {
text: profile.userid
selectByMouse: true
font.pixelSize: 15
color: colors.text
Layout.alignment: Qt.AlignHCenter
}
@ -80,15 +72,7 @@ ApplicationWindow{
Layout.alignment: Qt.AlignHCenter
enabled: profile.isUserVerified?false:true
visible: profile.isUserVerified?false:true
palette {
button: "white"
}
contentItem: Text {
text: verifyUserButton.text
color: "black"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: {
var newFlow = profile.createFlow(true);
newFlow.userId = profile.userid;
@ -101,12 +85,11 @@ ApplicationWindow{
RowLayout {
Layout.alignment: Qt.AlignHCenter
spacing: 8
ImageButton {
image:":/icons/icons/ui/do-not-disturb-rounded-sign.png"
Layout.margins: {
left: 5
right: 5
}
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: qsTr("Ban the user")
onClicked : {
@ -127,10 +110,7 @@ ApplicationWindow{
// }
ImageButton{
image:":/icons/icons/ui/black-bubble-speech.png"
Layout.margins: {
left: 5
right: 5
}
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: qsTr("Start a private chat")
onClicked : {
@ -139,10 +119,7 @@ ApplicationWindow{
}
ImageButton{
image:":/icons/icons/ui/round-remove-button.png"
Layout.margins: {
left: 5
right: 5
}
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: qsTr("Kick the user")
onClicked : {
@ -151,51 +128,55 @@ ApplicationWindow{
}
}
ScrollView {
implicitHeight: userProfileDialog.height/2-13
implicitWidth: userProfileDialog.width-20
clip: true
Layout.alignment: Qt.AlignHCenter
ListView{
id: devicelist
anchors.fill: parent
Layout.fillHeight: true
Layout.minimumHeight: 200
Layout.fillWidth: true
clip: true
spacing: 4
spacing: 8
boundsBehavior: Flickable.StopAtBounds
model: profile.deviceList
delegate: RowLayout{
width: parent.width
Layout.margins : {
top : 50
}
spacing: 4
ColumnLayout{
spacing: 0
Text{
Layout.fillWidth: true
Layout.alignment: Qt.AlignLeft
elide: Text.ElideRight
color: colors.text
font.bold: true
Layout.alignment: Qt.AlignLeft
text: model.deviceId
}
Text{
Layout.fillWidth: true
color:colors.text
Layout.alignment: Qt.AlignRight
elide: Text.ElideRight
color:colors.text
text: model.deviceName
}
}
RowLayout{
Image{
Layout.preferredWidth: 20
Layout.preferredHeight: 20
Layout.preferredHeight: 16
Layout.preferredWidth: 16
source: ((model.verificationStatus == VerificationStatus.VERIFIED)?"image://colorimage/:/icons/icons/ui/lock.png?green":
((model.verificationStatus == VerificationStatus.UNVERIFIED)?"image://colorimage/:/icons/icons/ui/unlock.png?yellow":
"image://colorimage/:/icons/icons/ui/unlock.png?red"))
}
Button{
id: verifyButton
text:(model.verificationStatus != VerificationStatus.VERIFIED)?"Verify":"Unverify"
text: (model.verificationStatus != VerificationStatus.VERIFIED)?"Verify":"Unverify"
onClicked: {
var newFlow = profile.createFlow(false);
newFlow.userId = profile.userid;
@ -210,49 +191,14 @@ ApplicationWindow{
dialog.show();
}
}
Layout.margins:{
right: 10
}
palette {
button: "white"
}
contentItem: Text {
text: verifyButton.text
color: "black"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
}
}
}
Button{
id: okbutton
text:"OK"
onClicked: userProfileDialog.close()
footer: DialogButtonBox {
standardButtons: DialogButtonBox.Ok
Layout.alignment: Qt.AlignRight | Qt.AlignBottom
Layout.margins : {
right : 10
bottom: 5
}
palette {
button: "white"
}
contentItem: Text {
text: okbutton.text
color: "black"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
Item { Layout.fillHeight: true }
onAccepted: userProfileDialog.close()
}
}