mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
dankbar: make control center widget per-instance not global
fixes #1017
This commit is contained in:
@@ -14,7 +14,7 @@ import "settings/SettingsStore.js" as Store
|
|||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property int settingsConfigVersion: 2
|
readonly property int settingsConfigVersion: 3
|
||||||
|
|
||||||
readonly property bool isGreeterMode: Quickshell.env("DMS_RUN_GREETER") === "1" || Quickshell.env("DMS_RUN_GREETER") === "true"
|
readonly property bool isGreeterMode: Quickshell.env("DMS_RUN_GREETER") === "1" || Quickshell.env("DMS_RUN_GREETER") === "true"
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
@@ -17,40 +16,67 @@ Singleton {
|
|||||||
pciId: "",
|
pciId: "",
|
||||||
mountPath: "/",
|
mountPath: "/",
|
||||||
minimumWidth: true,
|
minimumWidth: true,
|
||||||
showSwap: false
|
showSwap: false,
|
||||||
}
|
mediaSize: 1,
|
||||||
leftModel.append(dummy)
|
showNetworkIcon: true,
|
||||||
centerModel.append(dummy)
|
showBluetoothIcon: true,
|
||||||
rightModel.append(dummy)
|
showAudioIcon: true,
|
||||||
|
showVpnIcon: true,
|
||||||
|
showBrightnessIcon: false,
|
||||||
|
showMicIcon: false,
|
||||||
|
showBatteryIcon: false,
|
||||||
|
showPrinterIcon: false
|
||||||
|
};
|
||||||
|
leftModel.append(dummy);
|
||||||
|
centerModel.append(dummy);
|
||||||
|
rightModel.append(dummy);
|
||||||
|
|
||||||
update(leftModel, left)
|
update(leftModel, left);
|
||||||
update(centerModel, center)
|
update(centerModel, center);
|
||||||
update(rightModel, right)
|
update(rightModel, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update(model, order) {
|
function update(model, order) {
|
||||||
model.clear()
|
model.clear();
|
||||||
for (var i = 0; i < order.length; i++) {
|
for (var i = 0; i < order.length; i++) {
|
||||||
var widgetId = typeof order[i] === "string" ? order[i] : order[i].id
|
var isObj = typeof order[i] !== "string";
|
||||||
var enabled = typeof order[i] === "string" ? true : order[i].enabled
|
var widgetId = isObj ? order[i].id : order[i];
|
||||||
var size = typeof order[i] === "string" ? undefined : order[i].size
|
|
||||||
var selectedGpuIndex = typeof order[i] === "string" ? undefined : order[i].selectedGpuIndex
|
|
||||||
var pciId = typeof order[i] === "string" ? undefined : order[i].pciId
|
|
||||||
var mountPath = typeof order[i] === "string" ? undefined : order[i].mountPath
|
|
||||||
var minimumWidth = typeof order[i] === "string" ? undefined : order[i].minimumWidth
|
|
||||||
var showSwap = typeof order[i] === "string" ? undefined : order[i].showSwap
|
|
||||||
var item = {
|
var item = {
|
||||||
widgetId: widgetId,
|
widgetId: widgetId,
|
||||||
enabled: enabled
|
enabled: isObj ? order[i].enabled : true
|
||||||
}
|
};
|
||||||
if (size !== undefined) item.size = size
|
if (isObj && order[i].size !== undefined)
|
||||||
if (selectedGpuIndex !== undefined) item.selectedGpuIndex = selectedGpuIndex
|
item.size = order[i].size;
|
||||||
if (pciId !== undefined) item.pciId = pciId
|
if (isObj && order[i].selectedGpuIndex !== undefined)
|
||||||
if (mountPath !== undefined) item.mountPath = mountPath
|
item.selectedGpuIndex = order[i].selectedGpuIndex;
|
||||||
if (minimumWidth !== undefined) item.minimumWidth = minimumWidth
|
if (isObj && order[i].pciId !== undefined)
|
||||||
if (showSwap !== undefined) item.showSwap = showSwap
|
item.pciId = order[i].pciId;
|
||||||
|
if (isObj && order[i].mountPath !== undefined)
|
||||||
|
item.mountPath = order[i].mountPath;
|
||||||
|
if (isObj && order[i].minimumWidth !== undefined)
|
||||||
|
item.minimumWidth = order[i].minimumWidth;
|
||||||
|
if (isObj && order[i].showSwap !== undefined)
|
||||||
|
item.showSwap = order[i].showSwap;
|
||||||
|
if (isObj && order[i].mediaSize !== undefined)
|
||||||
|
item.mediaSize = order[i].mediaSize;
|
||||||
|
if (isObj && order[i].showNetworkIcon !== undefined)
|
||||||
|
item.showNetworkIcon = order[i].showNetworkIcon;
|
||||||
|
if (isObj && order[i].showBluetoothIcon !== undefined)
|
||||||
|
item.showBluetoothIcon = order[i].showBluetoothIcon;
|
||||||
|
if (isObj && order[i].showAudioIcon !== undefined)
|
||||||
|
item.showAudioIcon = order[i].showAudioIcon;
|
||||||
|
if (isObj && order[i].showVpnIcon !== undefined)
|
||||||
|
item.showVpnIcon = order[i].showVpnIcon;
|
||||||
|
if (isObj && order[i].showBrightnessIcon !== undefined)
|
||||||
|
item.showBrightnessIcon = order[i].showBrightnessIcon;
|
||||||
|
if (isObj && order[i].showMicIcon !== undefined)
|
||||||
|
item.showMicIcon = order[i].showMicIcon;
|
||||||
|
if (isObj && order[i].showBatteryIcon !== undefined)
|
||||||
|
item.showBatteryIcon = order[i].showBatteryIcon;
|
||||||
|
if (isObj && order[i].showPrinterIcon !== undefined)
|
||||||
|
item.showPrinterIcon = order[i].showPrinterIcon;
|
||||||
|
|
||||||
model.append(item)
|
model.append(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -113,6 +113,12 @@ function migrateToVersion(obj, targetVersion) {
|
|||||||
settings.configVersion = 2;
|
settings.configVersion = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (currentVersion < 3) {
|
||||||
|
console.info("Migrating settings from version", currentVersion, "to version 3");
|
||||||
|
console.info("Per-widget controlCenterButton config now supported via widgetData properties");
|
||||||
|
settings.configVersion = 3;
|
||||||
|
}
|
||||||
|
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,14 +13,14 @@ BasePill {
|
|||||||
property var widgetData: null
|
property var widgetData: null
|
||||||
property string screenName: ""
|
property string screenName: ""
|
||||||
property string screenModel: ""
|
property string screenModel: ""
|
||||||
property bool showNetworkIcon: SettingsData.controlCenterShowNetworkIcon
|
property bool showNetworkIcon: widgetData?.showNetworkIcon !== undefined ? widgetData.showNetworkIcon : SettingsData.controlCenterShowNetworkIcon
|
||||||
property bool showBluetoothIcon: SettingsData.controlCenterShowBluetoothIcon
|
property bool showBluetoothIcon: widgetData?.showBluetoothIcon !== undefined ? widgetData.showBluetoothIcon : SettingsData.controlCenterShowBluetoothIcon
|
||||||
property bool showAudioIcon: SettingsData.controlCenterShowAudioIcon
|
property bool showAudioIcon: widgetData?.showAudioIcon !== undefined ? widgetData.showAudioIcon : SettingsData.controlCenterShowAudioIcon
|
||||||
property bool showVpnIcon: SettingsData.controlCenterShowVpnIcon
|
property bool showVpnIcon: widgetData?.showVpnIcon !== undefined ? widgetData.showVpnIcon : SettingsData.controlCenterShowVpnIcon
|
||||||
property bool showBrightnessIcon: SettingsData.controlCenterShowBrightnessIcon
|
property bool showBrightnessIcon: widgetData?.showBrightnessIcon !== undefined ? widgetData.showBrightnessIcon : SettingsData.controlCenterShowBrightnessIcon
|
||||||
property bool showMicIcon: SettingsData.controlCenterShowMicIcon
|
property bool showMicIcon: widgetData?.showMicIcon !== undefined ? widgetData.showMicIcon : SettingsData.controlCenterShowMicIcon
|
||||||
property bool showBatteryIcon: SettingsData.controlCenterShowBatteryIcon
|
property bool showBatteryIcon: widgetData?.showBatteryIcon !== undefined ? widgetData.showBatteryIcon : SettingsData.controlCenterShowBatteryIcon
|
||||||
property bool showPrinterIcon: SettingsData.controlCenterShowPrinterIcon
|
property bool showPrinterIcon: widgetData?.showPrinterIcon !== undefined ? widgetData.showPrinterIcon : SettingsData.controlCenterShowPrinterIcon
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
active: root.showPrinterIcon
|
active: root.showPrinterIcon
|
||||||
|
|||||||
@@ -371,9 +371,14 @@ Item {
|
|||||||
widgetObj.pciId = "";
|
widgetObj.pciId = "";
|
||||||
}
|
}
|
||||||
if (widgetId === "controlCenterButton") {
|
if (widgetId === "controlCenterButton") {
|
||||||
widgetObj.showNetworkIcon = true;
|
widgetObj.showNetworkIcon = SettingsData.controlCenterShowNetworkIcon;
|
||||||
widgetObj.showBluetoothIcon = true;
|
widgetObj.showBluetoothIcon = SettingsData.controlCenterShowBluetoothIcon;
|
||||||
widgetObj.showAudioIcon = true;
|
widgetObj.showAudioIcon = SettingsData.controlCenterShowAudioIcon;
|
||||||
|
widgetObj.showVpnIcon = SettingsData.controlCenterShowVpnIcon;
|
||||||
|
widgetObj.showBrightnessIcon = SettingsData.controlCenterShowBrightnessIcon;
|
||||||
|
widgetObj.showMicIcon = SettingsData.controlCenterShowMicIcon;
|
||||||
|
widgetObj.showBatteryIcon = SettingsData.controlCenterShowBatteryIcon;
|
||||||
|
widgetObj.showPrinterIcon = SettingsData.controlCenterShowPrinterIcon;
|
||||||
}
|
}
|
||||||
if (widgetId === "diskUsage")
|
if (widgetId === "diskUsage")
|
||||||
widgetObj.mountPath = "/";
|
widgetObj.mountPath = "/";
|
||||||
@@ -423,9 +428,14 @@ Item {
|
|||||||
else if (widget.id === "gpuTemp")
|
else if (widget.id === "gpuTemp")
|
||||||
newWidget.pciId = "";
|
newWidget.pciId = "";
|
||||||
if (widget.id === "controlCenterButton") {
|
if (widget.id === "controlCenterButton") {
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? SettingsData.controlCenterShowNetworkIcon;
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? SettingsData.controlCenterShowBluetoothIcon;
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
newWidget.showAudioIcon = widget.showAudioIcon ?? SettingsData.controlCenterShowAudioIcon;
|
||||||
|
newWidget.showVpnIcon = widget.showVpnIcon ?? SettingsData.controlCenterShowVpnIcon;
|
||||||
|
newWidget.showBrightnessIcon = widget.showBrightnessIcon ?? SettingsData.controlCenterShowBrightnessIcon;
|
||||||
|
newWidget.showMicIcon = widget.showMicIcon ?? SettingsData.controlCenterShowMicIcon;
|
||||||
|
newWidget.showBatteryIcon = widget.showBatteryIcon ?? SettingsData.controlCenterShowBatteryIcon;
|
||||||
|
newWidget.showPrinterIcon = widget.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
||||||
}
|
}
|
||||||
widgets[i] = newWidget;
|
widgets[i] = newWidget;
|
||||||
break;
|
break;
|
||||||
@@ -471,9 +481,14 @@ Item {
|
|||||||
if (widget.pciId !== undefined)
|
if (widget.pciId !== undefined)
|
||||||
newWidget.pciId = widget.pciId;
|
newWidget.pciId = widget.pciId;
|
||||||
if (widget.id === "controlCenterButton") {
|
if (widget.id === "controlCenterButton") {
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? SettingsData.controlCenterShowNetworkIcon;
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? SettingsData.controlCenterShowBluetoothIcon;
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
newWidget.showAudioIcon = widget.showAudioIcon ?? SettingsData.controlCenterShowAudioIcon;
|
||||||
|
newWidget.showVpnIcon = widget.showVpnIcon ?? SettingsData.controlCenterShowVpnIcon;
|
||||||
|
newWidget.showBrightnessIcon = widget.showBrightnessIcon ?? SettingsData.controlCenterShowBrightnessIcon;
|
||||||
|
newWidget.showMicIcon = widget.showMicIcon ?? SettingsData.controlCenterShowMicIcon;
|
||||||
|
newWidget.showBatteryIcon = widget.showBatteryIcon ?? SettingsData.controlCenterShowBatteryIcon;
|
||||||
|
newWidget.showPrinterIcon = widget.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
||||||
}
|
}
|
||||||
widgets[widgetIndex] = newWidget;
|
widgets[widgetIndex] = newWidget;
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
@@ -541,41 +556,48 @@ Item {
|
|||||||
if (widget.pciId !== undefined)
|
if (widget.pciId !== undefined)
|
||||||
newWidget.pciId = widget.pciId;
|
newWidget.pciId = widget.pciId;
|
||||||
if (widget.id === "controlCenterButton") {
|
if (widget.id === "controlCenterButton") {
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? SettingsData.controlCenterShowNetworkIcon;
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? SettingsData.controlCenterShowBluetoothIcon;
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
newWidget.showAudioIcon = widget.showAudioIcon ?? SettingsData.controlCenterShowAudioIcon;
|
||||||
|
newWidget.showVpnIcon = widget.showVpnIcon ?? SettingsData.controlCenterShowVpnIcon;
|
||||||
|
newWidget.showBrightnessIcon = widget.showBrightnessIcon ?? SettingsData.controlCenterShowBrightnessIcon;
|
||||||
|
newWidget.showMicIcon = widget.showMicIcon ?? SettingsData.controlCenterShowMicIcon;
|
||||||
|
newWidget.showBatteryIcon = widget.showBatteryIcon ?? SettingsData.controlCenterShowBatteryIcon;
|
||||||
|
newWidget.showPrinterIcon = widget.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
||||||
}
|
}
|
||||||
widgets[widgetIndex] = newWidget;
|
widgets[widgetIndex] = newWidget;
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleControlCenterSettingChanged(sectionId, widgetIndex, settingName, value) {
|
function handleControlCenterSettingChanged(sectionId, widgetIndex, settingName, value) {
|
||||||
switch (settingName) {
|
var widgets = getWidgetsForSection(sectionId).slice();
|
||||||
case "showNetworkIcon":
|
if (widgetIndex < 0 || widgetIndex >= widgets.length)
|
||||||
SettingsData.set("controlCenterShowNetworkIcon", value);
|
return;
|
||||||
break;
|
|
||||||
case "showBluetoothIcon":
|
var widget = widgets[widgetIndex];
|
||||||
SettingsData.set("controlCenterShowBluetoothIcon", value);
|
if (typeof widget === "string") {
|
||||||
break;
|
widget = {
|
||||||
case "showAudioIcon":
|
"id": widget,
|
||||||
SettingsData.set("controlCenterShowAudioIcon", value);
|
"enabled": true
|
||||||
break;
|
};
|
||||||
case "showVpnIcon":
|
|
||||||
SettingsData.set("controlCenterShowVpnIcon", value);
|
|
||||||
break;
|
|
||||||
case "showBrightnessIcon":
|
|
||||||
SettingsData.set("controlCenterShowBrightnessIcon", value);
|
|
||||||
break;
|
|
||||||
case "showMicIcon":
|
|
||||||
SettingsData.set("controlCenterShowMicIcon", value);
|
|
||||||
break;
|
|
||||||
case "showBatteryIcon":
|
|
||||||
SettingsData.set("controlCenterShowBatteryIcon", value);
|
|
||||||
break;
|
|
||||||
case "showPrinterIcon":
|
|
||||||
SettingsData.set("controlCenterShowPrinterIcon", value);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var newWidget = {
|
||||||
|
"id": widget.id,
|
||||||
|
"enabled": widget.enabled !== undefined ? widget.enabled : true,
|
||||||
|
"showNetworkIcon": widget.showNetworkIcon ?? SettingsData.controlCenterShowNetworkIcon,
|
||||||
|
"showBluetoothIcon": widget.showBluetoothIcon ?? SettingsData.controlCenterShowBluetoothIcon,
|
||||||
|
"showAudioIcon": widget.showAudioIcon ?? SettingsData.controlCenterShowAudioIcon,
|
||||||
|
"showVpnIcon": widget.showVpnIcon ?? SettingsData.controlCenterShowVpnIcon,
|
||||||
|
"showBrightnessIcon": widget.showBrightnessIcon ?? SettingsData.controlCenterShowBrightnessIcon,
|
||||||
|
"showMicIcon": widget.showMicIcon ?? SettingsData.controlCenterShowMicIcon,
|
||||||
|
"showBatteryIcon": widget.showBatteryIcon ?? SettingsData.controlCenterShowBatteryIcon,
|
||||||
|
"showPrinterIcon": widget.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon
|
||||||
|
};
|
||||||
|
newWidget[settingName] = value;
|
||||||
|
|
||||||
|
widgets[widgetIndex] = newWidget;
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePrivacySettingChanged(sectionId, widgetIndex, settingName, value) {
|
function handlePrivacySettingChanged(sectionId, widgetIndex, settingName, value) {
|
||||||
@@ -626,9 +648,14 @@ Item {
|
|||||||
if (widget.showSwap !== undefined)
|
if (widget.showSwap !== undefined)
|
||||||
newWidget.showSwap = widget.showSwap;
|
newWidget.showSwap = widget.showSwap;
|
||||||
if (widget.id === "controlCenterButton") {
|
if (widget.id === "controlCenterButton") {
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? SettingsData.controlCenterShowNetworkIcon;
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? SettingsData.controlCenterShowBluetoothIcon;
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
newWidget.showAudioIcon = widget.showAudioIcon ?? SettingsData.controlCenterShowAudioIcon;
|
||||||
|
newWidget.showVpnIcon = widget.showVpnIcon ?? SettingsData.controlCenterShowVpnIcon;
|
||||||
|
newWidget.showBrightnessIcon = widget.showBrightnessIcon ?? SettingsData.controlCenterShowBrightnessIcon;
|
||||||
|
newWidget.showMicIcon = widget.showMicIcon ?? SettingsData.controlCenterShowMicIcon;
|
||||||
|
newWidget.showBatteryIcon = widget.showBatteryIcon ?? SettingsData.controlCenterShowBatteryIcon;
|
||||||
|
newWidget.showPrinterIcon = widget.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
||||||
}
|
}
|
||||||
widgets[widgetIndex] = newWidget;
|
widgets[widgetIndex] = newWidget;
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
@@ -678,9 +705,14 @@ Item {
|
|||||||
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
||||||
newWidget.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
newWidget.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
||||||
if (widget.id === "controlCenterButton") {
|
if (widget.id === "controlCenterButton") {
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? SettingsData.controlCenterShowNetworkIcon;
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? SettingsData.controlCenterShowBluetoothIcon;
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
newWidget.showAudioIcon = widget.showAudioIcon ?? SettingsData.controlCenterShowAudioIcon;
|
||||||
|
newWidget.showVpnIcon = widget.showVpnIcon ?? SettingsData.controlCenterShowVpnIcon;
|
||||||
|
newWidget.showBrightnessIcon = widget.showBrightnessIcon ?? SettingsData.controlCenterShowBrightnessIcon;
|
||||||
|
newWidget.showMicIcon = widget.showMicIcon ?? SettingsData.controlCenterShowMicIcon;
|
||||||
|
newWidget.showBatteryIcon = widget.showBatteryIcon ?? SettingsData.controlCenterShowBatteryIcon;
|
||||||
|
newWidget.showPrinterIcon = widget.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
||||||
}
|
}
|
||||||
widgets[widgetIndex] = newWidget;
|
widgets[widgetIndex] = newWidget;
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
@@ -730,9 +762,14 @@ Item {
|
|||||||
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
||||||
newWidget.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
newWidget.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
||||||
if (widget.id === "controlCenterButton") {
|
if (widget.id === "controlCenterButton") {
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? SettingsData.controlCenterShowNetworkIcon;
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? SettingsData.controlCenterShowBluetoothIcon;
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
newWidget.showAudioIcon = widget.showAudioIcon ?? SettingsData.controlCenterShowAudioIcon;
|
||||||
|
newWidget.showVpnIcon = widget.showVpnIcon ?? SettingsData.controlCenterShowVpnIcon;
|
||||||
|
newWidget.showBrightnessIcon = widget.showBrightnessIcon ?? SettingsData.controlCenterShowBrightnessIcon;
|
||||||
|
newWidget.showMicIcon = widget.showMicIcon ?? SettingsData.controlCenterShowMicIcon;
|
||||||
|
newWidget.showBatteryIcon = widget.showBatteryIcon ?? SettingsData.controlCenterShowBatteryIcon;
|
||||||
|
newWidget.showPrinterIcon = widget.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
||||||
}
|
}
|
||||||
widgets[i] = newWidget;
|
widgets[i] = newWidget;
|
||||||
widget = newWidget;
|
widget = newWidget;
|
||||||
@@ -789,6 +826,16 @@ Item {
|
|||||||
item.showBluetoothIcon = widget.showBluetoothIcon;
|
item.showBluetoothIcon = widget.showBluetoothIcon;
|
||||||
if (widget.showAudioIcon !== undefined)
|
if (widget.showAudioIcon !== undefined)
|
||||||
item.showAudioIcon = widget.showAudioIcon;
|
item.showAudioIcon = widget.showAudioIcon;
|
||||||
|
if (widget.showVpnIcon !== undefined)
|
||||||
|
item.showVpnIcon = widget.showVpnIcon;
|
||||||
|
if (widget.showBrightnessIcon !== undefined)
|
||||||
|
item.showBrightnessIcon = widget.showBrightnessIcon;
|
||||||
|
if (widget.showMicIcon !== undefined)
|
||||||
|
item.showMicIcon = widget.showMicIcon;
|
||||||
|
if (widget.showBatteryIcon !== undefined)
|
||||||
|
item.showBatteryIcon = widget.showBatteryIcon;
|
||||||
|
if (widget.showPrinterIcon !== undefined)
|
||||||
|
item.showPrinterIcon = widget.showPrinterIcon;
|
||||||
if (widget.minimumWidth !== undefined)
|
if (widget.minimumWidth !== undefined)
|
||||||
item.minimumWidth = widget.minimumWidth;
|
item.minimumWidth = widget.minimumWidth;
|
||||||
if (widget.showSwap !== undefined)
|
if (widget.showSwap !== undefined)
|
||||||
|
|||||||
@@ -806,50 +806,42 @@ Column {
|
|||||||
{
|
{
|
||||||
icon: "lan",
|
icon: "lan",
|
||||||
label: I18n.tr("Network"),
|
label: I18n.tr("Network"),
|
||||||
setting: "showNetworkIcon",
|
setting: "showNetworkIcon"
|
||||||
checked: SettingsData.controlCenterShowNetworkIcon
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "vpn_lock",
|
icon: "vpn_lock",
|
||||||
label: I18n.tr("VPN"),
|
label: I18n.tr("VPN"),
|
||||||
setting: "showVpnIcon",
|
setting: "showVpnIcon"
|
||||||
checked: SettingsData.controlCenterShowVpnIcon
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "bluetooth",
|
icon: "bluetooth",
|
||||||
label: I18n.tr("Bluetooth"),
|
label: I18n.tr("Bluetooth"),
|
||||||
setting: "showBluetoothIcon",
|
setting: "showBluetoothIcon"
|
||||||
checked: SettingsData.controlCenterShowBluetoothIcon
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "volume_up",
|
icon: "volume_up",
|
||||||
label: I18n.tr("Audio"),
|
label: I18n.tr("Audio"),
|
||||||
setting: "showAudioIcon",
|
setting: "showAudioIcon"
|
||||||
checked: SettingsData.controlCenterShowAudioIcon
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "mic",
|
icon: "mic",
|
||||||
label: I18n.tr("Microphone"),
|
label: I18n.tr("Microphone"),
|
||||||
setting: "showMicIcon",
|
setting: "showMicIcon"
|
||||||
checked: SettingsData.controlCenterShowMicIcon
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "brightness_high",
|
icon: "brightness_high",
|
||||||
label: I18n.tr("Brightness"),
|
label: I18n.tr("Brightness"),
|
||||||
setting: "showBrightnessIcon",
|
setting: "showBrightnessIcon"
|
||||||
checked: SettingsData.controlCenterShowBrightnessIcon
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "battery_full",
|
icon: "battery_full",
|
||||||
label: I18n.tr("Battery"),
|
label: I18n.tr("Battery"),
|
||||||
setting: "showBatteryIcon",
|
setting: "showBatteryIcon"
|
||||||
checked: SettingsData.controlCenterShowBatteryIcon
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "print",
|
icon: "print",
|
||||||
label: I18n.tr("Printer"),
|
label: I18n.tr("Printer"),
|
||||||
setting: "showPrinterIcon",
|
setting: "showPrinterIcon"
|
||||||
checked: SettingsData.controlCenterShowPrinterIcon
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -857,6 +849,30 @@ Column {
|
|||||||
required property var modelData
|
required property var modelData
|
||||||
required property int index
|
required property int index
|
||||||
|
|
||||||
|
function getCheckedState() {
|
||||||
|
var wd = controlCenterContextMenu.widgetData;
|
||||||
|
switch (modelData.setting) {
|
||||||
|
case "showNetworkIcon":
|
||||||
|
return wd?.showNetworkIcon ?? SettingsData.controlCenterShowNetworkIcon;
|
||||||
|
case "showVpnIcon":
|
||||||
|
return wd?.showVpnIcon ?? SettingsData.controlCenterShowVpnIcon;
|
||||||
|
case "showBluetoothIcon":
|
||||||
|
return wd?.showBluetoothIcon ?? SettingsData.controlCenterShowBluetoothIcon;
|
||||||
|
case "showAudioIcon":
|
||||||
|
return wd?.showAudioIcon ?? SettingsData.controlCenterShowAudioIcon;
|
||||||
|
case "showMicIcon":
|
||||||
|
return wd?.showMicIcon ?? SettingsData.controlCenterShowMicIcon;
|
||||||
|
case "showBrightnessIcon":
|
||||||
|
return wd?.showBrightnessIcon ?? SettingsData.controlCenterShowBrightnessIcon;
|
||||||
|
case "showBatteryIcon":
|
||||||
|
return wd?.showBatteryIcon ?? SettingsData.controlCenterShowBatteryIcon;
|
||||||
|
case "showPrinterIcon":
|
||||||
|
return wd?.showPrinterIcon ?? SettingsData.controlCenterShowPrinterIcon;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width: menuColumn.width
|
width: menuColumn.width
|
||||||
height: 32
|
height: 32
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
@@ -891,7 +907,7 @@ Column {
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: 40
|
width: 40
|
||||||
height: 20
|
height: 20
|
||||||
checked: modelData.checked
|
checked: getCheckedState()
|
||||||
onToggled: {
|
onToggled: {
|
||||||
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, modelData.setting, toggled);
|
root.controlCenterSettingChanged(controlCenterContextMenu.sectionId, controlCenterContextMenu.widgetIndex, modelData.setting, toggled);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user