From c8ad3f02cc12da45fd3c6b5c73f1306622551452 Mon Sep 17 00:00:00 2001 From: molan-git Date: Sun, 24 May 2020 19:54:46 +0200 Subject: [PATCH] sentBanner Adds a confirmation banner when sending a Toot --- harbour-tooter.pro | 233 ++++++++++--------- qml/pages/Conversation.qml | 22 +- qml/pages/MainPage.qml | 2 +- qml/pages/components/InfoBanner.qml | 62 +++++ qml/pages/components/InfoBanner.qml.autosave | 61 +++++ qml/pages/components/VisualContainer.qml | 1 + translations/harbour-tooter-de.ts | 8 +- translations/harbour-tooter-el.ts | 8 +- translations/harbour-tooter-es.ts | 8 +- translations/harbour-tooter-fi.ts | 8 +- translations/harbour-tooter-fr.ts | 8 +- translations/harbour-tooter-it.ts | 28 +-- translations/harbour-tooter-nl.ts | 8 +- translations/harbour-tooter-nl_BE.ts | 8 +- translations/harbour-tooter-oc.ts | 8 +- translations/harbour-tooter-pl.ts | 8 +- translations/harbour-tooter-ru.ts | 8 +- translations/harbour-tooter-sr.ts | 8 +- translations/harbour-tooter-sv.ts | 8 +- translations/harbour-tooter-zh_CN.ts | 8 +- translations/harbour-tooter.ts | 8 +- 21 files changed, 325 insertions(+), 196 deletions(-) create mode 100644 qml/pages/components/InfoBanner.qml create mode 100644 qml/pages/components/InfoBanner.qml.autosave diff --git a/harbour-tooter.pro b/harbour-tooter.pro index 6a1b13c..026fe41 100644 --- a/harbour-tooter.pro +++ b/harbour-tooter.pro @@ -1,116 +1,117 @@ -# NOTICE: -# -# Application name defined in TARGET has a corresponding QML filename. -# If name defined in TARGET is changed, the following needs to be done -# to match new name: -# - corresponding QML filename must be changed -# - desktop icon filename must be changed -# - desktop filename must be changed -# - icon definition filename in desktop file must be changed -# - translation filenames have to be changed - -# The name of your application -TARGET = harbour-tooter - -CONFIG += sailfishapp - -QT += network dbus sql -CONFIG += link_pkgconfig -PKGCONFIG += sailfishapp -PKGCONFIG += \ - nemonotifications-qt5 - -DEFINES += "APPVERSION=\\\"$${SPECVERSION}\\\"" -DEFINES += "APPNAME=\\\"$${TARGET}\\\"" - -!exists( src/dbusAdaptor.h ) { - system(qdbusxml2cpp config/ba.dysko.harbour.tooter.xml -i dbus.h -a src/dbusAdaptor) -} - -config.path = /usr/share/$${TARGET}/config/ -config.files = config/icon-lock-harbour-tooter.png - -notification_categories.path = /usr/share/lipstick/notificationcategories -notification_categories.files = config/x-harbour.tooter.activity.* - -dbus_services.path = /usr/share/dbus-1/services/ -dbus_services.files = config/ba.dysko.harbour.tooter.service - -interfaces.path = /usr/share/dbus-1/interfaces/ -interfaces.files = config/ba.dysko.harbour.tooter.xml - -SOURCES += src/harbour-tooter.cpp -SOURCES += src/imageuploader.cpp -SOURCES += src/filedownloader.cpp -SOURCES += src/notifications.cpp -SOURCES += src/dbusAdaptor.cpp -SOURCES += src/dbus.cpp - -HEADERS += src/imageuploader.h -HEADERS += src/filedownloader.h -HEADERS += src/notifications.h -HEADERS += src/dbusAdaptor.h -HEADERS += src/dbus.h - -DISTFILES += qml/harbour-tooter.qml \ - qml/pages/components/VisualContainer.qml \ - qml/pages/components/MiniStatus.qml \ - qml/pages/components/MiniHeader.qml \ - qml/pages/components/ItemUser.qml \ - qml/pages/components/MyList.qml \ - qml/pages/components/Navigation.qml \ - qml/pages/components/ProfileHeader.qml \ - qml/pages/components/MediaBlock.qml \ - qml/pages/components/MyImage.qml \ - qml/pages/components/ImageFullScreen.qml \ - qml/cover/CoverPage.qml \ - qml/pages/MainPage.qml \ - qml/pages/LoginPage.qml \ - qml/pages/Conversation.qml \ - qml/pages/components/Toot.qml \ - qml/pages/Browser.qml \ - qml/pages/Profile.qml \ - qml/pages/Settings.qml \ - qml/lib/API.js \ - qml/images/notification.svg \ - qml/images/verified.svg \ - qml/images/boosted.svg \ - qml/images/tooter.svg \ - qml/images/emojiselect.svg \ - qml/images/icon-m-profile.svg \ - qml/images/icon-l-profile.svg \ - qml/lib/Mastodon.js \ - qml/lib/Worker.js \ - config/icon-lock-harbour-tooter.png \ - config/x-harbour.tooter.activity.conf \ - rpm/harbour-tooter.changes \ - rpm/harbour-tooter.changes.run.in \ - rpm/harbour-tooter.spec \ - rpm/harbour-tooter.yaml \ - translations/*.ts \ - harbour-tooter.desktop - -SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 - -# to disable building translations every time, comment out the -# following CONFIG line -CONFIG += sailfishapp_i18n - -# German translation is enabled as an example. If you aren't -# planning to localize your app, remember to comment out the -# following TRANSLATIONS line. And also do not forget to -# modify the localized app name in the the .desktop file. -TRANSLATIONS += translations/harbour-tooter-de.ts -TRANSLATIONS += translations/harbour-tooter-el.ts -TRANSLATIONS += translations/harbour-tooter-es.ts -TRANSLATIONS += translations/harbour-tooter-fi.ts -TRANSLATIONS += translations/harbour-tooter-fr.ts -TRANSLATIONS += translations/harbour-tooter-nl.ts -TRANSLATIONS += translations/harbour-tooter-nl_BE.ts -TRANSLATIONS += translations/harbour-tooter-oc.ts -TRANSLATIONS += translations/harbour-tooter-pl.ts -TRANSLATIONS += translations/harbour-tooter-ru.ts -TRANSLATIONS += translations/harbour-tooter-sr.ts -TRANSLATIONS += translations/harbour-tooter-sv.ts -TRANSLATIONS += translations/harbour-tooter-zh_CN.ts -TRANSLATIONS += translations/harbour-tooter-it.ts +# NOTICE: +# +# Application name defined in TARGET has a corresponding QML filename. +# If name defined in TARGET is changed, the following needs to be done +# to match new name: +# - corresponding QML filename must be changed +# - desktop icon filename must be changed +# - desktop filename must be changed +# - icon definition filename in desktop file must be changed +# - translation filenames have to be changed + +# The name of your application +TARGET = harbour-tooter + +CONFIG += sailfishapp + +QT += network dbus sql +CONFIG += link_pkgconfig +PKGCONFIG += sailfishapp +PKGCONFIG += \ + nemonotifications-qt5 + +DEFINES += "APPVERSION=\\\"$${SPECVERSION}\\\"" +DEFINES += "APPNAME=\\\"$${TARGET}\\\"" + +!exists( src/dbusAdaptor.h ) { + system(qdbusxml2cpp config/ba.dysko.harbour.tooter.xml -i dbus.h -a src/dbusAdaptor) +} + +config.path = /usr/share/$${TARGET}/config/ +config.files = config/icon-lock-harbour-tooter.png + +notification_categories.path = /usr/share/lipstick/notificationcategories +notification_categories.files = config/x-harbour.tooter.activity.* + +dbus_services.path = /usr/share/dbus-1/services/ +dbus_services.files = config/ba.dysko.harbour.tooter.service + +interfaces.path = /usr/share/dbus-1/interfaces/ +interfaces.files = config/ba.dysko.harbour.tooter.xml + +SOURCES += src/harbour-tooter.cpp +SOURCES += src/imageuploader.cpp +SOURCES += src/filedownloader.cpp +SOURCES += src/notifications.cpp +SOURCES += src/dbusAdaptor.cpp +SOURCES += src/dbus.cpp + +HEADERS += src/imageuploader.h +HEADERS += src/filedownloader.h +HEADERS += src/notifications.h +HEADERS += src/dbusAdaptor.h +HEADERS += src/dbus.h + +DISTFILES += qml/harbour-tooter.qml \ + qml/pages/components/InfoBanner.qml \ + qml/pages/components/VisualContainer.qml \ + qml/pages/components/MiniStatus.qml \ + qml/pages/components/MiniHeader.qml \ + qml/pages/components/ItemUser.qml \ + qml/pages/components/MyList.qml \ + qml/pages/components/Navigation.qml \ + qml/pages/components/ProfileHeader.qml \ + qml/pages/components/MediaBlock.qml \ + qml/pages/components/MyImage.qml \ + qml/pages/components/ImageFullScreen.qml \ + qml/cover/CoverPage.qml \ + qml/pages/MainPage.qml \ + qml/pages/LoginPage.qml \ + qml/pages/Conversation.qml \ + qml/pages/components/Toot.qml \ + qml/pages/Browser.qml \ + qml/pages/Profile.qml \ + qml/pages/Settings.qml \ + qml/lib/API.js \ + qml/images/notification.svg \ + qml/images/verified.svg \ + qml/images/boosted.svg \ + qml/images/tooter.svg \ + qml/images/emojiselect.svg \ + qml/images/icon-m-profile.svg \ + qml/images/icon-l-profile.svg \ + qml/lib/Mastodon.js \ + qml/lib/Worker.js \ + config/icon-lock-harbour-tooter.png \ + config/x-harbour.tooter.activity.conf \ + rpm/harbour-tooter.changes \ + rpm/harbour-tooter.changes.run.in \ + rpm/harbour-tooter.spec \ + rpm/harbour-tooter.yaml \ + translations/*.ts \ + harbour-tooter.desktop + +SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 + +# to disable building translations every time, comment out the +# following CONFIG line +CONFIG += sailfishapp_i18n + +# German translation is enabled as an example. If you aren't +# planning to localize your app, remember to comment out the +# following TRANSLATIONS line. And also do not forget to +# modify the localized app name in the the .desktop file. +TRANSLATIONS += translations/harbour-tooter-de.ts +TRANSLATIONS += translations/harbour-tooter-el.ts +TRANSLATIONS += translations/harbour-tooter-es.ts +TRANSLATIONS += translations/harbour-tooter-fi.ts +TRANSLATIONS += translations/harbour-tooter-fr.ts +TRANSLATIONS += translations/harbour-tooter-nl.ts +TRANSLATIONS += translations/harbour-tooter-nl_BE.ts +TRANSLATIONS += translations/harbour-tooter-oc.ts +TRANSLATIONS += translations/harbour-tooter-pl.ts +TRANSLATIONS += translations/harbour-tooter-ru.ts +TRANSLATIONS += translations/harbour-tooter-sr.ts +TRANSLATIONS += translations/harbour-tooter-sv.ts +TRANSLATIONS += translations/harbour-tooter-zh_CN.ts +TRANSLATIONS += translations/harbour-tooter-it.ts diff --git a/qml/pages/Conversation.qml b/qml/pages/Conversation.qml index 3fed799..2aac1ad 100644 --- a/qml/pages/Conversation.qml +++ b/qml/pages/Conversation.qml @@ -4,9 +4,11 @@ import harbour.tooter.Uploader 1.0 import "../lib/API.js" as Logic import "./components/" + Page { id: conversationPage - property string type + property string headerTitle: "" + property string type property alias title: header.title property alias description: header.description property alias avatar: header.image @@ -40,6 +42,10 @@ Page { } } + InfoBanner { + id: sentBanner + } + ListModel { id: mediaModel onCountChanged: { @@ -62,7 +68,7 @@ Page { SilicaListView { id: conversationList header: PageHeader { - title: qsTr("Conversation") + title: headerTitle // pageTitle pushed from MainPage.qml or VisualContainer.qml } clip: true anchors { @@ -208,7 +214,6 @@ Page { || description.charAt( 0) == '#') ? description + ' ' : '' height: Math.max(270, Math.min(900, implicitHeight)) - //height: implicitHeight horizontalAlignment: Text.AlignLeft placeholderText: qsTr("What's on your mind?") font.pixelSize: Theme.fontSizeSmall @@ -304,7 +309,6 @@ Page { } } IconButton { - id: btnContentWarning anchors { top: toot.bottom @@ -426,11 +430,11 @@ Page { msg.params['spoiler_text'] = warningContent.text } - worker.sendMessage(msg) - warningContent.text = "" - toot.text = "" - mediaModel.clear() - pageStack.pop() + worker.sendMessage(msg) + warningContent.text = "" + toot.text = "" + mediaModel.clear() + sentBanner.showText(qsTr("Toot sent!")) } } diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml index e676870..463b305 100644 --- a/qml/pages/MainPage.qml +++ b/qml/pages/MainPage.qml @@ -246,7 +246,7 @@ Page { visible: !isPortrait ? true : !infoPanel.open icon.source: "image://theme/icon-l-add" onClicked: { - pageStack.push(Qt.resolvedUrl("Conversation.qml"), {title: qsTr("New Toot"), type: "new"}) + pageStack.push(Qt.resolvedUrl("Conversation.qml"), {headerTitle: qsTr("New Toot"), type: "new"}) } } diff --git a/qml/pages/components/InfoBanner.qml b/qml/pages/components/InfoBanner.qml new file mode 100644 index 0000000..3696c59 --- /dev/null +++ b/qml/pages/components/InfoBanner.qml @@ -0,0 +1,62 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 + + +DockedPanel { + id: root + z: 100; + width: parent.width //- Theme.paddingLarge*4 + //x: Theme.paddingLarge*2 + height: content.height + dock: Dock.Bottom + + Rectangle { + id: content + width: root.width + height: infoLabel.height + 4*Theme.paddingMedium + //anchors.topMargin: 20 + color: Theme.highlightBackgroundColor + opacity: 1.0 + + Label { + id: infoLabel + text : "" + color: Theme.primaryColor + font.family: Theme.fontFamilyHeading + font.pixelSize: Theme.fontSizeMedium + //font.weight: Font.Bold + width: parent.width + wrapMode: Text.WrapAnywhere + anchors { + left: parent.left + leftMargin: Theme.horizontalPageMargin + right: parent.right + rightMargin: Theme.horizontalPageMargin + verticalCenter: parent.verticalCenter + } + } + MouseArea { + anchors.fill: parent + onClicked: { + root.hide() + autoClose.stop() + } + } + } + + function showText(text) { + infoLabel.text = text + root.show() + autoClose.start() + } + + Timer { + id: autoClose + interval: 6000 + running: false + onTriggered: { + root.hide() + stop() + } + } +} diff --git a/qml/pages/components/InfoBanner.qml.autosave b/qml/pages/components/InfoBanner.qml.autosave new file mode 100644 index 0000000..7921d05 --- /dev/null +++ b/qml/pages/components/InfoBanner.qml.autosave @@ -0,0 +1,61 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 + + +DockedPanel { + id: root + z: 100; + width: parent.width + height: content.height + dock: Dock.Bottom + + Rectangle { + id: content + width: root.width + height: infoLabel.height + 4*Theme.paddingMedium + //anchors.topMargin: 20 + color: Theme.highlightBackgroundColor + opacity: 1.0 + + Label { + id: infoLabel + text : "" + color: Theme.primaryColor + font.family: Theme.fontFamilyHeading + font.pixelSize: Theme.fontSizeMedium + //font.weight: Font.Bold + width: parent.width + wrapMode: Text.WrapAnywhere + anchors { + left: parent.left + leftMargin: Theme.horizontalPageMargin + right: parent.right + rightMargin: Theme.ho rizontalPageMargin + verticalCenter: parent.verticalCenter + } + } + MouseArea { + anchors.fill: parent + onClicked: { + root.hide() + autoClose.stop() + } + } + } + + function showText(text) { + infoLabel.text = text + root.show() + autoClose.start() + } + + Timer { + id: autoClose + interval: 6000 + running: false + onTriggered: { + root.hide() + stop() + } + } +} diff --git a/qml/pages/components/VisualContainer.qml b/qml/pages/components/VisualContainer.qml index 072f816..d3a06e2 100644 --- a/qml/pages/components/VisualContainer.qml +++ b/qml/pages/components/VisualContainer.qml @@ -277,6 +277,7 @@ BackgroundItem { if (typeof mdl !== "undefined") m.append(mdl.get(index)) pageStack.push(Qt.resolvedUrl("../Conversation.qml"), { + headerTitle: "Conversation", toot_id: status_id, title: account_display_name, description: '@'+account_acct, diff --git a/translations/harbour-tooter-de.ts b/translations/harbour-tooter-de.ts index d2a2c44..210e07b 100644 --- a/translations/harbour-tooter-de.ts +++ b/translations/harbour-tooter-de.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Konversation - Delete Löschen @@ -62,6 +58,10 @@ What's on your mind? Was gibt's Neues? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-el.ts b/translations/harbour-tooter-el.ts index 6f47211..c926c14 100644 --- a/translations/harbour-tooter-el.ts +++ b/translations/harbour-tooter-el.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Συνομιλία - Delete Διαγραφή @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-es.ts b/translations/harbour-tooter-es.ts index fe77cd8..c52d603 100644 --- a/translations/harbour-tooter-es.ts +++ b/translations/harbour-tooter-es.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Conversación - Delete Borrar @@ -62,6 +58,10 @@ What's on your mind? ¿En qué estás pensando? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-fi.ts b/translations/harbour-tooter-fi.ts index f1444ea..a1ec939 100644 --- a/translations/harbour-tooter-fi.ts +++ b/translations/harbour-tooter-fi.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - - Delete @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-fr.ts b/translations/harbour-tooter-fr.ts index 341f2a4..b3835ab 100644 --- a/translations/harbour-tooter-fr.ts +++ b/translations/harbour-tooter-fr.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Conversation - Delete Supprimer @@ -62,6 +58,10 @@ What's on your mind? Qu'avez-vous en tête? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-it.ts b/translations/harbour-tooter-it.ts index 6689a88..e62798d 100644 --- a/translations/harbour-tooter-it.ts +++ b/translations/harbour-tooter-it.ts @@ -28,52 +28,52 @@ Conversation - - Conversation - Conversazione - - - + Write your warning here Contenuto avviso - + What's on your mind? A cosa stai pensando? - + Delete Elimina - + Public Pubblico - + Unlisted Non elencato - + Followers-only Solo ai seguaci - + Direct Diretto - + + Toot sent! + + + + Emojis Emojis - + Tap to insert Tap per inserire diff --git a/translations/harbour-tooter-nl.ts b/translations/harbour-tooter-nl.ts index 6ff67ed..768c5a8 100644 --- a/translations/harbour-tooter-nl.ts +++ b/translations/harbour-tooter-nl.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Gesprek - Delete Verwijderen @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-nl_BE.ts b/translations/harbour-tooter-nl_BE.ts index cf8d937..035f8b9 100644 --- a/translations/harbour-tooter-nl_BE.ts +++ b/translations/harbour-tooter-nl_BE.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Gesprek - Delete Verwijderen @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-oc.ts b/translations/harbour-tooter-oc.ts index 2bb86d9..cf6f401 100644 --- a/translations/harbour-tooter-oc.ts +++ b/translations/harbour-tooter-oc.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Discutida - Delete Escafar @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-pl.ts b/translations/harbour-tooter-pl.ts index 952b1b2..7e97caa 100644 --- a/translations/harbour-tooter-pl.ts +++ b/translations/harbour-tooter-pl.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Konwersacja - Delete Usuń @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-ru.ts b/translations/harbour-tooter-ru.ts index 277a582..724ec09 100644 --- a/translations/harbour-tooter-ru.ts +++ b/translations/harbour-tooter-ru.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Беседа - Delete Удалить @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-sr.ts b/translations/harbour-tooter-sr.ts index 3091e3e..6080c74 100644 --- a/translations/harbour-tooter-sr.ts +++ b/translations/harbour-tooter-sr.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Разговор - Delete Обриши @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-sv.ts b/translations/harbour-tooter-sv.ts index 43b1866..3e411bf 100644 --- a/translations/harbour-tooter-sv.ts +++ b/translations/harbour-tooter-sv.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Konversation - Delete Radera @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter-zh_CN.ts b/translations/harbour-tooter-zh_CN.ts index d25e9f9..fa8b314 100644 --- a/translations/harbour-tooter-zh_CN.ts +++ b/translations/harbour-tooter-zh_CN.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - 对话 - Delete 删除 @@ -62,6 +58,10 @@ What's on your mind? 有何想法? + + Toot sent! + + ImageFullScreen diff --git a/translations/harbour-tooter.ts b/translations/harbour-tooter.ts index b119e7e..bf8ce75 100644 --- a/translations/harbour-tooter.ts +++ b/translations/harbour-tooter.ts @@ -22,10 +22,6 @@ Conversation - - Conversation - Conversation - Delete Delete @@ -62,6 +58,10 @@ What's on your mind? + + Toot sent! + + ImageFullScreen