From 18f100b55e29f2090c038931e1b99d852d2a8aa3 Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Thu, 16 Nov 2017 11:02:41 -0800 Subject: [PATCH] Try loading photos using the NetImageTracker --- assets/PostItem.qml | 44 +++++++++++++++++++++++++++++++++++++----- translations/Goober.ts | 20 +++++++++---------- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/assets/PostItem.qml b/assets/PostItem.qml index c250b38..7b0f7ae 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -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 { diff --git a/translations/Goober.ts b/translations/Goober.ts index 285d300..59ac41e 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -43,52 +43,52 @@ PostItem - + Reply - + Reply All - + Delete Bookmark - + Add Bookmark - + Delete Repost - + Repost - + Quote - + View Profile - + Copy text - + Delete