BaBar Widgets: pass a proper section name instead of a longer string.

This commit is contained in:
LemmyCook 2025-09-12 12:54:09 -04:00
parent 28677d6888
commit 380f31fbd9
16 changed files with 19 additions and 33 deletions

View file

@ -77,7 +77,7 @@ Variants {
"screen": root.modelData || null, "screen": root.modelData || null,
"scaling": ScalingService.getScreenScale(screen), "scaling": ScalingService.getScreenScale(screen),
"widgetId": modelData.id, "widgetId": modelData.id,
"barSection": parent.objectName, "section": parent.objectName.replace("Section", "").toLowerCase(),
"sectionWidgetIndex": index, "sectionWidgetIndex": index,
"sectionWidgetsCount": Settings.data.bar.widgets.left.length "sectionWidgetsCount": Settings.data.bar.widgets.left.length
} }
@ -105,7 +105,7 @@ Variants {
"screen": root.modelData || null, "screen": root.modelData || null,
"scaling": ScalingService.getScreenScale(screen), "scaling": ScalingService.getScreenScale(screen),
"widgetId": modelData.id, "widgetId": modelData.id,
"barSection": parent.objectName, "section": parent.objectName.replace("Section", "").toLowerCase(),
"sectionWidgetIndex": index, "sectionWidgetIndex": index,
"sectionWidgetsCount": Settings.data.bar.widgets.center.length "sectionWidgetsCount": Settings.data.bar.widgets.center.length
} }
@ -134,7 +134,7 @@ Variants {
"screen": root.modelData || null, "screen": root.modelData || null,
"scaling": ScalingService.getScreenScale(screen), "scaling": ScalingService.getScreenScale(screen),
"widgetId": modelData.id, "widgetId": modelData.id,
"barSection": parent.objectName, "section": parent.objectName.replace("Section", "").toLowerCase(),
"sectionWidgetIndex": index, "sectionWidgetIndex": index,
"sectionWidgetsCount": Settings.data.bar.widgets.right.length "sectionWidgetsCount": Settings.data.bar.widgets.right.length
} }

View file

@ -15,13 +15,12 @@ RowLayout {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -14,13 +14,12 @@ Item {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -13,13 +13,12 @@ Item {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -13,13 +13,12 @@ Rectangle {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -15,13 +15,12 @@ NIconButton {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -15,13 +15,12 @@ Item {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -15,13 +15,12 @@ RowLayout {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -15,13 +15,12 @@ Item {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -15,13 +15,12 @@ NIconButton {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -14,13 +14,12 @@ NIconButton {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -14,13 +14,12 @@ Item {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -13,13 +13,12 @@ RowLayout {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -15,13 +15,12 @@ Item {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -16,13 +16,12 @@ Item {
// Widget properties passed from Bar.qml for per-instance settings // Widget properties passed from Bar.qml for per-instance settings
property string widgetId: "" property string widgetId: ""
property string barSection: "" property string section: ""
property int sectionWidgetIndex: -1 property int sectionWidgetIndex: -1
property int sectionWidgetsCount: 0 property int sectionWidgetsCount: 0
property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId] property var widgetMetadata: BarWidgetRegistry.widgetMetadata[widgetId]
property var widgetSettings: { property var widgetSettings: {
var section = barSection.replace("Section", "").toLowerCase()
if (section && sectionWidgetIndex >= 0) { if (section && sectionWidgetIndex >= 0) {
var widgets = Settings.data.bar.widgets[section] var widgets = Settings.data.bar.widgets[section]
if (widgets && sectionWidgetIndex < widgets.length) { if (widgets && sectionWidgetIndex < widgets.length) {

View file

@ -206,9 +206,9 @@ Singleton {
function getNPillDirection(widget) { function getNPillDirection(widget) {
try { try {
if (widget.barSection === "leftSection") { if (widget.section === "left") {
return true return true
} else if (widget.barSection === "rightSection") { } else if (widget.section === "right") {
return false return false
} else { } else {
// middle section // middle section