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 { Avatar {
id: messageUserAvatar id: messageUserAvatar
width: avatarSize width: Nheko.avatarSize
height: avatarSize height: Nheko.avatarSize
url: modelData ? chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/") : "" url: modelData ? chat.model.avatarUrl(modelData.userId).replace("mxc://", "image://MxcImage/") : ""
displayName: modelData ? modelData.userName : "" displayName: modelData ? modelData.userName : ""
userid: modelData ? modelData.userId : "" userid: modelData ? modelData.userId : ""
@ -292,7 +292,7 @@ ScrollView {
text: modelData ? TimelineManager.userStatus(modelData.userId) : "" text: modelData ? TimelineManager.userStatus(modelData.userId) : ""
textFormat: Text.PlainText textFormat: Text.PlainText
elide: Text.ElideRight 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 font.italic: true
} }

View file

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

View file

@ -18,12 +18,6 @@ import im.nheko.EmojiModel 1.0
Page { Page {
id: timelineRoot 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 palette: Nheko.colors
FontMetrics { FontMetrics {

View file

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

View file

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

View file

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

View file

@ -75,8 +75,8 @@ Popup {
Avatar { Avatar {
Layout.rightMargin: cameraCombo.visible ? 16 : 64 Layout.rightMargin: cameraCombo.visible ? 16 : 64
width: avatarSize width: Nheko.avatarSize
height: avatarSize height: Nheko.avatarSize
url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/") url: TimelineManager.timeline.roomAvatarUrl.replace("mxc://", "image://MxcImage/")
displayName: TimelineManager.timeline.roomName displayName: TimelineManager.timeline.roomName
onClicked: TimelineManager.openImageOverlay(TimelineManager.timeline.avatarUrl(userid), TimelineManager.timeline.data.id) 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 colors READ colors NOTIFY colorsChanged)
Q_PROPERTY(QPalette inactiveColors READ inactiveColors NOTIFY colorsChanged) Q_PROPERTY(QPalette inactiveColors READ inactiveColors NOTIFY colorsChanged)
Q_PROPERTY(int avatarSize READ avatarSize CONSTANT)
public: public:
Nheko(); Nheko();
@ -20,6 +21,8 @@ public:
QPalette colors() const; QPalette colors() const;
QPalette inactiveColors() const; QPalette inactiveColors() const;
int avatarSize() const { return 40; }
Q_INVOKABLE void openLink(QString link) const; Q_INVOKABLE void openLink(QString link) const;
signals: signals: