From c157ba28ee7648f07d5df61dd237750cf496a92c Mon Sep 17 00:00:00 2001 From: Dusko Angirevic Date: Wed, 7 Jun 2017 16:09:41 +0200 Subject: [PATCH] Minor fixes to the timelines --- harbour-tooter.pro | 3 +- harbour-tooter.pro.user | 28 +- harbour-tooter.pro.user.41ec03c | 801 ++++++++++++++++++++++++++ qml/images/boosted.svg | 16 + qml/images/public.svg | 15 + qml/lib/Worker.js | 41 +- qml/pages/MainPage.qml | 141 +++-- qml/pages/Profile.qml | 51 +- qml/pages/SecondPage.qml | 67 --- qml/pages/components/MyList.qml | 2 +- qml/pages/components/Navigation.qml | 24 +- qml/pages/components/Notification.qml | 158 ----- qml/pages/components/Toot.qml | 54 +- translations/harbour-tooter-de.ts | 45 +- translations/harbour-tooter.ts | 79 ++- 15 files changed, 1075 insertions(+), 450 deletions(-) create mode 100644 harbour-tooter.pro.user.41ec03c create mode 100644 qml/images/boosted.svg create mode 100644 qml/images/public.svg delete mode 100644 qml/pages/SecondPage.qml delete mode 100644 qml/pages/components/Notification.qml diff --git a/harbour-tooter.pro b/harbour-tooter.pro index 03b2599..ea57ac2 100644 --- a/harbour-tooter.pro +++ b/harbour-tooter.pro @@ -18,7 +18,6 @@ SOURCES += src/harbour-tooter.cpp OTHER_FILES += qml/harbour-tooter.qml \ qml/cover/CoverPage.qml \ - qml/pages/SecondPage.qml \ qml/pages/MainPage.qml \ qml/pages/LoginPage.qml \ qml/pages/components/MyList.qml \ @@ -56,4 +55,4 @@ DISTFILES += \ qml/pages/Browser.qml \ qml/pages/Profile.qml \ qml/pages/components/ProfileHeader.qml \ - qml/pages/components/Notification.qml + qml/images/boosted.svg diff --git a/harbour-tooter.pro.user b/harbour-tooter.pro.user index 02a6031..9a41bb8 100644 --- a/harbour-tooter.pro.user +++ b/harbour-tooter.pro.user @@ -1,14 +1,14 @@ - + EnvironmentId - {41ec03ca-9430-48f3-b421-990d428b2838} + {25497605-1bff-4134-a878-76c1475dd8e3} ProjectExplorer.Project.ActiveTarget - 1 + 0 ProjectExplorer.Project.EditorSettings @@ -61,12 +61,12 @@ MerSDK-SailfishOS-i486 MerSDK-SailfishOS-i486 - {fd18ca89-dfc9-4054-9c53-c67be7689951} + {f49c1b5a-d715-401a-9a10-0e5fe9e5b72a} 0 2 0 - /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Debug + C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Debug true @@ -138,7 +138,7 @@ true - /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Release + C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Release true @@ -210,7 +210,7 @@ true - /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Profile + C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_i486-Profile true @@ -396,7 +396,7 @@ 13 14 - /Users/dysko/GIT/harbour-tooter + C:/Users/dysko/SF/harbour-tooter false 10234 3 @@ -426,12 +426,12 @@ MerSDK-SailfishOS-armv7hl MerSDK-SailfishOS-armv7hl - {f895389d-b51a-4d4f-8b03-5ec64bda6f66} + {588087e2-ecc1-41aa-b652-86f16cba9351} 0 2 0 - /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Debug + C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Debug true @@ -503,7 +503,7 @@ true - /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Release + C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Release true @@ -575,7 +575,7 @@ true - /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Profile + C:/Users/dysko/SF/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Profile true @@ -761,7 +761,7 @@ 13 14 - /Users/dysko/GIT/harbour-tooter + C:/Users/dysko/SF/harbour-tooter false 10234 3 @@ -779,7 +779,7 @@ 3768 false true - true + false false true diff --git a/harbour-tooter.pro.user.41ec03c b/harbour-tooter.pro.user.41ec03c new file mode 100644 index 0000000..02a6031 --- /dev/null +++ b/harbour-tooter.pro.user.41ec03c @@ -0,0 +1,801 @@ + + + + + + EnvironmentId + {41ec03ca-9430-48f3-b421-990d428b2838} + + + ProjectExplorer.Project.ActiveTarget + 1 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + MerSDK-SailfishOS-i486 + MerSDK-SailfishOS-i486 + {fd18ca89-dfc9-4054-9c53-c67be7689951} + 0 + 2 + 0 + + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Debug + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 3 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 2 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Release + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 3 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 2 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_i486-Profile + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 3 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 2 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + RPM + + QmakeProjectManager.MerRpmBuildStep + + + true + RPM Validation + + QmakeProjectManager.MerRpmValidationStep + + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy By Building An RPM Package + + QmakeProjectManager.MerMb2RpmBuildConfiguration + + + + + true + Prepare Target + + QmakeProjectManager.MerPrepareTargetStep + + + true + Rsync + + QmakeProjectManager.MerRsyncDeployStep + + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy By Copying Binaries + + QmakeProjectManager.MerRSyncDeployConfiguration + + + + + true + Prepare Target + + QmakeProjectManager.MerPrepareTargetStep + + + true + RPM + + QmakeProjectManager.MerRpmDeployStep + + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy As RPM Package + + QmakeProjectManager.MerRpmDeployConfiguration + + 3 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + /Users/dysko/GIT/harbour-tooter + false + 10234 + 3 + + 1 + + harbour-tooter (on Remote Device) + + QmakeProjectManager.MerRunConfiguration:harbour-tooter + + harbour-tooter + + false + + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + MerSDK-SailfishOS-armv7hl + MerSDK-SailfishOS-armv7hl + {f895389d-b51a-4d4f-8b03-5ec64bda6f66} + 0 + 2 + 0 + + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Debug + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 3 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 2 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Release + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 3 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 2 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + /Users/dysko/GIT/build-harbour-tooter-MerSDK_SailfishOS_armv7hl-Profile + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + false + + + + 3 + Build + + ProjectExplorer.BuildSteps.Build + + + + true + Start SDK + + Mer.MerSdkStartStep + + + true + Make + + Qt4ProjectManager.MakeStep + + -w + -r + + true + clean + + + 2 + Clean + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + + true + RPM + + QmakeProjectManager.MerRpmBuildStep + + + true + RPM Validation + + QmakeProjectManager.MerRpmValidationStep + + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy By Building An RPM Package + + QmakeProjectManager.MerMb2RpmBuildConfiguration + + + + + true + Prepare Target + + QmakeProjectManager.MerPrepareTargetStep + + + true + Rsync + + QmakeProjectManager.MerRsyncDeployStep + + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy By Copying Binaries + + QmakeProjectManager.MerRSyncDeployConfiguration + + + + + true + Prepare Target + + QmakeProjectManager.MerPrepareTargetStep + + + true + RPM + + QmakeProjectManager.MerRpmDeployStep + + 2 + Deploy + + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy As RPM Package + + QmakeProjectManager.MerRpmDeployConfiguration + + 3 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + /Users/dysko/GIT/harbour-tooter + false + 10234 + 3 + + 1 + + harbour-tooter (on Remote Device) + + QmakeProjectManager.MerRunConfiguration:harbour-tooter + + harbour-tooter + + false + + 3768 + false + true + true + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/qml/images/boosted.svg b/qml/images/boosted.svg new file mode 100644 index 0000000..468e2da --- /dev/null +++ b/qml/images/boosted.svg @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/qml/images/public.svg b/qml/images/public.svg new file mode 100644 index 0000000..bb92391 --- /dev/null +++ b/qml/images/public.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/qml/lib/Worker.js b/qml/lib/Worker.js index ef4cd16..d5a3f83 100644 --- a/qml/lib/Worker.js +++ b/qml/lib/Worker.js @@ -26,7 +26,10 @@ WorkerScript.onMessage = function(msg) { var items = []; for (var i in data) { if (data.hasOwnProperty(i)) { - if(msg.action === "notifications") { + if(msg.action === "accounts/search") { + var item = parseAccounts(data[i]); + items.push(item) + } else if(msg.action === "notifications") { console.log("Is notification... parsing...") var item = parseNotification(data[i]); items.push(item) @@ -59,7 +62,12 @@ function addDataToModel (model, mode, items){ model.sync() } +function parseAccounts(data){ + return (data); +} + function parseNotification(data){ + console.log(JSON.stringify(data)) var item = { id: data.id, type: data.type, @@ -73,15 +81,26 @@ function parseNotification(data){ }; switch (item['type']){ case "mention": + item = parseToot(data.status) + item['typeIcon'] = "image://theme/icon-s-retweet" item['typeIcon'] = "image://theme/icon-s-alarm" break; case "reblog": + item = parseToot(data.status) + item['isReblog'] = true; + item['type'] = "reblog"; + item['retweetScreenName'] = data['account']['username']; item['typeIcon'] = "image://theme/icon-s-retweet" break; case "favourite": + item = parseToot(data.status) item['typeIcon'] = "image://theme/icon-s-favorite" + item['type'] = "favourite"; + item['retweetScreenName'] = data['account']['username']; break; case "follow": + item['type'] = "follow"; + item['retweetScreenName'] = data['account']['username']; item['typeIcon'] = "image://theme/icon-s-installed" break; default: @@ -96,8 +115,8 @@ function parseNotification(data){ function parseToot (data){ //console.log(JSON.stringify(data)) var item = {}; - item['username'] = "Mjau" - + item['account_username'] = "Mjau" + item['type'] = ""; item['retweetScreenName'] = ''; item['isVerified'] = false; item['isReblog'] = false; @@ -115,18 +134,18 @@ function parseToot (data){ } if(data['account']){ item['account_id'] = data['account']['id']; - item['username'] = data['account']['username']; - item['displayname'] = data['account']['display_name']; + item['account_username'] = data['account']['username']; + item['account_display_name'] = data['account']['display_name']; item['account_locked'] = data['account']['locked']; item['account_avatar'] = data['account']['avatar']; } if(data['reblog']){ - item['isReblog'] = true; item['retweetScreenName'] = data['account']['username']; + item['type'] = "reblog"; item['reblog_id'] = data['reblog']['id']; item['account_id'] = data['reblog']['account']['id']; - item['username'] = data['reblog']['account']['username']; - item['displayname'] = data['reblog']['account']['display_name']; + item['account_username'] = data['reblog']['account']['username']; + item['account_display_name'] = data['reblog']['account']['display_name']; item['account_locked'] = data['reblog']['account']['locked']; item['account_avatar'] = data['reblog']['account']['avatar']; @@ -141,13 +160,11 @@ function parseToot (data){ item['content'] = item['content'].split(" ") for(var i = 0; i < item['content'].length ; i++){ if(item['content'][i][0] === "#"){ - item['content'][i] = ''+item['content'][i]+''; + item['content'][i] = ''+item['content'][i]+''; } if(item['content'][i][0] === "@"){ - item['content'][i] = ''+item['content'][i]+''; + item['content'][i] = ''+item['content'][i]+''; } - - console.log(item['content'][i]) } item['content'] = item['content'].join(" ").autoLink() diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml index b99aed2..a939fa2 100644 --- a/qml/pages/MainPage.qml +++ b/qml/pages/MainPage.qml @@ -36,6 +36,7 @@ import "./components/" Page { id: mainPage + property bool isFirstPage: true // The effective value will be restricted by ApplicationWindow.allowedOrientations allowedOrientations: Orientation.All @@ -55,6 +56,61 @@ Page { } } } + VisualItemModel { + id: visualModel + MyList{ + id: tlHome; + title: qsTr("Home") + type: "timelines/home" + mdl: Logic.modelTLhome + width: parent.width + height: parent.height + onOpenDrawer: infoPanel.open = setDrawer + } + MyList{ + id: tlPublic; + title: qsTr("Timeline") + type: "timelines/public" + mdl: Logic.modelTLpublic + width: parent.width + height: parent.height + onOpenDrawer: infoPanel.open = setDrawer + } + MyList{ + id: tlNotifications; + title: qsTr("Notifications") + type: "notifications" + mdl: Logic.modelTLnotifications + width: parent.width + height: parent.height + onOpenDrawer: infoPanel.open = setDrawer + //delegate: Notification {} + } + MyList{ + property string search; + id: tlSearch; + title: qsTr("Search") + type: "search" + mdl: Logic.modelTLsearch + width: parent.width + height: parent.height + onOpenDrawer: infoPanel.open = setDrawer + delegate: Notification {} + header: SearchField { + width: parent.width + text: tlSearch.search + placeholderText: "Search" + labelVisible: false + EnterKey.iconSource: "image://theme/icon-m-enter-close" + EnterKey.onClicked: { + tlSearch.search = text + focus = false + } + } + } + + } + SlideshowView { id: slideshow @@ -74,86 +130,19 @@ Page { rightMargin: mainPage.isPortrait ? 0 : infoPanel.visibleSize bottomMargin: mainPage.isPortrait ? infoPanel.visibleSize : 0 } - model: VisualItemModel { - MyList{ - id: tlHome; - title: qsTr("Home") - type: "timelines/home" - mdl: Logic.modelTLhome - width: parent.width - height: parent.height - onOpenDrawer: infoPanel.open = setDrawer - } - MyList{ - id: tlPublic; - title: qsTr("Timeline") - type: "timelines/public" - mdl: Logic.modelTLpublic - width: parent.width - height: parent.height - onOpenDrawer: infoPanel.open = setDrawer - } - MyList{ - id: tlNotifications; - title: qsTr("Notifications") - type: "notifications" - mdl: Logic.modelTLnotifications - width: parent.width - height: parent.height - onOpenDrawer: infoPanel.open = setDrawer - delegate: Notification {} - } - /* - MyList{ - id: timeline2; - width: parent.width - height: parent.height - model: 0 - onOpenDrawer: infoPanel.open = setDrawer - } - MyList{ - id: timeline3; - width: parent.width - height: parent.height - model: 30 - onOpenDrawer: infoPanel.open = setDrawer - } - MyList{ - id: timeline4; - width: parent.width - height: parent.height - model: 4 - onOpenDrawer: infoPanel.open = setDrawer - }*/ - + model: visualModel + Component.onCompleted: { } - } + function onLinkActivated(href){ + if (href[0] === '#' || href[0] === '@' ) { + slideshow.positionViewAtIndex(3, ListView.SnapToItem) + navigation.navigateTo('search') - Component.onCompleted: { - /*Mastodon.api.post("statuses", {status:"First toot by Tooter - Mastodon client for #SailfishOS"}, function (data) { - console.log(JSON.stringify(data)) - // will be called if the toot was successful - // data is the http response object - //sidenote: please do not actually execute this request, you could be bullied by your friends - });*/ - - /*Logic.api.get("timelines/home", [ - //["since_id", 420], - //["max_id", 1337] - ], function(data) { - // returns all users account id 1 is following in the id range from 420 to 1337 - // you don't have to supply the parameters, you can also just go with .get(endpoint, callback) - //model.append(data) - for (var i in data) { - if (data.hasOwnProperty(i)) { - console.log(JSON.stringify(data[i])) - } - } - - });*/ - console.log(Logic.test) + } else { + pageStack.push(Qt.resolvedUrl("Browser.qml"), {"href" : href}) + } } } diff --git a/qml/pages/Profile.qml b/qml/pages/Profile.qml index c50ee52..08e7c1c 100644 --- a/qml/pages/Profile.qml +++ b/qml/pages/Profile.qml @@ -33,6 +33,23 @@ Page { source: "../lib/Worker.js" onMessage: { console.log(JSON.stringify(messageObject)) + if(messageObject.action.indexOf("accounts/search") > -1 ){ + user_id = messageObject.data.id + followers_count = messageObject.data.followers_count + following_count = messageObject.data.following_count + username = messageObject.data.username + displayname = messageObject.data.display_name + profileImage = messageObject.data.avatar_static + + var msg = { + 'action' : "accounts/relationships/", + 'params' : [ {name: "id", data: user_id}], + 'conf' : Logic.conf + }; + worker.sendMessage(msg); + list.loadData("prepend") + } + if(messageObject.action === "accounts/relationships/"){ console.log(JSON.stringify(messageObject)) following= messageObject.data.following @@ -87,22 +104,32 @@ Page { // The effective value will be restricted by ApplicationWindow.allowedOrientations allowedOrientations: Orientation.All Component.onCompleted: { - var msg = { - 'action' : "accounts/relationships/", - 'params' : [ {name: "id", data: user_id}], - 'conf' : Logic.conf - }; - worker.sendMessage(msg); - msg = { - 'action' : "accounts/"+user_id, - 'conf' : Logic.conf - }; - worker.sendMessage(msg); + var msg; + if (user_id) { + msg = { + 'action' : "accounts/relationships/", + 'params' : [ {name: "id", data: user_id}], + 'conf' : Logic.conf + }; + worker.sendMessage(msg); + msg = { + 'action' : "accounts/"+user_id, + 'conf' : Logic.conf + }; + worker.sendMessage(msg); + } else { + msg = { + 'action' : "accounts/search?limit=1&q="+username, + 'conf' : Logic.conf + }; + worker.sendMessage(msg); + } } MyList { + id: list header: ProfileHeader { id: header title: displayname @@ -121,7 +148,7 @@ Page { model: ListModel {} type: "accounts/"+user_id+"/statuses" vars: {} - conf: Logic.getConfTW() + conf: Logic.conf } diff --git a/qml/pages/SecondPage.qml b/qml/pages/SecondPage.qml deleted file mode 100644 index 99ea9b6..0000000 --- a/qml/pages/SecondPage.qml +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2013 Jolla Ltd. - Contact: Thomas Perl - All rights reserved. - - You may use this file under the terms of BSD license as follows: - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Jolla Ltd nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -import QtQuick 2.0 -import Sailfish.Silica 1.0 -import "../lib/API.js" as Logic - - -Page { - id: page - - // The effective value will be restricted by ApplicationWindow.allowedOrientations - allowedOrientations: Orientation.All - - SilicaListView { - id: listView - model: 20 - anchors.fill: parent - header: PageHeader { - title: qsTr("Nested Page") - } - delegate: BackgroundItem { - id: delegate - - Label { - x: Theme.horizontalPageMargin - text: qsTr("Item") + " " + index - anchors.verticalCenter: parent.verticalCenter - color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor - } - onClicked: console.log("Clicked " + index) - } - VerticalScrollDecorator {} - } - Component.onCompleted: { - Logic.test++; - Logic.conf['test'] = "aaaa"; - console.log(Logic.test) - } -} diff --git a/qml/pages/components/MyList.qml b/qml/pages/components/MyList.qml index 75f6b3a..f8fe8b2 100644 --- a/qml/pages/components/MyList.qml +++ b/qml/pages/components/MyList.qml @@ -92,7 +92,7 @@ SilicaListView { criteria: ViewSection.FullString delegate: SectionHeader { text: { - var dat = Date.fromLocaleDateString(locale, section); + var dat = Date.fromLocaleDateString(locale, created_at); dat = Format.formatDate(dat, Formatter.TimepointRelativeCurrentDay) if (dat === "00:00:00" || dat === "00:00") { visible = false; diff --git a/qml/pages/components/Navigation.qml b/qml/pages/components/Navigation.qml index 8252914..80b1014 100644 --- a/qml/pages/components/Navigation.qml +++ b/qml/pages/components/Navigation.qml @@ -1,6 +1,5 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 -import QtGraphicalEffects 1.0 SilicaGridView { signal slideshowShow(int vIndex); @@ -14,27 +13,27 @@ SilicaGridView { ListModel { id: listModel ListElement { - icon: "../../images/home.svg" + icon: "image://theme/icon-m-home" slug: "timeline" name: "Timeline" active: true unread: false } ListElement { - icon: "../../images/home.svg" + icon: "image://theme/icon-m-region" slug: "mentions" name: "Mentions" active: false unread: false } ListElement { - icon: "../../images/notification.svg" + icon: "image://theme/icon-m-alarm" slug: "msgs" name: "Messagess" active: false } ListElement { - icon: "../../images/search.svg" + icon: "image://theme/icon-m-search" slug: "search" name: "Search" active: false @@ -45,8 +44,8 @@ SilicaGridView { anchors.fill: parent currentIndex: -1 - cellWidth: isPortrait ? gridView.width : gridView.width / listModel.count - cellHeight: isPortrait ? gridView.height/listModel.count : gridView.height + cellWidth: isPortrait ? gridView.width : gridView.width / model.count + cellHeight: isPortrait ? gridView.height/model.count : gridView.height delegate: BackgroundItem { @@ -97,20 +96,13 @@ SilicaGridView { }*/ Image { id: image - source: model.icon + (highlighted + source: model.icon +'?'+ (highlighted ? Theme.highlightColor : (model.active ? Theme.primaryColor : Theme.secondaryHighlightColor)) anchors.centerIn: parent smooth: true - visible: false - } - ColorOverlay { - anchors.fill: image - source: image - color: (highlighted - ? Theme.highlightColor - : (model.active ? Theme.primaryColor : Theme.secondaryHighlightColor)) } + Text { anchors.centerIn: parent visible: false diff --git a/qml/pages/components/Notification.qml b/qml/pages/components/Notification.qml deleted file mode 100644 index f87137b..0000000 --- a/qml/pages/components/Notification.qml +++ /dev/null @@ -1,158 +0,0 @@ -import QtQuick 2.0 -import Sailfish.Silica 1.0 -import QtGraphicalEffects 1.0 - -BackgroundItem { - signal send (string notice) - - id: delegate - //property string text: "0" - width: parent.width - signal navigateTo(string link) - height: lblText.paintedHeight + (lblText.text.length > 0 ? Theme.paddingLarge : 0 )+ lblName.paintedHeight + Theme.paddingLarge - - Image { - id: avatar - x: Theme.horizontalPageMargin - y: Theme.paddingLarge - asynchronous: true - width: Theme.iconSizeMedium - height: width - smooth: true - source: account_avatar - visible: true - MouseArea { - anchors.fill: parent - onClicked: { - pageStack.push(Qt.resolvedUrl("../Profile.qml"), { - "user_id": account_id, - "displayname": account_display_name, - "username": account_acct, - "profileImage": account_avatar - }) - } - - } - - } - Label { - id: lblName - anchors { - top: avatar.top - topMargin: 0 - left: avatar.right - leftMargin: Theme.paddingMedium - } - text: account_display_name - font.weight: Font.Bold - font.pixelSize: Theme.fontSizeSmall - color: (pressed ? Theme.highlightColor : Theme.primaryColor) - } - - Image { - id: iconVerified - y: Theme.paddingLarge - anchors { - left: lblName.right - leftMargin: Theme.paddingSmall - verticalCenter: lblName.verticalCenter - } - visible: account_locked - width: account_locked ? Theme.iconSizeExtraSmall*0.8 : 0 - opacity: 0.8 - height: width - source: "image://theme/icon-s-secure?" + (pressed - ? Theme.highlightColor - : Theme.primaryColor) - } - - - Label { - id: lblScreenName - anchors { - left: iconVerified.right - right: lblDate.left - leftMargin: Theme.paddingMedium - baseline: lblName.baseline - } - truncationMode: TruncationMode.Fade - text: '@'+account_acct - font.pixelSize: Theme.fontSizeExtraSmall - color: (pressed ? Theme.secondaryHighlightColor : Theme.secondaryColor) - } - Label { - function timestamp() { - var txt = Format.formatDate(created_at, Formatter.Timepoint) - var elapsed = Format.formatDate(created_at, Formatter.DurationElapsedShort) - return (elapsed ? elapsed : txt ) - } - id: lblDate - color: (pressed ? Theme.highlightColor : Theme.primaryColor) - text: Format.formatDate(created_at, new Date() - created_at < 60*60*1000 ? Formatter.DurationElapsedShort : Formatter.TimeValueTwentyFourHours) - font.pixelSize: Theme.fontSizeExtraSmall - horizontalAlignment: Text.AlignRight - anchors { - right: parent.right - baseline: lblName.baseline - rightMargin: Theme.paddingLarge - } - } - - Label { - id: lblText - anchors { - left: lblName.left - right: parent.right - top: lblScreenName.bottom - topMargin: Theme.paddingSmall - rightMargin: Theme.paddingLarge - } - height: content.length ? paintedHeight : 0 - onLinkActivated: { - console.log(link) - if (link[0] === "@") { - pageStack.push(Qt.resolvedUrl("../Profile.qml"), { - "name": "", - "username": link.substring(1), - "profileImage": "" - }) - } else if (link[0] === "#") { - - pageStack.pop(pageStack.find(function(page) { - var check = page.isFirstPage === true; - if (check) - page.onLinkActivated(link) - return check; - })); - - send(link) - } else { - pageStack.push(Qt.resolvedUrl("../Browser.qml"), {"href" : link}) - } - - - } - text: { - switch (type){ - case "mention": - return qsTr("metioned you") - case "reblog": - return qsTr("boosted your status") - case "favourite": - return qsTr("favourited your status") - case "follow": - return qsTr("followed you") - default: - return type - } - } - - textFormat: Text.StyledText - linkColor : Theme.highlightColor - wrapMode: Text.Wrap - maximumLineCount: 6 - font.pixelSize: Theme.fontSizeSmall - color: (pressed ? Theme.highlightColor : Theme.primaryColor) - } - -} diff --git a/qml/pages/components/Toot.qml b/qml/pages/components/Toot.qml index 5e8e453..7de4745 100644 --- a/qml/pages/components/Toot.qml +++ b/qml/pages/components/Toot.qml @@ -9,33 +9,50 @@ BackgroundItem { //property string text: "0" width: parent.width signal navigateTo(string link) - height: lblText.paintedHeight + (lblText.text.length > 0 ? Theme.paddingLarge : 0 )+ lblName.paintedHeight + (isReblog ? Theme.paddingLarge + iconRT.height : 0) + Theme.paddingLarge + height: lblText.paintedHeight + (lblText.text.length > 0 ? Theme.paddingLarge : 0 )+ lblName.paintedHeight + (type.length ? Theme.paddingLarge + iconRT.height : 0) + Theme.paddingLarge Image { id: iconRT y: Theme.paddingLarge anchors { right: avatar.right } - visible: isReblog + visible: type.length width: Theme.iconSizeExtraSmall height: width - source: "image://theme/icon-s-retweet?" + (pressed ? Theme.primaryColor : Theme.secondaryColor) + source: "../../images/boosted.svg" } Label { id: lblRtByName - visible: isReblog + visible: type.length anchors { left: lblName.left bottom: iconRT.bottom } - text: '@' + retweetScreenName + ' boosted' + text: { + var action; + switch(type){ + case "reblog": + action = qsTr('boosted'); + break; + case "favourite": + action = qsTr('favourited'); + break; + case "follow": + action = qsTr('followed you'); + break; + default: + action = type; + } + return '@' + retweetScreenName + ' ' + action + } + font.pixelSize: Theme.fontSizeExtraSmall color: Theme.secondaryColor } Image { id: avatar x: Theme.horizontalPageMargin - y: Theme.paddingLarge + (isReblog ? iconRT.height+Theme.paddingMedium : 0) + y: Theme.paddingLarge + (type.length ? iconRT.height+Theme.paddingMedium : 0) asynchronous: true width: Theme.iconSizeMedium height: width @@ -46,9 +63,8 @@ BackgroundItem { anchors.fill: parent onClicked: { pageStack.push(Qt.resolvedUrl("../Profile.qml"), { - "user_id": account_id, - "displayname": displayname, - "username": username, + "displayname": account_display_name, + "username": account_username, "profileImage": account_avatar }) } @@ -64,7 +80,7 @@ BackgroundItem { left: avatar.right leftMargin: Theme.paddingMedium } - text: displayname + text: account_display_name font.weight: Font.Bold font.pixelSize: Theme.fontSizeSmall color: (pressed ? Theme.highlightColor : Theme.primaryColor) @@ -83,8 +99,8 @@ BackgroundItem { opacity: 0.8 height: width source: "image://theme/icon-s-secure?" + (pressed - ? Theme.highlightColor - : Theme.primaryColor) + ? Theme.highlightColor + : Theme.primaryColor) } @@ -97,7 +113,7 @@ BackgroundItem { baseline: lblName.baseline } truncationMode: TruncationMode.Fade - text: '@'+username + text: '@'+account_username font.pixelSize: Theme.fontSizeExtraSmall color: (pressed ? Theme.secondaryHighlightColor : Theme.secondaryColor) } @@ -139,12 +155,12 @@ BackgroundItem { }) } else if (link[0] === "#") { - pageStack.pop(pageStack.find(function(page) { - var check = page.isFirstPage === true; - if (check) - page.onLinkActivated(link) - return check; - })); + pageStack.pop(pageStack.find(function(page) { + var check = page.isFirstPage === true; + if (check) + page.onLinkActivated(link) + return check; + })); send(link) } else { diff --git a/translations/harbour-tooter-de.ts b/translations/harbour-tooter-de.ts index 2db46c7..f600799 100644 --- a/translations/harbour-tooter-de.ts +++ b/translations/harbour-tooter-de.ts @@ -29,18 +29,22 @@ MainPage - - Timeline - - Home + + Timeline + + Notifications + + Search + + MyList @@ -49,25 +53,6 @@ - - Notification - - metioned you - - - - boosted your status - - - - favourited your status - - - - followed you - - - Profile @@ -120,14 +105,18 @@ - SecondPage + Toot - Nested Page - Unterseite + followed you + - Item - Element + boosted + + + + favourited + diff --git a/translations/harbour-tooter.ts b/translations/harbour-tooter.ts index 030e74c..fd4002b 100644 --- a/translations/harbour-tooter.ts +++ b/translations/harbour-tooter.ts @@ -16,118 +16,107 @@ Browser Open in Browser - + Open in Browser Web mode - + Web mode Reading mode - + Reading mode MainPage - Timeline - + Home + Home - Home - + Timeline + Timeline Notifications - + Notifications + + + Search + Search MyList Load more - Cargar más - - - - Notification - - metioned you - - - - boosted your status - - - - favourited your status - - - - followed you - + Load more Profile Unfollow - + Unfollow Follow request sent! - + Follow request sent! Following - + Following Mute - + Mute Unmute - + Unmute Unblock - + Unblock Block - + Block Statuses - + Statuses Favourites - + Favourites Follow - + Follow Summary - + Summary Followers - + Followers - SecondPage + Toot - Nested Page - Página anidada + boosted + boosted - Item - Artículo + favourited + favourited + + + followed you + followed you