qs: refactor initialization logic and improve service connections

This commit is contained in:
2026-03-08 22:38:05 +01:00
parent 299188923b
commit 387f8b247b
3 changed files with 11 additions and 6 deletions
@@ -145,8 +145,7 @@ Variants {
} }
Connections { Connections {
target: LyricsService function onShowLyricsBarChanged() {
onShowLyricsBarChanged: {
if (LyricsService.showLyricsBar) { if (LyricsService.showLyricsBar) {
LyricsService.registerComponent("LyricsBar"); LyricsService.registerComponent("LyricsBar");
SystemStatService.unregisterComponent("BarMonitors"); SystemStatService.unregisterComponent("BarMonitors");
@@ -155,6 +154,8 @@ Variants {
SystemStatService.registerComponent("BarMonitors"); SystemStatService.registerComponent("BarMonitors");
} }
} }
target: LyricsService
} }
Item { Item {
@@ -8,7 +8,8 @@ pragma Singleton
Singleton { Singleton {
id: root id: root
property bool loaded: false property bool dirsLoaded: false
property bool initialized: dirsLoaded && ImageCacheService.initialized && ShellState.isLoaded
Component.onCompleted: { Component.onCompleted: {
let mkdirs = ""; let mkdirs = "";
@@ -27,7 +28,7 @@ Singleton {
running: false running: false
onExited: (code, status) => { onExited: (code, status) => {
if (code === 0) if (code === 0)
root.loaded = true; root.dirsLoaded = true;
else else
Logger.e("Init", `Failed to create necessary directories: ${code} (${status})`); Logger.e("Init", `Failed to create necessary directories: ${code} (${status})`);
} }
@@ -12,15 +12,18 @@ ShellRoot {
Component.onCompleted: { Component.onCompleted: {
ImageCacheService.init(); ImageCacheService.init();
SunsetService;
} }
Loader { Loader {
id: loader id: loader
active: Init.loaded && ImageCacheService.initialized && ShellState.isLoaded active: Init.initialized
sourceComponent: Item { sourceComponent: Item {
Component.onCompleted: {
SunsetService;
}
IPCService { IPCService {
id: ipcService id: ipcService
} }