Krolyxon
Commit 4b25a0d

Branches

Refs →

aurora.configquickshellauroraTile.qml

51 lines · 1.8 KB · QML

1import QtQuick
2
3// Round toggle with a caption under it (control panel). Off = dark circle, on = white circle with a black icon,
4// live = the accent circle (recording). Right click = menu (`picked` = its options are open: caption turns white).
5// Parts from glyph-rice (GPL-3.0), quick/Quick.qml (Tile).
6Column {
7 id: tile
8
9 property string icon
10 property string name
11 property bool on: false
12 property bool live: false
13 property bool picked: false
14 property real size: 68
15 signal clicked()
16 signal menu()
17
18 spacing: 8
19
20 Rectangle {
21 anchors.horizontalCenter: parent.horizontalCenter
22 width: tile.size
23 height: tile.size
24 radius: tile.size / 2
25 color: tile.live ? Theme.live : tile.on ? Theme.fill : m.containsMouse ? Theme.s3 : Theme.s2
26 Behavior on color { enabled: Theme.motion; ColorAnimation { duration: Theme.t } }
27 Icon {
28 anchors.centerIn: parent
29 text: tile.icon
30 font.pixelSize: Math.round(tile.size * 0.35)
31 color: tile.live ? Theme.liveFg : tile.on ? Theme.fillFg : Theme.fg
32 }
33 MouseArea {
34 id: m
35 anchors.fill: parent
36 hoverEnabled: true
37 cursorShape: Qt.PointingHandCursor
38 acceptedButtons: Qt.LeftButton | Qt.RightButton
39 onClicked: mouse => { if (mouse.button === Qt.RightButton) tile.menu(); else tile.clicked() }
40 }
41 }
42 Lb {
43 anchors.horizontalCenter: parent.horizontalCenter
44 width: Math.min(implicitWidth, Math.max(tile.width, tile.size + 16))
45 horizontalAlignment: Text.AlignHCenter
46 elide: Text.ElideRight
47 text: tile.name
48 px: 10
49 color: tile.picked || tile.on || tile.live ? Theme.fg : Theme.grey
50 }
51}