Cleaned up init sequence
This commit is contained in:
parent
e3f50c0ce2
commit
c055690a9b
3 changed files with 59 additions and 51 deletions
|
|
@ -35,6 +35,7 @@ Singleton {
|
||||||
// Signal emitted when settings are loaded after startupcale changes
|
// Signal emitted when settings are loaded after startupcale changes
|
||||||
signal settingsLoaded
|
signal settingsLoaded
|
||||||
|
|
||||||
|
// -----------------------------------------------------
|
||||||
// Function to validate monitor configurations
|
// Function to validate monitor configurations
|
||||||
function validateMonitorConfigurations() {
|
function validateMonitorConfigurations() {
|
||||||
var availableScreenNames = []
|
var availableScreenNames = []
|
||||||
|
|
@ -55,17 +56,65 @@ Singleton {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasValidBarMonitor) {
|
if (!hasValidBarMonitor) {
|
||||||
Logger.log("Settings",
|
Logger.warn("Settings",
|
||||||
"No configured bar monitors found on system, clearing bar monitor list to show on all screens")
|
"No configured bar monitors found on system, clearing bar monitor list to show on all screens")
|
||||||
adapter.bar.monitors = []
|
adapter.bar.monitors = []
|
||||||
} else {
|
} else {
|
||||||
Logger.log("Settings", "Found valid bar monitors, keeping configuration")
|
//Logger.log("Settings", "Found valid bar monitors, keeping configuration")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Logger.log("Settings", "Bar monitor list is empty, will show on all available screens")
|
//Logger.log("Settings", "Bar monitor list is empty, will show on all available screens")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------
|
||||||
|
// If the settings structure has changed, ensure
|
||||||
|
// backward compatibility
|
||||||
|
function upgradeSettingsData() {
|
||||||
|
for (var i = 0; i < adapter.bar.widgets.left.length; i++) {
|
||||||
|
var obj = adapter.bar.widgets.left[i]
|
||||||
|
if (typeof obj === "string") {
|
||||||
|
adapter.bar.widgets.left[i] = {
|
||||||
|
"id": obj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i = 0; i < adapter.bar.widgets.center.length; i++) {
|
||||||
|
var obj = adapter.bar.widgets.center[i]
|
||||||
|
if (typeof obj === "string") {
|
||||||
|
adapter.bar.widgets.center[i] = {
|
||||||
|
"id": obj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (var i = 0; i < adapter.bar.widgets.right.length; i++) {
|
||||||
|
var obj = adapter.bar.widgets.right[i]
|
||||||
|
if (typeof obj === "string") {
|
||||||
|
adapter.bar.widgets.right[i] = {
|
||||||
|
"id": obj
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------
|
||||||
|
// Kickoff essential services
|
||||||
|
function kickOffServices() {
|
||||||
|
// Ensure our location singleton is created as soon as possible so we start fetching weather asap
|
||||||
|
LocationService.init()
|
||||||
|
|
||||||
|
NightLightService.apply()
|
||||||
|
|
||||||
|
ColorSchemeService.init()
|
||||||
|
|
||||||
|
MatugenService.init()
|
||||||
|
|
||||||
|
FontService.init()
|
||||||
|
|
||||||
|
HooksService.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------
|
||||||
Item {
|
Item {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
|
||||||
|
|
@ -100,49 +149,14 @@ Singleton {
|
||||||
Logger.log("Settings", "Settings loaded successfully")
|
Logger.log("Settings", "Settings loaded successfully")
|
||||||
isLoaded = true
|
isLoaded = true
|
||||||
|
|
||||||
for (var i = 0; i < adapter.bar.widgets.left.length; i++) {
|
upgradeSettingsData()
|
||||||
var obj = adapter.bar.widgets.left[i]
|
|
||||||
if (typeof obj === "string") {
|
validateMonitorConfigurations()
|
||||||
adapter.bar.widgets.left[i] = {
|
|
||||||
"id": obj
|
kickOffServices();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var i = 0; i < adapter.bar.widgets.center.length; i++) {
|
|
||||||
var obj = adapter.bar.widgets.center[i]
|
|
||||||
if (typeof obj === "string") {
|
|
||||||
adapter.bar.widgets.center[i] = {
|
|
||||||
"id": obj
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var i = 0; i < adapter.bar.widgets.right.length; i++) {
|
|
||||||
var obj = adapter.bar.widgets.right[i]
|
|
||||||
if (typeof obj === "string") {
|
|
||||||
adapter.bar.widgets.right[i] = {
|
|
||||||
"id": obj
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Emit the signal
|
// Emit the signal
|
||||||
root.settingsLoaded()
|
root.settingsLoaded()
|
||||||
|
|
||||||
// Kickoff ColorScheme service
|
|
||||||
ColorSchemeService.init()
|
|
||||||
|
|
||||||
// Kickoff Matugen service
|
|
||||||
MatugenService.init()
|
|
||||||
|
|
||||||
// Kickoff Font service
|
|
||||||
FontService.init()
|
|
||||||
|
|
||||||
// Kickoff HooksService
|
|
||||||
HooksService.init()
|
|
||||||
|
|
||||||
Qt.callLater(function () {
|
|
||||||
validateMonitorConfigurations()
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
onLoadFailed: function (error) {
|
onLoadFailed: function (error) {
|
||||||
|
|
|
||||||
|
|
@ -141,9 +141,9 @@ NPanel {
|
||||||
const clipboardPlugin = Qt.createComponent("Plugins/ClipboardPlugin.qml").createObject(this)
|
const clipboardPlugin = Qt.createComponent("Plugins/ClipboardPlugin.qml").createObject(this)
|
||||||
if (clipboardPlugin) {
|
if (clipboardPlugin) {
|
||||||
registerPlugin(clipboardPlugin)
|
registerPlugin(clipboardPlugin)
|
||||||
Logger.log("Launcher", "Registered: clipboardPlugin")
|
Logger.log("Launcher", "Registered: ClipboardPlugin")
|
||||||
} else {
|
} else {
|
||||||
Logger.error("Launcher", "Failed to load clipboardPlugin")
|
Logger.error("Launcher", "Failed to load ClipboardPlugin")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -103,11 +103,5 @@ ShellRoot {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
// Save a ref. to our lockScreen so we can access it easily
|
// Save a ref. to our lockScreen so we can access it easily
|
||||||
PanelService.lockScreen = lockScreen
|
PanelService.lockScreen = lockScreen
|
||||||
|
|
||||||
// Ensure our location singleton is created as soon as possible so we start fetching weather asap
|
|
||||||
LocationService.init()
|
|
||||||
|
|
||||||
// Kickoff NightLight service
|
|
||||||
NightLightService.apply()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue