No need to track open popups anymore. Avoid widgets to include services directly

This commit is contained in:
ItsLemmy
2025-11-08 22:37:19 -05:00
parent 373398236a
commit 8b7ec73fdf
10 changed files with 1 additions and 73 deletions
@@ -25,19 +25,12 @@ Popup {
anchors.centerIn: parent
onOpened: {
// Mark this popup has opened in the PanelService
PanelService.willOpenPopup(root)
// Load settings when popup opens with data
if (widgetData && widgetId) {
loadWidgetSettings()
}
}
onClosed: {
PanelService.willClosePopup(root)
}
background: Rectangle {
id: bgRect
@@ -23,16 +23,11 @@ Popup {
anchors.centerIn: parent
onOpened: {
PanelService.willOpenPopup(root)
if (widgetData && widgetId) {
loadWidgetSettings()
}
}
onClosed: {
PanelService.willClosePopup(root)
}
background: Rectangle {
color: Color.mSurface
radius: Style.radiusL
+1 -1
View File
@@ -12,7 +12,7 @@ SmartPanel {
id: root
preferredWidth: Math.round(820 * Style.uiScaleRatio)
preferredHeight: Math.round(900 * Style.uiScaleRatio)
preferredHeight: Math.round(910 * Style.uiScaleRatio)
readonly property bool attachToBar: Settings.data.ui.settingsPanelAttachToBar
readonly property string barPosition: Settings.data.bar.position
-19
View File
@@ -16,12 +16,6 @@ Singleton {
signal willOpen
signal didClose
// Currently opened popups, can have more than one.
// ex: when opening an NIconPicker from a widget setting.
property var openedPopups: []
property bool hasOpenedPopup: false
signal popupChanged
// Register this panel (called after panel is loaded)
function registerPanel(panel) {
registeredPanels[panel.objectName] = panel
@@ -77,17 +71,4 @@ Singleton {
// emit signal
didClose()
}
// Popups
function willOpenPopup(popup) {
openedPopups.push(popup)
hasOpenedPopup = (openedPopups.length !== 0)
popupChanged()
}
function willClosePopup(popup) {
openedPopups = openedPopups.filter(p => p !== popup)
hasOpenedPopup = (openedPopups.length !== 0)
popupChanged()
}
}
-8
View File
@@ -26,14 +26,6 @@ Popup {
modal: true
onOpened: {
PanelService.willOpenPopup(root)
}
onClosed: {
PanelService.willClosePopup(root)
}
function rgbToHsv(r, g, b) {
r /= 255
g /= 255
-8
View File
@@ -108,14 +108,6 @@ RowLayout {
implicitHeight: Math.min(root.popupHeight, contentItem.implicitHeight + Style.marginM * 2)
padding: Style.marginM
onOpened: {
PanelService.willOpenPopup(root)
}
onClosed: {
PanelService.willClosePopup(root)
}
contentItem: NListView {
model: combo.popup.visible ? root.model : null
implicitHeight: contentHeight
-3
View File
@@ -17,9 +17,6 @@ Popup {
width: 180
padding: Style.marginS
onOpened: PanelService.willOpenPopup(root)
onClosed: PanelService.willClosePopup(root)
background: Rectangle {
color: Color.mSurfaceVariant
border.color: Color.mOutline
-8
View File
@@ -27,14 +27,6 @@ Popup {
signal accepted(var paths)
signal cancelled
onOpened: {
PanelService.willOpenPopup(root)
}
onClosed: {
PanelService.willClosePopup(root)
}
function openFilePicker() {
if (!root.currentPath)
root.currentPath = root.initialPath
-6
View File
@@ -4,7 +4,6 @@ import QtQuick.Layouts
import QtQuick.Window
import qs.Commons
import qs.Widgets
import qs.Services.UI
Popup {
id: root
@@ -36,11 +35,6 @@ Popup {
selectedIcon = initialIcon
query = initialIcon
searchInput.forceActiveFocus()
PanelService.willOpenPopup(root)
}
onClosed: {
PanelService.willClosePopup(root)
}
background: Rectangle {
-8
View File
@@ -158,14 +158,6 @@ RowLayout {
height: root.popupHeight + 60
padding: Style.marginM
onOpened: {
PanelService.willOpenPopup(root)
}
onClosed: {
PanelService.willClosePopup(root)
}
contentItem: ColumnLayout {
spacing: Style.marginS