mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-01 19:18:28 -04:00
cc: migrate some settings to cache
port 1.5
This commit is contained in:
@@ -159,7 +159,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
function getPinnedInputs() {
|
||||
const pins = SettingsData.audioInputDevicePins || {};
|
||||
const pins = CacheData.audioInputDevicePins || {};
|
||||
return normalizePinList(pins["preferredInput"]);
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
||||
onClicked: {
|
||||
const pins = JSON.parse(JSON.stringify(SettingsData.audioInputDevicePins || {}));
|
||||
const pins = JSON.parse(JSON.stringify(CacheData.audioInputDevicePins || {}));
|
||||
let pinnedList = audioContent.normalizePinList(pins["preferredInput"]);
|
||||
const pinIndex = pinnedList.indexOf(modelData.name);
|
||||
|
||||
@@ -332,7 +332,7 @@ Rectangle {
|
||||
else
|
||||
delete pins["preferredInput"];
|
||||
|
||||
SettingsData.set("audioInputDevicePins", pins);
|
||||
CacheData.set("audioInputDevicePins", pins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
function getPinnedOutputs() {
|
||||
const pins = SettingsData.audioOutputDevicePins || {};
|
||||
const pins = CacheData.audioOutputDevicePins || {};
|
||||
return normalizePinList(pins["preferredOutput"]);
|
||||
}
|
||||
|
||||
@@ -324,7 +324,7 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
||||
onClicked: {
|
||||
const pins = JSON.parse(JSON.stringify(SettingsData.audioOutputDevicePins || {}));
|
||||
const pins = JSON.parse(JSON.stringify(CacheData.audioOutputDevicePins || {}));
|
||||
let pinnedList = audioContent.normalizePinList(pins["preferredOutput"]);
|
||||
const pinIndex = pinnedList.indexOf(modelData.name);
|
||||
|
||||
@@ -341,7 +341,7 @@ Rectangle {
|
||||
else
|
||||
delete pins["preferredOutput"];
|
||||
|
||||
SettingsData.set("audioOutputDevicePins", pins);
|
||||
CacheData.set("audioOutputDevicePins", pins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
function getPinnedDevices() {
|
||||
const pins = SettingsData.bluetoothDevicePins || {};
|
||||
const pins = CacheData.bluetoothDevicePins || {};
|
||||
return normalizePinList(pins["preferredDevice"]);
|
||||
}
|
||||
|
||||
@@ -395,7 +395,7 @@ Rectangle {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
const pins = JSON.parse(JSON.stringify(SettingsData.bluetoothDevicePins || {}));
|
||||
const pins = JSON.parse(JSON.stringify(CacheData.bluetoothDevicePins || {}));
|
||||
let pinnedList = root.normalizePinList(pins["preferredDevice"]);
|
||||
const pinIndex = pinnedList.indexOf(pairedDelegate.modelData.address);
|
||||
|
||||
@@ -413,7 +413,7 @@ Rectangle {
|
||||
delete pins["preferredDevice"];
|
||||
}
|
||||
|
||||
SettingsData.set("bluetoothDevicePins", pins);
|
||||
CacheData.set("bluetoothDevicePins", pins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ Rectangle {
|
||||
|
||||
const pinKey = getScreenPinKey();
|
||||
if (pinKey.length > 0) {
|
||||
const pins = SettingsData.brightnessDevicePins || {};
|
||||
const pins = CacheData.brightnessDevicePins || {};
|
||||
const pinnedDevice = pins[pinKey];
|
||||
if (pinnedDevice && pinnedDevice.length > 0) {
|
||||
const found = devices.find(d => d.name === pinnedDevice);
|
||||
@@ -85,12 +85,12 @@ Rectangle {
|
||||
}
|
||||
const pinKey = getScreenPinKey();
|
||||
if (pinKey.length > 0) {
|
||||
const pins = SettingsData.brightnessDevicePins || {};
|
||||
const pins = CacheData.brightnessDevicePins || {};
|
||||
const existing = pins[pinKey];
|
||||
if (existing && existing !== deviceName) {
|
||||
const next = JSON.parse(JSON.stringify(pins));
|
||||
delete next[pinKey];
|
||||
SettingsData.set("brightnessDevicePins", next);
|
||||
CacheData.set("brightnessDevicePins", next);
|
||||
}
|
||||
}
|
||||
root.currentDeviceName = deviceName;
|
||||
@@ -106,7 +106,7 @@ Rectangle {
|
||||
const pinKey = getScreenPinKey();
|
||||
if (!pinKey || !deviceName)
|
||||
return false;
|
||||
const pins = SettingsData.brightnessDevicePins || {};
|
||||
const pins = CacheData.brightnessDevicePins || {};
|
||||
return pins[pinKey] === deviceName;
|
||||
}
|
||||
|
||||
@@ -114,13 +114,13 @@ Rectangle {
|
||||
const pinKey = getScreenPinKey();
|
||||
if (!pinKey || !deviceName)
|
||||
return;
|
||||
const pins = JSON.parse(JSON.stringify(SettingsData.brightnessDevicePins || {}));
|
||||
const pins = JSON.parse(JSON.stringify(CacheData.brightnessDevicePins || {}));
|
||||
if (pins[pinKey] === deviceName) {
|
||||
delete pins[pinKey];
|
||||
} else {
|
||||
pins[pinKey] = deviceName;
|
||||
}
|
||||
SettingsData.set("brightnessDevicePins", pins);
|
||||
CacheData.set("brightnessDevicePins", pins);
|
||||
}
|
||||
|
||||
implicitHeight: {
|
||||
@@ -269,7 +269,7 @@ Rectangle {
|
||||
|
||||
readonly property bool selected: !!(modelData && modelData.name === root.currentDeviceName)
|
||||
readonly property bool devicePinnedHere: {
|
||||
SettingsData.brightnessDevicePins;
|
||||
CacheData.brightnessDevicePins;
|
||||
return root.isDevicePinnedToScreen(modelData ? modelData.name : "");
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ Rectangle {
|
||||
}
|
||||
|
||||
function getPinnedNetworks() {
|
||||
const pins = SettingsData.wifiNetworkPins || {};
|
||||
const pins = CacheData.wifiNetworkPins || {};
|
||||
return normalizePinList(pins["preferredWifi"]);
|
||||
}
|
||||
|
||||
@@ -907,7 +907,7 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: mouse => pinRipple.trigger(mouse.x, mouse.y)
|
||||
onClicked: {
|
||||
const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {}));
|
||||
const pins = JSON.parse(JSON.stringify(CacheData.wifiNetworkPins || {}));
|
||||
let pinnedList = root.normalizePinList(pins["preferredWifi"]);
|
||||
const pinIndex = pinnedList.indexOf(modelData.ssid);
|
||||
|
||||
@@ -924,7 +924,7 @@ Rectangle {
|
||||
else
|
||||
delete pins["preferredWifi"];
|
||||
|
||||
SettingsData.set("wifiNetworkPins", pins);
|
||||
CacheData.set("wifiNetworkPins", pins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ Row {
|
||||
if (screenName && screenName.length > 0) {
|
||||
const screen = Quickshell.screens.find(s => s.name === screenName);
|
||||
const pinKey = screen ? SettingsData.getScreenDisplayName(screen) : screenName;
|
||||
const pins = SettingsData.brightnessDevicePins || {};
|
||||
const pins = CacheData.brightnessDevicePins || {};
|
||||
const pinnedDevice = pins[pinKey];
|
||||
if (pinnedDevice && pinnedDevice.length > 0) {
|
||||
const found = DisplayService.devices.find(dev => dev.name === pinnedDevice);
|
||||
|
||||
@@ -203,7 +203,7 @@ BasePill {
|
||||
const pinKey = getScreenPinKey();
|
||||
if (!pinKey)
|
||||
return "";
|
||||
const pins = SettingsData.brightnessDevicePins || {};
|
||||
const pins = CacheData.brightnessDevicePins || {};
|
||||
return pins[pinKey] || "";
|
||||
}
|
||||
|
||||
|
||||
@@ -55,12 +55,12 @@ Item {
|
||||
}
|
||||
|
||||
function getPinnedWifiNetworks() {
|
||||
const pins = SettingsData.wifiNetworkPins || {};
|
||||
const pins = CacheData.wifiNetworkPins || {};
|
||||
return normalizePinList(pins["preferredWifi"]);
|
||||
}
|
||||
|
||||
function toggleWifiPin(ssid) {
|
||||
const pins = JSON.parse(JSON.stringify(SettingsData.wifiNetworkPins || {}));
|
||||
const pins = JSON.parse(JSON.stringify(CacheData.wifiNetworkPins || {}));
|
||||
let pinnedList = normalizePinList(pins["preferredWifi"]);
|
||||
const pinIndex = pinnedList.indexOf(ssid);
|
||||
|
||||
@@ -77,7 +77,7 @@ Item {
|
||||
else
|
||||
delete pins["preferredWifi"];
|
||||
|
||||
SettingsData.set("wifiNetworkPins", pins);
|
||||
CacheData.set("wifiNetworkPins", pins);
|
||||
}
|
||||
|
||||
property var forgetNetworkConfirm: ConfirmModal {}
|
||||
|
||||
Reference in New Issue
Block a user