From 6f41f3b948d2bf7fa9f21e0ad371f4610b703bdc Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Thu, 16 Nov 2017 12:35:30 -0800 Subject: [PATCH] Open image in preview card --- assets/PostItem.qml | 10 ++++++---- assets/StreamTab.qml | 6 ++---- assets/ThreadPage.qml | 3 +++ src/applicationui.cpp | 3 +-- src/applicationui.hpp | 2 +- translations/Goober.ts | 28 ++++++++++++++-------------- 6 files changed, 27 insertions(+), 25 deletions(-) diff --git a/assets/PostItem.qml b/assets/PostItem.qml index acf270b..a6a0b78 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -154,7 +154,8 @@ Container { // TODO: add tab to open full image in a page horizontalAlignment: HorizontalAlignment.Center bottomMargin: ui.sdu(2.0) - ImageView { + ImageButton { + id: pimage visible: { var isphoto = false if (typeof ListItemData.raw !== "undefined") { @@ -168,9 +169,10 @@ Container { } return isphoto } - scalingMethod: ScalingMethod.AspectFit - //imageSource: "asset:///icons/laughing_man.png" - image: ptracker.image + defaultImage: ptracker.image + onClicked: { + postitem.ListItem.view.showImage(ptracker.imageSource) + } attachedObjects: [ NetImageTracker { id: ptracker diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index 3083fe5..c5b0419 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -122,10 +122,8 @@ NavigationPane { function copyText(text) { _app.copyText(text) } - function showImage(filename, mtype) { - console.log('-- showImage --') - console.log(filename) - _app.showImage(filename, mtype) + function showImage(filename) { + _app.showImage(filename) } attachedObjects: [ ListScrollStateHandler { diff --git a/assets/ThreadPage.qml b/assets/ThreadPage.qml index f513342..357de67 100644 --- a/assets/ThreadPage.qml +++ b/assets/ThreadPage.qml @@ -66,6 +66,9 @@ Page { return false } } + function showImage(filename) { + _app.showImage(filename) + } attachedObjects: [ NetImageManager { id: feedImageManager diff --git a/src/applicationui.cpp b/src/applicationui.cpp index fe838fc..e37354c 100644 --- a/src/applicationui.cpp +++ b/src/applicationui.cpp @@ -123,7 +123,7 @@ void ApplicationUI::onInvoke(const bb::system::InvokeRequest& request) } } -void ApplicationUI::showImage(const QString& filename, const QString& mtype) +void ApplicationUI::showImage(const QString& filename) { qDebug() << "showImage called!"; bb::system::InvokeManager manager; @@ -132,7 +132,6 @@ void ApplicationUI::showImage(const QString& filename, const QString& mtype) request.setUri(QUrl::fromLocalFile(filename)); request.setTarget("sys.pictures.card.previewer"); request.setAction("bb.action.VIEW"); - request.setMimeType(mtype); bb::system::InvokeTargetReply *targetReply = manager.invoke(request); manager.setParent(this); diff --git a/src/applicationui.hpp b/src/applicationui.hpp index 96cfbf8..4ac4f70 100644 --- a/src/applicationui.hpp +++ b/src/applicationui.hpp @@ -48,7 +48,7 @@ public: Q_INVOKABLE void setSetting(const QString &key, const QString &value); Q_INVOKABLE QString appversion(); Q_INVOKABLE void copyText(QByteArray text); - Q_INVOKABLE void showImage(const QString &filename, const QString &mtype); + Q_INVOKABLE void showImage(const QString &filename); Q_SIGNALS: void createPost(QByteArray text); diff --git a/translations/Goober.ts b/translations/Goober.ts index e5cf044..7934c95 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 @@ -203,22 +203,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload