smsapp/attachments: Remove Qt5Compat import
Replace deprecated OpacityMask with Kirigami.ShadowImage. Some additional cleanup with sizing/centering the thumbnail(s).
This commit is contained in:
parent
bd049e8886
commit
da05a88655
1 changed files with 10 additions and 27 deletions
|
@ -7,7 +7,6 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Qt5Compat.GraphicalEffects
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
import QtMultimedia
|
import QtMultimedia
|
||||||
|
|
||||||
|
@ -21,8 +20,8 @@ Item {
|
||||||
readonly property int elementWidth: 100
|
readonly property int elementWidth: 100
|
||||||
readonly property int elementHeight: 100
|
readonly property int elementHeight: 100
|
||||||
|
|
||||||
width: thumbnailElement.visible ? thumbnailElement.width : elementWidth
|
width: thumbnailElement.width
|
||||||
height: thumbnailElement.visible ? thumbnailElement.height : elementHeight
|
height: thumbnailElement.height
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: attachmentViewer
|
id: attachmentViewer
|
||||||
|
@ -34,29 +33,15 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Image {
|
Kirigami.ShadowedImage {
|
||||||
id: thumbnailElement
|
id: thumbnailElement
|
||||||
visible: mimeType.match("image") || mimeType.match("video")
|
visible: mimeType.match("image") || mimeType.match("video")
|
||||||
source: visible ? "image://thumbnailsProvider/" + root.uniqueIdentifier : ""
|
source: visible ? "image://thumbnailsProvider/" + root.uniqueIdentifier : ""
|
||||||
|
|
||||||
property bool rounded: true
|
radius: 6
|
||||||
property bool adapt: true
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
|
|
||||||
layer.enabled: rounded
|
width: visible ? sourceSize.width : elementWidth
|
||||||
layer.effect: OpacityMask {
|
height: visible ? sourceSize.height : elementHeight
|
||||||
maskSource: Item {
|
|
||||||
width: thumbnailElement.width
|
|
||||||
height: thumbnailElement.height
|
|
||||||
Rectangle {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: thumbnailElement.adapt ? thumbnailElement.width : Math.min(thumbnailElement.width, thumbnailElement.height)
|
|
||||||
height: thumbnailElement.adapt ? thumbnailElement.height : width
|
|
||||||
radius: messageBox.radius
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -72,8 +57,7 @@ Item {
|
||||||
Button {
|
Button {
|
||||||
icon.name: "media-playback-start"
|
icon.name: "media-playback-start"
|
||||||
visible: root.mimeType.match("video")
|
visible: root.mimeType.match("video")
|
||||||
anchors.horizontalCenter: thumbnailElement.horizontalCenter
|
anchors.centerIn: parent
|
||||||
anchors.verticalCenter: thumbnailElement.verticalCenter
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.sourcePath == "") {
|
if (root.sourcePath == "") {
|
||||||
conversationModel.requestAttachmentPath(root.partID, root.uniqueIdentifier)
|
conversationModel.requestAttachmentPath(root.partID, root.uniqueIdentifier)
|
||||||
|
@ -105,8 +89,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.centerIn: parent
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
spacing: Kirigami.Units.largeSpacing
|
spacing: Kirigami.Units.largeSpacing
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
|
@ -116,7 +99,7 @@ Item {
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (root.sourcePath != "") {
|
if (root.sourcePath != "") {
|
||||||
if (icon.name == "media-playback-start") {
|
if (icon.name === "media-playback-start") {
|
||||||
audioPlayer.play()
|
audioPlayer.play()
|
||||||
} else {
|
} else {
|
||||||
audioPlayer.stop()
|
audioPlayer.stop()
|
||||||
|
@ -136,7 +119,7 @@ Item {
|
||||||
Connections {
|
Connections {
|
||||||
target: conversationModel
|
target: conversationModel
|
||||||
function onFilePathReceived(filePath, fileName) {
|
function onFilePathReceived(filePath, fileName) {
|
||||||
if (root.uniqueIdentifier == fileName && root.sourcePath == "") {
|
if (root.uniqueIdentifier === fileName && root.sourcePath == "") {
|
||||||
root.sourcePath = "file://" + filePath
|
root.sourcePath = "file://" + filePath
|
||||||
|
|
||||||
if (root.mimeType.match("audio")) {
|
if (root.mimeType.match("audio")) {
|
||||||
|
|
Loading…
Reference in a new issue