Warning, /plasma/latte-dock/plasmoid/package/contents/ui/task/AudioStream.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2017 Kai Uwe Broulik <kde@privat.broulik.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.0 0008 0009 import org.kde.plasma.core 2.0 as PlasmaCore 0010 0011 import org.kde.latte.core 0.2 as LatteCore 0012 import org.kde.latte.components 1.0 as LatteComponents 0013 0014 Item { 0015 id: background 0016 0017 Item { 0018 id: subRectangle 0019 width: parent.width/ 2 0020 height: width 0021 0022 states: [ 0023 State { 0024 name: "default" 0025 when: (root.location !== PlasmaCore.Types.RightEdge) 0026 0027 AnchorChanges { 0028 target: subRectangle 0029 anchors{ top:parent.top; bottom:undefined; left:parent.left; right:undefined;} 0030 } 0031 }, 0032 State { 0033 name: "right" 0034 when: (root.location === PlasmaCore.Types.RightEdge) 0035 0036 AnchorChanges { 0037 target: subRectangle 0038 anchors{ top:parent.top; bottom:undefined; left:undefined; right:parent.right;} 0039 } 0040 } 0041 ] 0042 0043 LatteComponents.BadgeText { 0044 anchors.centerIn: parent 0045 width: 0.8 * parent.width 0046 height: width 0047 minimumWidth: width 0048 maximumWidth: width 0049 0050 fullCircle: true 0051 showNumber: false 0052 showText: true 0053 0054 color: theme.backgroundColor 0055 borderColor: root.lightTextColor 0056 proportion: 0 0057 radiusPerCentage: 100 0058 0059 style3d: taskItem.abilities.myView.badgesIn3DStyle 0060 0061 LatteCore.IconItem{ 0062 id: audioStreamIcon 0063 anchors.centerIn: parent 0064 width: 0.9*parent.width 0065 height: width 0066 colorGroup: PlasmaCore.Theme.ButtonColorGroup 0067 usesPlasmaTheme: true 0068 0069 //opacity: taskItem.playingAudio && !taskItem.muted ? 1 : 0.85 0070 source: { 0071 if (taskItem.volume <= 0 || taskItem.muted) { 0072 return "audio-volume-muted"; 0073 } else if (taskItem.volume <= 25) { 0074 return "audio-volume-low"; 0075 } else if (taskItem.volume <= 75) { 0076 return "audio-volume-medium"; 0077 } else { 0078 return "audio-volume-high" ; 0079 } 0080 } 0081 0082 MouseArea{ 0083 id: audioBadgeMouseArea 0084 anchors.fill: parent 0085 enabled: root.audioBadgeActionsEnabled 0086 0087 property bool wheelIsBlocked: false; 0088 0089 onClicked: { 0090 taskItem.toggleMuted(); 0091 } 0092 0093 onWheel: { 0094 if (wheelIsBlocked) { 0095 return; 0096 } 0097 0098 wheelIsBlocked = true; 0099 scrollDelayer.start(); 0100 0101 var angle = wheel.angleDelta.y / 8; 0102 0103 if (angle > 2) { 0104 taskItem.increaseVolume(); 0105 } else if (angle < -2) { 0106 taskItem.decreaseVolume(); 0107 } 0108 } 0109 0110 //! A timer is needed in order to handle also touchpads that probably 0111 //! send too many signals very fast. This way the signals per sec are limited. 0112 //! The user needs to have a steady normal scroll in order to not 0113 //! notice a annoying delay 0114 Timer{ 0115 id: scrollDelayer 0116 0117 interval: 80 0118 0119 onTriggered: audioBadgeMouseArea.wheelIsBlocked = false; 0120 } 0121 } 0122 } 0123 } 0124 } 0125 }