extract OsdSection base component from Volume and Backlight modules
This commit is contained in:
parent
e50dd155fa
commit
2ec24e3075
4 changed files with 33 additions and 34 deletions
|
|
@ -4,17 +4,15 @@ import "." as M
|
|||
import "../services" as S
|
||||
import "../applets" as C
|
||||
|
||||
M.BarSection {
|
||||
M.OsdSection {
|
||||
id: root
|
||||
spacing: S.Theme.moduleSpacing
|
||||
opacity: S.Modules.backlight.enable && S.BacklightService.available ? 1 : 0
|
||||
visible: opacity > 0
|
||||
tooltip: ""
|
||||
_panelHovered: hoverPanel.panelHovered
|
||||
|
||||
property int percent: S.BacklightService.percent
|
||||
property bool _osdActive: false
|
||||
property bool _percentInit: false
|
||||
readonly property bool _showPanel: root._hovered || hoverPanel.panelHovered || _osdActive
|
||||
|
||||
onPercentChanged: {
|
||||
if (!_percentInit) {
|
||||
|
|
@ -22,18 +20,7 @@ M.BarSection {
|
|||
return;
|
||||
}
|
||||
if (percent > 0)
|
||||
_flashPanel();
|
||||
}
|
||||
|
||||
function _flashPanel() {
|
||||
_osdActive = true;
|
||||
_osdTimer.restart();
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _osdTimer
|
||||
interval: 1500
|
||||
onTriggered: root._osdActive = false
|
||||
flashPanel();
|
||||
}
|
||||
|
||||
WheelHandler {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue