mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 05:25:41 -05:00
settings: make plugin browser and widget browser floating
This commit is contained in:
@@ -194,9 +194,9 @@ Item {
|
|||||||
// ! Hacky workaround because we want to re-register any vertical bars after changing a hBar
|
// ! Hacky workaround because we want to re-register any vertical bars after changing a hBar
|
||||||
// ! That allows them to re-make with the right exclusiveZone
|
// ! That allows them to re-make with the right exclusiveZone
|
||||||
function notifyHorizontalBarChange() {
|
function notifyHorizontalBarChange() {
|
||||||
if (!selectedBarIsVertical) {
|
if (selectedBarIsVertical)
|
||||||
horizontalBarChangeDebounce.restart();
|
return;
|
||||||
}
|
horizontalBarChangeDebounce.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNewBar() {
|
function createNewBar() {
|
||||||
@@ -290,38 +290,44 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getWidgetsForSection(sectionId) {
|
function getWidgetsForSection(sectionId) {
|
||||||
if (sectionId === "left")
|
switch (sectionId) {
|
||||||
|
case "left":
|
||||||
return selectedBarConfig?.leftWidgets || [];
|
return selectedBarConfig?.leftWidgets || [];
|
||||||
if (sectionId === "center")
|
case "center":
|
||||||
return selectedBarConfig?.centerWidgets || [];
|
return selectedBarConfig?.centerWidgets || [];
|
||||||
if (sectionId === "right")
|
case "right":
|
||||||
return selectedBarConfig?.rightWidgets || [];
|
return selectedBarConfig?.rightWidgets || [];
|
||||||
return [];
|
default:
|
||||||
|
return [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setWidgetsForSection(sectionId, widgets) {
|
function setWidgetsForSection(sectionId, widgets) {
|
||||||
if (sectionId === "left")
|
switch (sectionId) {
|
||||||
|
case "left":
|
||||||
SettingsData.updateBarConfig(selectedBarId, {
|
SettingsData.updateBarConfig(selectedBarId, {
|
||||||
leftWidgets: widgets
|
leftWidgets: widgets
|
||||||
});
|
});
|
||||||
else if (sectionId === "center")
|
break;
|
||||||
|
case "center":
|
||||||
SettingsData.updateBarConfig(selectedBarId, {
|
SettingsData.updateBarConfig(selectedBarId, {
|
||||||
centerWidgets: widgets
|
centerWidgets: widgets
|
||||||
});
|
});
|
||||||
else if (sectionId === "right")
|
break;
|
||||||
|
case "right":
|
||||||
SettingsData.updateBarConfig(selectedBarId, {
|
SettingsData.updateBarConfig(selectedBarId, {
|
||||||
rightWidgets: widgets
|
rightWidgets: widgets
|
||||||
});
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getWidgetsForPopup() {
|
function getWidgetsForPopup() {
|
||||||
return baseWidgetDefinitions.filter(widget => {
|
return baseWidgetDefinitions.filter(widget => {
|
||||||
if (widget.warning && widget.warning.includes("Plugin is disabled")) {
|
if (widget.warning && widget.warning.includes("Plugin is disabled"))
|
||||||
return false;
|
return false;
|
||||||
}
|
if (widget.enabled === false)
|
||||||
if (widget.enabled === false) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -646,36 +652,38 @@ Item {
|
|||||||
for (var i = 0; i < widgets.length; i++) {
|
for (var i = 0; i < widgets.length; i++) {
|
||||||
var widget = widgets[i];
|
var widget = widgets[i];
|
||||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
var widgetId = typeof widget === "string" ? widget : widget.id;
|
||||||
if (widgetId === itemId) {
|
if (widgetId !== itemId)
|
||||||
if (typeof widget === "string") {
|
continue;
|
||||||
widgets[i] = {
|
|
||||||
"id": widget,
|
if (typeof widget === "string") {
|
||||||
"enabled": enabled
|
widgets[i] = {
|
||||||
};
|
"id": widget,
|
||||||
} else {
|
"enabled": enabled
|
||||||
var newWidget = {
|
};
|
||||||
"id": widget.id,
|
|
||||||
"enabled": enabled
|
|
||||||
};
|
|
||||||
if (widget.size !== undefined)
|
|
||||||
newWidget.size = widget.size;
|
|
||||||
if (widget.selectedGpuIndex !== undefined)
|
|
||||||
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
|
||||||
else if (widget.id === "gpuTemp")
|
|
||||||
newWidget.selectedGpuIndex = 0;
|
|
||||||
if (widget.pciId !== undefined)
|
|
||||||
newWidget.pciId = widget.pciId;
|
|
||||||
else if (widget.id === "gpuTemp")
|
|
||||||
newWidget.pciId = "";
|
|
||||||
if (widget.id === "controlCenterButton") {
|
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon !== undefined ? widget.showNetworkIcon : true;
|
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon !== undefined ? widget.showBluetoothIcon : true;
|
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon !== undefined ? widget.showAudioIcon : true;
|
|
||||||
}
|
|
||||||
widgets[i] = newWidget;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var newWidget = {
|
||||||
|
"id": widget.id,
|
||||||
|
"enabled": enabled
|
||||||
|
};
|
||||||
|
if (widget.size !== undefined)
|
||||||
|
newWidget.size = widget.size;
|
||||||
|
if (widget.selectedGpuIndex !== undefined)
|
||||||
|
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
||||||
|
else if (widget.id === "gpuTemp")
|
||||||
|
newWidget.selectedGpuIndex = 0;
|
||||||
|
if (widget.pciId !== undefined)
|
||||||
|
newWidget.pciId = widget.pciId;
|
||||||
|
else if (widget.id === "gpuTemp")
|
||||||
|
newWidget.pciId = "";
|
||||||
|
if (widget.id === "controlCenterButton") {
|
||||||
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
||||||
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
||||||
|
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
||||||
|
}
|
||||||
|
widgets[i] = newWidget;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
}
|
}
|
||||||
@@ -686,227 +694,251 @@ Item {
|
|||||||
|
|
||||||
function handleSpacerSizeChanged(sectionId, widgetIndex, newSize) {
|
function handleSpacerSizeChanged(sectionId, widgetIndex, newSize) {
|
||||||
var widgets = getWidgetsForSection(sectionId).slice();
|
var widgets = getWidgetsForSection(sectionId).slice();
|
||||||
|
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||||
if (widgetIndex >= 0 && widgetIndex < widgets.length) {
|
setWidgetsForSection(sectionId, widgets);
|
||||||
var widget = widgets[widgetIndex];
|
return;
|
||||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
|
||||||
if (widgetId === "spacer") {
|
|
||||||
if (typeof widget === "string") {
|
|
||||||
widgets[widgetIndex] = {
|
|
||||||
"id": widget,
|
|
||||||
"enabled": true,
|
|
||||||
"size": newSize
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
var newWidget = {
|
|
||||||
"id": widget.id,
|
|
||||||
"enabled": widget.enabled,
|
|
||||||
"size": newSize
|
|
||||||
};
|
|
||||||
if (widget.selectedGpuIndex !== undefined)
|
|
||||||
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
|
||||||
if (widget.pciId !== undefined)
|
|
||||||
newWidget.pciId = widget.pciId;
|
|
||||||
if (widget.id === "controlCenterButton") {
|
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon !== undefined ? widget.showNetworkIcon : true;
|
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon !== undefined ? widget.showBluetoothIcon : true;
|
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon !== undefined ? widget.showAudioIcon : true;
|
|
||||||
}
|
|
||||||
widgets[widgetIndex] = newWidget;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var widget = widgets[widgetIndex];
|
||||||
|
var widgetId = typeof widget === "string" ? widget : widget.id;
|
||||||
|
if (widgetId !== "spacer") {
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof widget === "string") {
|
||||||
|
widgets[widgetIndex] = {
|
||||||
|
"id": widget,
|
||||||
|
"enabled": true,
|
||||||
|
"size": newSize
|
||||||
|
};
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newWidget = {
|
||||||
|
"id": widget.id,
|
||||||
|
"enabled": widget.enabled,
|
||||||
|
"size": newSize
|
||||||
|
};
|
||||||
|
if (widget.selectedGpuIndex !== undefined)
|
||||||
|
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
||||||
|
if (widget.pciId !== undefined)
|
||||||
|
newWidget.pciId = widget.pciId;
|
||||||
|
if (widget.id === "controlCenterButton") {
|
||||||
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
||||||
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
||||||
|
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
||||||
|
}
|
||||||
|
widgets[widgetIndex] = newWidget;
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleGpuSelectionChanged(sectionId, widgetIndex, selectedGpuIndex) {
|
function handleGpuSelectionChanged(sectionId, widgetIndex, selectedGpuIndex) {
|
||||||
var widgets = getWidgetsForSection(sectionId).slice();
|
var widgets = getWidgetsForSection(sectionId).slice();
|
||||||
|
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||||
if (widgetIndex >= 0 && widgetIndex < widgets.length) {
|
setWidgetsForSection(sectionId, widgets);
|
||||||
var widget = widgets[widgetIndex];
|
return;
|
||||||
if (typeof widget === "string") {
|
|
||||||
widgets[widgetIndex] = {
|
|
||||||
"id": widget,
|
|
||||||
"enabled": true,
|
|
||||||
"selectedGpuIndex": selectedGpuIndex,
|
|
||||||
"pciId": DgopService.availableGpus && DgopService.availableGpus.length > selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : ""
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
var newWidget = {
|
|
||||||
"id": widget.id,
|
|
||||||
"enabled": widget.enabled,
|
|
||||||
"selectedGpuIndex": selectedGpuIndex,
|
|
||||||
"pciId": DgopService.availableGpus && DgopService.availableGpus.length > selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : ""
|
|
||||||
};
|
|
||||||
if (widget.size !== undefined)
|
|
||||||
newWidget.size = widget.size;
|
|
||||||
widgets[widgetIndex] = newWidget;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pciId = DgopService.availableGpus && DgopService.availableGpus.length > selectedGpuIndex ? DgopService.availableGpus[selectedGpuIndex].pciId : "";
|
||||||
|
var widget = widgets[widgetIndex];
|
||||||
|
if (typeof widget === "string") {
|
||||||
|
widgets[widgetIndex] = {
|
||||||
|
"id": widget,
|
||||||
|
"enabled": true,
|
||||||
|
"selectedGpuIndex": selectedGpuIndex,
|
||||||
|
"pciId": pciId
|
||||||
|
};
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newWidget = {
|
||||||
|
"id": widget.id,
|
||||||
|
"enabled": widget.enabled,
|
||||||
|
"selectedGpuIndex": selectedGpuIndex,
|
||||||
|
"pciId": pciId
|
||||||
|
};
|
||||||
|
if (widget.size !== undefined)
|
||||||
|
newWidget.size = widget.size;
|
||||||
|
widgets[widgetIndex] = newWidget;
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleDiskMountSelectionChanged(sectionId, widgetIndex, mountPath) {
|
function handleDiskMountSelectionChanged(sectionId, widgetIndex, mountPath) {
|
||||||
var widgets = getWidgetsForSection(sectionId).slice();
|
var widgets = getWidgetsForSection(sectionId).slice();
|
||||||
|
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||||
if (widgetIndex >= 0 && widgetIndex < widgets.length) {
|
setWidgetsForSection(sectionId, widgets);
|
||||||
var widget = widgets[widgetIndex];
|
return;
|
||||||
if (typeof widget === "string") {
|
|
||||||
widgets[widgetIndex] = {
|
|
||||||
"id": widget,
|
|
||||||
"enabled": true,
|
|
||||||
"mountPath": mountPath
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
var newWidget = {
|
|
||||||
"id": widget.id,
|
|
||||||
"enabled": widget.enabled,
|
|
||||||
"mountPath": mountPath
|
|
||||||
};
|
|
||||||
if (widget.size !== undefined)
|
|
||||||
newWidget.size = widget.size;
|
|
||||||
if (widget.selectedGpuIndex !== undefined)
|
|
||||||
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
|
||||||
if (widget.pciId !== undefined)
|
|
||||||
newWidget.pciId = widget.pciId;
|
|
||||||
if (widget.id === "controlCenterButton") {
|
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon !== undefined ? widget.showNetworkIcon : true;
|
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon !== undefined ? widget.showBluetoothIcon : true;
|
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon !== undefined ? widget.showAudioIcon : true;
|
|
||||||
}
|
|
||||||
widgets[widgetIndex] = newWidget;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var widget = widgets[widgetIndex];
|
||||||
|
if (typeof widget === "string") {
|
||||||
|
widgets[widgetIndex] = {
|
||||||
|
"id": widget,
|
||||||
|
"enabled": true,
|
||||||
|
"mountPath": mountPath
|
||||||
|
};
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newWidget = {
|
||||||
|
"id": widget.id,
|
||||||
|
"enabled": widget.enabled,
|
||||||
|
"mountPath": mountPath
|
||||||
|
};
|
||||||
|
if (widget.size !== undefined)
|
||||||
|
newWidget.size = widget.size;
|
||||||
|
if (widget.selectedGpuIndex !== undefined)
|
||||||
|
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
||||||
|
if (widget.pciId !== undefined)
|
||||||
|
newWidget.pciId = widget.pciId;
|
||||||
|
if (widget.id === "controlCenterButton") {
|
||||||
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
||||||
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
||||||
|
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
||||||
|
}
|
||||||
|
widgets[widgetIndex] = newWidget;
|
||||||
|
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleControlCenterSettingChanged(sectionId, widgetIndex, settingName, value) {
|
function handleControlCenterSettingChanged(sectionId, widgetIndex, settingName, value) {
|
||||||
switch (settingName) {
|
switch (settingName) {
|
||||||
case "showNetworkIcon":
|
case "showNetworkIcon":
|
||||||
SettingsData.set("controlCenterShowNetworkIcon", value)
|
SettingsData.set("controlCenterShowNetworkIcon", value);
|
||||||
break
|
break;
|
||||||
case "showBluetoothIcon":
|
case "showBluetoothIcon":
|
||||||
SettingsData.set("controlCenterShowBluetoothIcon", value)
|
SettingsData.set("controlCenterShowBluetoothIcon", value);
|
||||||
break
|
break;
|
||||||
case "showAudioIcon":
|
case "showAudioIcon":
|
||||||
SettingsData.set("controlCenterShowAudioIcon", value)
|
SettingsData.set("controlCenterShowAudioIcon", value);
|
||||||
break
|
break;
|
||||||
case "showVpnIcon":
|
case "showVpnIcon":
|
||||||
SettingsData.set("controlCenterShowVpnIcon", value)
|
SettingsData.set("controlCenterShowVpnIcon", value);
|
||||||
break
|
break;
|
||||||
case "showBrightnessIcon":
|
case "showBrightnessIcon":
|
||||||
SettingsData.set("controlCenterShowBrightnessIcon", value)
|
SettingsData.set("controlCenterShowBrightnessIcon", value);
|
||||||
break
|
break;
|
||||||
case "showMicIcon":
|
case "showMicIcon":
|
||||||
SettingsData.set("controlCenterShowMicIcon", value)
|
SettingsData.set("controlCenterShowMicIcon", value);
|
||||||
break
|
break;
|
||||||
case "showBatteryIcon":
|
case "showBatteryIcon":
|
||||||
SettingsData.set("controlCenterShowBatteryIcon", value)
|
SettingsData.set("controlCenterShowBatteryIcon", value);
|
||||||
break
|
break;
|
||||||
case "showPrinterIcon":
|
case "showPrinterIcon":
|
||||||
SettingsData.set("controlCenterShowPrinterIcon", value)
|
SettingsData.set("controlCenterShowPrinterIcon", value);
|
||||||
break
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePrivacySettingChanged(sectionId, widgetIndex, settingName, value) {
|
function handlePrivacySettingChanged(sectionId, widgetIndex, settingName, value) {
|
||||||
if (settingName === "showMicIcon") {
|
switch (settingName) {
|
||||||
|
case "showMicIcon":
|
||||||
SettingsData.set("privacyShowMicIcon", value);
|
SettingsData.set("privacyShowMicIcon", value);
|
||||||
} else if (settingName === "showCameraIcon") {
|
break;
|
||||||
|
case "showCameraIcon":
|
||||||
SettingsData.set("privacyShowCameraIcon", value);
|
SettingsData.set("privacyShowCameraIcon", value);
|
||||||
} else if (settingName === "showScreenSharingIcon") {
|
break;
|
||||||
|
case "showScreenSharingIcon":
|
||||||
SettingsData.set("privacyShowScreenShareIcon", value);
|
SettingsData.set("privacyShowScreenShareIcon", value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMinimumWidthChanged(sectionId, widgetIndex, enabled) {
|
function handleMinimumWidthChanged(sectionId, widgetIndex, enabled) {
|
||||||
var widgets = getWidgetsForSection(sectionId).slice();
|
var widgets = getWidgetsForSection(sectionId).slice();
|
||||||
|
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||||
if (widgetIndex >= 0 && widgetIndex < widgets.length) {
|
setWidgetsForSection(sectionId, widgets);
|
||||||
var widget = widgets[widgetIndex];
|
return;
|
||||||
if (typeof widget === "string") {
|
|
||||||
widgets[widgetIndex] = {
|
|
||||||
"id": widget,
|
|
||||||
"enabled": true,
|
|
||||||
"minimumWidth": enabled
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
var newWidget = {
|
|
||||||
"id": widget.id,
|
|
||||||
"enabled": widget.enabled,
|
|
||||||
"minimumWidth": enabled
|
|
||||||
};
|
|
||||||
if (widget.size !== undefined)
|
|
||||||
newWidget.size = widget.size;
|
|
||||||
if (widget.selectedGpuIndex !== undefined)
|
|
||||||
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
|
||||||
if (widget.pciId !== undefined)
|
|
||||||
newWidget.pciId = widget.pciId;
|
|
||||||
if (widget.mountPath !== undefined)
|
|
||||||
newWidget.mountPath = widget.mountPath;
|
|
||||||
if (widget.showSwap !== undefined)
|
|
||||||
newWidget.showSwap = widget.showSwap;
|
|
||||||
if (widget.id === "controlCenterButton") {
|
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon !== undefined ? widget.showNetworkIcon : true;
|
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon !== undefined ? widget.showBluetoothIcon : true;
|
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon !== undefined ? widget.showAudioIcon : true;
|
|
||||||
}
|
|
||||||
widgets[widgetIndex] = newWidget;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var widget = widgets[widgetIndex];
|
||||||
|
if (typeof widget === "string") {
|
||||||
|
widgets[widgetIndex] = {
|
||||||
|
"id": widget,
|
||||||
|
"enabled": true,
|
||||||
|
"minimumWidth": enabled
|
||||||
|
};
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newWidget = {
|
||||||
|
"id": widget.id,
|
||||||
|
"enabled": widget.enabled,
|
||||||
|
"minimumWidth": enabled
|
||||||
|
};
|
||||||
|
if (widget.size !== undefined)
|
||||||
|
newWidget.size = widget.size;
|
||||||
|
if (widget.selectedGpuIndex !== undefined)
|
||||||
|
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
||||||
|
if (widget.pciId !== undefined)
|
||||||
|
newWidget.pciId = widget.pciId;
|
||||||
|
if (widget.mountPath !== undefined)
|
||||||
|
newWidget.mountPath = widget.mountPath;
|
||||||
|
if (widget.showSwap !== undefined)
|
||||||
|
newWidget.showSwap = widget.showSwap;
|
||||||
|
if (widget.id === "controlCenterButton") {
|
||||||
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
||||||
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
||||||
|
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
||||||
|
}
|
||||||
|
widgets[widgetIndex] = newWidget;
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleShowSwapChanged(sectionId, widgetIndex, enabled) {
|
function handleShowSwapChanged(sectionId, widgetIndex, enabled) {
|
||||||
var widgets = getWidgetsForSection(sectionId).slice();
|
var widgets = getWidgetsForSection(sectionId).slice();
|
||||||
|
if (widgetIndex < 0 || widgetIndex >= widgets.length) {
|
||||||
if (widgetIndex >= 0 && widgetIndex < widgets.length) {
|
setWidgetsForSection(sectionId, widgets);
|
||||||
var widget = widgets[widgetIndex];
|
return;
|
||||||
if (typeof widget === "string") {
|
|
||||||
widgets[widgetIndex] = {
|
|
||||||
"id": widget,
|
|
||||||
"enabled": true,
|
|
||||||
"showSwap": enabled
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
var newWidget = {
|
|
||||||
"id": widget.id,
|
|
||||||
"enabled": widget.enabled,
|
|
||||||
"showSwap": enabled
|
|
||||||
};
|
|
||||||
if (widget.size !== undefined)
|
|
||||||
newWidget.size = widget.size;
|
|
||||||
if (widget.selectedGpuIndex !== undefined)
|
|
||||||
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
|
||||||
if (widget.pciId !== undefined)
|
|
||||||
newWidget.pciId = widget.pciId;
|
|
||||||
if (widget.mountPath !== undefined)
|
|
||||||
newWidget.mountPath = widget.mountPath;
|
|
||||||
if (widget.minimumWidth !== undefined)
|
|
||||||
newWidget.minimumWidth = widget.minimumWidth;
|
|
||||||
if (widget.mediaSize !== undefined)
|
|
||||||
newWidget.mediaSize = widget.mediaSize;
|
|
||||||
if (widget.clockCompactMode !== undefined)
|
|
||||||
newWidget.clockCompactMode = widget.clockCompactMode;
|
|
||||||
if (widget.focusedWindowCompactMode !== undefined)
|
|
||||||
newWidget.focusedWindowCompactMode = widget.focusedWindowCompactMode;
|
|
||||||
if (widget.runningAppsCompactMode !== undefined)
|
|
||||||
newWidget.runningAppsCompactMode = widget.runningAppsCompactMode;
|
|
||||||
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
|
||||||
newWidget.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
|
||||||
if (widget.id === "controlCenterButton") {
|
|
||||||
newWidget.showNetworkIcon = widget.showNetworkIcon !== undefined ? widget.showNetworkIcon : true;
|
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon !== undefined ? widget.showBluetoothIcon : true;
|
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon !== undefined ? widget.showAudioIcon : true;
|
|
||||||
}
|
|
||||||
widgets[widgetIndex] = newWidget;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var widget = widgets[widgetIndex];
|
||||||
|
if (typeof widget === "string") {
|
||||||
|
widgets[widgetIndex] = {
|
||||||
|
"id": widget,
|
||||||
|
"enabled": true,
|
||||||
|
"showSwap": enabled
|
||||||
|
};
|
||||||
|
setWidgetsForSection(sectionId, widgets);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var newWidget = {
|
||||||
|
"id": widget.id,
|
||||||
|
"enabled": widget.enabled,
|
||||||
|
"showSwap": enabled
|
||||||
|
};
|
||||||
|
if (widget.size !== undefined)
|
||||||
|
newWidget.size = widget.size;
|
||||||
|
if (widget.selectedGpuIndex !== undefined)
|
||||||
|
newWidget.selectedGpuIndex = widget.selectedGpuIndex;
|
||||||
|
if (widget.pciId !== undefined)
|
||||||
|
newWidget.pciId = widget.pciId;
|
||||||
|
if (widget.mountPath !== undefined)
|
||||||
|
newWidget.mountPath = widget.mountPath;
|
||||||
|
if (widget.minimumWidth !== undefined)
|
||||||
|
newWidget.minimumWidth = widget.minimumWidth;
|
||||||
|
if (widget.mediaSize !== undefined)
|
||||||
|
newWidget.mediaSize = widget.mediaSize;
|
||||||
|
if (widget.clockCompactMode !== undefined)
|
||||||
|
newWidget.clockCompactMode = widget.clockCompactMode;
|
||||||
|
if (widget.focusedWindowCompactMode !== undefined)
|
||||||
|
newWidget.focusedWindowCompactMode = widget.focusedWindowCompactMode;
|
||||||
|
if (widget.runningAppsCompactMode !== undefined)
|
||||||
|
newWidget.runningAppsCompactMode = widget.runningAppsCompactMode;
|
||||||
|
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
||||||
|
newWidget.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
||||||
|
if (widget.id === "controlCenterButton") {
|
||||||
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
||||||
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
||||||
|
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
||||||
|
}
|
||||||
|
widgets[widgetIndex] = newWidget;
|
||||||
setWidgetsForSection(sectionId, widgets);
|
setWidgetsForSection(sectionId, widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -932,7 +964,6 @@ Item {
|
|||||||
"id": widget.id,
|
"id": widget.id,
|
||||||
"enabled": widget.enabled
|
"enabled": widget.enabled
|
||||||
};
|
};
|
||||||
|
|
||||||
if (widget.size !== undefined)
|
if (widget.size !== undefined)
|
||||||
newWidget.size = widget.size;
|
newWidget.size = widget.size;
|
||||||
if (widget.selectedGpuIndex !== undefined)
|
if (widget.selectedGpuIndex !== undefined)
|
||||||
@@ -956,11 +987,10 @@ 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 !== undefined ? widget.showNetworkIcon : true;
|
newWidget.showNetworkIcon = widget.showNetworkIcon ?? true;
|
||||||
newWidget.showBluetoothIcon = widget.showBluetoothIcon !== undefined ? widget.showBluetoothIcon : true;
|
newWidget.showBluetoothIcon = widget.showBluetoothIcon ?? true;
|
||||||
newWidget.showAudioIcon = widget.showAudioIcon !== undefined ? widget.showAudioIcon : true;
|
newWidget.showAudioIcon = widget.showAudioIcon ?? true;
|
||||||
}
|
}
|
||||||
|
|
||||||
widgets[i] = newWidget;
|
widgets[i] = newWidget;
|
||||||
widget = newWidget;
|
widget = newWidget;
|
||||||
}
|
}
|
||||||
@@ -993,59 +1023,45 @@ Item {
|
|||||||
var widgets = [];
|
var widgets = [];
|
||||||
var widgetData = getWidgetsForSection(sectionId);
|
var widgetData = getWidgetsForSection(sectionId);
|
||||||
widgetData.forEach(widget => {
|
widgetData.forEach(widget => {
|
||||||
var widgetId = typeof widget === "string" ? widget : widget.id;
|
var isString = typeof widget === "string";
|
||||||
var widgetEnabled = typeof widget === "string" ? true : widget.enabled;
|
var widgetId = isString ? widget : widget.id;
|
||||||
var widgetSize = typeof widget === "string" ? undefined : widget.size;
|
var widgetDef = baseWidgetDefinitions.find(w => w.id === widgetId);
|
||||||
var widgetSelectedGpuIndex = typeof widget === "string" ? undefined : widget.selectedGpuIndex;
|
if (!widgetDef)
|
||||||
var widgetPciId = typeof widget === "string" ? undefined : widget.pciId;
|
return;
|
||||||
var widgetMountPath = typeof widget === "string" ? undefined : widget.mountPath;
|
|
||||||
var widgetShowNetworkIcon = typeof widget === "string" ? undefined : widget.showNetworkIcon;
|
|
||||||
var widgetShowBluetoothIcon = typeof widget === "string" ? undefined : widget.showBluetoothIcon;
|
|
||||||
var widgetShowAudioIcon = typeof widget === "string" ? undefined : widget.showAudioIcon;
|
|
||||||
var widgetMinimumWidth = typeof widget === "string" ? undefined : widget.minimumWidth;
|
|
||||||
var widgetShowSwap = typeof widget === "string" ? undefined : widget.showSwap;
|
|
||||||
var widgetMediaSize = typeof widget === "string" ? undefined : widget.mediaSize;
|
|
||||||
var widgetClockCompactMode = typeof widget === "string" ? undefined : widget.clockCompactMode;
|
|
||||||
var widgetFocusedWindowCompactMode = typeof widget === "string" ? undefined : widget.focusedWindowCompactMode;
|
|
||||||
var widgetRunningAppsCompactMode = typeof widget === "string" ? undefined : widget.runningAppsCompactMode;
|
|
||||||
var widgetKeyboardLayoutNameCompactMode = typeof widget === "string" ? undefined : widget.keyboardLayoutNameCompactMode;
|
|
||||||
var widgetDef = baseWidgetDefinitions.find(w => {
|
|
||||||
return w.id === widgetId;
|
|
||||||
});
|
|
||||||
if (widgetDef) {
|
|
||||||
var item = Object.assign({}, widgetDef);
|
|
||||||
item.enabled = widgetEnabled;
|
|
||||||
if (widgetSize !== undefined)
|
|
||||||
item.size = widgetSize;
|
|
||||||
if (widgetSelectedGpuIndex !== undefined)
|
|
||||||
item.selectedGpuIndex = widgetSelectedGpuIndex;
|
|
||||||
if (widgetPciId !== undefined)
|
|
||||||
item.pciId = widgetPciId;
|
|
||||||
if (widgetMountPath !== undefined)
|
|
||||||
item.mountPath = widgetMountPath;
|
|
||||||
if (widgetShowNetworkIcon !== undefined)
|
|
||||||
item.showNetworkIcon = widgetShowNetworkIcon;
|
|
||||||
if (widgetShowBluetoothIcon !== undefined)
|
|
||||||
item.showBluetoothIcon = widgetShowBluetoothIcon;
|
|
||||||
if (widgetShowAudioIcon !== undefined)
|
|
||||||
item.showAudioIcon = widgetShowAudioIcon;
|
|
||||||
if (widgetMinimumWidth !== undefined)
|
|
||||||
item.minimumWidth = widgetMinimumWidth;
|
|
||||||
if (widgetShowSwap !== undefined)
|
|
||||||
item.showSwap = widgetShowSwap;
|
|
||||||
if (widgetMediaSize !== undefined)
|
|
||||||
item.mediaSize = widgetMediaSize;
|
|
||||||
if (widgetClockCompactMode !== undefined)
|
|
||||||
item.clockCompactMode = widgetClockCompactMode;
|
|
||||||
if (widgetFocusedWindowCompactMode !== undefined)
|
|
||||||
item.focusedWindowCompactMode = widgetFocusedWindowCompactMode;
|
|
||||||
if (widgetRunningAppsCompactMode !== undefined)
|
|
||||||
item.runningAppsCompactMode = widgetRunningAppsCompactMode;
|
|
||||||
if (widgetKeyboardLayoutNameCompactMode !== undefined)
|
|
||||||
item.keyboardLayoutNameCompactMode = widgetKeyboardLayoutNameCompactMode;
|
|
||||||
|
|
||||||
widgets.push(item);
|
var item = Object.assign({}, widgetDef);
|
||||||
|
item.enabled = isString ? true : widget.enabled;
|
||||||
|
if (!isString) {
|
||||||
|
if (widget.size !== undefined)
|
||||||
|
item.size = widget.size;
|
||||||
|
if (widget.selectedGpuIndex !== undefined)
|
||||||
|
item.selectedGpuIndex = widget.selectedGpuIndex;
|
||||||
|
if (widget.pciId !== undefined)
|
||||||
|
item.pciId = widget.pciId;
|
||||||
|
if (widget.mountPath !== undefined)
|
||||||
|
item.mountPath = widget.mountPath;
|
||||||
|
if (widget.showNetworkIcon !== undefined)
|
||||||
|
item.showNetworkIcon = widget.showNetworkIcon;
|
||||||
|
if (widget.showBluetoothIcon !== undefined)
|
||||||
|
item.showBluetoothIcon = widget.showBluetoothIcon;
|
||||||
|
if (widget.showAudioIcon !== undefined)
|
||||||
|
item.showAudioIcon = widget.showAudioIcon;
|
||||||
|
if (widget.minimumWidth !== undefined)
|
||||||
|
item.minimumWidth = widget.minimumWidth;
|
||||||
|
if (widget.showSwap !== undefined)
|
||||||
|
item.showSwap = widget.showSwap;
|
||||||
|
if (widget.mediaSize !== undefined)
|
||||||
|
item.mediaSize = widget.mediaSize;
|
||||||
|
if (widget.clockCompactMode !== undefined)
|
||||||
|
item.clockCompactMode = widget.clockCompactMode;
|
||||||
|
if (widget.focusedWindowCompactMode !== undefined)
|
||||||
|
item.focusedWindowCompactMode = widget.focusedWindowCompactMode;
|
||||||
|
if (widget.runningAppsCompactMode !== undefined)
|
||||||
|
item.runningAppsCompactMode = widget.runningAppsCompactMode;
|
||||||
|
if (widget.keyboardLayoutNameCompactMode !== undefined)
|
||||||
|
item.keyboardLayoutNameCompactMode = widget.keyboardLayoutNameCompactMode;
|
||||||
}
|
}
|
||||||
|
widgets.push(item);
|
||||||
});
|
});
|
||||||
return widgets;
|
return widgets;
|
||||||
}
|
}
|
||||||
@@ -1139,49 +1155,13 @@ Item {
|
|||||||
implicitHeight: 1
|
implicitHeight: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
DankButton {
|
||||||
id: addBarBtn
|
text: I18n.tr("Add Bar")
|
||||||
width: 100
|
iconName: "add"
|
||||||
height: 32
|
buttonHeight: 32
|
||||||
radius: Theme.cornerRadius
|
|
||||||
color: addBarArea.containsMouse ? Theme.primaryPressed : Theme.primary
|
|
||||||
visible: SettingsData.barConfigs.length < 4
|
visible: SettingsData.barConfigs.length < 4
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
onClicked: dankBarTab.createNewBar()
|
||||||
Row {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: Theme.spacingXS
|
|
||||||
|
|
||||||
DankIcon {
|
|
||||||
name: "add"
|
|
||||||
size: 14
|
|
||||||
color: Theme.onPrimary
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: I18n.tr("Add Bar")
|
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
|
||||||
font.weight: Font.Medium
|
|
||||||
color: Theme.onPrimary
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: addBarArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: dankBarTab.createNewBar()
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3284,7 +3264,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center/Middle Section
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: centerSection.implicitHeight + Theme.spacingL * 2
|
height: centerSection.implicitHeight + Theme.spacingL * 2
|
||||||
@@ -3343,7 +3322,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Right/Bottom Section
|
|
||||||
StyledRect {
|
StyledRect {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: rightSection.implicitHeight + Theme.spacingL * 2
|
height: rightSection.implicitHeight + Theme.spacingL * 2
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import QtCore
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
|
||||||
import QtQuick.Effects
|
import QtQuick.Effects
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals
|
|
||||||
import qs.Modals.FileBrowser
|
import qs.Modals.FileBrowser
|
||||||
import qs.Services
|
import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
@@ -1542,7 +1539,7 @@ Item {
|
|||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
checked: SessionData.isLightMode
|
checked: SessionData.isLightMode
|
||||||
onToggleCompleted: checked => {
|
onToggled: checked => {
|
||||||
Theme.screenTransition();
|
Theme.screenTransition();
|
||||||
Theme.setLightMode(checked);
|
Theme.setLightMode(checked);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -124,7 +124,7 @@ FocusScope {
|
|||||||
iconName: "store"
|
iconName: "store"
|
||||||
enabled: DMSService.dmsAvailable
|
enabled: DMSService.dmsAvailable
|
||||||
onClicked: {
|
onClicked: {
|
||||||
pluginBrowserModal.show();
|
pluginBrowser.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,9 +286,9 @@ FocusScope {
|
|||||||
Connections {
|
Connections {
|
||||||
target: DMSService
|
target: DMSService
|
||||||
function onPluginsListReceived(plugins) {
|
function onPluginsListReceived(plugins) {
|
||||||
pluginBrowserModal.isLoading = false;
|
pluginBrowser.isLoading = false;
|
||||||
pluginBrowserModal.allPlugins = plugins;
|
pluginBrowser.allPlugins = plugins;
|
||||||
pluginBrowserModal.updateFilteredPlugins();
|
pluginBrowser.updateFilteredPlugins();
|
||||||
}
|
}
|
||||||
function onInstalledPluginsReceived(plugins) {
|
function onInstalledPluginsReceived(plugins) {
|
||||||
var pluginMap = {};
|
var pluginMap = {};
|
||||||
@@ -314,13 +314,12 @@ FocusScope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
pluginBrowserModal.parentModal = pluginsTab.parentModal;
|
pluginBrowser.parentModal = pluginsTab.parentModal;
|
||||||
if (DMSService.dmsAvailable && DMSService.apiVersion >= 8) {
|
if (DMSService.dmsAvailable && DMSService.apiVersion >= 8)
|
||||||
DMSService.listInstalled();
|
DMSService.listInstalled();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginBrowser {
|
PluginBrowser {
|
||||||
id: pluginBrowserModal
|
id: pluginBrowser
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
import qs.Common
|
import qs.Common
|
||||||
import qs.Modals.Common
|
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
DankModal {
|
FloatingWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var allWidgets: []
|
property var allWidgets: []
|
||||||
@@ -12,7 +12,6 @@ DankModal {
|
|||||||
property var filteredWidgets: []
|
property var filteredWidgets: []
|
||||||
property int selectedIndex: -1
|
property int selectedIndex: -1
|
||||||
property bool keyboardNavigationActive: false
|
property bool keyboardNavigationActive: false
|
||||||
property Component widgetSelectionContent
|
|
||||||
property var parentModal: null
|
property var parentModal: null
|
||||||
|
|
||||||
signal widgetSelected(string widgetId, string targetSection)
|
signal widgetSelected(string widgetId, string targetSection)
|
||||||
@@ -32,9 +31,8 @@ DankModal {
|
|||||||
var description = widget.description ? widget.description.toLowerCase() : "";
|
var description = widget.description ? widget.description.toLowerCase() : "";
|
||||||
var id = widget.id ? widget.id.toLowerCase() : "";
|
var id = widget.id ? widget.id.toLowerCase() : "";
|
||||||
|
|
||||||
if (text.indexOf(query) !== -1 || description.indexOf(query) !== -1 || id.indexOf(query) !== -1) {
|
if (text.indexOf(query) !== -1 || description.indexOf(query) !== -1 || id.indexOf(query) !== -1)
|
||||||
filtered.push(widget);
|
filtered.push(widget);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filteredWidgets = filtered;
|
filteredWidgets = filtered;
|
||||||
@@ -58,136 +56,134 @@ DankModal {
|
|||||||
return;
|
return;
|
||||||
keyboardNavigationActive = true;
|
keyboardNavigationActive = true;
|
||||||
selectedIndex = Math.max(selectedIndex - 1, -1);
|
selectedIndex = Math.max(selectedIndex - 1, -1);
|
||||||
if (selectedIndex === -1) {
|
if (selectedIndex === -1)
|
||||||
keyboardNavigationActive = false;
|
keyboardNavigationActive = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectWidget() {
|
function selectWidget() {
|
||||||
if (selectedIndex >= 0 && selectedIndex < filteredWidgets.length) {
|
if (selectedIndex < 0 || selectedIndex >= filteredWidgets.length)
|
||||||
var widget = filteredWidgets[selectedIndex];
|
return;
|
||||||
root.widgetSelected(widget.id, root.targetSection);
|
var widget = filteredWidgets[selectedIndex];
|
||||||
root.close();
|
root.widgetSelected(widget.id, root.targetSection);
|
||||||
}
|
root.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function show() {
|
function show() {
|
||||||
if (parentModal) {
|
if (parentModal)
|
||||||
parentModal.shouldHaveFocus = false;
|
parentModal.shouldHaveFocus = false;
|
||||||
}
|
visible = true;
|
||||||
open();
|
|
||||||
Qt.callLater(() => {
|
Qt.callLater(() => {
|
||||||
if (contentLoader.item && contentLoader.item.searchField) {
|
searchField.forceActiveFocus();
|
||||||
contentLoader.item.searchField.forceActiveFocus();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function hide() {
|
function hide() {
|
||||||
close();
|
visible = false;
|
||||||
if (parentModal) {
|
if (!parentModal)
|
||||||
parentModal.shouldHaveFocus = Qt.binding(() => {
|
return;
|
||||||
return parentModal.shouldBeVisible;
|
parentModal.shouldHaveFocus = Qt.binding(() => parentModal.shouldBeVisible);
|
||||||
});
|
Qt.callLater(() => {
|
||||||
Qt.callLater(() => {
|
if (parentModal && parentModal.modalFocusScope)
|
||||||
if (parentModal && parentModal.modalFocusScope) {
|
parentModal.modalFocusScope.forceActiveFocus();
|
||||||
parentModal.modalFocusScope.forceActiveFocus();
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modalWidth: 500
|
objectName: "widgetSelectionPopup"
|
||||||
modalHeight: 550
|
title: I18n.tr("Add Widget")
|
||||||
allowStacking: true
|
implicitWidth: 500
|
||||||
backgroundOpacity: 0
|
implicitHeight: 550
|
||||||
closeOnEscapeKey: false
|
color: Theme.withAlpha(Theme.surfaceContainer, Theme.popupTransparency)
|
||||||
onDialogClosed: () => {
|
visible: false
|
||||||
|
|
||||||
|
onVisibleChanged: {
|
||||||
|
if (visible) {
|
||||||
|
Qt.callLater(() => {
|
||||||
|
searchField.forceActiveFocus();
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
allWidgets = [];
|
allWidgets = [];
|
||||||
targetSection = "";
|
targetSection = "";
|
||||||
searchQuery = "";
|
searchQuery = "";
|
||||||
filteredWidgets = [];
|
filteredWidgets = [];
|
||||||
selectedIndex = -1;
|
selectedIndex = -1;
|
||||||
keyboardNavigationActive = false;
|
keyboardNavigationActive = false;
|
||||||
if (parentModal) {
|
if (!parentModal)
|
||||||
parentModal.shouldHaveFocus = Qt.binding(() => {
|
return;
|
||||||
return parentModal.shouldBeVisible;
|
parentModal.shouldHaveFocus = Qt.binding(() => parentModal.shouldBeVisible);
|
||||||
});
|
Qt.callLater(() => {
|
||||||
Qt.callLater(() => {
|
if (parentModal && parentModal.modalFocusScope)
|
||||||
if (parentModal && parentModal.modalFocusScope) {
|
parentModal.modalFocusScope.forceActiveFocus();
|
||||||
parentModal.modalFocusScope.forceActiveFocus();
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
FocusScope {
|
||||||
|
id: widgetKeyHandler
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
|
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_Escape:
|
||||||
|
root.hide();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Down:
|
||||||
|
root.selectNext();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Up:
|
||||||
|
root.selectPrevious();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_Return:
|
||||||
|
case Qt.Key_Enter:
|
||||||
|
if (root.keyboardNavigationActive) {
|
||||||
|
root.selectWidget();
|
||||||
|
} else if (root.filteredWidgets.length > 0) {
|
||||||
|
var firstWidget = root.filteredWidgets[0];
|
||||||
|
root.widgetSelected(firstWidget.id, root.targetSection);
|
||||||
|
root.hide();
|
||||||
}
|
}
|
||||||
});
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.modifiers & Qt.ControlModifier) {
|
||||||
|
switch (event.key) {
|
||||||
|
case Qt.Key_N:
|
||||||
|
case Qt.Key_J:
|
||||||
|
root.selectNext();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
case Qt.Key_P:
|
||||||
|
case Qt.Key_K:
|
||||||
|
root.selectPrevious();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
onBackgroundClicked: () => {
|
|
||||||
return hide();
|
|
||||||
}
|
|
||||||
content: widgetSelectionContent
|
|
||||||
|
|
||||||
widgetSelectionContent: Component {
|
|
||||||
FocusScope {
|
|
||||||
id: widgetKeyHandler
|
|
||||||
property alias searchField: searchField
|
|
||||||
|
|
||||||
|
Column {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
focus: true
|
spacing: 0
|
||||||
|
|
||||||
Keys.onPressed: event => {
|
Item {
|
||||||
if (event.key === Qt.Key_Escape) {
|
id: titleBar
|
||||||
root.close();
|
width: parent.width
|
||||||
event.accepted = true;
|
height: 48
|
||||||
} else if (event.key === Qt.Key_Down) {
|
|
||||||
root.selectNext();
|
Rectangle {
|
||||||
event.accepted = true;
|
anchors.fill: parent
|
||||||
} else if (event.key === Qt.Key_Up) {
|
color: Theme.surfaceContainer
|
||||||
root.selectPrevious();
|
opacity: 0.5
|
||||||
event.accepted = true;
|
|
||||||
} else if (event.key === Qt.Key_N && event.modifiers & Qt.ControlModifier) {
|
|
||||||
root.selectNext();
|
|
||||||
event.accepted = true;
|
|
||||||
} else if (event.key === Qt.Key_P && event.modifiers & Qt.ControlModifier) {
|
|
||||||
root.selectPrevious();
|
|
||||||
event.accepted = true;
|
|
||||||
} else if (event.key === Qt.Key_J && event.modifiers & Qt.ControlModifier) {
|
|
||||||
root.selectNext();
|
|
||||||
event.accepted = true;
|
|
||||||
} else if (event.key === Qt.Key_K && event.modifiers & Qt.ControlModifier) {
|
|
||||||
root.selectPrevious();
|
|
||||||
event.accepted = true;
|
|
||||||
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
|
||||||
if (root.keyboardNavigationActive) {
|
|
||||||
root.selectWidget();
|
|
||||||
} else if (root.filteredWidgets.length > 0) {
|
|
||||||
var firstWidget = root.filteredWidgets[0];
|
|
||||||
root.widgetSelected(firstWidget.id, root.targetSection);
|
|
||||||
root.close();
|
|
||||||
}
|
|
||||||
event.accepted = true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
DankActionButton {
|
|
||||||
iconName: "close"
|
|
||||||
iconSize: Theme.iconSize - 2
|
|
||||||
iconColor: Theme.outline
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: Theme.spacingM
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Theme.spacingM
|
|
||||||
onClicked: root.close()
|
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
id: contentColumn
|
|
||||||
|
|
||||||
spacing: Theme.spacingM
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Theme.spacingL
|
|
||||||
anchors.topMargin: Theme.spacingL + 30 // Space for close button
|
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
width: parent.width
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: Theme.spacingL
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
@@ -198,134 +194,158 @@ DankModal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
text: I18n.tr("Add Widget to ") + root.targetSection + " Section"
|
text: I18n.tr("Add Widget to %1 Section").arg(root.targetSection)
|
||||||
font.pixelSize: Theme.fontSizeLarge
|
font.pixelSize: Theme.fontSizeXLarge
|
||||||
font.weight: Font.Medium
|
|
||||||
color: Theme.surfaceText
|
color: Theme.surfaceText
|
||||||
|
font.weight: Font.Medium
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
DankActionButton {
|
||||||
text: I18n.tr("Select a widget to add to the ") + root.targetSection.toLowerCase() + " section of the top bar. You can add multiple instances of the same widget if needed."
|
circular: false
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
iconName: "close"
|
||||||
color: Theme.outline
|
iconSize: Theme.iconSize - 4
|
||||||
width: parent.width
|
iconColor: Theme.surfaceText
|
||||||
wrapMode: Text.WordWrap
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Theme.spacingM
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onClicked: root.hide()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DankTextField {
|
Item {
|
||||||
id: searchField
|
width: parent.width
|
||||||
width: parent.width
|
height: parent.height - titleBar.height
|
||||||
height: 48
|
|
||||||
cornerRadius: Theme.cornerRadius
|
Column {
|
||||||
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
id: contentColumn
|
||||||
normalBorderColor: Theme.outlineMedium
|
anchors.fill: parent
|
||||||
focusedBorderColor: Theme.primary
|
anchors.margins: Theme.spacingL
|
||||||
leftIconName: "search"
|
spacing: Theme.spacingM
|
||||||
leftIconSize: Theme.iconSize
|
|
||||||
leftIconColor: Theme.surfaceVariantText
|
StyledText {
|
||||||
leftIconFocusedColor: Theme.primary
|
text: I18n.tr("Select a widget to add. You can add multiple instances of the same widget if needed.")
|
||||||
showClearButton: true
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
textColor: Theme.surfaceText
|
color: Theme.outline
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
width: parent.width
|
||||||
placeholderText: ""
|
wrapMode: Text.WordWrap
|
||||||
text: root.searchQuery
|
|
||||||
focus: true
|
|
||||||
ignoreLeftRightKeys: true
|
|
||||||
keyForwardTargets: [widgetKeyHandler]
|
|
||||||
onTextEdited: {
|
|
||||||
root.searchQuery = text;
|
|
||||||
updateFilteredWidgets();
|
|
||||||
}
|
}
|
||||||
Keys.onPressed: event => {
|
|
||||||
if (event.key === Qt.Key_Escape) {
|
DankTextField {
|
||||||
root.close();
|
id: searchField
|
||||||
event.accepted = true;
|
width: parent.width
|
||||||
} else if (event.key === Qt.Key_Down || event.key === Qt.Key_Up || ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length === 0)) {
|
height: 48
|
||||||
event.accepted = false;
|
cornerRadius: Theme.cornerRadius
|
||||||
|
backgroundColor: Theme.withAlpha(Theme.surfaceContainerHigh, Theme.popupTransparency)
|
||||||
|
normalBorderColor: Theme.outlineMedium
|
||||||
|
focusedBorderColor: Theme.primary
|
||||||
|
leftIconName: "search"
|
||||||
|
leftIconSize: Theme.iconSize
|
||||||
|
leftIconColor: Theme.surfaceVariantText
|
||||||
|
leftIconFocusedColor: Theme.primary
|
||||||
|
showClearButton: true
|
||||||
|
textColor: Theme.surfaceText
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
placeholderText: I18n.tr("Search widgets...")
|
||||||
|
text: root.searchQuery
|
||||||
|
focus: true
|
||||||
|
ignoreLeftRightKeys: true
|
||||||
|
keyForwardTargets: [widgetKeyHandler]
|
||||||
|
onTextEdited: {
|
||||||
|
root.searchQuery = text;
|
||||||
|
updateFilteredWidgets();
|
||||||
|
}
|
||||||
|
Keys.onPressed: event => {
|
||||||
|
if (event.key === Qt.Key_Escape) {
|
||||||
|
root.hide();
|
||||||
|
event.accepted = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (event.key === Qt.Key_Down || event.key === Qt.Key_Up || ((event.key === Qt.Key_Return || event.key === Qt.Key_Enter) && text.length === 0))
|
||||||
|
event.accepted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
DankListView {
|
DankListView {
|
||||||
id: widgetList
|
id: widgetList
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height - y
|
height: parent.height - y
|
||||||
spacing: Theme.spacingS
|
spacing: Theme.spacingS
|
||||||
model: root.filteredWidgets
|
model: root.filteredWidgets
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
delegate: Rectangle {
|
delegate: Rectangle {
|
||||||
width: widgetList.width
|
width: widgetList.width
|
||||||
height: 60
|
height: 60
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
property bool isSelected: root.keyboardNavigationActive && index === root.selectedIndex
|
property bool isSelected: root.keyboardNavigationActive && index === root.selectedIndex
|
||||||
color: isSelected ? Theme.primarySelected : widgetArea.containsMouse ? Theme.primaryHover : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
|
color: isSelected ? Theme.primarySelected : widgetArea.containsMouse ? Theme.primaryHover : Qt.rgba(Theme.surfaceVariant.r, Theme.surfaceVariant.g, Theme.surfaceVariant.b, 0.3)
|
||||||
border.color: isSelected ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
border.color: isSelected ? Theme.primary : Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.2)
|
||||||
border.width: isSelected ? 2 : 1
|
border.width: isSelected ? 2 : 1
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Theme.spacingM
|
anchors.margins: Theme.spacingM
|
||||||
spacing: Theme.spacingM
|
spacing: Theme.spacingM
|
||||||
|
|
||||||
DankIcon {
|
DankIcon {
|
||||||
name: modelData.icon
|
name: modelData.icon
|
||||||
size: Theme.iconSize
|
size: Theme.iconSize
|
||||||
color: Theme.primary
|
color: Theme.primary
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
|
||||||
|
|
||||||
Column {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
spacing: 2
|
|
||||||
width: parent.width - Theme.iconSize - Theme.spacingM * 3
|
|
||||||
|
|
||||||
StyledText {
|
|
||||||
text: modelData.text
|
|
||||||
font.pixelSize: Theme.fontSizeMedium
|
|
||||||
font.weight: Font.Medium
|
|
||||||
color: Theme.surfaceText
|
|
||||||
elide: Text.ElideRight
|
|
||||||
width: parent.width
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledText {
|
Column {
|
||||||
text: modelData.description
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font.pixelSize: Theme.fontSizeSmall
|
spacing: 2
|
||||||
color: Theme.outline
|
width: parent.width - Theme.iconSize - Theme.spacingM * 3
|
||||||
elide: Text.ElideRight
|
|
||||||
width: parent.width
|
StyledText {
|
||||||
wrapMode: Text.WordWrap
|
text: modelData.text
|
||||||
|
font.pixelSize: Theme.fontSizeMedium
|
||||||
|
font.weight: Font.Medium
|
||||||
|
color: Theme.surfaceText
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: parent.width
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledText {
|
||||||
|
text: modelData.description
|
||||||
|
font.pixelSize: Theme.fontSizeSmall
|
||||||
|
color: Theme.outline
|
||||||
|
elide: Text.ElideRight
|
||||||
|
width: parent.width
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DankIcon {
|
||||||
|
name: "add"
|
||||||
|
size: Theme.iconSize - 4
|
||||||
|
color: Theme.primary
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DankIcon {
|
MouseArea {
|
||||||
name: "add"
|
id: widgetArea
|
||||||
size: Theme.iconSize - 4
|
|
||||||
color: Theme.primary
|
anchors.fill: parent
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
|
root.widgetSelected(modelData.id, root.targetSection);
|
||||||
|
root.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
Behavior on color {
|
||||||
id: widgetArea
|
ColorAnimation {
|
||||||
|
duration: Theme.shortDuration
|
||||||
anchors.fill: parent
|
easing.type: Theme.standardEasing
|
||||||
hoverEnabled: true
|
}
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onClicked: {
|
|
||||||
root.widgetSelected(modelData.id, root.targetSection);
|
|
||||||
root.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Theme.shortDuration
|
|
||||||
easing.type: Theme.standardEasing
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -682,7 +682,7 @@ Item {
|
|||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
checked: SettingsData.osdAlwaysShowValue
|
checked: SettingsData.osdAlwaysShowValue
|
||||||
onToggleCompleted: checked => {
|
onToggled: checked => {
|
||||||
SettingsData.set("osdAlwaysShowValue", checked);
|
SettingsData.set("osdAlwaysShowValue", checked);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user