Autoformatting + converted a bunch console.log to logger, hiding some extra logging

This commit is contained in:
LemmyCook 2025-08-24 08:48:39 -04:00
parent c3515ddcc0
commit a7b7c03877
11 changed files with 341 additions and 329 deletions

View file

@ -202,13 +202,13 @@ ColumnLayout {
// Helper functions
function addWidgetToSection(widgetName, section) {
console.log("Adding widget", widgetName, "to section", section)
//Logger.log("BarTab", "Adding widget", widgetName, "to section", section)
var sectionArray = Settings.data.bar.widgets[section]
if (sectionArray) {
// Create a new array to avoid modifying the original
var newArray = sectionArray.slice()
newArray.push(widgetName)
console.log("Widget added. New array:", JSON.stringify(newArray))
//Logger.log("BarTab", "Widget added. New array:", JSON.stringify(newArray))
// Assign the new array
Settings.data.bar.widgets[section] = newArray
@ -216,34 +216,35 @@ ColumnLayout {
}
function removeWidgetFromSection(section, index) {
console.log("Removing widget from section", section, "at index", index)
// Logger.log("BarTab", "Removing widget from section", section, "at index", index)
var sectionArray = Settings.data.bar.widgets[section]
console.log("Current section array:", JSON.stringify(sectionArray))
//Logger.log("BarTab", "Current section array:", JSON.stringify(sectionArray))
if (sectionArray && index >= 0 && index < sectionArray.length) {
// Create a new array to avoid modifying the original
var newArray = sectionArray.slice()
newArray.splice(index, 1)
console.log("Widget removed. New array:", JSON.stringify(newArray))
//Logger.log("BarTab", "Widget removed. New array:", JSON.stringify(newArray))
// Assign the new array
Settings.data.bar.widgets[section] = newArray
// Force a settings save
console.log("Settings updated, triggering save...")
//Logger.log("BarTab", "Settings updated, triggering save...")
// Verify the change was applied
Qt.setTimeout(function() {
Qt.setTimeout(function () {
var updatedArray = Settings.data.bar.widgets[section]
console.log("Verification - updated section array:", JSON.stringify(updatedArray))
//Logger.log("BarTab", "Verification - updated section array:", JSON.stringify(updatedArray))
}, 100)
} else {
console.log("Invalid section or index:", section, index, "array length:", sectionArray ? sectionArray.length : "null")
//Logger.log("BarTab", "Invalid section or index:", section, index, "array length:",
// sectionArray ? sectionArray.length : "null")
}
}
function reorderWidgetInSection(section, fromIndex, toIndex) {
console.log("Reordering widget in section", section, "from", fromIndex, "to", toIndex)
//Logger.log("BarTab", "Reordering widget in section", section, "from", fromIndex, "to", toIndex)
var sectionArray = Settings.data.bar.widgets[section]
if (sectionArray && fromIndex >= 0 && fromIndex < sectionArray.length && toIndex >= 0
&& toIndex < sectionArray.length) {
@ -253,7 +254,7 @@ ColumnLayout {
var item = newArray[fromIndex]
newArray.splice(fromIndex, 1)
newArray.splice(toIndex, 0, item)
console.log("Widget reordered. New array:", JSON.stringify(newArray))
Logger.log("BarTab", "Widget reordered. New array:", JSON.stringify(newArray))
// Assign the new array
Settings.data.bar.widgets[section] = newArray