summary refs log tree commit diff
path: root/resources
diff options
context:
space:
mode:
authorCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-06-28 21:01:34 +0530
committerCH Chethan Reddy <40890937+Chethan2k1@users.noreply.github.com>2020-07-30 22:10:27 +0530
commit6fae36abc404ffb7e6ae29c9edceda5231400f0a (patch)
treebce50b744fd917e393848813d8206668f48bd190 /resources
parentError Handling and some fixes (diff)
downloadnheko-6fae36abc404ffb7e6ae29c9edceda5231400f0a.tar.xz
[WIP] Add Caching for users
Diffstat (limited to 'resources')
-rw-r--r--resources/qml/TimelineView.qml18
-rw-r--r--resources/qml/UserProfile.qml11
2 files changed, 15 insertions, 14 deletions
diff --git a/resources/qml/TimelineView.qml b/resources/qml/TimelineView.qml

index d9302ed7..3618140a 100644 --- a/resources/qml/TimelineView.qml +++ b/resources/qml/TimelineView.qml
@@ -21,6 +21,7 @@ Page { property real highlightHue: colors.highlight.hslHue property real highlightSat: colors.highlight.hslSaturation property real highlightLight: colors.highlight.hslLightness + property variant userProfile palette: colors @@ -238,6 +239,11 @@ Page { } } + Component{ + id: userProfileComponent + UserProfile{} + } + section { property: "section" } @@ -274,8 +280,6 @@ Page { } } - property variant userProfile - Row { height: userName.height spacing: 8 @@ -290,9 +294,7 @@ Page { MouseArea { anchors.fill: parent onClicked: { - if(userProfile) userProfile.destroy() - var component = Qt.createComponent("UserProfile.qml"); - userProfile = component.createObject(timelineRoot,{user_data : modelData}); + userProfile = userProfileComponent.createObject(timelineRoot,{user_data: modelData,avatarUrl:chat.model.avatarUrl(modelData.userId)}); userProfile.show(); } cursorShape: Qt.PointingHandCursor @@ -310,10 +312,8 @@ Page { anchors.fill: parent Layout.alignment: Qt.AlignHCenter onClicked: { - if(userProfile) userProfile.destroy() - var component = Qt.createComponent("UserProfile.qml") - userProfile = component.createObject(timelineRoot,{user_data : modelData}) - userProfile.show() + userProfile = userProfileComponent.createObject(timelineRoot,{user_data: modelData,avatarUrl:chat.model.avatarUrl(modelData.userId)}); + userProfile.show(); } cursorShape: Qt.PointingHandCursor propagateComposedEvents: true diff --git a/resources/qml/UserProfile.qml b/resources/qml/UserProfile.qml
index 6ef75031..a0b0f993 100644 --- a/resources/qml/UserProfile.qml +++ b/resources/qml/UserProfile.qml
@@ -9,6 +9,7 @@ import "./device-verification" ApplicationWindow{ property var user_data + property var avatarUrl property var colors: currentActivePalette id:userProfileDialog @@ -52,11 +53,11 @@ ApplicationWindow{ Avatar{ id: userProfileAvatar - url:chat.model.avatarUrl(user_data.userId).replace("mxc://", "image://MxcImage/") + url: avatarUrl.replace("mxc://", "image://MxcImage/") height: 130 width: 130 - displayName: modelData.userName - userid: modelData.userId + displayName: user_data.userName + userid: user_data.userId Layout.alignment: Qt.AlignHCenter Layout.margins : { top: 10 @@ -68,7 +69,7 @@ ApplicationWindow{ text: user_data.userName fontSizeMode: Text.HorizontalFit font.pixelSize: 20 - color:TimelineManager.userColor(modelData.userId, colors.window) + color:TimelineManager.userColor(user_data.userId, colors.window) font.bold: true Layout.alignment: Qt.AlignHCenter } @@ -207,7 +208,7 @@ ApplicationWindow{ Layout.margins : { right : 10 - bottom : 10 + bottom: 5 } palette {