mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
settings: bar/controlcenter/desktop widgets - debounce save
This commit is contained in:
@@ -15,11 +15,12 @@ Popup {
|
||||
property string widgetId: ""
|
||||
property string sectionId: ""
|
||||
property var screen: null
|
||||
|
||||
signal updateWidgetSettings(string section, int index, var settings)
|
||||
property var settingsCache: ({})
|
||||
|
||||
readonly property real maxHeight: screen ? screen.height * 0.9 : 800
|
||||
|
||||
signal updateWidgetSettings(string section, int index, var settings)
|
||||
|
||||
width: Math.max(content.implicitWidth + padding * 2, 640)
|
||||
height: Math.min(content.implicitHeight + padding * 2, maxHeight)
|
||||
padding: Style.marginXL
|
||||
@@ -141,14 +142,24 @@ Popup {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: saveTimer
|
||||
running: false
|
||||
interval: 150
|
||||
onTriggered: {
|
||||
root.updateWidgetSettings(root.sectionId, root.widgetIndex, root.settingsCache);
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: settingsLoader.item
|
||||
ignoreUnknownSignals: true
|
||||
function onSettingsChanged(newSettings) {
|
||||
if (newSettings) {
|
||||
root.updateWidgetSettings(root.sectionId, root.widgetIndex, newSettings);
|
||||
root.settingsCache = newSettings;
|
||||
saveTimer.start();
|
||||
}
|
||||
}
|
||||
ignoreUnknownSignals: true
|
||||
}
|
||||
|
||||
function saveAndClose() {
|
||||
|
||||
@@ -14,6 +14,7 @@ Popup {
|
||||
property string widgetId: ""
|
||||
property string sectionId: ""
|
||||
property var screen: null
|
||||
property var settingsCache: ({})
|
||||
|
||||
signal updateWidgetSettings(string section, int index, var settings)
|
||||
|
||||
@@ -113,14 +114,24 @@ Popup {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: saveTimer
|
||||
running: false
|
||||
interval: 150
|
||||
onTriggered: {
|
||||
root.updateWidgetSettings(root.sectionId, root.widgetIndex, root.settingsCache);
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: settingsLoader.item
|
||||
ignoreUnknownSignals: true
|
||||
function onSettingsChanged(newSettings) {
|
||||
if (newSettings) {
|
||||
root.updateWidgetSettings(root.sectionId, root.widgetIndex, newSettings);
|
||||
root.settingsCache = newSettings;
|
||||
saveTimer.start();
|
||||
}
|
||||
}
|
||||
ignoreUnknownSignals: true
|
||||
}
|
||||
|
||||
function saveAndClose() {
|
||||
|
||||
@@ -16,11 +16,12 @@ Popup {
|
||||
property string widgetId: ""
|
||||
property string sectionId: "" // Not used for desktop widgets, but required by NSectionEditor
|
||||
property var screen: null
|
||||
|
||||
signal updateWidgetSettings(string section, int index, var settings)
|
||||
property var settingsCache: ({})
|
||||
|
||||
readonly property real maxHeight: screen ? screen.height * 0.9 : 800
|
||||
|
||||
signal updateWidgetSettings(string section, int index, var settings)
|
||||
|
||||
width: Math.max(content.implicitWidth + padding * 2, 500)
|
||||
height: Math.min(content.implicitHeight + padding * 2, maxHeight)
|
||||
padding: Style.marginXL
|
||||
@@ -135,14 +136,24 @@ Popup {
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: saveTimer
|
||||
running: false
|
||||
interval: 150
|
||||
onTriggered: {
|
||||
root.updateWidgetSettings(root.sectionId, root.widgetIndex, root.settingsCache);
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: settingsLoader.item
|
||||
ignoreUnknownSignals: true
|
||||
function onSettingsChanged(newSettings) {
|
||||
if (newSettings) {
|
||||
root.updateWidgetSettings(root.sectionId, root.widgetIndex, newSettings);
|
||||
root.settingsCache = newSettings;
|
||||
saveTimer.start();
|
||||
}
|
||||
}
|
||||
ignoreUnknownSignals: true
|
||||
}
|
||||
|
||||
function saveAndClose() {
|
||||
|
||||
Reference in New Issue
Block a user