Add additiona; media element for audio.

This commit is contained in:
Mark Washeim 2022-11-30 16:50:50 +01:00
parent 7e2d91a106
commit e46e53da16
25 changed files with 319 additions and 36 deletions

View file

@ -68,6 +68,7 @@ DISTFILES += qml/harbour-tooterb.qml \
qml/pages/components/MyList.qml \
qml/pages/components/ProfileHeader.qml \
qml/pages/components/MediaBlock.qml \
qml/pages/components/MediaItem.qml \
qml/cover/CoverPage.qml \
qml/pages/MainPage.qml \
qml/pages/LoginPage.qml \

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.15.2, 2022-11-14T13:45:36. -->
<!-- Written by QtCreator 4.15.2, 2022-11-29T17:24:15. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -112,7 +112,7 @@
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">true</value>
<valuelist type="QVariantList" key="QtProjectManager.QMakeBuildStep.SelectedAbis"/>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.2">

View file

@ -67,6 +67,8 @@ ApplicationWindow {
}
})
Logic.init()
}
Component.onDestruction: {

View file

@ -8,6 +8,7 @@ import "./components/"
Page {
id: conversationPage
property bool debug: false
property ListModel suggestedModel
property ListModel mdl
property int tootMaxChar: 500
@ -25,9 +26,11 @@ Page {
property string status_link:
if (status_url === "") {
var test = status_uri.split("/")
if (debug) {
console.log(status_uri)
console.log(JSON.stringify(test))
console.log(JSON.stringify(test.length))
}
if (test.length === 8 && (test[7] === "activity")) {
var urialt = status_uri.replace("activity", "")
status_link = urialt
@ -37,7 +40,7 @@ Page {
allowedOrientations: Orientation.All
onSuggestedUserChanged: {
console.log(suggestedUser)
//console.log(suggestedUser)
suggestedModel = Qt.createQmlObject( 'import QtQuick 2.0; ListModel { }', Qt.application, 'InternalQmlObject' )
predictionList.visible = false
if (suggestedUser.length > 0) {
@ -67,7 +70,9 @@ Page {
WorkerScript {
id: worker
source: "../lib/Worker.js"
onMessage: { console.log(JSON.stringify(messageObject)) }
onMessage: {
//console.log(JSON.stringify(messageObject))
}
}
SilicaListView {
@ -98,7 +103,7 @@ Page {
if (mdl)
for (var i = 0; i < mdl.count; i++) {
if (mdl.get(i).status_id === status_id) {
console.log(mdl.get(i).status_id)
//console.log(mdl.get(i).status_id)
positionViewAtIndex(i, ListView.Center)
}
}
@ -266,7 +271,7 @@ Page {
textOperations.select(
textOperations.selectionStart ? textOperations.selectionStart - 1 : 0,
textOperations.selectionEnd)
console.log(toot.text.length)
//console.log(toot.text.length)
suggestedUser = ""
if (textOperations.selectedText.charAt(0) === "@") {
suggestedUser = textOperations.selectedText.trim().substring(1)
@ -292,7 +297,9 @@ Page {
right: parent.right
rightMargin: Theme.paddingSmall
}
onSelectionChanged: { console.log(selection) }
onSelectionChanged: {
//console.log(selection)
}
onClicked: pageStack.push(emojiDialog)
}
@ -321,7 +328,7 @@ Page {
}
onClicked: {
var idx = index
console.log(idx)
//console.log(idx)
//mediaModel.remove(idx)
remorse.execute(myDelegate, "", function () {
mediaModel.remove(idx)
@ -381,7 +388,9 @@ Page {
var imagePicker = pageStack.push("Sailfish.Pickers.ImagePickerPage", { "allowedOrientations": Orientation.All })
imagePicker.selectedContentChanged.connect(function () {
var imagePath = imagePicker.selectedContent
console.log(imagePath)
// console.log(imagePath)
imageUploader.setUploadUrl(Logic.conf.instance + "/api/v1/media")
imageUploader.setFile(imagePath)
imageUploader.setAuthorizationHeader(Logic.conf.api_user_token)
@ -393,19 +402,19 @@ Page {
ImageUploader {
id: imageUploader
onProgressChanged: {
console.log("progress " + progress)
// console.log("progress " + progress)
uploadProgress.width = parent.width * progress
}
onSuccess: {
uploadProgress.width = 0
console.log(replyData)
//console.log(replyData)
mediaModel.append(JSON.parse(replyData))
}
onFailure: {
uploadProgress.width = 0
btnAddImage.enabled = true
console.log(status)
console.log(statusText)
//console.log(status)
//console.log(statusText)
}
}
@ -447,7 +456,7 @@ Page {
var visibility = ["public", "unlisted", "private", "direct"]
var media_ids = []
for (var k = 0; k < mediaModel.count; k++) {
console.log(mediaModel.get(k).id)
// console.log(mediaModel.get(k).id)
media_ids.push(mediaModel.get(k).id)
}
var msg = {
@ -511,7 +520,7 @@ Page {
privacy.currentIndex = setIndex
}
console.log(JSON.stringify())
// console.log(JSON.stringify())
worker.sendMessage({
"action": 'statuses/' + mdl.get(0).status_id + '/context',

View file

@ -290,7 +290,7 @@ Page {
tlSearch.search = "#"+decodeURIComponent(test[4])
slideshow.positionViewAtIndex(5, ListView.SnapToItem)
navigation.navigateTo('search')
console.log("search tag")
if (debug) console.log("search tag")
} else if (test.length === 4 && test[3][0] === "@" ) {
tlSearch.search = decodeURIComponent("@"+test[3].substring(1)+"@"+test[2])

View file

@ -10,14 +10,17 @@ Item {
property double wRatio : 16/9
property double hRatio : 9/16
property bool debug: true
width: width
height: height
Component.onCompleted: {
console.log("MB: " + JSON.stringify(model.get(0)))
if (model && model.count && model.get(0).type === "video") {
//console.log("Mediablock")
//console.log(JSON.stringify(model.get(0).type))
while (model.count>1) {
model.remove(model.count-1)
}
//console.log(JSON.stringify(model.get(0)))
}
var count = 0
if (model && model.count)
@ -89,6 +92,8 @@ Item {
type = model.get(0).type
previewURL = model.get(0).preview_url
mediaURL = model.get(0).url
url = model.get(0).url
if(debug) console.log( model.get(0).url )
height = Theme.itemSizeLarge
return true
} else {
@ -108,6 +113,8 @@ Item {
type = model.get(1).type
previewURL = model.get(1).preview_url
mediaURL = model.get(1).url
url = model.get(0).url
if(debug) console.log( model.get(1).url )
height = Theme.itemSizeLarge
return true
} else {
@ -127,6 +134,7 @@ Item {
type = model.get(2).type
previewURL = model.get(2).preview_url
mediaURL = model.get(2).url
url = model.get(0).url
height = Theme.itemSizeLarge
return true
} else {
@ -146,6 +154,7 @@ Item {
type = model.get(3).type
previewURL = model.get(3).preview_url
mediaURL = model.get(3).url
url = model.get(0).url
height = Theme.itemSizeLarge
return true
} else {

View file

@ -9,6 +9,7 @@ FullscreenContentPage {
property string type: ""
property string previewURL: ""
property string mediaURL: ""
property string url: ""
allowedOrientations: Orientation.All
Component.onCompleted: function() {
@ -18,6 +19,13 @@ FullscreenContentPage {
if (type != 'gifv' && type != 'video') {
imagePreview.source = mediaURL
imageFlickable.visible = true
} else if( type == 'audio'){
video.source = url
videoFlickable.visible = true
playerIcon.visible = true
playerProgress.visible = true
video.play()
hideTimer.start()
} else {
video.source = mediaURL
video.fillMode = VideoOutput.PreserveAspectFit

View file

@ -7,6 +7,7 @@ import "."
SilicaListView {
id: myList
property bool debug:false
property string type
property string title
property string description
@ -25,7 +26,7 @@ SilicaListView {
signal notify (string what, int num)
onNotify: {
console.log(what + " - " + num)
if(debug) console.log(what + " - " + num)
}
signal openDrawer (bool setDrawer)
onOpenDrawer: {
@ -33,7 +34,7 @@ SilicaListView {
}
signal send (string notice)
onSend: {
console.log("LIST send signal emitted with notice: " + notice)
if (debug) console.log("LIST send signal emitted with notice: " + notice)
}
header: PageHeader {
@ -178,7 +179,7 @@ SilicaListView {
Timer {
triggeredOnStart: false; interval: 5*60*1000; running: true; repeat: true
onTriggered: {
console.log(title + ' ' +Date().toString())
if(debug) console.log(title + ' ' +Date().toString())
loadData("prepend")
}
}
@ -204,7 +205,7 @@ SilicaListView {
'conf' : Logic.conf
}
console.log(JSON.stringify(msg))
if (debug) console.log(JSON.stringify(msg))
if (type !== "")
worker.sendMessage(msg)
}

View file

@ -9,6 +9,7 @@ Item {
property string type : ""
property string previewURL: ""
property string mediaURL: ""
property string url: ""
Rectangle {
opacity: 0.4
@ -31,13 +32,36 @@ Item {
source: "image://theme/icon-m-file-video?"
anchors.centerIn: parent
}
Image {
Text {
anchors{
topMargin: 10
}
id: audioUrl
visible: type == 'audio'
//opacity: img.status === Image.Ready ? 0.0 : 1.0
text: "<a href='" + url + "'>" + 'Audio file' + '</a>'
font.pixelSize: Theme.fontSizeLarge
}
//Image {
MediaItem {
id: audioContent
visible: type == 'audio'
opacity: img.status === Image.Ready ? 0.0 : 1.0
Behavior on opacity { FadeAnimator {} }
source: "image://theme/icon-m-file-audio?"
mimeType: 'audio/mp3'
url: url
//source: "image://theme/icon-m-file-audio?"
anchors.centerIn: parent
/*MouseArea {
anchors.fill: parent
onClicked: {
pageStack.push(Qt.resolvedUrl("./MediaFullScreen.qml"), {
"url": url,
"type": type
})
}
}*/
}
Rectangle {
@ -109,5 +133,19 @@ Item {
onClicked: parent.visible = false
}
}
IconButton {
id: mediaDlBtn
icon.source: "image://theme/icon-m-cloud-download"
anchors {
right: parent.right
rightMargin: Theme.horizontalPageMargin
bottom: parent.bottom
bottomMargin: Theme.horizontalPageMargin
}
onClicked: {
var filename = url.split("/")
FileDownloader.downloadFile(url, filename[filename.length-1])
}
}
}
}

View file

@ -6,6 +6,8 @@ import "../../lib/API.js" as Logic
BackgroundItem {
id: delegate
property bool debug:false
signal send (string notice)
signal navigateTo(string link)
@ -195,9 +197,11 @@ BackgroundItem {
}
onLinkActivated: {
var test = link.split("/")
if (debug) {
console.log(link)
console.log(JSON.stringify(test))
console.log(JSON.stringify(test.length))
}
if (test.length === 5 && (test[3] === "tags" || test[3] === "tag") ) {
pageStack.pop(pageStack.find(function(page) {
var check = page.isFirstPage === true;
@ -447,11 +451,11 @@ BackgroundItem {
}
onPressAndHold: {
console.log(JSON.stringify(mdl.get(index)))
if (debug) console.log(JSON.stringify(mdl.get(index)))
mnu.open(delegate)
}
onDoubleClicked: {
console.log("double click")
if (debug) console.log("double click")
}
}

View file

@ -14,7 +14,7 @@ Name: harbour-tooterb
%{?qtc_builddir:%define _builddir %qtc_builddir}
Summary: Tooter β
Version: 1.0.9
Release: 1
Release: 2
Group: Qt/Qt
License: GPLv3
URL: https://github.com/poetaster/harbour-tooter#readme
@ -43,10 +43,11 @@ Categories:
- Network
PackagerName: Mark Washeim (poetaster)
Custom:
- Repo: https://github.com/poetaster/harbour-tooter
- Repo: https://github.com/molan-git/harbour-tooter
- PackagingRepo: https://github.com/poetaster/harbour-tooter
Icon: https://raw.githubusercontent.com/poetaster/harbour-tooter/master/icons/256x256/harbour-tooterb.png
Url:
Homepage: https://github.com/poetaster/harbour-tooter
- Bugtracker: https://github.com/poetaster/harbour-tooter/issues
%endif
%prep

View file

@ -161,6 +161,21 @@
<translation>Ladefehler</translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation>Error al cargar</translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation>Erreur au chargement</translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation>Errore durante caricamento</translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation>Laadfout</translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation>Ошибка при загрузке</translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation>Fel vid inläsning</translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation></translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>

View file

@ -161,6 +161,21 @@
<translation>Error loading</translation>
</message>
</context>
<context>
<name>MediaItem</name>
<message>
<source>Image</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Video</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>PDF document</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>MiniStatus</name>
<message>