last 7 months of qs changes

This commit is contained in:
outfoxxed 2025-01-06 00:13:19 -08:00
parent 2c64563ade
commit 4b90113a54
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
103 changed files with 3467 additions and 1415 deletions

View file

@ -6,7 +6,7 @@ Item {
property bool expanded: false;
readonly property bool open: progress != 0;
readonly property bool animating: internalProgress != -1 && internalProgress != 101;
readonly property bool animating: internalProgress != (expanded ? 101 : -1);
implicitHeight: 16
implicitWidth: 16

View file

@ -1,14 +1,15 @@
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Widgets
import Quickshell.DBusMenu
import "../.."
MouseArea {
id: root
required property var entry;
required property QsMenuEntry entry;
property alias expanded: childrenRevealer.expanded;
property bool animating: childrenRevealer.animating || childrenList.animating;
property bool animating: childrenRevealer.animating || (childMenuLoader?.item?.animating ?? false);
// appears it won't actually create the handler when only used from MenuItemList.
onExpandedChanged: {}
onAnimatingChanged: {}
@ -22,7 +23,7 @@ MouseArea {
onClicked: {
if (entry.hasChildren) childrenRevealer.expanded = !childrenRevealer.expanded
else {
entry.click();
entry.triggered();
if (entry.toggleType == ToggleButtonType.None) close();
}
}
@ -34,19 +35,21 @@ MouseArea {
spacing: 0
RowLayout {
id: innerRow
Item {
implicitWidth: 22
implicitHeight: 22
MenuCheckBox {
anchors.centerIn: parent
visible: entry.toggleType == ToggleButtonType.CheckBox
visible: entry.buttonType == QsMenuButtonType.CheckBox
checkState: entry.checkState
}
MenuRadioButton {
anchors.centerIn: parent
visible: entry.toggleType == ToggleButtonType.RadioButton
visible: entry.buttonType == QsMenuButtonType.RadioButton
checkState: entry.checkState
}
@ -59,7 +62,7 @@ MouseArea {
}
Text {
text: entry.cleanLabel
text: entry.text
color: entry.enabled ? "white" : "#bbbbbb"
}
@ -68,25 +71,32 @@ MouseArea {
implicitWidth: 22
implicitHeight: 22
Image {
IconImage {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
visible: entry.icon != ""
source: entry.icon
sourceSize.height: parent.height
sourceSize.width: parent.height
visible: source != ""
implicitSize: parent.height
}
}
}
Item {
Loader {
id: childMenuLoader
Layout.fillWidth: true
implicitHeight: childrenList.implicitHeight * childrenRevealer.progress
Layout.preferredHeight: active ? item.implicitHeight * childrenRevealer.progress : 0
readonly property real widthDifference: {
Math.max(0, (item?.implicitWidth ?? 0) - innerRow.implicitWidth);
}
Layout.preferredWidth: active ? innerRow.implicitWidth + (widthDifference * childrenRevealer.progress) : 0
active: root.expanded || root.animating
clip: true
MenuItemList {
sourceComponent: MenuView {
id: childrenList
items: entry.children
menu: entry
onClose: root.close()
anchors {

View file

@ -6,17 +6,19 @@ import "../.."
ColumnLayout {
id: root
required property var items;
property alias menu: menuView.menu;
property Item animatingItem: null;
property bool animating: animatingItem != null;
signal close();
signal submenuExpanded(item: var);
QsMenuOpener { id: menuView }
spacing: 0
Repeater {
model: items
model: menuView.children;
Loader {
required property var modelData;

View file

@ -1,3 +1,5 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import QtQuick.Effects
@ -5,102 +7,102 @@ import Quickshell
import Quickshell.Services.SystemTray
import ".."
OverlayWidget {
BarWidgetInner {
id: root
expandedWidth: 600
expandedHeight: 800
required property var bar;
implicitHeight: column.implicitHeight + 10
BarWidgetInner {
implicitHeight: column.implicitHeight + 10
ColumnLayout {
id: column
implicitHeight: childrenRect.height
spacing: 5
ColumnLayout {
id: column
implicitHeight: childrenRect.height
spacing: 5
anchors {
fill: parent
margins: 5
}
anchors {
fill: parent
margins: 5
}
Repeater {
model: SystemTray.items;
Repeater {
model: SystemTray.items;
Item {
id: item
required property SystemTrayItem modelData;
Item {
required property var modelData;
readonly property alias menu: menuWatcher.menu;
property bool targetMenuOpen: false;
SystemTrayMenuWatcher {
id: menuWatcher;
trayItem: modelData;
Layout.fillWidth: true
implicitHeight: width
ClickableIcon {
id: mouseArea
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
}
width: height
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
image: item.modelData.icon
showPressed: item.targetMenuOpen || (pressedButtons & ~Qt.RightButton)
fillWindowWidth: true
extraVerticalMargin: column.spacing / 2
onClicked: event => {
event.accepted = true;
if (event.button == Qt.LeftButton) {
item.modelData.activate();
} else if (event.button == Qt.MiddleButton) {
item.modelData.secondaryActivate();
}
}
property bool targetMenuOpen: false;
onTargetMenuOpenChanged: menu.showChildren = targetMenuOpen
Layout.fillWidth: true
implicitHeight: width
ClickableIcon {
id: mouseArea
anchors {
top: parent.top
bottom: parent.bottom
horizontalCenter: parent.horizontalCenter
onPressed: event => {
if (event.button == Qt.RightButton && item.modelData.hasMenu) {
item.targetMenuOpen = !item.targetMenuOpen;
}
width: height
}
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onWheel: event => {
event.accepted = true;
const points = event.angleDelta.y / 120
item.modelData.scroll(points, false);
}
image: modelData.icon
showPressed: targetMenuOpen
property var tooltip: TooltipItem {
tooltip: root.bar.tooltip
owner: mouseArea
onClicked: event => {
event.accepted = true;
show: mouseArea.containsMouse
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;
}
Text {
id: tooltipText
text: item.modelData.tooltipTitle != "" ? item.modelData.tooltipTitle : item.modelData.id
color: "white"
}
}
onWheel: event => {
event.accepted = true;
const points = event.angleDelta.y / 120
modelData.scroll(points, false);
}
property var rightclickMenu: TooltipItem {
id: rightclickMenu
tooltip: root.bar.tooltip
owner: mouseArea
property var tooltip: TooltipItem {
tooltip: bar.tooltip
owner: mouseArea
isMenu: true
show: item.targetMenuOpen
animateSize: !(menuContentLoader?.item?.animating ?? false)
show: mouseArea.containsMouse
onClose: item.targetMenuOpen = false;
Text {
id: tooltipText
text: modelData.tooltipTitle != "" ? modelData.tooltipTitle : modelData.id
color: "white"
}
}
Loader {
id: menuContentLoader
active: item.targetMenuOpen || rightclickMenu.visible || mouseArea.containsMouse
property var rightclickMenu: TooltipItem {
tooltip: bar.tooltip
owner: mouseArea
isMenu: true
show: targetMenuOpen && menu.showChildren
animateSize: !rightclickItems.animating
onClose: targetMenuOpen = false;
MenuItemList {
id: rightclickItems
items: menu == null ? [] : menu.children
onClose: targetMenuOpen = false;
sourceComponent: MenuView {
menu: item.modelData.menu
onClose: item.targetMenuOpen = false;
}
}
}