mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-04-20 23:20:10 +00:00
Make StreamingPreferences a proper singleton
This removes the need for several hacks in SettingsView to force updates and improves performance by not reloading preferences all over the place.
This commit is contained in:
@@ -1349,15 +1349,7 @@ Flickable {
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.swapFaceButtons
|
||||
onCheckedChanged: {
|
||||
// Check if the value changed (this is called on init too)
|
||||
if (StreamingPreferences.swapFaceButtons !== checked) {
|
||||
StreamingPreferences.swapFaceButtons = checked
|
||||
|
||||
// Save and restart SdlGamepadKeyNavigation so it can pull the new value
|
||||
StreamingPreferences.save()
|
||||
SdlGamepadKeyNavigation.disable()
|
||||
SdlGamepadKeyNavigation.enable()
|
||||
}
|
||||
StreamingPreferences.swapFaceButtons = checked
|
||||
}
|
||||
|
||||
ToolTip.delay: 1000
|
||||
@@ -1621,10 +1613,6 @@ Flickable {
|
||||
if (StreamingPreferences.enableMdns != checked) {
|
||||
StreamingPreferences.enableMdns = checked
|
||||
|
||||
// We must save the updated preference to ensure
|
||||
// ComputerManager can observe the change internally.
|
||||
StreamingPreferences.save()
|
||||
|
||||
// Restart polling so the mDNS change takes effect
|
||||
if (window.pollingActive) {
|
||||
ComputerManager.stopPollingAsync()
|
||||
@@ -1641,15 +1629,7 @@ Flickable {
|
||||
font.pointSize: 12
|
||||
checked: StreamingPreferences.detectNetworkBlocking
|
||||
onCheckedChanged: {
|
||||
// This is called on init, so only do the work if we've
|
||||
// actually changed the value.
|
||||
if (StreamingPreferences.detectNetworkBlocking != checked) {
|
||||
StreamingPreferences.detectNetworkBlocking = checked
|
||||
|
||||
// We must save the updated preference to ensure
|
||||
// ComputerManager can observe the change internally.
|
||||
StreamingPreferences.save()
|
||||
}
|
||||
StreamingPreferences.detectNetworkBlocking = checked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user