Merge pull request #714 from Thulinma/profileSizingFix

More profile improvements (sizing for smaller displays, alignment)
This commit is contained in:
DeepBlueV7.X 2021-09-07 23:30:41 +00:00 committed by GitHub
commit 54cff84371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 273 additions and 255 deletions

View File

@ -21,7 +21,7 @@ ApplicationWindow {
height: 650
width: 420
minimumWidth: 150
minimumHeight: 420
minimumHeight: 150
palette: Nheko.colors
color: Nheko.colors.window
title: profile.isGlobalUserProfile ? qsTr("Global User Profile") : qsTr("Room User Profile")
@ -34,11 +34,19 @@ ApplicationWindow {
onActivated: userProfileDialog.close()
}
ColumnLayout {
id: contentL
ListView {
ScrollHelper {
flickable: parent
anchors.fill: parent
anchors.margins: 10
enabled: !Settings.mobileMode
}
header: ColumnLayout {
id: contentL
width: devicelist.width
spacing: 10
Avatar {
@ -151,31 +159,30 @@ ApplicationWindow {
MatrixText {
text: profile.userid
font.pixelSize: 15
Layout.alignment: Qt.AlignHCenter
}
RowLayout {
visible: !profile.isGlobalUserProfile
Layout.alignment: Qt.AlignHCenter
spacing: Nheko.paddingSmall
MatrixText {
id: displayRoomname
text: qsTr("Room: %1").arg(profile.room.roomName)
Layout.alignment: Qt.AlignHCenter
visible: !profile.isGlobalUserProfile
text: qsTr("Room: %1").arg(profile.room?profile.room.roomName:"")
ToolTip.text: qsTr("This is a room-specific profile. The user's name and avatar may be different from their global versions.")
ToolTip.visible: ma.hovered
HoverHandler {
id: ma
}
}
ImageButton {
anchors.leftMargin: Nheko.paddingSmall
anchors.left: displayRoomname.right
anchors.verticalCenter: displayRoomname.verticalCenter
image: ":/icons/icons/ui/world.png"
hoverEnabled: true
ToolTip.visible: hovered
ToolTip.text: qsTr("Open the global profile for this user.")
onClicked: profile.openGlobalProfile()
visible: !profile.isGlobalUserProfile
}
}
@ -212,7 +219,8 @@ ApplicationWindow {
// }
Layout.alignment: Qt.AlignHCenter
spacing: 8
Layout.bottomMargin: 10
spacing: Nheko.paddingSmall
ImageButton {
image: ":/icons/icons/ui/black-bubble-speech.png"
@ -241,17 +249,18 @@ ApplicationWindow {
}
}
}
ListView {
id: devicelist
Layout.fillHeight: true
Layout.minimumHeight: 200
Layout.fillWidth: true
clip: true
spacing: 8
boundsBehavior: Flickable.StopAtBounds
model: profile.deviceList
anchors.fill: parent
anchors.margins: 10
delegate: RowLayout {
width: devicelist.width
@ -299,14 +308,19 @@ ApplicationWindow {
}
}
}
}
footerPositioning: ListView.OverlayFooter
footer: DialogButtonBox {
z: 2
width: devicelist.width
alignment: Qt.AlignRight
standardButtons: DialogButtonBox.Ok
onAccepted: userProfileDialog.close()
background: Rectangle {
anchors.fill: parent
color: Nheko.colors.window
}
}
}
}

View File

@ -1279,8 +1279,13 @@ ChatPage::handleMatrixUri(const QByteArray &uri)
if (sigil1 == "u") {
if (action.isEmpty()) {
if (auto t = view_manager_->rooms()->currentRoom())
auto t = view_manager_->rooms()->currentRoom();
if (t &&
cache::isRoomMember(mxid1.toStdString(), t->roomId().toStdString())) {
t->openUserProfile(mxid1);
return;
}
emit view_manager_->openGlobalUserProfile(mxid1);
} else if (action == "chat") {
this->startChat(mxid1);
}

View File

@ -423,6 +423,5 @@ UserProfile::getGlobalProfileData()
void
UserProfile::openGlobalProfile()
{
UserProfile *userProfile = new UserProfile("", userid_, manager, model);
emit manager->openProfile(userProfile);
emit manager->openGlobalUserProfile(userid_);
}