Try loading photos using the NetImageTracker

This commit is contained in:
Morgan McMillian 2017-11-16 11:02:41 -08:00
parent 0ed88761f9
commit 18f100b55e
2 changed files with 49 additions and 15 deletions

View file

@ -156,19 +156,53 @@ Container {
// TODO: add tab to open full image in a page
horizontalAlignment: HorizontalAlignment.Center
bottomMargin: ui.sdu(2.0)
WebImageView {
url: {
var oembed = ""
ImageView {
// url: {
// var oembed = ""
// if (typeof ListItemData.raw !== "undefined") {
// ListItemData.raw.forEach(function (item) {
// if (item["type"] == "io.pnut.core.oembed") {
// oembed = item["value"]["thumbnail_url"]
// }
// })
// }
// return oembed
// }
visible: {
var isphoto = false
if (typeof ListItemData.raw !== "undefined") {
ListItemData.raw.forEach(function (item) {
if (item["type"] == "io.pnut.core.oembed") {
oembed = item["value"]["thumbnail_url"]
if (item["value"]["type"] == "photo") {
isphoto = true
}
}
})
}
return oembed
return isphoto
}
scalingMethod: ScalingMethod.AspectFit
//imageSource: "asset:///icons/laughing_man.png"
image: ptracker.image
attachedObjects: [
NetImageTracker {
id: ptracker
manager: postitem.ListItem.view.listImageManager
source: {
var photo_url = ""
if (typeof ListItemData.raw !== "undefined") {
ListItemData.raw.forEach(function (item) {
if (item["type"] == "io.pnut.core.oembed") {
if (item["value"]["type"] == "photo") {
photo_url = item["value"]["url"]
}
}
})
}
return photo_url
}
}
]
}
}
Container {

View file

@ -43,52 +43,52 @@
<context>
<name>PostItem</name>
<message>
<location filename="../assets/PostItem.qml" line="199"/>
<location filename="../assets/PostItem.qml" line="233"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="208"/>
<location filename="../assets/PostItem.qml" line="242"/>
<source>Reply All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="218"/>
<location filename="../assets/PostItem.qml" line="252"/>
<source>Delete Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="218"/>
<location filename="../assets/PostItem.qml" line="252"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="229"/>
<location filename="../assets/PostItem.qml" line="263"/>
<source>Delete Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="229"/>
<location filename="../assets/PostItem.qml" line="263"/>
<source>Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="240"/>
<location filename="../assets/PostItem.qml" line="274"/>
<source>Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="249"/>
<location filename="../assets/PostItem.qml" line="283"/>
<source>View Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="256"/>
<location filename="../assets/PostItem.qml" line="290"/>
<source>Copy text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="286"/>
<location filename="../assets/PostItem.qml" line="320"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>