diff --git a/.gitignore b/.gitignore index 8411201..97f4069 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.user harbour-tooter.pro.user harbour-tooter.pro.user + +harbour-tooter.pro.user.2549760 diff --git a/harbour-tooter.pro b/harbour-tooter.pro index b970890..3c63d5e 100644 --- a/harbour-tooter.pro +++ b/harbour-tooter.pro @@ -31,6 +31,9 @@ OTHER_FILES += qml/harbour-tooter.qml \ rpm/harbour-tooter.spec \ rpm/harbour-tooter.yaml \ translations/*.ts \ + qml/pages/components/VisualContainer.qml \ + qml/pages/components/MiniStatus.qml \ + qml/pages/components/MiniHeader.qml \ harbour-tooter.desktop SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256 @@ -58,7 +61,4 @@ DISTFILES += \ qml/images/verified.svg \ qml/lib/Mastodon.js \ qml/lib/Worker.js \ - qml/images/boosted.svg \ - qml/pages/components/VisualContainer.qml \ - qml/pages/components/MiniStatus.qml \ - qml/pages/components/MiniHeader.qml + qml/images/boosted.svg diff --git a/harbour-tooter.pro.user b/harbour-tooter.pro.user index 610f4b9..8828c45 100644 --- a/harbour-tooter.pro.user +++ b/harbour-tooter.pro.user @@ -1,10 +1,10 @@ - + EnvironmentId - {25497605-1bff-4134-a878-76c1475dd8e3} + {41ec03ca-9430-48f3-b421-990d428b2838} ProjectExplorer.Project.ActiveTarget @@ -61,12 +61,12 @@ MerSDK-SailfishOS-i486 MerSDK-SailfishOS-i486 - {f49c1b5a-d715-401a-9a10-0e5fe9e5b72a} + {fd18ca89-dfc9-4054-9c53-c67be7689951} 0 2 0 - C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Debug + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Debug true @@ -138,7 +138,7 @@ true - C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Release + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Release true @@ -210,7 +210,7 @@ true - C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Profile + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Profile true @@ -396,7 +396,7 @@ 13 14 - C:/Users/dysko/SF/harbour-tooter + /Users/dysko/GIT/harbour-tooter false 10234 3 @@ -414,7 +414,7 @@ 3768 false true - true + false false true @@ -426,12 +426,12 @@ MerSDK-SailfishOS-armv7hl MerSDK-SailfishOS-armv7hl - {588087e2-ecc1-41aa-b652-86f16cba9351} + {f895389d-b51a-4d4f-8b03-5ec64bda6f66} 0 2 0 - C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Debug + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Debug true @@ -503,7 +503,7 @@ true - C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Release + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Release true @@ -575,7 +575,7 @@ true - C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Profile + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Profile true @@ -761,7 +761,7 @@ 13 14 - C:/Users/dysko/SF/harbour-tooter + /Users/dysko/GIT/harbour-tooter false 10234 3 @@ -779,7 +779,7 @@ 3768 false true - true + false false true diff --git a/qml/lib/Worker.js b/qml/lib/Worker.js index 44d2a05..02ac217 100644 --- a/qml/lib/Worker.js +++ b/qml/lib/Worker.js @@ -14,18 +14,20 @@ WorkerScript.onMessage = function(msg) { } } - if (!msg.conf.login){ + if (!msg.conf || !msg.conf.login){ console.log("Not loggedin") return; } var API = MastodonAPI({ instance: msg.conf.instance, api_user_token: msg.conf.api_user_token}); if (msg.method === "POST"){ API.post(msg.action, msg.params, function(data) { - if (msg.action === "statuses"){ + if (msg.bgAction){ + console.log(JSON.stringify(data)) + } else if (msg.action === "statuses"){ // status posted if(msg.model){ - var item = parseToot(data); - msg.model.append(item) + var item = parseToot(data); + msg.model.append(item) msg.model.sync(); } @@ -201,6 +203,7 @@ function getDate(dateStr){ function parseToot (data){ //console.log(JSON.stringify(data)) var item = {}; + item['type'] = "toot" item['highlight'] = false item['status_id'] = data["id"] item['status_uri'] = data["uri"] diff --git a/qml/pages/components/MediaBlock.qml b/qml/pages/components/MediaBlock.qml index aa1d9e5..e31af8d 100644 --- a/qml/pages/components/MediaBlock.qml +++ b/qml/pages/components/MediaBlock.qml @@ -45,10 +45,13 @@ Item { placeholder1.width = holder.width - Theme.paddingSmall - Theme.itemSizeLarge; placeholder1.height = Theme.itemSizeLarge*2+Theme.paddingSmall + holder.height = placeholder1.height placeholder2.width = Theme.itemSizeLarge; - placeholder2.height = placeholder2.width - placeholder2.x = placeholder1.x + placeholder1.width + Theme.paddingSmall; + placeholder3.height = placeholder3.width = placeholder2.height = placeholder2.width + placeholder3.x = placeholder2.x = placeholder1.x + placeholder1.width + Theme.paddingSmall; + placeholder3.y = placeholder2.y + placeholder2.height + Theme.paddingSmall; + break; case 4: placeholder1.visible = true; @@ -67,6 +70,7 @@ Item { break; default: holder.height = 0 + placeholder1.visible = placeholder2.visible = placeholder3.visible = placeholder4.visible = false; } } diff --git a/qml/pages/components/VisualContainer.qml b/qml/pages/components/VisualContainer.qml index 081ed5c..4374b5c 100644 --- a/qml/pages/components/VisualContainer.qml +++ b/qml/pages/components/VisualContainer.qml @@ -1,5 +1,6 @@ import QtQuick 2.2 import Sailfish.Silica 1.0 +import "../../lib/API.js" as Logic BackgroundItem { @@ -44,6 +45,19 @@ BackgroundItem { }) } + } + Image { + id: iconTR + anchors { + top: avatar.bottom + topMargin: Theme.paddingMedium + left: avatar.left + } + visible: typeof status_reblogged !== "undefined" && status_reblogged + width: Theme.iconSizeExtraSmall + height: width + source: "image://theme/icon-s-retweet" + } Rectangle { color: Theme.highlightDimmerColor @@ -137,14 +151,37 @@ BackgroundItem { } ContextMenu { id: mnu - MenuItem { - text: "Toggle bold font" - } - MenuItem { - text: "Remove" - onClicked: model.remove(model.index) - } - } + MenuItem { + visible: model.type === "retoot" || model.type === "toot" + text: typeof status_reblogged !== "undefined" && status_reblogged ? qsTr("Unboost") : qsTr("Boost") + onClicked: { + var reblogged = typeof status_reblogged !== "undefined" && status_reblogged + worker.sendMessage({ + "conf" : Logic.conf, + "params" : [], + "method" : "POST", + //"bgAction": true, + "action" : "statuses/"+model.status_id+"/" + (reblogged ? "unreblog" : "reblog") + }) + model['status_reblogged'] = !reblogged + } + } + MenuItem { + visible: model.type === "retoot" || model.type === "toot" + text: typeof status_favourited !== "undefined" && status_favourited ? qsTr("Unfavorite") : qsTr("Favorite") + onClicked: { + var favourited = typeof status_favourited !== "undefined" && status_favourited + worker.sendMessage({ + "conf" : Logic.conf, + "params" : [], + "method" : "POST", + //"bgAction": true, + "action" : "statuses/"+model.status_id+"/" + (favourited ? "unfavourite" : "favourite") + }) + model['status_favourited'] = !favourited + } + } + } @@ -162,7 +199,7 @@ BackgroundItem { }) } onPressAndHold: { - console.log(lblContent.text) + console.log(model['status_reblogged']) mnu.show(delegate) } onDoubleClicked: { diff --git a/translations/harbour-tooter-es.ts b/translations/harbour-tooter-es.ts index 3153c2a..4c761e2 100644 --- a/translations/harbour-tooter-es.ts +++ b/translations/harbour-tooter-es.ts @@ -191,4 +191,23 @@ te siguió + + VisualContainer + + Unboost + + + + Boost + + + + Unfavorite + + + + Favorite + + + diff --git a/translations/harbour-tooter-fr.ts b/translations/harbour-tooter-fr.ts index 5ef37ac..1dbec26 100644 --- a/translations/harbour-tooter-fr.ts +++ b/translations/harbour-tooter-fr.ts @@ -191,4 +191,23 @@ vous suit + + VisualContainer + + Unboost + + + + Boost + + + + Unfavorite + + + + Favorite + + + diff --git a/translations/harbour-tooter-nl.ts b/translations/harbour-tooter-nl.ts index 8333cef..d24ae29 100644 --- a/translations/harbour-tooter-nl.ts +++ b/translations/harbour-tooter-nl.ts @@ -191,4 +191,23 @@ volgde jou + + VisualContainer + + Unboost + + + + Boost + + + + Unfavorite + + + + Favorite + + + diff --git a/translations/harbour-tooter-oc.ts b/translations/harbour-tooter-oc.ts index 556b8d3..a4b25fd 100644 --- a/translations/harbour-tooter-oc.ts +++ b/translations/harbour-tooter-oc.ts @@ -191,4 +191,23 @@ vos sèc + + VisualContainer + + Unboost + + + + Boost + + + + Unfavorite + + + + Favorite + + + diff --git a/translations/harbour-tooter.ts b/translations/harbour-tooter.ts index c95b736..fe442e4 100644 --- a/translations/harbour-tooter.ts +++ b/translations/harbour-tooter.ts @@ -191,4 +191,23 @@ followed you + + VisualContainer + + Unboost + + + + Boost + + + + Unfavorite + + + + Favorite + + +