extract PinnableSection base component from 12 bar modules
This commit is contained in:
parent
deb3fc0a12
commit
aa0f7bb5ef
14 changed files with 55 additions and 229 deletions
|
|
@ -4,10 +4,10 @@ import "." as M
|
|||
import "../services" as S
|
||||
import "../applets" as C
|
||||
|
||||
M.BarSection {
|
||||
M.PinnableSection {
|
||||
id: root
|
||||
spacing: Math.max(1, S.Theme.moduleSpacing - 2)
|
||||
tooltip: ""
|
||||
_panelHovered: hoverPanel.panelHovered
|
||||
|
||||
property int percent: S.SystemStats.memPercent
|
||||
property real usedGb: S.SystemStats.memUsedGb
|
||||
|
|
@ -16,29 +16,12 @@ M.BarSection {
|
|||
property real cachedGb: S.SystemStats.memCachedGb
|
||||
property real buffersGb: S.SystemStats.memBuffersGb
|
||||
|
||||
property bool _pinned: false
|
||||
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
|
||||
readonly property bool _showPanel: _anyHover || _pinned
|
||||
|
||||
property M.ProcessList _procs: M.ProcessList {
|
||||
sortBy: "mem"
|
||||
active: root._showPanel
|
||||
onProcessesChanged: hoverPanel.keepOpen(300)
|
||||
}
|
||||
|
||||
on_AnyHoverChanged: {
|
||||
if (_anyHover)
|
||||
_unpinTimer.stop();
|
||||
else if (_pinned)
|
||||
_unpinTimer.start();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _unpinTimer
|
||||
interval: 500
|
||||
onTriggered: root._pinned = false
|
||||
}
|
||||
|
||||
M.BarIcon {
|
||||
icon: "\uEFC5"
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue