Move global avatarSize property

This commit is contained in:
Nicolas Werner 2021-05-13 11:32:20 +02:00
parent 877f4daa1a
commit 5658be5215
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
8 changed files with 17 additions and 20 deletions

View file

@ -240,8 +240,8 @@ ScrollView {
Avatar {
id: messageUserAvatar
width: avatarSize
height: avatarSize
width: Nheko.avatarSize
height: Nheko.avatarSize
url: modelData ? chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/") : ""
displayName: modelData ? modelData.userName : ""
userid: modelData ? modelData.userId : ""
@ -292,7 +292,7 @@ ScrollView {
text: modelData ? TimelineManager.userStatus(modelData.userId) : ""
textFormat: Text.PlainText
elide: Text.ElideRight
width: chat.delegateMaxWidth - parent.spacing * 2 - userName.implicitWidth - avatarSize
width: chat.delegateMaxWidth - parent.spacing * 2 - userName.implicitWidth - Nheko.avatarSize
font.italic: true
}

View file

@ -42,7 +42,7 @@ Item {
id: row
anchors.rightMargin: 1
anchors.leftMargin: avatarSize + 16
anchors.leftMargin: Nheko.avatarSize + 16
anchors.left: parent.left
anchors.right: parent.right

View file

@ -18,12 +18,6 @@ import im.nheko.EmojiModel 1.0
Page {
id: timelineRoot
property var systemInactive
readonly property int avatarSize: 40
property real highlightHue: Nheko.colors.highlight.hslHue
property real highlightSat: Nheko.colors.highlight.hslSaturation
property real highlightLight: Nheko.colors.highlight.hslLightness
palette: Nheko.colors
FontMetrics {

View file

@ -43,8 +43,8 @@ Rectangle {
Layout.row: 0
Layout.rowSpan: 2
Layout.alignment: Qt.AlignVCenter
width: avatarSize
height: avatarSize
width: Nheko.avatarSize
height: Nheko.avatarSize
visible: TimelineManager.isNarrowView
image: ":/icons/icons/ui/angle-pointing-to-left.png"
ToolTip.visible: hovered
@ -57,8 +57,8 @@ Rectangle {
Layout.row: 0
Layout.rowSpan: 2
Layout.alignment: Qt.AlignVCenter
width: avatarSize
height: avatarSize
width: Nheko.avatarSize
height: Nheko.avatarSize
url: room ? room.roomAvatarUrl.replace("mxc://", "image://MxcImage/") : ""
displayName: room ? room.roomName : qsTr("No room selected")
onClicked: TimelineManager.timeline.openRoomSettings()

View file

@ -31,8 +31,8 @@ Rectangle {
anchors.leftMargin: 8
Avatar {
width: avatarSize
height: avatarSize
width: Nheko.avatarSize
height: Nheko.avatarSize
url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: CallManager.callParty
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)

View file

@ -38,8 +38,8 @@ Rectangle {
anchors.leftMargin: 8
Avatar {
width: avatarSize
height: avatarSize
width: Nheko.avatarSize
height: Nheko.avatarSize
url: CallManager.callPartyAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: CallManager.callParty
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)

View file

@ -75,8 +75,8 @@ Popup {
Avatar {
Layout.rightMargin: cameraCombo.visible ? 16 : 64
width: avatarSize
height: avatarSize
width: Nheko.avatarSize
height: Nheko.avatarSize
url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: TimelineManager.timeline.roomName
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id)

View file

@ -13,6 +13,7 @@ class Nheko : public QObject
Q_PROPERTY(QPalette colors READ colors NOTIFY colorsChanged)
Q_PROPERTY(QPalette inactiveColors READ inactiveColors NOTIFY colorsChanged)
Q_PROPERTY(int avatarSize READ avatarSize CONSTANT)
public:
Nheko();
@ -20,6 +21,8 @@ public:
QPalette colors() const;
QPalette inactiveColors() const;
int avatarSize() const { return 40; }
Q_INVOKABLE void openLink(QString link) const;
signals: