Try to fix video page (without refactoring ;))

This commit is contained in:
Sebastian Wolf 2021-02-03 23:12:24 +01:00
parent 31ee65fc98
commit 40fea18a46
No known key found for this signature in database
GPG key ID: CEA9522B5F38A90A
16 changed files with 65 additions and 58 deletions

View file

@ -218,7 +218,7 @@ MessageContentBase {
highlighted: videoMessageComponent.highlighted || down highlighted: videoMessageComponent.highlighted || down
visible: ( placeholderImage.status === Image.Ready && !videoMessageComponent.fullscreen ) ? true : false visible: ( placeholderImage.status === Image.Ready && !videoMessageComponent.fullscreen ) ? true : false
onClicked: { onClicked: {
pageStack.push(Qt.resolvedUrl("../../pages/VideoPage.qml"), {"videoData": videoData}); pageStack.push(Qt.resolvedUrl("../../pages/VideoPage.qml"), {"videoData": videoData, "sourceMessage": rawMessage});
} }
} }
} }
@ -464,7 +464,7 @@ MessageContentBase {
} }
visible: ( videoComponentLoader.active && messageVideo.playbackState === MediaPlayer.PausedState ) ? true : false visible: ( videoComponentLoader.active && messageVideo.playbackState === MediaPlayer.PausedState ) ? true : false
onClicked: { onClicked: {
pageStack.push(Qt.resolvedUrl("../../pages/VideoPage.qml"), {"videoData": videoData}); pageStack.push(Qt.resolvedUrl("../../pages/VideoPage.qml"), {"videoData": videoData, "sourceMessage": rawMessage});
} }
} }
} }

View file

@ -20,13 +20,18 @@ import QtQuick 2.6
import Sailfish.Silica 1.0 import Sailfish.Silica 1.0
import QtMultimedia 5.6 import QtMultimedia 5.6
import "../components" import "../components"
import "../components/messageContent"
import "../js/functions.js" as Functions import "../js/functions.js" as Functions
import "../js/debug.js" as Debug
Page { Page {
id: videoPage id: videoPage
allowedOrientations: Orientation.All allowedOrientations: Orientation.All
property var videoData; property var videoData;
property alias videoType: myVideoComponent.videoType
property alias isVideoNote: myVideoComponent.isVideoNote
property var sourceMessage;
property int videoWidth : videoData.width property int videoWidth : videoData.width
property int videoHeight : videoData.height property int videoHeight : videoData.height
@ -42,8 +47,8 @@ Page {
function updateVideoData() { function updateVideoData() {
if (typeof videoData === "object") { if (typeof videoData === "object") {
if (videoData.video.local.is_downloading_completed) { if (videoData[videoType].local.is_downloading_completed) {
videoPage.videoUrl = videoData.video.local.path; videoPage.videoUrl = videoData[videoType].local.path;
} }
} }
} }
@ -55,7 +60,7 @@ Page {
id: videoPagePullDownMenu id: videoPagePullDownMenu
visible: (videoPage.videoUrl !== "") visible: (videoPage.videoUrl !== "")
MenuItem { MenuItem {
text: qsTr("Download Video") text: qsTr("Copy video to gallery")
onClicked: { onClicked: {
tdLibWrapper.copyFileToDownloads(videoPage.videoUrl); tdLibWrapper.copyFileToDownloads(videoPage.videoUrl);
} }
@ -65,9 +70,8 @@ Page {
Connections { Connections {
target: tdLibWrapper target: tdLibWrapper
onFileUpdated: { onFileUpdated: {
if (fileId === videoPage.video.id) { if (fileId === videoPage.videoData[videoType].id) {
if (fileInformation.local.is_downloading_completed) { if (fileInformation.local.is_downloading_completed) {
videoPage.video = fileInformation;
videoPage.videoUrl = fileInformation.local.path; videoPage.videoUrl = fileInformation.local.path;
videoPagePullDownMenu.visible = true; videoPagePullDownMenu.visible = true;
} }
@ -87,10 +91,13 @@ Page {
height: videoPage.videoHeight * videoPage.sizingFactor height: videoPage.videoHeight * videoPage.sizingFactor
anchors.centerIn: parent anchors.centerIn: parent
VideoPreview { MessageVideo {
id: myVideoComponent
videoData: videoPage.videoData videoData: videoPage.videoData
fullscreen: true fullscreen: true
onScreen: videoPage.status === PageStatus.Active onScreen: videoPage.status === PageStatus.Active
rawMessage: sourceMessage
anchors.fill: parent
} }
} }

View file

@ -12,7 +12,7 @@ Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.7 Version: 0.7
Release: 2 Release: 3
Group: Qt/Qt Group: Qt/Qt
License: LICENSE License: LICENSE
URL: http://werkwolf.eu/ URL: http://werkwolf.eu/

View file

@ -1,7 +1,7 @@
Name: harbour-fernschreiber Name: harbour-fernschreiber
Summary: Fernschreiber is a Telegram client for Sailfish OS Summary: Fernschreiber is a Telegram client for Sailfish OS
Version: 0.7 Version: 0.7
Release: 2 Release: 3
# The contents of the Group field should be one of the groups listed here: # The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS # https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
Group: Qt/Qt Group: Qt/Qt

View file

@ -1664,10 +1664,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Video herunterladen</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Download von %1 erfolgreich.</translation> <translation>Download von %1 erfolgreich.</translation>
@ -1676,6 +1672,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Download fehlgeschlagen.</translation> <translation>Download fehlgeschlagen.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation>Video in die Galerie kopieren</translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1664,10 +1664,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Download Video</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Download of %1 successful.</translation> <translation>Download of %1 successful.</translation>
@ -1676,6 +1672,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Download failed.</translation> <translation>Download failed.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation>Copy video to gallery</translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1664,10 +1664,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Bajar Vídeo</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Bajada de %1 exitosa.</translation> <translation>Bajada de %1 exitosa.</translation>
@ -1676,6 +1672,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Error al bajar</translation> <translation>Error al bajar</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1665,10 +1665,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Lataa video</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Videon %1 lataus onnistui.</translation> <translation>Videon %1 lataus onnistui.</translation>
@ -1677,6 +1673,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Lataus epäonnistui.</translation> <translation>Lataus epäonnistui.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1637,10 +1637,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Videó letöltése</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>A %1 letöltése sikerült.</translation> <translation>A %1 letöltése sikerült.</translation>
@ -1649,6 +1645,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>A letöltés nem sikerült.</translation> <translation>A letöltés nem sikerült.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1664,10 +1664,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Scarica video</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Download di %1 completato.</translation> <translation>Download di %1 completato.</translation>
@ -1676,6 +1672,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Download non riuscito.</translation> <translation>Download non riuscito.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1691,10 +1691,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Pobierz film</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Pobieranie %1 zakończone sukcesem</translation> <translation>Pobieranie %1 zakończone sukcesem</translation>
@ -1703,6 +1699,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Nieudane pobieranie</translation> <translation>Nieudane pobieranie</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1691,10 +1691,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Скачать видео</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Успешно скачано %1.</translation> <translation>Успешно скачано %1.</translation>
@ -1703,6 +1699,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Ошибка скачивания.</translation> <translation>Ошибка скачивания.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1691,10 +1691,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Sťahovať video</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Sťahovanie %1 bolo úspešné.</translation> <translation>Sťahovanie %1 bolo úspešné.</translation>
@ -1703,6 +1699,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Sťahovanie zlyhalo.</translation> <translation>Sťahovanie zlyhalo.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1664,10 +1664,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Ladda ner video</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Nerladdning av %1 slutförd.</translation> <translation>Nerladdning av %1 slutförd.</translation>
@ -1676,6 +1672,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Nerladdning misslyckades.</translation> <translation>Nerladdning misslyckades.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1637,10 +1637,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation></translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation> %1 </translation> <translation> %1 </translation>
@ -1649,6 +1645,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>

View file

@ -1664,10 +1664,6 @@
</context> </context>
<context> <context>
<name>VideoPage</name> <name>VideoPage</name>
<message>
<source>Download Video</source>
<translation>Download Video</translation>
</message>
<message> <message>
<source>Download of %1 successful.</source> <source>Download of %1 successful.</source>
<translation>Download of %1 successful.</translation> <translation>Download of %1 successful.</translation>
@ -1676,6 +1672,10 @@
<source>Download failed.</source> <source>Download failed.</source>
<translation>Download failed.</translation> <translation>Download failed.</translation>
</message> </message>
<message>
<source>Copy video to gallery</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>VoiceNoteOverlay</name> <name>VoiceNoteOverlay</name>