1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-02 03:28:28 -04:00

qs: large sweep of dead code removals

This commit is contained in:
bbedward
2026-07-26 23:22:22 -04:00
parent bab2078dfd
commit c67b185076
113 changed files with 1467 additions and 3254 deletions
+20 -30
View File
@@ -1,6 +1,7 @@
import QtQuick
import qs.Common
import qs.Widgets
import "../../Common/QmlUtils.js" as QmlUtils
Column {
id: root
@@ -16,68 +17,57 @@ Column {
spacing: Theme.spacingS
function loadValue() {
const settings = findSettings()
const settings = QmlUtils.findSettings(root.parent);
if (settings && settings.pluginService) {
value = settings.loadValue(settingKey, defaultValue)
value = settings.loadValue(settingKey, defaultValue);
}
}
Component.onCompleted: {
loadValue()
loadValue();
}
readonly property var optionLabels: {
const labels = []
const labels = [];
for (let i = 0; i < options.length; i++) {
labels.push(options[i].label || options[i])
labels.push(options[i].label || options[i]);
}
return labels
return labels;
}
readonly property var valueToLabel: {
const map = {}
const map = {};
for (let i = 0; i < options.length; i++) {
const opt = options[i]
const opt = options[i];
if (typeof opt === 'object') {
map[opt.value] = opt.label
map[opt.value] = opt.label;
} else {
map[opt] = opt
map[opt] = opt;
}
}
return map
return map;
}
readonly property var labelToValue: {
const map = {}
const map = {};
for (let i = 0; i < options.length; i++) {
const opt = options[i]
const opt = options[i];
if (typeof opt === 'object') {
map[opt.label] = opt.value
map[opt.label] = opt.value;
} else {
map[opt] = opt
map[opt] = opt;
}
}
return map
return map;
}
onValueChanged: {
const settings = findSettings()
const settings = QmlUtils.findSettings(root.parent);
if (settings) {
settings.saveValue(settingKey, value)
settings.saveValue(settingKey, value);
}
}
function findSettings() {
let item = parent
while (item) {
if (item.saveValue !== undefined && item.loadValue !== undefined) {
return item
}
item = item.parent
}
return null
}
DankDropdown {
width: parent.width
text: root.label
@@ -85,7 +75,7 @@ Column {
currentValue: root.valueToLabel[root.value] || root.value
options: root.optionLabels
onValueChanged: newValue => {
root.value = root.labelToValue[newValue] || newValue
root.value = root.labelToValue[newValue] || newValue;
}
}
}