28 lines
1,018 B
QML
28 lines
1,018 B
QML
import QtQuick
|
|
import "." as M
|
|
import "../services" as S
|
|
|
|
M.BarModule {
|
|
id: root
|
|
active: S.Modules.powerProfile.enable
|
|
tooltip: "Power profile: " + (S.PowerProfileService.profile || "unknown")
|
|
onTapped: {
|
|
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
|
|
}
|
|
}
|