mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
No need to track open popups anymore. Avoid widgets to include services directly
This commit is contained in:
@@ -25,19 +25,12 @@ Popup {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
// Mark this popup has opened in the PanelService
|
|
||||||
PanelService.willOpenPopup(root)
|
|
||||||
|
|
||||||
// Load settings when popup opens with data
|
// Load settings when popup opens with data
|
||||||
if (widgetData && widgetId) {
|
if (widgetData && widgetId) {
|
||||||
loadWidgetSettings()
|
loadWidgetSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
PanelService.willClosePopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
id: bgRect
|
id: bgRect
|
||||||
|
|
||||||
|
|||||||
@@ -23,16 +23,11 @@ Popup {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
onOpened: {
|
onOpened: {
|
||||||
PanelService.willOpenPopup(root)
|
|
||||||
if (widgetData && widgetId) {
|
if (widgetData && widgetId) {
|
||||||
loadWidgetSettings()
|
loadWidgetSettings()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
PanelService.willClosePopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Color.mSurface
|
color: Color.mSurface
|
||||||
radius: Style.radiusL
|
radius: Style.radiusL
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ SmartPanel {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
preferredWidth: Math.round(820 * Style.uiScaleRatio)
|
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 bool attachToBar: Settings.data.ui.settingsPanelAttachToBar
|
||||||
readonly property string barPosition: Settings.data.bar.position
|
readonly property string barPosition: Settings.data.bar.position
|
||||||
|
|||||||
@@ -16,12 +16,6 @@ Singleton {
|
|||||||
signal willOpen
|
signal willOpen
|
||||||
signal didClose
|
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)
|
// Register this panel (called after panel is loaded)
|
||||||
function registerPanel(panel) {
|
function registerPanel(panel) {
|
||||||
registeredPanels[panel.objectName] = panel
|
registeredPanels[panel.objectName] = panel
|
||||||
@@ -77,17 +71,4 @@ Singleton {
|
|||||||
// emit signal
|
// emit signal
|
||||||
didClose()
|
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()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,14 +26,6 @@ Popup {
|
|||||||
|
|
||||||
modal: true
|
modal: true
|
||||||
|
|
||||||
onOpened: {
|
|
||||||
PanelService.willOpenPopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
PanelService.willClosePopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
function rgbToHsv(r, g, b) {
|
function rgbToHsv(r, g, b) {
|
||||||
r /= 255
|
r /= 255
|
||||||
g /= 255
|
g /= 255
|
||||||
|
|||||||
@@ -108,14 +108,6 @@ RowLayout {
|
|||||||
implicitHeight: Math.min(root.popupHeight, contentItem.implicitHeight + Style.marginM * 2)
|
implicitHeight: Math.min(root.popupHeight, contentItem.implicitHeight + Style.marginM * 2)
|
||||||
padding: Style.marginM
|
padding: Style.marginM
|
||||||
|
|
||||||
onOpened: {
|
|
||||||
PanelService.willOpenPopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
PanelService.willClosePopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
contentItem: NListView {
|
contentItem: NListView {
|
||||||
model: combo.popup.visible ? root.model : null
|
model: combo.popup.visible ? root.model : null
|
||||||
implicitHeight: contentHeight
|
implicitHeight: contentHeight
|
||||||
|
|||||||
@@ -17,9 +17,6 @@ Popup {
|
|||||||
width: 180
|
width: 180
|
||||||
padding: Style.marginS
|
padding: Style.marginS
|
||||||
|
|
||||||
onOpened: PanelService.willOpenPopup(root)
|
|
||||||
onClosed: PanelService.willClosePopup(root)
|
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
border.color: Color.mOutline
|
border.color: Color.mOutline
|
||||||
|
|||||||
@@ -27,14 +27,6 @@ Popup {
|
|||||||
signal accepted(var paths)
|
signal accepted(var paths)
|
||||||
signal cancelled
|
signal cancelled
|
||||||
|
|
||||||
onOpened: {
|
|
||||||
PanelService.willOpenPopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
PanelService.willClosePopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
function openFilePicker() {
|
function openFilePicker() {
|
||||||
if (!root.currentPath)
|
if (!root.currentPath)
|
||||||
root.currentPath = root.initialPath
|
root.currentPath = root.initialPath
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Window
|
import QtQuick.Window
|
||||||
import qs.Commons
|
import qs.Commons
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
import qs.Services.UI
|
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
id: root
|
id: root
|
||||||
@@ -36,11 +35,6 @@ Popup {
|
|||||||
selectedIcon = initialIcon
|
selectedIcon = initialIcon
|
||||||
query = initialIcon
|
query = initialIcon
|
||||||
searchInput.forceActiveFocus()
|
searchInput.forceActiveFocus()
|
||||||
PanelService.willOpenPopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
PanelService.willClosePopup(root)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|||||||
@@ -158,14 +158,6 @@ RowLayout {
|
|||||||
height: root.popupHeight + 60
|
height: root.popupHeight + 60
|
||||||
padding: Style.marginM
|
padding: Style.marginM
|
||||||
|
|
||||||
onOpened: {
|
|
||||||
PanelService.willOpenPopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
onClosed: {
|
|
||||||
PanelService.willClosePopup(root)
|
|
||||||
}
|
|
||||||
|
|
||||||
contentItem: ColumnLayout {
|
contentItem: ColumnLayout {
|
||||||
spacing: Style.marginS
|
spacing: Style.marginS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user