Port smsapp to Qt6

See https://invent.kde.org/libraries/kirigami-addons/-/issues/9 for the Avatar change
This app is now Qt6-only, but the rest of kdeconnect still works with Qt5. This is only a runtime dependency
This commit is contained in:
Alexander Lohnau 2023-09-21 19:23:06 +02:00
parent 14192dd9c4
commit ebfabd7c14
7 changed files with 28 additions and 24 deletions

1
.gitignore vendored
View file

@ -34,3 +34,4 @@ CMakeLists.txt.user
/cmake-build*
.clang-format
app/resources.generated.qrc
smsapp/resources.generated.qrc

View file

@ -8,14 +8,14 @@ import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import org.kde.kirigami 2.13 as Kirigami
import QtMultimedia 5.12
import QtMultimedia
Kirigami.Page {
id: root
property string filePath
property string mimeType
contextualActions: [
actions: [
Kirigami.Action {
text: i18nd("kdeconnect-sms", "Open with default")
icon.name: "window-new"
@ -66,13 +66,15 @@ Kirigami.Page {
height: parent.height - mediaControls.height
anchors.topMargin: root.implicitHeaderHeight
VideoOutput {
anchors.fill: parent
MediaPlayer {
source: mediaPlayer
fillMode: VideoOutput.PreserveAspectFit
videoOutput: VideoOutput {
anchors.fill: parent
fillMode: VideoOutput.PreserveAspectFit
// By default QML's videoOutput element rotates the vdeeo files by 90 degrees in clockwise direction
orientation: -90
// By default QML's videoOutput element rotates the vdeeo files by 90 degrees in clockwise direction
orientation: -90
}
}
}

View file

@ -7,8 +7,9 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.12
import Qt5Compat.GraphicalEffects
import org.kde.kirigami 2.13 as Kirigami
import org.kde.kirigamiaddons.components as KirigamiComponents
Item {
id: root
@ -25,7 +26,7 @@ Item {
signal messageCopyRequested(string message)
Kirigami.Avatar {
KirigamiComponents.Avatar {
id: avatar
width: visible ? Kirigami.Units.gridUnit * 2 : 0
height: width

View file

@ -12,7 +12,7 @@ import QtQuick.Layouts 1.1
import org.kde.people 1.0
import org.kde.kirigami 2.4 as Kirigami
import org.kde.kdeconnect.sms 1.0
import QtGraphicalEffects 1.0
import Qt5Compat.GraphicalEffects
Kirigami.ScrollablePage
{

View file

@ -81,7 +81,7 @@ Kirigami.ScrollablePage
actions: [
Kirigami.Action {
iconName: "dialog-cancel"
icon.name: "dialog-cancel"
text: i18nd("kdeconnect-sms", "Cancel")
onTriggered: initialMessage = ""
}

View file

@ -7,9 +7,9 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.12
import Qt5Compat.GraphicalEffects
import org.kde.kirigami 2.13 as Kirigami
import QtMultimedia 5.12
import QtMultimedia
Item {
id: root
@ -91,16 +91,16 @@ Item {
radius: messageBox.radius
color: "lightgrey"
Audio {
MediaPlayer {
id: audioPlayer
source: root.sourcePath
onStopped: {
audioPlayButton.icon.name = "media-playback-start"
}
onPlaying: {
audioPlayButton.icon.name = "media-playback-stop"
onPlaybackStateChanged: {
if (playbackState === MediaPlayer.PlayingState) {
audioPlayButton.icon.name = "media-playback-stop"
} else {
audioPlayButton.icon.name = "media-playback-start"
}
}
}

View file

@ -8,8 +8,8 @@ import QtQuick 2.1
import QtQuick.Controls 2.2 as Controls
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.4 as Kirigami
import QtGraphicalEffects 1.0
import QtQuick.Dialogs 1.1
import Qt5Compat.GraphicalEffects
import QtQuick.Dialogs
import org.kde.kdeconnect.sms 1.0
ColumnLayout {
@ -31,8 +31,8 @@ ColumnLayout {
FileDialog {
id: fileDialog
folder: shortcuts.home
selectMultiple: true
currentFolder: shortcuts.home
fileMode: FileDialog.OpenFiles
onAccepted: {
root.selectedFileUrls = fileDialog.fileUrls