diff --git a/harbour-tooter.pro b/harbour-tooter.pro index c5e9730..91834ed 100644 --- a/harbour-tooter.pro +++ b/harbour-tooter.pro @@ -63,7 +63,10 @@ DISTFILES += \ qml/images/tooter.svg \ qml/lib/Mastodon.js \ qml/lib/Worker.js \ - qml/images/boosted.svg + qml/images/boosted.svg \ + qml/pages/Settings.qml \ + qml/pages/components/MediaBlock.qml \ + qml/pages/components/MyImage.qml HEADERS += \ src/imageuploader.h diff --git a/qml/harbour-tooter.qml b/qml/harbour-tooter.qml index 95d704a..f076e09 100644 --- a/qml/harbour-tooter.qml +++ b/qml/harbour-tooter.qml @@ -51,6 +51,7 @@ ApplicationWindow Logic.api = new Logic.MastodonAPI({ instance: Logic.conf['instance'], api_user_token: "" }); } if (Logic.conf['login']) { + //Logic.conf['notificationLastID'] = 0 Logic.api.setConfig("api_user_token", Logic.conf['api_user_token']) pageStack.push(Qt.resolvedUrl("./pages/MainPage.qml"), {}) //pageStack.push(Qt.resolvedUrl("./pages/Conversation.qml"), {}) diff --git a/qml/lib/API.js b/qml/lib/API.js index dd65e18..df46b3f 100644 --- a/qml/lib/API.js +++ b/qml/lib/API.js @@ -162,7 +162,7 @@ var notifier = function(item){ msg = { urgency: "low", timestamp: item.created_at, - summary: (item.account_display_name !== "" ? item.account_display_name : '@'+item.account_username) + ' ' + qsTr("boosted"), + summary: (item.reblog_account_display_name !== "" ? item.reblog_account_display_name : '@'+item.reblog_account_username) + ' ' + qsTr("boosted"), body: item.content } break; diff --git a/qml/lib/Worker.js b/qml/lib/Worker.js index fb01a6d..c538394 100644 --- a/qml/lib/Worker.js +++ b/qml/lib/Worker.js @@ -1,4 +1,5 @@ Qt.include("Mastodon.js") +var loadImages = true; WorkerScript.onMessage = function(msg) { console.log("Action > " + msg.action) console.log("Model > " + msg.model) @@ -18,6 +19,9 @@ WorkerScript.onMessage = function(msg) { console.log("Not loggedin") return; } + if (typeof msg.conf['loadImages'] !== "undefined") + loadImages = msg.conf['loadImages'] + 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) { @@ -246,6 +250,8 @@ function parseToot (data){ item['content'] = item['content'].replaceAll('#'+tag, ''+tag+'') }*/ item['attachments'] = []; + console.log("Image "+loadImages) + for(var i = 0; i < data['media_attachments'].length ; i++){ var attachments = data['media_attachments'][i]; item['content'] = item['content'].replaceAll(attachments['text_url'], '') @@ -254,7 +260,7 @@ function parseToot (data){ id: attachments['id'], type: attachments['type'], url: attachments['remote_url'] !=="" ? attachments['remote_url'] : attachments['url'] , - preview_url: attachments['preview_url'] + preview_url: loadImages ? attachments['preview_url'] : '' }) } /*item['content'] = item['content'].split(" ") diff --git a/qml/pages/Conversation.qml b/qml/pages/Conversation.qml index a9dd559..7e90368 100644 --- a/qml/pages/Conversation.qml +++ b/qml/pages/Conversation.qml @@ -12,6 +12,7 @@ Page { property alias avatar: header.image property int toot_id property ListModel mdl; + allowedOrientations: Orientation.All ListModel { id: mediaModel onCountChanged: { diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml index 84f03c6..c92d4d2 100644 --- a/qml/pages/MainPage.qml +++ b/qml/pages/MainPage.qml @@ -37,6 +37,7 @@ import "./components/" Page { id: mainPage property bool isFirstPage: true + property bool isTablet: true; //Screen.sizeCategory >= Screen.Large // The effective value will be restricted by ApplicationWindow.allowedOrientations allowedOrientations: Orientation.All @@ -63,8 +64,8 @@ Page { title: qsTr("Home") type: "timelines/home" mdl: Logic.modelTLhome - width: parent.width - height: parent.height + width: parent.itemWidth + height: parent.itemHeight onOpenDrawer: infoPanel.open = setDrawer } MyList{ @@ -72,8 +73,8 @@ Page { title: qsTr("Timeline") type: "timelines/public" mdl: Logic.modelTLpublic - width: parent.width - height: parent.height + width: parent.itemWidth + height: parent.itemHeight onOpenDrawer: infoPanel.open = setDrawer } MyList{ @@ -82,8 +83,8 @@ Page { type: "notifications" notifier: true mdl: Logic.modelTLnotifications - width: parent.width - height: parent.height + width: parent.itemWidth + height: parent.itemHeight onOpenDrawer: infoPanel.open = setDrawer } MyList{ @@ -102,8 +103,8 @@ Page { title: qsTr("Search") type: "" mdl: ListModel {} - width: parent.width - height: parent.height + width: parent.itemWidth + height: parent.itemHeight onOpenDrawer: infoPanel.open = setDrawer header: SearchField { @@ -130,7 +131,8 @@ Page { id: slideshow width: parent.width height: parent.height - itemWidth: parent.width + itemWidth: isTablet ? Math.round(parent.width) : parent.width + itemHeight: height clip: true onCurrentIndexChanged: { navigation.slideshowIndexChanged(currentIndex) @@ -148,6 +150,7 @@ Page { Component.onCompleted: { } } + IconButton { anchors { right: (mainPage.isPortrait ? parent.right : infoPanel.left) diff --git a/qml/pages/Settings.qml b/qml/pages/Settings.qml new file mode 100644 index 0000000..ac9b568 --- /dev/null +++ b/qml/pages/Settings.qml @@ -0,0 +1,160 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import "../lib/API.js" as Logic + +Page { + SilicaFlickable { + anchors.fill: parent + contentHeight: column.height + Theme.paddingLarge + contentWidth: parent.width + + VerticalScrollDecorator {} + Column { + id: column + spacing: Theme.paddingSmall + width: parent.width + PageHeader { + title: qsTr("Settings") + } + Column { + // No spacing in this column + width: parent.width + IconTextSwitch { + text: Logic.conf['login'] ? qsTr("Remove Account"): qsTr("Add Account") + description: Logic.conf['login'] ? qsTr("Deauthorize this app and remove your account") : qsTr("Authorize this app to use your Mastodon account in your behalf") + icon.source: Logic.conf['login'] ? "image://theme/icon-m-people" : "image://theme/icon-m-add" + onClicked: { + if (Logic.conf['login']) { + Logic.conf['login'] = false + Logic.conf['instance'] = null; + Logic.conf['api_user_token'] = null; + } + pageStack.push(Qt.resolvedUrl("LoginPage.qml")) + } + } + IconTextSwitch { + //enabled: false + checked: typeof Logic.conf['loadImages'] !== "undefined" && Logic.conf['loadImages'] + text: qsTr("Load images in toots") + description: qsTr("Disable this option if you want to preserve your data connection") + icon.source: "image://theme/icon-m-mobile-network" + onClicked: { + Logic.conf['loadImages'] = checked + } + } + IconTextSwitch { + text: qsTr("Translate") + description: qsTr("Use Transifex to help with app translation to your language") + icon.source: "image://theme/icon-m-presence" + onClicked: { + Qt.openUrlExternally("https://www.transifex.com/dysko/tooter/"); + } + } + } + SectionHeader { + text: qsTr("Credits") + } + + Column { + width: parent.width + anchors { + left: parent.left + right: parent.right + rightMargin: Theme.horizontalPageMargin + } + Repeater { + model: ListModel { + ListElement { + name: "Duško Angirević" + desc: qsTr("UI/UX design and development") + mastodon: "dysko@mastodon.social" + mail: "" + } + ListElement { + name: "Miodrag Nikolić" + desc: "visual identity" + mastodon: "" + mail: "micotakis@gmail.com" + } + ListElement { + name: "Quentin PAGÈS / Quenti ♏" + desc: "Occitan & French translation" + mastodon: "Quenti@framapiaf.org" + mail: "" + } + ListElement { + name: "André Koot" + desc: "Dutch translation" + mastodon: "meneer@mastodon.social" + mail: "https://twitter.com/meneer" + } + ListElement { + name: "Carlos Gonzalez / Caballlero" + desc: "Español translation" + mastodon: "" + mail: "carlosgonz@protonmail.com" + } + + ListElement { + name: "Mohamed-Touhami MAHDI" + desc: "Added README file" + mastodon: "dragnucs@touha.me" + mail: "touhami@touha.me" + } + } + + Item { + width: parent.width + height: Theme.itemSizeMedium + IconButton { + id: btn + anchors { + verticalCenter: parent.verticalCenter + right: parent.right + } + icon.source: "image://theme/" + (model.mastodon !== "" ? "icon-m-person" : "icon-m-mail") + "?" + (pressed + ? Theme.highlightColor + : Theme.primaryColor) + onClicked: { + if (model.mastodon !== ""){ + var m = Qt.createQmlObject('import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject'); + pageStack.push(Qt.resolvedUrl("Conversation.qml"), { + toot_id: 0, + title: model.name, + description: '@'+model.mastodon, + avatar: "", + mdl: m, + type: "reply" + }) + } else { + Qt.openUrlExternally("mailto:"+model.mail); + } + } + } + Column { + anchors { + verticalCenter: parent.verticalCenter + left: parent.left + leftMargin: Theme.horizontalPageMargin + right: btn.left + rightMargin: Theme.paddingMedium + } + + Label { + id: lblName + text: model.name + color: Theme.secondaryColor + font.pixelSize: Theme.fontSizeSmall + } + Label { + text: model.desc + color: Theme.secondaryHighlightColor + font.pixelSize: Theme.fontSizeExtraSmall + } + } + } + } + } + } + } +} diff --git a/qml/pages/components/MiniHeader.qml b/qml/pages/components/MiniHeader.qml index 6bc414e..34140a9 100644 --- a/qml/pages/components/MiniHeader.qml +++ b/qml/pages/components/MiniHeader.qml @@ -61,7 +61,7 @@ Item { anchors { right: parent.right baseline: lblName.baseline - rightMargin: Theme.paddingLarge + rightMargin: Theme.horizontalPageMargin } } } diff --git a/qml/pages/components/MyImage.qml b/qml/pages/components/MyImage.qml index 0345958..ccaac7a 100644 --- a/qml/pages/components/MyImage.qml +++ b/qml/pages/components/MyImage.qml @@ -6,6 +6,16 @@ Item { property string type : "" property string previewURL: "" property string mediaURL: "" + Rectangle { + opacity: 0.2 + anchors.fill: parent + color: Theme.highlightDimmerColor + + } + Image { + anchors.centerIn: parent + source: "image://theme/icon-m-image" + } Image { id: img anchors.fill: parent @@ -46,4 +56,5 @@ Item { } } } + } diff --git a/qml/pages/components/MyList.qml b/qml/pages/components/MyList.qml index ae57c38..d2f5967 100644 --- a/qml/pages/components/MyList.qml +++ b/qml/pages/components/MyList.qml @@ -58,14 +58,9 @@ SilicaListView { PullDownMenu { MenuItem { - text: Logic.conf['login'] ? qsTr("Logout"): qsTr("Login") + text: qsTr("Settings") onClicked: { - if (Logic.conf['login']) { - Logic.conf['login'] = false - Logic.conf['instance'] = null; - Logic.conf['api_user_token'] = null; - Logic.conf['dysko'] = null; - } + pageStack.push(Qt.resolvedUrl("../Settings.qml"), {}) } } diff --git a/qml/pages/components/VisualContainer.qml b/qml/pages/components/VisualContainer.qml index cbf1bb4..182c541 100644 --- a/qml/pages/components/VisualContainer.qml +++ b/qml/pages/components/VisualContainer.qml @@ -34,6 +34,13 @@ BackgroundItem { smooth: true source: account_avatar visible: true + onStatusChanged: { + if (avatar.status === Image.Error) + source = "image://theme/icon-m-person?" + (pressed + ? Theme.highlightColor + : Theme.primaryColor) + } + MouseArea { anchors.fill: parent onClicked: { @@ -101,7 +108,7 @@ BackgroundItem { topMargin: Theme.paddingSmall bottomMargin: Theme.paddingLarge } - height: content.length ? paintedHeight : 0 + height: content.length ? (contentWarningLabel.paintedHeight > paintedHeight ? contentWarningLabel.paintedHeight : paintedHeight) : 0 onLinkActivated: { var test = link.split("/") console.log(link) @@ -138,11 +145,22 @@ BackgroundItem { color: Theme.highlightDimmerColor visible: status_spoiler_text.length > 0 Label { + id: contentWarningLabel font.pixelSize: Theme.fontSizeExtraSmall horizontalAlignment: Text.AlignHCenter - - anchors.centerIn: parent + anchors { + topMargin: Theme.paddingSmall + left: parent.left + leftMargin: Theme.paddingMedium + centerIn: parent + right: parent.right + rightMargin: Theme.paddingMedium + bottomMargin: Theme.paddingSmall + } + width: parent.width + truncationMode: TruncationMode.Fade color: Theme.highlightColor + wrapMode: Text.WordWrap text: model.status_spoiler_text } MouseArea { diff --git a/rpm/harbour-tooter.changes.in b/rpm/harbour-tooter.changes.in index ea18678..2b86380 100644 --- a/rpm/harbour-tooter.changes.in +++ b/rpm/harbour-tooter.changes.in @@ -33,3 +33,9 @@ * Thu July 7 2017 Dusko Angirevic 0.1.9-0 - Image Upload added [#9] - Emoji pannel added +- ES lang update by Carlos Gonzales + +* Thu July 20 2017 Dusko Angirevic 0.2.0-0 +- Better tablet displaying +- "boosted" notification bugfix +- ES lang update by Caballlero diff --git a/translations/harbour-tooter-es.ts b/translations/harbour-tooter-es.ts index 27a6c25..1b1ae00 100644 --- a/translations/harbour-tooter-es.ts +++ b/translations/harbour-tooter-es.ts @@ -133,12 +133,8 @@ Cargar más - Logout - Cerrar sesión - - - Login - Iniciar sesión + Settings + @@ -192,6 +188,53 @@ Seguidores + + Settings + + Settings + + + + Remove Account + + + + Add Account + + + + Load images in toots + + + + Credits + + + + UI/UX design and development + + + + Translate + + + + Deauthorize this app and remove your account + + + + Authorize this app to use your Mastodon account in your behalf + + + + Disable this option if you want to preserve your data connection + + + + Use Transifex to help with app translation to your language + + + Toot diff --git a/translations/harbour-tooter-fr.ts b/translations/harbour-tooter-fr.ts index 6addb32..c6b620e 100644 --- a/translations/harbour-tooter-fr.ts +++ b/translations/harbour-tooter-fr.ts @@ -133,12 +133,8 @@ Charger plus - Logout - Déconnexion - - - Login - Connexion + Settings + @@ -192,6 +188,53 @@ Abonnés + + Settings + + Settings + + + + Remove Account + + + + Add Account + + + + Load images in toots + + + + Credits + + + + UI/UX design and development + + + + Translate + + + + Deauthorize this app and remove your account + + + + Authorize this app to use your Mastodon account in your behalf + + + + Disable this option if you want to preserve your data connection + + + + Use Transifex to help with app translation to your language + + + Toot diff --git a/translations/harbour-tooter-nl.ts b/translations/harbour-tooter-nl.ts index 6dba369..6b79ec1 100644 --- a/translations/harbour-tooter-nl.ts +++ b/translations/harbour-tooter-nl.ts @@ -133,11 +133,7 @@ - Logout - - - - Login + Settings @@ -192,6 +188,53 @@ Volgers + + Settings + + Settings + + + + Remove Account + + + + Add Account + + + + Load images in toots + + + + Credits + + + + UI/UX design and development + + + + Translate + + + + Deauthorize this app and remove your account + + + + Authorize this app to use your Mastodon account in your behalf + + + + Disable this option if you want to preserve your data connection + + + + Use Transifex to help with app translation to your language + + + Toot diff --git a/translations/harbour-tooter-oc.ts b/translations/harbour-tooter-oc.ts index 5b0783a..1368ee3 100644 --- a/translations/harbour-tooter-oc.ts +++ b/translations/harbour-tooter-oc.ts @@ -133,12 +133,8 @@ Cargar mai - Logout - Desconnexion - - - Login - Connexion + Settings + @@ -192,6 +188,53 @@ Seguidors + + Settings + + Settings + + + + Remove Account + + + + Add Account + + + + Load images in toots + + + + Credits + + + + UI/UX design and development + + + + Translate + + + + Deauthorize this app and remove your account + + + + Authorize this app to use your Mastodon account in your behalf + + + + Disable this option if you want to preserve your data connection + + + + Use Transifex to help with app translation to your language + + + Toot diff --git a/translations/harbour-tooter.ts b/translations/harbour-tooter.ts index 2d56f2a..e9e6322 100644 --- a/translations/harbour-tooter.ts +++ b/translations/harbour-tooter.ts @@ -39,46 +39,46 @@ Conversation Conversation - + Conversation Content warning! - + Content warning! public - + public unlisted - + unlisted followers only - + followers only direct - + direct Delete - + Delete Emojis - + Emojis Tap to insert - + Tap to insert ImageUploader The file %1 does not exists - The file %1 does not exists + @@ -133,12 +133,8 @@ Load more - Logout - Logout - - - Login - Login + Settings + Settings @@ -192,6 +188,53 @@ Followers + + Settings + + Settings + Settings + + + Remove Account + Remove Account + + + Add Account + Add Account + + + Authorize this app to use your Mastodon account in your behalf + Authorize this app to use your Mastodon account in your behalf + + + Load images in toots + Load images in toots + + + Deauthorize this app and remove your account + Deauthorize this app and remove your account + + + Credits + Credits + + + Translate + Translate + + + Use Transifex to help with app translation to your language + Use Transifex to help with app translation to your language + + + Disable this option if you want to preserve your data connection + + + + UI/UX design and development + + + Toot