From 0ed88761f976252eebfb1453335a32694ec8a830 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Thu, 16 Nov 2017 08:42:30 -0800 Subject: [PATCH] Switch avatar loading to NetImageTracker --- assets/PostItem.qml | 13 +++++++++++-- assets/StreamTab.qml | 6 ++++++ translations/Goober.ts | 41 +++++++++++++++++++++++++++-------------- 3 files changed, 44 insertions(+), 16 deletions(-) diff --git a/assets/PostItem.qml b/assets/PostItem.qml index dcda1c3..c250b38 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -19,6 +19,7 @@ import bb.cascades 1.4 import org.labsquare 1.0 +import com.netimage 1.0 import "moment.js" as Moment import "parser.js" as Parser @@ -45,12 +46,20 @@ Container { } Container { background: (theme === VisualStyle.Bright) ? Color.create("#e9e9e9") : Color.create("#282828") - WebImageView { + ImageView { id: avatar - url: ListItemData.user.content.avatar_image.link + //url: ListItemData.user.content.avatar_image.link maxWidth: ui.du(12) maxHeight: ui.du(12) //imageSource: "asset:///icons/laughing_man.png" + image: tracker.image + attachedObjects: [ + NetImageTracker { + id: tracker + source: ListItemData.user.content.avatar_image.link + manager: postitem.ListItem.view.listImageManager + } + ] } } Container { diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index e71f3ba..df3a788 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -20,6 +20,7 @@ import bb.cascades 1.4 import com.monkeystew.pnut 1.0 import com.monkeystew.qtimer 1.0 +import com.netimage 1.0 NavigationPane { id: nav @@ -42,6 +43,7 @@ NavigationPane { Container { ListView { id: streamView + property variant listImageManager: feedImageManager dataModel: ArrayDataModel { id: postModel } @@ -139,6 +141,10 @@ NavigationPane { nav.parent.unreadContentCount = unread } } + }, + NetImageManager { + id: feedImageManager + cacheId: "feedImageManager" } ] } diff --git a/translations/Goober.ts b/translations/Goober.ts index 1a50e4b..285d300 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -9,6 +9,19 @@ + + NetImageManager + + + SSL errors received + + + + + We have received information about a security breach in the protocol. Press "OK" to terminate the application + + + NewPostSheet @@ -30,52 +43,52 @@ PostItem - + Reply - + Reply All - + Delete Bookmark - + Add Bookmark - + Delete Repost - + Repost - + Quote - + View Profile - + Copy text - + Delete @@ -190,22 +203,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload