mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-25 05:52:50 -05:00
popout: use mapToItem instead of mapToGlobal for popout positioning
fixes #1152
This commit is contained in:
@@ -57,8 +57,6 @@ DankPopout {
|
||||
const contentHeight = contentLoader.item && contentLoader.item.implicitHeight > 0 ? contentLoader.item.implicitHeight + 20 : 400;
|
||||
return Math.min(maxHeight, contentHeight);
|
||||
}
|
||||
triggerX: 0
|
||||
triggerY: 0
|
||||
triggerWidth: 80
|
||||
positioning: ""
|
||||
screen: triggerScreen
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
function setTriggerPosition(root, x, y, width, section, screen) {
|
||||
root.triggerX = x
|
||||
root.triggerY = y
|
||||
root.triggerWidth = width
|
||||
root.triggerSection = section
|
||||
root.triggerScreen = screen
|
||||
}
|
||||
|
||||
function openWithSection(root, section) {
|
||||
if (root.shouldBeVisible) {
|
||||
root.close()
|
||||
} else {
|
||||
root.expandedSection = section
|
||||
root.open()
|
||||
}
|
||||
if (root.shouldBeVisible) {
|
||||
root.close();
|
||||
} else {
|
||||
root.expandedSection = section;
|
||||
root.open();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleSection(root, section) {
|
||||
if (root.expandedSection === section) {
|
||||
root.expandedSection = ""
|
||||
root.expandedWidgetIndex = -1
|
||||
} else {
|
||||
root.expandedSection = section
|
||||
}
|
||||
if (root.expandedSection === section) {
|
||||
root.expandedSection = "";
|
||||
root.expandedWidgetIndex = -1;
|
||||
} else {
|
||||
root.expandedSection = section;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -581,7 +581,7 @@ Item {
|
||||
appDrawerLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
|
||||
}
|
||||
if (appDrawerLoader.item && appDrawerLoader.item.setTriggerPosition) {
|
||||
const globalPos = launcherButton.visualContent.mapToGlobal(0, 0);
|
||||
const globalPos = launcherButton.visualContent.mapToItem(null, 0, 0);
|
||||
const currentScreen = barWindow.screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barWindow.effectiveBarThickness, launcherButton.visualWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
appDrawerLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, launcherButton.section, currentScreen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -676,20 +676,20 @@ Item {
|
||||
if (centerSection) {
|
||||
if (barWindow.isVertical) {
|
||||
const centerY = centerSection.height / 2;
|
||||
const centerGlobalPos = centerSection.mapToGlobal(0, centerY);
|
||||
const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
|
||||
triggerPos = centerGlobalPos;
|
||||
triggerWidth = centerSection.height;
|
||||
} else {
|
||||
const centerGlobalPos = centerSection.mapToGlobal(0, 0);
|
||||
const centerGlobalPos = centerSection.mapToItem(null, 0, 0);
|
||||
triggerPos = centerGlobalPos;
|
||||
triggerWidth = centerSection.width;
|
||||
}
|
||||
} else {
|
||||
triggerPos = visualContent.mapToGlobal(0, 0);
|
||||
triggerPos = visualContent.mapToItem(null, 0, 0);
|
||||
triggerWidth = visualWidth;
|
||||
}
|
||||
} else {
|
||||
triggerPos = visualContent.mapToGlobal(0, 0);
|
||||
triggerPos = visualContent.mapToItem(null, 0, 0);
|
||||
triggerWidth = visualWidth;
|
||||
}
|
||||
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
@@ -732,20 +732,20 @@ Item {
|
||||
if (centerSection) {
|
||||
if (barWindow.isVertical) {
|
||||
const centerY = centerSection.height / 2;
|
||||
const centerGlobalPos = centerSection.mapToGlobal(0, centerY);
|
||||
const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
|
||||
triggerPos = centerGlobalPos;
|
||||
triggerWidth = centerSection.height;
|
||||
} else {
|
||||
const centerGlobalPos = centerSection.mapToGlobal(0, 0);
|
||||
const centerGlobalPos = centerSection.mapToItem(null, 0, 0);
|
||||
triggerPos = centerGlobalPos;
|
||||
triggerWidth = centerSection.width;
|
||||
}
|
||||
} else {
|
||||
triggerPos = visualContent.mapToGlobal(0, 0);
|
||||
triggerPos = visualContent.mapToItem(null, 0, 0);
|
||||
triggerWidth = visualWidth;
|
||||
}
|
||||
} else {
|
||||
triggerPos = visualContent.mapToGlobal(0, 0);
|
||||
triggerPos = visualContent.mapToItem(null, 0, 0);
|
||||
triggerWidth = visualWidth;
|
||||
}
|
||||
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
@@ -790,21 +790,21 @@ Item {
|
||||
// For vertical bars, use center Y of section; for horizontal, use left edge
|
||||
if (barWindow.isVertical) {
|
||||
const centerY = centerSection.height / 2;
|
||||
const centerGlobalPos = centerSection.mapToGlobal(0, centerY);
|
||||
const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
|
||||
triggerPos = centerGlobalPos;
|
||||
triggerWidth = centerSection.height;
|
||||
} else {
|
||||
// For horizontal bars, use left edge (DankPopout will center it)
|
||||
const centerGlobalPos = centerSection.mapToGlobal(0, 0);
|
||||
const centerGlobalPos = centerSection.mapToItem(null, 0, 0);
|
||||
triggerPos = centerGlobalPos;
|
||||
triggerWidth = centerSection.width;
|
||||
}
|
||||
} else {
|
||||
triggerPos = visualContent.mapToGlobal(0, 0);
|
||||
triggerPos = visualContent.mapToItem(null, 0, 0);
|
||||
triggerWidth = visualWidth;
|
||||
}
|
||||
} else {
|
||||
triggerPos = visualContent.mapToGlobal(0, 0);
|
||||
triggerPos = visualContent.mapToItem(null, 0, 0);
|
||||
triggerWidth = visualWidth;
|
||||
}
|
||||
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
@@ -871,7 +871,7 @@ Item {
|
||||
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
|
||||
}
|
||||
if (processListPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = cpuWidget.mapToGlobal(0, 0);
|
||||
const globalPos = cpuWidget.mapToItem(null, 0, 0);
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
|
||||
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -907,7 +907,7 @@ Item {
|
||||
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
|
||||
}
|
||||
if (processListPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = ramWidget.mapToGlobal(0, 0);
|
||||
const globalPos = ramWidget.mapToItem(null, 0, 0);
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, ramWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
|
||||
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -957,7 +957,7 @@ Item {
|
||||
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
|
||||
}
|
||||
if (processListPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = cpuTempWidget.mapToGlobal(0, 0);
|
||||
const globalPos = cpuTempWidget.mapToItem(null, 0, 0);
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
|
||||
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -993,7 +993,7 @@ Item {
|
||||
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
|
||||
}
|
||||
if (processListPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = gpuTempWidget.mapToGlobal(0, 0);
|
||||
const globalPos = gpuTempWidget.mapToItem(null, 0, 0);
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, gpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
|
||||
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -1036,7 +1036,7 @@ Item {
|
||||
notificationCenterLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
|
||||
}
|
||||
if (notificationCenterLoader.item.setTriggerPosition) {
|
||||
const globalPos = notificationButton.mapToGlobal(0, 0);
|
||||
const globalPos = notificationButton.mapToItem(null, 0, 0);
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, notificationButton.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
|
||||
notificationCenterLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -1074,7 +1074,7 @@ Item {
|
||||
batteryPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
|
||||
}
|
||||
if (batteryPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = batteryWidget.mapToGlobal(0, 0);
|
||||
const globalPos = batteryWidget.mapToItem(null, 0, 0);
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, batteryWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
|
||||
batteryPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -1107,7 +1107,7 @@ Item {
|
||||
const barPosition = barWindow.axis?.edge === "left" ? 2 : (barWindow.axis?.edge === "right" ? 3 : (barWindow.axis?.edge === "top" ? 0 : 1));
|
||||
|
||||
if (layoutPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = layoutWidget.mapToGlobal(0, 0);
|
||||
const globalPos = layoutWidget.mapToItem(null, 0, 0);
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, layoutWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
const widgetSection = topBarContent.getWidgetSection(parent) || "center";
|
||||
layoutPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -1147,7 +1147,7 @@ Item {
|
||||
}
|
||||
|
||||
if (vpnPopoutLoader.item.setTriggerPosition) {
|
||||
const globalPos = vpnWidget.mapToGlobal(0, 0);
|
||||
const globalPos = vpnWidget.mapToItem(null, 0, 0);
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, vpnWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
|
||||
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
|
||||
vpnPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
|
||||
@@ -1193,7 +1193,7 @@ Item {
|
||||
}
|
||||
controlCenterLoader.item.triggerScreen = barWindow.screen;
|
||||
if (controlCenterLoader.item.setTriggerPosition) {
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const globalPos = mapToItem(null, 0, 0);
|
||||
// Use topBarContent.barConfig directly
|
||||
const effectiveBarConfig = topBarContent.barConfig;
|
||||
// Calculate barPosition from axis.edge like Battery widget does
|
||||
|
||||
@@ -27,10 +27,9 @@ PanelWindow {
|
||||
}
|
||||
|
||||
if (controlCenterButtonRef && controlCenterLoader.item.setTriggerPosition) {
|
||||
const globalPos = controlCenterButtonRef.mapToGlobal(0, 0);
|
||||
// Calculate barPosition from axis.edge
|
||||
const screenPos = controlCenterButtonRef.mapToItem(null, 0, 0);
|
||||
const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1));
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, controlCenterButtonRef.width, barConfig?.spacing ?? 4, barPosition, barConfig);
|
||||
const pos = SettingsData.getPopupTriggerPosition(screenPos, barWindow.screen, barWindow.effectiveBarThickness, controlCenterButtonRef.width, barConfig?.spacing ?? 4, barPosition, barConfig);
|
||||
const section = controlCenterButtonRef.section || "right";
|
||||
controlCenterLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, section, barWindow.screen, barPosition, barWindow.effectiveBarThickness, barConfig?.spacing ?? 4, barConfig);
|
||||
} else {
|
||||
@@ -54,29 +53,24 @@ PanelWindow {
|
||||
const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1));
|
||||
const section = clockButtonRef.section || "center";
|
||||
|
||||
// For center section widgets, use center section bounds for DankDash centering
|
||||
let triggerPos, triggerWidth;
|
||||
if (section === "center") {
|
||||
const centerSection = barWindow.isVertical ? (barWindow.axis?.edge === "left" ? topBarContent.vCenterSection : topBarContent.vCenterSection) : topBarContent.hCenterSection;
|
||||
if (centerSection) {
|
||||
// For vertical bars, use center Y of section; for horizontal, use left edge
|
||||
if (barWindow.isVertical) {
|
||||
const centerY = centerSection.height / 2;
|
||||
const centerGlobalPos = centerSection.mapToGlobal(0, centerY);
|
||||
triggerPos = centerGlobalPos;
|
||||
triggerPos = centerSection.mapToItem(null, 0, centerY);
|
||||
triggerWidth = centerSection.height;
|
||||
} else {
|
||||
// For horizontal bars, use left edge (DankPopout will center it)
|
||||
const centerGlobalPos = centerSection.mapToGlobal(0, 0);
|
||||
triggerPos = centerGlobalPos;
|
||||
triggerPos = centerSection.mapToItem(null, 0, 0);
|
||||
triggerWidth = centerSection.width;
|
||||
}
|
||||
} else {
|
||||
triggerPos = clockButtonRef.visualContent.mapToGlobal(0, 0);
|
||||
triggerPos = clockButtonRef.visualContent.mapToItem(null, 0, 0);
|
||||
triggerWidth = clockButtonRef.visualWidth;
|
||||
}
|
||||
} else {
|
||||
triggerPos = clockButtonRef.visualContent.mapToGlobal(0, 0);
|
||||
triggerPos = clockButtonRef.visualContent.mapToItem(null, 0, 0);
|
||||
triggerWidth = clockButtonRef.visualWidth;
|
||||
}
|
||||
|
||||
|
||||
@@ -264,14 +264,14 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: Theme.widgetIconColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: audioPercentV
|
||||
visible: root.showAudioPercent
|
||||
text: Math.round(AudioService.sink.audio.volume * 100) + "%"
|
||||
text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%"
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -305,14 +305,14 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: root.getMicIconColor()
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: micPercentV
|
||||
visible: root.showMicPercent
|
||||
text: Math.round(AudioService.source.audio.volume * 100) + "%"
|
||||
text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%"
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
@@ -346,7 +346,7 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: Theme.widgetIconColor
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
anchors.top: parent
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 2
|
||||
}
|
||||
|
||||
@@ -442,14 +442,14 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: Theme.widgetIconColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: audioPercent
|
||||
visible: root.showAudioPercent
|
||||
text: Math.round(AudioService.sink.audio.volume * 100) + "%"
|
||||
text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%"
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -484,14 +484,14 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: root.getMicIconColor()
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: micPercent
|
||||
visible: root.showMicPercent
|
||||
text: Math.round(AudioService.source.audio.volume * 100) + "%"
|
||||
text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%"
|
||||
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale)
|
||||
color: Theme.widgetTextColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@@ -526,7 +526,7 @@ BasePill {
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: Theme.widgetIconColor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 2
|
||||
}
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (root.popoutTarget && root.popoutTarget.setTriggerPosition) {
|
||||
const globalPos = parent.mapToGlobal(0, 0);
|
||||
const globalPos = parent.mapToItem(null, 0, 0);
|
||||
const currentScreen = root.parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, parent.width);
|
||||
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen);
|
||||
@@ -294,7 +294,7 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
if (root.popoutTarget && root.popoutTarget.setTriggerPosition) {
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const globalPos = mapToItem(null, 0, 0);
|
||||
const currentScreen = root.parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, root.barThickness, root.width);
|
||||
root.popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, root.section, currentScreen);
|
||||
|
||||
@@ -12,7 +12,7 @@ BasePill {
|
||||
readonly property bool isChecking: SystemUpdateService.isChecking
|
||||
|
||||
readonly property real horizontalPadding: (barConfig?.noBackground ?? false) ? 2 : Theme.spacingS
|
||||
width : (SettingsData.updaterHideWidget && !hasUpdates) ? 0 : (18 + horizontalPadding * 2)
|
||||
width: (SettingsData.updaterHideWidget && !hasUpdates) ? 0 : (18 + horizontalPadding * 2)
|
||||
|
||||
Ref {
|
||||
service: SystemUpdateService
|
||||
@@ -28,16 +28,21 @@ BasePill {
|
||||
anchors.centerIn: parent
|
||||
visible: root.isVerticalOrientation
|
||||
name: {
|
||||
if (root.isChecking) return "refresh"
|
||||
if (SystemUpdateService.hasError) return "error"
|
||||
if (root.hasUpdates) return "system_update_alt"
|
||||
return "check_circle"
|
||||
if (root.isChecking)
|
||||
return "refresh";
|
||||
if (SystemUpdateService.hasError)
|
||||
return "error";
|
||||
if (root.hasUpdates)
|
||||
return "system_update_alt";
|
||||
return "check_circle";
|
||||
}
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: {
|
||||
if (SystemUpdateService.hasError) return Theme.error
|
||||
if (root.hasUpdates) return Theme.primary
|
||||
return root.isActive ? Theme.primary : Theme.surfaceText
|
||||
if (SystemUpdateService.hasError)
|
||||
return Theme.error;
|
||||
if (root.hasUpdates)
|
||||
return Theme.primary;
|
||||
return root.isActive ? Theme.primary : Theme.surfaceText;
|
||||
}
|
||||
|
||||
RotationAnimation {
|
||||
@@ -52,7 +57,7 @@ BasePill {
|
||||
|
||||
onRunningChanged: {
|
||||
if (!running) {
|
||||
statusIcon.rotation = 0
|
||||
statusIcon.rotation = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,16 +85,21 @@ BasePill {
|
||||
id: statusIconHorizontal
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
name: {
|
||||
if (root.isChecking) return "refresh"
|
||||
if (SystemUpdateService.hasError) return "error"
|
||||
if (root.hasUpdates) return "system_update_alt"
|
||||
return "check_circle"
|
||||
if (root.isChecking)
|
||||
return "refresh";
|
||||
if (SystemUpdateService.hasError)
|
||||
return "error";
|
||||
if (root.hasUpdates)
|
||||
return "system_update_alt";
|
||||
return "check_circle";
|
||||
}
|
||||
size: Theme.barIconSize(root.barThickness, -4)
|
||||
color: {
|
||||
if (SystemUpdateService.hasError) return Theme.error
|
||||
if (root.hasUpdates) return Theme.primary
|
||||
return root.isActive ? Theme.primary : Theme.surfaceText
|
||||
if (SystemUpdateService.hasError)
|
||||
return Theme.error;
|
||||
if (root.hasUpdates)
|
||||
return Theme.primary;
|
||||
return root.isActive ? Theme.primary : Theme.surfaceText;
|
||||
}
|
||||
|
||||
RotationAnimation {
|
||||
@@ -104,7 +114,7 @@ BasePill {
|
||||
|
||||
onRunningChanged: {
|
||||
if (!running) {
|
||||
statusIconHorizontal.rotation = 0
|
||||
statusIconHorizontal.rotation = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,12 +138,12 @@ BasePill {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onPressed: {
|
||||
if (popoutTarget && popoutTarget.setTriggerPosition) {
|
||||
const globalPos = root.visualContent.mapToGlobal(0, 0)
|
||||
const currentScreen = parentScreen || Screen
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth)
|
||||
popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen)
|
||||
const globalPos = root.visualContent.mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth);
|
||||
popoutTarget.setTriggerPosition(pos.x, pos.y, pos.width, section, currentScreen);
|
||||
}
|
||||
root.clicked()
|
||||
root.clicked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ Item {
|
||||
}
|
||||
|
||||
if (popoutTarget.setTriggerPosition) {
|
||||
const globalPos = root.visualContent.mapToGlobal(0, 0);
|
||||
const globalPos = root.visualContent.mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const barPosition = root.axis?.edge === "left" ? 2 : (root.axis?.edge === "right" ? 3 : (root.axis?.edge === "top" ? 0 : 1));
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, root.visualWidth, root.barSpacing, barPosition, root.barConfig);
|
||||
|
||||
@@ -119,7 +119,7 @@ Item {
|
||||
if (pillClickAction.length === 0) {
|
||||
pillClickAction();
|
||||
} else {
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const globalPos = mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width);
|
||||
pillClickAction(pos.x, pos.y, pos.width, section, currentScreen);
|
||||
@@ -133,7 +133,7 @@ Item {
|
||||
if (pillRightClickAction.length === 0) {
|
||||
pillRightClickAction();
|
||||
} else {
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const globalPos = mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width);
|
||||
pillRightClickAction(pos.x, pos.y, pos.width, section, currentScreen);
|
||||
@@ -160,7 +160,7 @@ Item {
|
||||
if (pillClickAction.length === 0) {
|
||||
pillClickAction();
|
||||
} else {
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const globalPos = mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width);
|
||||
pillClickAction(pos.x, pos.y, pos.width, section, currentScreen);
|
||||
@@ -174,7 +174,7 @@ Item {
|
||||
if (pillRightClickAction.length === 0) {
|
||||
pillRightClickAction();
|
||||
} else {
|
||||
const globalPos = mapToGlobal(0, 0);
|
||||
const globalPos = mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, width);
|
||||
pillRightClickAction(pos.x, pos.y, pos.width, section, currentScreen);
|
||||
@@ -196,7 +196,7 @@ Item {
|
||||
return;
|
||||
}
|
||||
const pill = isVertical ? verticalPill : horizontalPill;
|
||||
const globalPos = pill.mapToGlobal(0, 0);
|
||||
const globalPos = pill.mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, pill.width);
|
||||
pillClickAction(pos.x, pos.y, pos.width, section, currentScreen);
|
||||
@@ -206,7 +206,7 @@ Item {
|
||||
return;
|
||||
|
||||
const pill = isVertical ? verticalPill : horizontalPill;
|
||||
const globalPos = pill.visualContent.mapToGlobal(0, 0);
|
||||
const globalPos = pill.visualContent.mapToItem(null, 0, 0);
|
||||
const currentScreen = parentScreen || Screen;
|
||||
const barPosition = axis?.edge === "left" ? 2 : (axis?.edge === "right" ? 3 : (axis?.edge === "top" ? 0 : 1));
|
||||
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barThickness, pill.visualWidth, barSpacing, barPosition, barConfig);
|
||||
|
||||
Reference in New Issue
Block a user