Switch avatar loading to NetImageTracker

This commit is contained in:
Morgan McMillian 2017-11-16 08:42:30 -08:00
parent 8378e71435
commit 0ed88761f9
3 changed files with 44 additions and 16 deletions

View file

@ -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 {

View file

@ -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"
}
]
}

View file

@ -9,6 +9,19 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NetImageManager</name>
<message>
<location filename="../src/netimagemanager.cpp" line="177"/>
<source>SSL errors received</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/netimagemanager.cpp" line="178"/>
<source>We have received information about a security breach in the protocol. Press &quot;OK&quot; to terminate the application</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>NewPostSheet</name>
<message>
@ -30,52 +43,52 @@
<context>
<name>PostItem</name>
<message>
<location filename="../assets/PostItem.qml" line="190"/>
<location filename="../assets/PostItem.qml" line="199"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="199"/>
<location filename="../assets/PostItem.qml" line="208"/>
<source>Reply All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="209"/>
<location filename="../assets/PostItem.qml" line="218"/>
<source>Delete Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="209"/>
<location filename="../assets/PostItem.qml" line="218"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="220"/>
<location filename="../assets/PostItem.qml" line="229"/>
<source>Delete Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="220"/>
<location filename="../assets/PostItem.qml" line="229"/>
<source>Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="231"/>
<location filename="../assets/PostItem.qml" line="240"/>
<source>Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="240"/>
<location filename="../assets/PostItem.qml" line="249"/>
<source>View Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="247"/>
<location filename="../assets/PostItem.qml" line="256"/>
<source>Copy text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="277"/>
<location filename="../assets/PostItem.qml" line="286"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
@ -190,22 +203,22 @@
<context>
<name>StreamTab</name>
<message>
<location filename="../assets/StreamTab.qml" line="148"/>
<location filename="../assets/StreamTab.qml" line="154"/>
<source>New Post</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="162"/>
<location filename="../assets/StreamTab.qml" line="168"/>
<source>To Top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="190"/>
<location filename="../assets/StreamTab.qml" line="196"/>
<source>To Bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/StreamTab.qml" line="177"/>
<location filename="../assets/StreamTab.qml" line="183"/>
<source>Reload</source>
<translation type="unfinished"></translation>
</message>