Warning, /plasma-mobile/mycroft-plasmoid-mobile/plasmoid/contents/ui/AudioFileDelegate.qml is written in an unsupported language. File is not indexed.
0001 /* Copyright 2016 Aditya Mehra <aix.m@outlook.com> 0002 0003 This library is free software; you can redistribute it and/or 0004 modify it under the terms of the GNU Lesser General Public 0005 License as published by the Free Software Foundation; either 0006 version 2.1 of the License, or (at your option) version 3, or any 0007 later version accepted by the membership of KDE e.V. (or its 0008 successor approved by the membership of KDE e.V.), which shall 0009 act as a proxy defined in Section 6 of version 3 of the license. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Lesser General Public License for more details. 0015 0016 You should have received a copy of the GNU Lesser General Public 0017 License along with this library. If not, see <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 import QtQuick 2.9 0021 import QtQml.Models 2.2 0022 import QtMultimedia 5.8 0023 import QtQuick.Controls 2.2 0024 import QtQuick.Layouts 1.3 0025 import org.kde.plasma.core 2.0 as PlasmaCore 0026 import org.kde.plasma.plasmoid 2.0 0027 import org.kde.plasma.components 2.0 as PlasmaComponents 0028 0029 Rectangle { 0030 id: audioFileDelegateItm 0031 implicitHeight: audioFileDelegateInner.height 0032 color: Qt.darker(theme.backgroundColor, 1.2) 0033 width: cbwidth 0034 0035 Item { 0036 id: audioFileDelegateInner 0037 implicitHeight: Math.max(audioInnerInfoColumn.height, playAudioBtn.height + units.gridUnit * 1) 0038 width: parent.width 0039 0040 PlasmaCore.IconItem { 0041 id: audioImgType 0042 source: "new-audio-alarm" 0043 anchors.left: parent.left 0044 width: units.gridUnit * 1 0045 height: units.gridUnit * 1 0046 anchors.verticalCenter: parent.verticalCenter 0047 } 0048 0049 Item { 0050 id: audioInnerInfoColumn 0051 implicitHeight: audioFileName.implicitHeight + sprTrinnerAudio.height + audioFileLoc.implicitHeight + units.gridUnit * 0.50 0052 anchors.left: audioImgType.right 0053 anchors.leftMargin: units.gridUnit * 0.30 0054 anchors.right: playAudioBtn.left 0055 anchors.rightMargin: units.gridUnit * 0.30 0056 0057 PlasmaComponents.Label { 0058 id: audioFileName 0059 color: theme.textColor 0060 anchors.left: parent.left 0061 anchors.right: parent.right 0062 anchors.top: parent.top 0063 anchors.topMargin: units.gridUnit * 0.25 0064 wrapMode: Text.Wrap 0065 height: units.gridUnit * 1 0066 0067 Component.onCompleted: { 0068 var filterName = InputQuery.toString(); 0069 audioFileName.text = filterName.match(/\/([^\/]+)\/?$/)[1] 0070 } 0071 } 0072 0073 Rectangle { 0074 id: sprTrinnerAudio 0075 anchors.left: parent.left 0076 anchors.right: parent.right 0077 anchors.rightMargin: units.gridUnit * 1 0078 anchors.top: audioFileName.bottom 0079 anchors.topMargin: units.gridUnit * 0.15 0080 color: theme.linkColor 0081 height: units.gridUnit * 0.1 0082 } 0083 0084 PlasmaComponents.Label { 0085 id: audioFileLoc 0086 color: theme.linkColor 0087 font.pixelSize: 12 0088 anchors.left: parent.left 0089 anchors.right: parent.right 0090 anchors.top: sprTrinnerAudio.bottom 0091 height: units.gridUnit * 1 0092 wrapMode: Text.Wrap 0093 Component.onCompleted: { 0094 audioFileLoc.text = i18n("<i>Location: %1</i>", InputQuery) 0095 } 0096 } 0097 } 0098 0099 PlasmaComponents.Button { 0100 id: playAudioBtn 0101 anchors.right: parent.right 0102 anchors.rightMargin: units.gridUnit * 0.75 0103 anchors.verticalCenter: parent.verticalCenter 0104 width: units.gridUnit * 3.5 0105 height: units.gridUnit * 3 0106 text: i18n("Listen") 0107 0108 onClicked: { 0109 var audFile = Qt.resolvedUrl(InputQuery) 0110 Qt.openUrlExternally(audFile) 0111 } 0112 } 0113 } 0114 }