2021-02-27 19:04:47 +00:00
|
|
|
/**
|
|
|
|
* SPDX-FileCopyrightText: 2019 Nicolas Fella <nicolas.fella@gmx.de>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
|
|
*/
|
|
|
|
|
2022-12-13 20:45:50 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Controls 2.15 as QQC2
|
|
|
|
import QtQuick.Layouts 1.15
|
2024-10-05 19:46:54 +01:00
|
|
|
import QtQuick.Dialogs as Dialogs
|
|
|
|
import QtMultimedia
|
2022-12-13 20:45:50 +00:00
|
|
|
import org.kde.kirigami 2.20 as Kirigami
|
2019-10-27 17:08:51 +00:00
|
|
|
import org.kde.kdeconnect 1.0
|
2024-10-05 19:46:54 +01:00
|
|
|
import org.kde.kdeconnect.private.findthisdevice as FindThisDevice
|
2019-10-27 17:08:51 +00:00
|
|
|
|
2024-10-05 21:53:32 +01:00
|
|
|
Kirigami.ScrollablePage {
|
|
|
|
id: root
|
2019-10-27 17:08:51 +00:00
|
|
|
|
|
|
|
property string device
|
|
|
|
|
2024-10-05 21:53:32 +01:00
|
|
|
actions: Kirigami.Action {
|
2019-10-27 17:08:51 +00:00
|
|
|
icon.name: "dialog-ok"
|
|
|
|
text: i18n("Apply")
|
|
|
|
onTriggered: config.set("ringtone", path.text)
|
|
|
|
}
|
|
|
|
|
2024-10-05 21:53:32 +01:00
|
|
|
Kirigami.FormLayout {
|
2024-10-05 19:46:54 +01:00
|
|
|
Dialogs.FileDialog {
|
2024-10-05 21:53:32 +01:00
|
|
|
id: fileDialog
|
|
|
|
currentFile: path.text
|
|
|
|
onAccepted: {
|
|
|
|
path.text = currentFile.toString().replace("file://", "")
|
|
|
|
}
|
2019-10-27 17:08:51 +00:00
|
|
|
|
2024-10-05 21:53:32 +01:00
|
|
|
KdeConnectPluginConfig {
|
|
|
|
id: config
|
|
|
|
deviceId: device
|
|
|
|
pluginName: "kdeconnect_findthisdevice"
|
2019-10-27 17:08:51 +00:00
|
|
|
|
2024-10-05 21:53:32 +01:00
|
|
|
onConfigChanged: {
|
2024-10-05 19:46:54 +01:00
|
|
|
path.text = getString("ringtone", FindThisDevice.FindThisDeviceHelper.defaultSound())
|
2024-10-05 21:53:32 +01:00
|
|
|
}
|
2019-10-27 17:08:51 +00:00
|
|
|
}
|
|
|
|
|
2024-10-05 21:53:32 +01:00
|
|
|
RowLayout {
|
|
|
|
Kirigami.FormData.label: i18n("Sound to play:")
|
2019-10-27 17:08:51 +00:00
|
|
|
|
2024-10-05 21:53:32 +01:00
|
|
|
QQC2.TextField {
|
|
|
|
id: path
|
|
|
|
}
|
2019-10-27 17:08:51 +00:00
|
|
|
|
2024-10-05 21:53:32 +01:00
|
|
|
QQC2.Button {
|
2024-10-05 19:46:54 +01:00
|
|
|
text: i18nc("@action:button", "Choose file")
|
|
|
|
display: QQC2.Button.IconOnly
|
2024-10-05 19:56:04 +01:00
|
|
|
icon.name: "document-open-symbolic"
|
2024-10-05 21:53:32 +01:00
|
|
|
onClicked: fileDialog.open()
|
|
|
|
}
|
2024-10-05 19:56:04 +01:00
|
|
|
|
|
|
|
QQC2.Button {
|
|
|
|
text: i18nc("@action:button", "Play")
|
|
|
|
display: QQC2.Button.IconOnly
|
|
|
|
icon.name: playMusic.playing ? "media-playback-stop-symbolic" : "media-playback-start-symbolic"
|
|
|
|
enabled: FindThisDevice.FindThisDeviceHelper.pathExists(path.text)
|
|
|
|
onClicked: {
|
|
|
|
playMusic.source = path.text;
|
|
|
|
playMusic.playing ? playMusic.stop() : playMusic.play();
|
|
|
|
}
|
|
|
|
|
|
|
|
MediaPlayer {
|
|
|
|
id: playMusic
|
|
|
|
audioOutput: AudioOutput {}
|
|
|
|
}
|
|
|
|
}
|
2019-10-27 17:08:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|