Lots of uncommitted changes
This commit is contained in:
parent
daace49bfc
commit
497ca48ada
27 changed files with 909 additions and 134 deletions
|
|
@ -0,0 +1,44 @@
|
|||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import "../.."
|
||||
|
||||
Rectangle {
|
||||
property var checkState: Qt.Unchecked;
|
||||
implicitHeight: 18
|
||||
implicitWidth: 18
|
||||
radius: 3
|
||||
color: ShellGlobals.colors.widget
|
||||
|
||||
Shape {
|
||||
visible: checkState == Qt.Checked
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
layer.samples: 10
|
||||
|
||||
ShapePath {
|
||||
strokeWidth: 2
|
||||
capStyle: ShapePath.RoundCap
|
||||
joinStyle: ShapePath.RoundJoin
|
||||
fillColor: "transparent"
|
||||
|
||||
startX: start.x
|
||||
startY: start.y
|
||||
|
||||
PathLine {
|
||||
id: start
|
||||
x: width * 0.8
|
||||
y: height * 0.2
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: width * 0.35
|
||||
y: height * 0.8
|
||||
}
|
||||
|
||||
PathLine {
|
||||
x: width * 0.2
|
||||
y: height * 0.6
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
import QtQuick
|
||||
import QtQuick.Shapes
|
||||
import Quickshell
|
||||
|
||||
Item {
|
||||
property bool expanded: false;
|
||||
|
||||
readonly property bool open: progress != 0;
|
||||
readonly property bool animating: internalProgress != -1 && internalProgress != 101;
|
||||
|
||||
implicitHeight: 16
|
||||
implicitWidth: 16
|
||||
property var xStart: Math.round(width * 0.3)
|
||||
property var yStart: Math.round(height * 0.1)
|
||||
property var xEnd: Math.round(width * 0.7)
|
||||
property var yEnd: Math.round(height * 0.9)
|
||||
|
||||
property real internalProgress: expanded ? 101 : -1;
|
||||
Behavior on internalProgress { SmoothedAnimation { velocity: 300 } }
|
||||
|
||||
EasingCurve {
|
||||
id: curve
|
||||
curve.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
readonly property real progress: curve.valueAt(Math.min(100, Math.max(internalProgress, 0)) * 0.01)
|
||||
|
||||
rotation: progress * 90;
|
||||
|
||||
Shape {
|
||||
anchors.fill: parent
|
||||
|
||||
layer.enabled: true
|
||||
layer.samples: 3
|
||||
|
||||
ShapePath {
|
||||
strokeWidth: 2
|
||||
capStyle: ShapePath.RoundCap
|
||||
joinStyle: ShapePath.MiterJoin
|
||||
fillColor: "transparent"
|
||||
|
||||
startX: xStart
|
||||
startY: yStart
|
||||
|
||||
PathLine {
|
||||
x: xEnd
|
||||
y: height / 2
|
||||
}
|
||||
|
||||
PathLine {
|
||||
y: yEnd
|
||||
x: xStart
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
110
modules/user/modules/quickshell/shell/bar/systray/MenuItem.qml
Normal file
110
modules/user/modules/quickshell/shell/bar/systray/MenuItem.qml
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.DBusMenu
|
||||
import "../.."
|
||||
|
||||
MouseArea {
|
||||
id: root
|
||||
required property var entry;
|
||||
property alias expanded: childrenRevealer.expanded;
|
||||
property bool animating: childrenRevealer.animating || childrenList.animating;
|
||||
// appears it won't actually create the handler when only used from MenuItemList.
|
||||
onExpandedChanged: {}
|
||||
onAnimatingChanged: {}
|
||||
|
||||
signal close();
|
||||
|
||||
implicitWidth: row.implicitWidth + 4
|
||||
implicitHeight: row.implicitHeight + 4
|
||||
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
if (entry.hasChildren) childrenRevealer.expanded = !childrenRevealer.expanded
|
||||
else {
|
||||
entry.click();
|
||||
if (entry.toggleType == ToggleButtonType.None) close();
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: row
|
||||
anchors.fill: parent
|
||||
anchors.margins: 2
|
||||
spacing: 0
|
||||
|
||||
RowLayout {
|
||||
Item {
|
||||
implicitWidth: 22
|
||||
implicitHeight: 22
|
||||
|
||||
MenuCheckBox {
|
||||
anchors.centerIn: parent
|
||||
visible: entry.toggleType == ToggleButtonType.CheckBox
|
||||
checkState: entry.checkState
|
||||
}
|
||||
|
||||
MenuRadioButton {
|
||||
anchors.centerIn: parent
|
||||
visible: entry.toggleType == ToggleButtonType.RadioButton
|
||||
checkState: entry.checkState
|
||||
}
|
||||
|
||||
MenuChildrenRevealer {
|
||||
id: childrenRevealer
|
||||
anchors.centerIn: parent
|
||||
visible: entry.hasChildren
|
||||
onOpenChanged: entry.showChildren = open
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: entry.cleanLabel
|
||||
color: entry.enabled ? "white" : "#bbbbbb"
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitWidth: 22
|
||||
implicitHeight: 22
|
||||
|
||||
Image {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: entry.icon != ""
|
||||
source: entry.icon
|
||||
sourceSize.height: parent.height
|
||||
sourceSize.width: parent.height
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: childrenList.implicitHeight * childrenRevealer.progress
|
||||
clip: true
|
||||
|
||||
MenuItemList {
|
||||
id: childrenList
|
||||
items: entry.children
|
||||
onClose: root.close()
|
||||
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
visible: root.containsMouse || childrenRevealer.expanded
|
||||
|
||||
color: ShellGlobals.colors.widget
|
||||
border.width: 1
|
||||
border.color: ShellGlobals.colors.widgetOutline
|
||||
radius: 5
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,80 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import Quickshell.DBusMenu
|
||||
import "../.."
|
||||
|
||||
ColumnLayout {
|
||||
id: root
|
||||
required property var items;
|
||||
property Item animatingItem: null;
|
||||
property bool animating: animatingItem != null;
|
||||
|
||||
signal close();
|
||||
signal submenuExpanded(item: var);
|
||||
|
||||
spacing: 0
|
||||
|
||||
Repeater {
|
||||
model: items
|
||||
|
||||
Loader {
|
||||
required property var modelData;
|
||||
|
||||
property var item: Component {
|
||||
BoundComponent {
|
||||
id: itemComponent
|
||||
source: "MenuItem.qml"
|
||||
|
||||
property var entry: modelData
|
||||
|
||||
function onClose() {
|
||||
root.close()
|
||||
}
|
||||
|
||||
function onExpandedChanged() {
|
||||
if (item.expanded) root.submenuExpanded(item);
|
||||
}
|
||||
|
||||
function onAnimatingChanged() {
|
||||
if (item.animating) {
|
||||
root.animatingItem = this;
|
||||
} else if (root.animatingItem == this) {
|
||||
root.animatingItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: root
|
||||
|
||||
function onSubmenuExpanded(expandedItem) {
|
||||
if (item != expandedItem) item.expanded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property var separator: Component {
|
||||
Item {
|
||||
implicitHeight: seprect.height + 6
|
||||
|
||||
Rectangle {
|
||||
id: seprect
|
||||
|
||||
anchors {
|
||||
verticalCenter: parent.verticalCenter
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
|
||||
color: ShellGlobals.colors.separator
|
||||
height: 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceComponent: modelData.isSeparator ? separator : item
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
import QtQuick
|
||||
import "../.."
|
||||
|
||||
Rectangle {
|
||||
property var checkState: Qt.Unchecked;
|
||||
implicitHeight: 18
|
||||
implicitWidth: 18
|
||||
radius: width / 2
|
||||
color: ShellGlobals.colors.widget
|
||||
|
||||
Rectangle {
|
||||
x: parent.width * 0.25
|
||||
y: parent.height * 0.25
|
||||
visible: checkState == Qt.Checked
|
||||
width: parent.width * 0.5
|
||||
height: width
|
||||
radius: width / 2
|
||||
}
|
||||
}
|
||||
147
modules/user/modules/quickshell/shell/bar/systray/SysTray.qml
Normal file
147
modules/user/modules/quickshell/shell/bar/systray/SysTray.qml
Normal file
|
|
@ -0,0 +1,147 @@
|
|||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Effects
|
||||
import Quickshell
|
||||
import Quickshell.Services.SystemTray
|
||||
import ".."
|
||||
|
||||
OverlayWidget {
|
||||
id: root
|
||||
expandedWidth: 600
|
||||
expandedHeight: 800
|
||||
required property var bar;
|
||||
|
||||
BarWidgetInner {
|
||||
implicitHeight: column.implicitHeight + 10
|
||||
|
||||
ColumnLayout {
|
||||
id: column
|
||||
implicitHeight: childrenRect.height
|
||||
spacing: 5
|
||||
|
||||
anchors {
|
||||
fill: parent
|
||||
margins: 5
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: SystemTray.items;
|
||||
|
||||
Item {
|
||||
required property var modelData;
|
||||
readonly property alias menu: menuWatcher.menu;
|
||||
|
||||
SystemTrayMenuWatcher {
|
||||
id: menuWatcher;
|
||||
trayItem: modelData;
|
||||
}
|
||||
|
||||
property bool targetMenuOpen: false;
|
||||
onTargetMenuOpenChanged: menu.showChildren = targetMenuOpen
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: width
|
||||
Behavior on implicitHeight {
|
||||
SmoothedAnimation { velocity: 50 }
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors {
|
||||
top: parent.top
|
||||
bottom: parent.bottom
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
width: height
|
||||
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
|
||||
|
||||
Image {
|
||||
id: image
|
||||
anchors.fill: parent
|
||||
|
||||
anchors.margins: mouseArea.pressed || targetMenuOpen ? 3 : 0
|
||||
Behavior on anchors.margins { SmoothedAnimation { velocity: 30 } }
|
||||
|
||||
source: modelData.icon
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
cache: false
|
||||
visible: false
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: image
|
||||
source: image
|
||||
|
||||
property real targetBrightness: mouseArea.pressed || targetMenuOpen ? -25 : mouseArea.containsMouse ? 75 : 0
|
||||
Behavior on targetBrightness { SmoothedAnimation { velocity: 600 } }
|
||||
brightness: targetBrightness / 1000
|
||||
}
|
||||
|
||||
onClicked: event => {
|
||||
event.accepted = true;
|
||||
|
||||
if (event.button == Qt.LeftButton) {
|
||||
modelData.activate();
|
||||
} else if (event.button == Qt.MiddleButton) {
|
||||
modelData.secondaryActivate();
|
||||
} else if (event.button == Qt.RightButton && menu != null) {
|
||||
targetMenuOpen = !targetMenuOpen;
|
||||
}
|
||||
}
|
||||
|
||||
onWheel: event => {
|
||||
event.accepted = true;
|
||||
const points = event.angleDelta.y / 120
|
||||
modelData.scroll(points, false);
|
||||
}
|
||||
|
||||
property var tooltip: TooltipItem {
|
||||
anchors.fill: parent
|
||||
tooltip: bar.widgetSurface.tooltip
|
||||
owner: image
|
||||
|
||||
show: mouseArea.containsMouse
|
||||
implicitWidth: tooltipText.implicitWidth
|
||||
implicitHeight: tooltipText.implicitHeight
|
||||
|
||||
Text {
|
||||
id: tooltipText
|
||||
anchors.fill: parent
|
||||
text: modelData.tooltipTitle != "" ? modelData.tooltipTitle : modelData.id
|
||||
color: "white"
|
||||
}
|
||||
}
|
||||
|
||||
property var rightclickMenu: TooltipItem {
|
||||
anchors.fill: parent
|
||||
tooltip: bar.widgetSurface.tooltip
|
||||
owner: image
|
||||
|
||||
isMenu: true
|
||||
show: targetMenuOpen && menu.showChildren
|
||||
animateSize: !rightclickItems.animating
|
||||
implicitHeight: rightclickItems.implicitHeight
|
||||
implicitWidth: rightclickItems.implicitWidth
|
||||
|
||||
onVisibleChanged: {
|
||||
if (!visible) targetMenuOpen = false;
|
||||
}
|
||||
|
||||
onClose: targetMenuOpen = false;
|
||||
|
||||
MenuItemList {
|
||||
id: rightclickItems
|
||||
anchors.fill: parent
|
||||
items: menu == null ? [] : menu.children
|
||||
onClose: targetMenuOpen = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue