Merge pull request #225 from jgibbon/feature/general-click

extend #224 to LocationPreview and VideoPreview
This commit is contained in:
Sebastian Wolf 2020-12-04 21:19:45 +01:00 committed by GitHub
commit c65ff27ebe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 29 deletions

View file

@ -38,7 +38,11 @@ Item {
Component.onCompleted: { Component.onCompleted: {
updatePicture(); updatePicture();
} }
function clicked(){
if(!processLauncher.launchProgram('harbour-pure-maps', ["geo:"+locationData.latitude+","+locationData.longitude])) {
imageNotification.show(qsTr("Install Pure Maps to inspect this location."));
}
}
function updatePicture() { function updatePicture() {
imagePreviewItem.pictureFileInformation = null; imagePreviewItem.pictureFileInformation = null;
if (locationData) { if (locationData) {
@ -95,20 +99,6 @@ Item {
source: markerImage source: markerImage
} }
} }
MouseArea {
anchors.fill: parent
onClicked: {
if(!processLauncher.launchProgram('harbour-pure-maps', ["geo:"+locationData.latitude+","+locationData.longitude])) {
imageNotification.show(qsTr("Install Pure Maps to inspect this location."));
}
}
Rectangle {
anchors.fill: parent
color: Theme.rgba(Theme.highlightBackgroundColor, Theme.highlightBackgroundOpacity)
opacity: parent.pressed ? 1.0 : 0.0
}
}
} }
BackgroundImage { BackgroundImage {

View file

@ -38,6 +38,7 @@ Item {
property bool onScreen: messageListItem ? messageListItem.page.status === PageStatus.Active : true; property bool onScreen: messageListItem ? messageListItem.page.status === PageStatus.Active : true;
property string videoType : "video"; property string videoType : "video";
property bool playRequested: false; property bool playRequested: false;
signal clicked();
width: parent.width width: parent.width
height: videoMessageComponent.isVideoNote ? width : Functions.getVideoHeight(width, videoData) height: videoMessageComponent.isVideoNote ? width : Functions.getVideoHeight(width, videoData)
@ -287,6 +288,21 @@ Item {
} }
} }
Connections {
target: videoMessageComponent
onClicked: {
if (messageVideo.playbackState === MediaPlayer.PlayingState) {
enableScreensaver();
messageVideo.pause();
timeLeftItem.visible = true;
} else {
disableScreensaver();
messageVideo.play();
timeLeftTimer.start();
}
}
}
Video { Video {
id: messageVideo id: messageVideo
@ -344,20 +360,6 @@ Item {
width: parent.width width: parent.width
height: parent.height height: parent.height
source: videoUrl source: videoUrl
MouseArea {
anchors.fill: parent
onClicked: {
if (messageVideo.playbackState === MediaPlayer.PlayingState) {
enableScreensaver();
messageVideo.pause();
timeLeftItem.visible = true;
} else {
disableScreensaver();
messageVideo.play();
timeLeftTimer.start();
}
}
}
onStopped: { onStopped: {
enableScreensaver(); enableScreensaver();
messageVideo.visible = false; messageVideo.visible = false;