Files
z-bar-qt/Modules/Settings/Pages/Panels/Bar/BarStatusIcons.qml
T
Inorishio 2d40ce33d1
C++ / fmt (pull_request) Successful in 5s
JS/TS / fmt (pull_request) Successful in 17s
JS/TS / lint (pull_request) Successful in 16s
Python / fmt (pull_request) Successful in 31s
Python / lint (pull_request) Successful in 41s
Python / test (pull_request) Successful in 1m5s
Python / typecheck (pull_request) Successful in 1m15s
Rust / clippy (pull_request) Failing after 12m43s
Rust / fmt (pull_request) Failing after 12m57s
Rust / build (pull_request) Failing after 13m33s
Python / buildcheck (pull_request) Failing after 13m45s
C++ / clang-tidy (pull_request) Failing after 14m23s
C++ / build (pull_request) Failing after 14m25s
Merge branch 'main' into module/wifi
2026-08-15 20:38:54 +02:00

108 lines
2.5 KiB
QML

import QtQuick.Layouts
import ZShell.Config
import qs.Modules.Settings.Common
PageBase {
id: root
readonly property var builtinIcons: ({
audio: qsTr("Speakers"),
microphone: qsTr("Microphone"),
power: qsTr("Battery"),
network: qsTr("Network"),
bluetooth: qsTr("Bluetooth")
})
isSubPage: true
title: qsTr("System icons")
ColumnLayout {
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
spacing: Tokens.spacing.extraSmall / 2
width: root.cappedWidth
// Visible icons
SectionHeader {
first: true
text: qsTr("Visible icons")
}
ListEditor {
function labelFor(item: var): string {
const prettyName = root.builtinIcons[item.id];
if (prettyName)
return prettyName;
const label = item.id.replace(/([A-Z])/g, " $1");
return label.charAt(0).toUpperCase() + label.slice(1).toLowerCase();
}
function toggledFor(item: var): bool {
return item.enabled;
}
first: true
values: Config.bar.tray.statusIcons.values
z: 1
onItemMoved: (from, to) => Config.bar.tray.statusIcons.move(from, to)
onItemRemoved: index => Config.bar.tray.statusIcons.remove(index)
onItemToggled: (index, checked) => Config.bar.tray.statusIcons.at(index).enabled = checked
}
DialogSelectButton {
id: addItemContainer
acceptLabel: qsTr("Add")
enabled: Object.keys(model).length > 0
header: qsTr("Add new entry")
icon: "add"
label: qsTr("Add entry")
model: {
const present = new Set(Config.bar.tray.statusIcons.values.map(item => item.id));
return Object.keys(root.builtinIcons).filter(id => !present.has(id)).map(id => ({
id: id,
label: root.builtinIcons[id]
}));
}
rootParent: root.flickable
onAccepted: {
if (!selectedItem)
return;
Config.bar.tray.statusIcons.insert({
id: selectedItem,
enabled: true
});
}
}
// Behavior
SectionHeader {
text: qsTr("Behavior")
}
ToggleRow {
checked: Config.bar.popouts.statusIcons
first: true
last: true
settingAnchor: "bar-status-popout-on-hover"
subtext: qsTr("Show a details popout when hovering the status icons")
text: qsTr("Popout on hover")
onToggled: Config.bar.popouts.statusIcons = checked
}
ToggleRow {
checked: Config.bar.popouts.network
last: true
settingAnchor: "bar-status-network-popout"
subtext: qsTr("Show a details popout when hovering the network icon")
text: qsTr("Network popout on hover")
onToggled: Config.bar.popouts.network = checked
}
}
}