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