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 // TODO: add tab to open full image in a page
horizontalAlignment: HorizontalAlignment.Center horizontalAlignment: HorizontalAlignment.Center
bottomMargin: ui.sdu(2.0) bottomMargin: ui.sdu(2.0)
WebImageView { ImageView {
url: { // url: {
var oembed = "" // 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") { if (typeof ListItemData.raw !== "undefined") {
ListItemData.raw.forEach(function (item) { ListItemData.raw.forEach(function (item) {
if (item["type"] == "io.pnut.core.oembed") { 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 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 { Container {

View file

@ -43,52 +43,52 @@
<context> <context>
<name>PostItem</name> <name>PostItem</name>
<message> <message>
<location filename="../assets/PostItem.qml" line="199"/> <location filename="../assets/PostItem.qml" line="233"/>
<source>Reply</source> <source>Reply</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="208"/> <location filename="../assets/PostItem.qml" line="242"/>
<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="218"/> <location filename="../assets/PostItem.qml" line="252"/>
<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="218"/> <location filename="../assets/PostItem.qml" line="252"/>
<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="229"/> <location filename="../assets/PostItem.qml" line="263"/>
<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="229"/> <location filename="../assets/PostItem.qml" line="263"/>
<source>Repost</source> <source>Repost</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="274"/>
<source>Quote</source> <source>Quote</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/PostItem.qml" line="249"/> <location filename="../assets/PostItem.qml" line="283"/>
<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="256"/> <location filename="../assets/PostItem.qml" line="290"/>
<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="286"/> <location filename="../assets/PostItem.qml" line="320"/>
<source>Delete</source> <source>Delete</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>