refactor: unified BarModule base component, click-to-open panels, remove pinning
This commit is contained in:
parent
034f0b6d85
commit
26476dc930
33 changed files with 273 additions and 517 deletions
|
|
@ -2,29 +2,26 @@ import QtQuick
|
|||
import "." as M
|
||||
import "../services" as S
|
||||
|
||||
M.BarIcon {
|
||||
M.BarModule {
|
||||
id: root
|
||||
tooltip: "Power profile: " + (S.PowerProfileService.profile || "unknown")
|
||||
|
||||
color: S.PowerProfileService.profile === "performance" ? S.Theme.base09 : S.PowerProfileService.profile === "power-saver" ? S.Theme.base0B : root.accentColor
|
||||
|
||||
icon: {
|
||||
if (S.PowerProfileService.profile === "performance")
|
||||
return "\uF0E7";
|
||||
if (S.PowerProfileService.profile === "power-saver")
|
||||
return "\uF06C";
|
||||
if (S.PowerProfileService.profile === "balanced")
|
||||
return "\uF24E";
|
||||
return "\uF0E7";
|
||||
onTapped: {
|
||||
const cycle = ["performance", "balanced", "power-saver"];
|
||||
const idx = cycle.indexOf(S.PowerProfileService.profile);
|
||||
S.PowerProfileService.set(cycle[(idx + 1) % cycle.length]);
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
const cycle = ["performance", "balanced", "power-saver"];
|
||||
const idx = cycle.indexOf(S.PowerProfileService.profile);
|
||||
S.PowerProfileService.set(cycle[(idx + 1) % cycle.length]);
|
||||
M.BarIcon {
|
||||
color: S.PowerProfileService.profile === "performance" ? S.Theme.base09 : S.PowerProfileService.profile === "power-saver" ? S.Theme.base0B : root.accentColor
|
||||
icon: {
|
||||
if (S.PowerProfileService.profile === "performance")
|
||||
return "\uF0E7";
|
||||
if (S.PowerProfileService.profile === "power-saver")
|
||||
return "\uF06C";
|
||||
if (S.PowerProfileService.profile === "balanced")
|
||||
return "\uF24E";
|
||||
return "\uF0E7";
|
||||
}
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue