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 bb.cascades 1.4
import org.labsquare 1.0 import org.labsquare 1.0
import com.netimage 1.0
import "moment.js" as Moment import "moment.js" as Moment
import "parser.js" as Parser import "parser.js" as Parser
@ -45,12 +46,20 @@ Container {
} }
Container { Container {
background: (theme === VisualStyle.Bright) ? Color.create("#e9e9e9") : Color.create("#282828") background: (theme === VisualStyle.Bright) ? Color.create("#e9e9e9") : Color.create("#282828")
WebImageView { ImageView {
id: avatar id: avatar
url: ListItemData.user.content.avatar_image.link //url: ListItemData.user.content.avatar_image.link
maxWidth: ui.du(12) maxWidth: ui.du(12)
maxHeight: ui.du(12) maxHeight: ui.du(12)
//imageSource: "asset:///icons/laughing_man.png" //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 { Container {

View file

@ -20,6 +20,7 @@
import bb.cascades 1.4 import bb.cascades 1.4
import com.monkeystew.pnut 1.0 import com.monkeystew.pnut 1.0
import com.monkeystew.qtimer 1.0 import com.monkeystew.qtimer 1.0
import com.netimage 1.0
NavigationPane { NavigationPane {
id: nav id: nav
@ -42,6 +43,7 @@ NavigationPane {
Container { Container {
ListView { ListView {
id: streamView id: streamView
property variant listImageManager: feedImageManager
dataModel: ArrayDataModel { dataModel: ArrayDataModel {
id: postModel id: postModel
} }
@ -139,6 +141,10 @@ NavigationPane {
nav.parent.unreadContentCount = unread nav.parent.unreadContentCount = unread
} }
} }
},
NetImageManager {
id: feedImageManager
cacheId: "feedImageManager"
} }
] ]
} }

View file

@ -9,6 +9,19 @@
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
</context> </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> <context>
<name>NewPostSheet</name> <name>NewPostSheet</name>
<message> <message>
@ -30,52 +43,52 @@
<context> <context>
<name>PostItem</name> <name>PostItem</name>
<message> <message>
<location filename="../assets/PostItem.qml" line="190"/> <location filename="../assets/PostItem.qml" line="199"/>
<source>Reply</source> <source>Reply</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="199"/> <location filename="../assets/PostItem.qml" line="208"/>
<source>Reply All</source> <source>Reply All</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="209"/> <location filename="../assets/PostItem.qml" line="218"/>
<source>Delete Bookmark</source> <source>Delete Bookmark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="209"/> <location filename="../assets/PostItem.qml" line="218"/>
<source>Add Bookmark</source> <source>Add Bookmark</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="220"/> <location filename="../assets/PostItem.qml" line="229"/>
<source>Delete Repost</source> <source>Delete Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="220"/> <location filename="../assets/PostItem.qml" line="229"/>
<source>Repost</source> <source>Repost</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="231"/> <location filename="../assets/PostItem.qml" line="240"/>
<source>Quote</source> <source>Quote</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="240"/> <location filename="../assets/PostItem.qml" line="249"/>
<source>View Profile</source> <source>View Profile</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="247"/> <location filename="../assets/PostItem.qml" line="256"/>
<source>Copy text</source> <source>Copy text</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="277"/> <location filename="../assets/PostItem.qml" line="286"/>
<source>Delete</source> <source>Delete</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
@ -190,22 +203,22 @@
<context> <context>
<name>StreamTab</name> <name>StreamTab</name>
<message> <message>
<location filename="../assets/StreamTab.qml" line="148"/> <location filename="../assets/StreamTab.qml" line="154"/>
<source>New Post</source> <source>New Post</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="162"/> <location filename="../assets/StreamTab.qml" line="168"/>
<source>To Top</source> <source>To Top</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="190"/> <location filename="../assets/StreamTab.qml" line="196"/>
<source>To Bottom</source> <source>To Bottom</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="177"/> <location filename="../assets/StreamTab.qml" line="183"/>
<source>Reload</source> <source>Reload</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>