/usr/share/plasma/shells/org.kde.plasma.mediacenter/contents/configuration/panelconfiguration/SliderHandle.qml is in plasma-mediacenter 5.7.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | /*
* Copyright 2013 Marco Martin <mart@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 2.010-1301, USA.
*/
import QtQuick 2.0
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.extras 2.0 as PlasmaExtras
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.configuration 2.0
import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddons
PlasmaCore.SvgItem {
id: root
svg: containmentControlsSvg
state: parent.state
width: naturalSize.width
height: naturalSize.height
//value expressed by this slider
property int value
//name of the graphics to load
property string graphicElementName
//where the point "0" is
property int offset: 0
//handle type: behave in different ways based on the alignment
property int alignment: panel.alignment
property int minimumValue: (dialogRoot.vertical) ? -root.height/2 : -root.width/2
property int maximumValue: (dialogRoot.vertical) ? root.parent.height - root.height/2+1 : root.parent.width - root.width/2+1
function syncPos() {
if (dialogRoot.vertical) {
if (alignment == Qt.AlignRight) {
y = root.parent.height - (value + offset + root.height/2)
} else if (alignment == Qt.AlignLeft) {
y = value + offset - root.height/2
} else {
if (root.alignment & Qt.AlignRight) {
y = root.parent.height/2 - value/2 - offset + root.height/2
} else if (root.alignment & Qt.AlignLeft) {
y = root.parent.height/2 + value/2 + offset - root.height/2
} else {
y = root.parent.height/2 + value + offset -root.height/2
}
}
} else {
if (alignment == Qt.AlignRight) {
x = root.parent.width - (value + offset + root.width/2)
} else if (alignment == Qt.AlignLeft) {
x = value + offset - root.width/2
} else {
if (root.alignment & Qt.AlignRight) {
x = root.parent.width/2 - value/2 + offset - root.width/2
} else if (root.alignment & Qt.AlignLeft) {
x = root.parent.width/2 + value/2 + offset -root.width/2
} else {
x = root.parent.width/2 + value + offset -root.width/2
}
}
}
}
onValueChanged: syncPos()
onOffsetChanged: syncPos()
onAlignmentChanged: syncPos()
Connections {
target: root.parent
onWidthChanged: syncPos()
onHeightChanged: syncPos()
}
MouseArea {
drag {
target: parent
axis: (dialogRoot.vertical) ? Drag.YAxis : Drag.XAxis
minimumX: root.minimumValue
minimumY: root.minimumValue
maximumX: root.maximumValue
maximumY: root.maximumValue
}
anchors.fill: parent
onPositionChanged: {
if (dialogRoot.vertical) {
if (root.alignment == Qt.AlignRight) {
root.value = root.parent.height - (parent.y + offset + root.height/2)
} else if (alignment == Qt.AlignLeft) {
root.value = parent.y - offset + root.height/2
//Center
} else {
if (root.alignment & Qt.AlignRight) {
root.value = (root.parent.height/2 - parent.y + offset)*2 + root.height/2
} else if (root.alignment & Qt.AlignLeft) {
root.value = (parent.y - offset - root.parent.height/2)*2 + root.height/2
} else {
var value = parent.y - root.parent.height/2 - offset + root.height/2
//Snap
if (Math.abs(value) < 5) {
root.value = 0
} else {
root.value = value
}
}
}
} else {
if (root.alignment == Qt.AlignRight) {
root.value = root.parent.width - (parent.x + offset + root.width/2)
} else if (alignment == Qt.AlignLeft) {
root.value = parent.x - offset + root.width/2
//Center
} else {
if (root.alignment & Qt.AlignRight) {
root.value = (root.parent.width/2 - parent.x + offset)*2 + root.width/2
} else if (root.alignment & Qt.AlignLeft) {
root.value = (parent.x - offset - root.parent.width/2)*2 + root.width/2
} else {
var value = parent.x - root.parent.width/2 - offset + root.width/2
//Snap
if (Math.abs(value) < 5) {
root.value = 0
} else {
root.value = value
}
}
}
}
}
}
states: [
State {
name: "TopEdge"
PropertyChanges {
target: root
elementId: "north-" + graphicElementName
}
},
State {
name: "BottomEdge"
PropertyChanges {
target: root
elementId: "south-" + graphicElementName
}
},
State {
name: "LeftEdge"
PropertyChanges {
target: root
elementId: "west-" + graphicElementName
}
},
State {
name: "RightEdge"
PropertyChanges {
target: root
elementId: "east-" + graphicElementName
}
}
]
}
|