centralize panel content-change grace period into HoverPanel.keepOpen()
This commit is contained in:
parent
084ef1da75
commit
46f14d5d36
6 changed files with 36 additions and 19 deletions
|
|
@ -47,6 +47,7 @@ M.BarSection {
|
|||
property M.ProcessList _procs: M.ProcessList {
|
||||
sortBy: "cpu"
|
||||
active: root._showPanel
|
||||
onProcessesChanged: hoverPanel.keepOpen(300)
|
||||
}
|
||||
|
||||
on_AnyHoverChanged: {
|
||||
|
|
|
|||
|
|
@ -92,6 +92,24 @@ PanelWindow {
|
|||
}
|
||||
}
|
||||
|
||||
// Content-change grace: call keepOpen(ms) when panel content is about to
|
||||
// resize/rebuild (session switch, device list change, etc.) to prevent the
|
||||
// hover-drop-on-resize from closing the panel.
|
||||
property bool _contentBusy: false
|
||||
Timer {
|
||||
id: _contentBusyTimer
|
||||
onTriggered: {
|
||||
root._contentBusy = false;
|
||||
if (!root.showPanel && !root._grace && !root._pinned)
|
||||
root._hideTimer.restart();
|
||||
}
|
||||
}
|
||||
function keepOpen(ms) {
|
||||
_contentBusy = true;
|
||||
_contentBusyTimer.interval = ms ?? 400;
|
||||
_contentBusyTimer.restart();
|
||||
}
|
||||
|
||||
function _show() {
|
||||
_updatePosition();
|
||||
_winVisible = true;
|
||||
|
|
@ -115,7 +133,7 @@ PanelWindow {
|
|||
Timer {
|
||||
id: _hideTimer
|
||||
interval: 150
|
||||
onTriggered: if (!root.showPanel && !root._grace && !root._pinned)
|
||||
onTriggered: if (!root.showPanel && !root._grace && !root._pinned && !root._contentBusy)
|
||||
root.dismiss()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ M.BarSection {
|
|||
property M.ProcessList _procs: M.ProcessList {
|
||||
sortBy: "mem"
|
||||
active: root._showPanel
|
||||
onProcessesChanged: hoverPanel.keepOpen(300)
|
||||
}
|
||||
|
||||
on_AnyHoverChanged: {
|
||||
|
|
|
|||
|
|
@ -75,13 +75,7 @@ M.BarSection {
|
|||
required property var bar
|
||||
|
||||
property bool _pinned: false
|
||||
property bool _switching: false
|
||||
Timer {
|
||||
id: _sessionSwitchTimer
|
||||
interval: 400
|
||||
onTriggered: root._switching = false
|
||||
}
|
||||
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered || _switching
|
||||
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
|
||||
readonly property bool _showPanel: _anyHover || _pinned
|
||||
|
||||
on_AnyHoverChanged: {
|
||||
|
|
@ -414,8 +408,7 @@ M.BarSection {
|
|||
TapHandler {
|
||||
onTapped: {
|
||||
root._playerIdx = index;
|
||||
root._switching = true;
|
||||
_sessionSwitchTimer.restart();
|
||||
hoverPanel.keepOpen(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ M.BarSection {
|
|||
|
||||
required property var bar
|
||||
|
||||
readonly property bool _anyHover: root._hovered || networkMenu.panelHovered || networkMenu._busy
|
||||
readonly property bool _anyHover: root._hovered || networkMenu.panelHovered
|
||||
|
||||
M.NetworkMenu {
|
||||
id: networkMenu
|
||||
|
|
|
|||
|
|
@ -12,8 +12,6 @@ M.HoverPanel {
|
|||
onVisibleChanged: if (visible)
|
||||
scanner.running = true
|
||||
|
||||
readonly property bool _busy: connectProc.running || disconnectProc.running || radioProc.running
|
||||
|
||||
function triggerRefresh() {
|
||||
if (visible)
|
||||
scanner.running = true;
|
||||
|
|
@ -85,24 +83,30 @@ M.HoverPanel {
|
|||
id: radioProc
|
||||
property string _state: ""
|
||||
command: ["nmcli", "radio", "wifi", _state]
|
||||
onRunningChanged: if (!running)
|
||||
scanner.running = true
|
||||
onRunningChanged: if (!running) {
|
||||
scanner.running = true;
|
||||
menuWindow.keepOpen(500);
|
||||
}
|
||||
}
|
||||
|
||||
property Process _connectProc: Process {
|
||||
id: connectProc
|
||||
property string uuid: ""
|
||||
command: ["nmcli", "connection", "up", uuid]
|
||||
onRunningChanged: if (!running)
|
||||
scanner.running = true
|
||||
onRunningChanged: if (!running) {
|
||||
scanner.running = true;
|
||||
menuWindow.keepOpen(500);
|
||||
}
|
||||
}
|
||||
|
||||
property Process _disconnectProc: Process {
|
||||
id: disconnectProc
|
||||
property string uuid: ""
|
||||
command: ["nmcli", "connection", "down", uuid]
|
||||
onRunningChanged: if (!running)
|
||||
scanner.running = true
|
||||
onRunningChanged: if (!running) {
|
||||
scanner.running = true;
|
||||
menuWindow.keepOpen(500);
|
||||
}
|
||||
}
|
||||
|
||||
// Wi-Fi radio toggle header
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue