Lift setting / vertical / barSize onto BarWidget
Six widgets (clock, daytime, keyboardLayout, lockKeys, activeWindow, media) shipped identical copies of `function setting(name, fallback)`. Eight widgets reimplemented `readonly property bool vertical`, and three reimplemented `readonly property int barSize`. Move all three onto the BarWidget base so widgets read the same wiring everyone else gets for free. While in here, drop the dead `setting()` declaration on media.qml — it was defined but never called.
This commit is contained in:
@@ -14,11 +14,6 @@ BarWidget {
|
||||
property bool scrollOn: false
|
||||
property bool hideWhenOff: true
|
||||
|
||||
function setting(name, fallback) {
|
||||
var value = settings ? settings[name] : undefined
|
||||
return value === undefined || value === null ? fallback : value
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
hideWhenOff = setting("hideWhenOff", true) === true
|
||||
refresh()
|
||||
@@ -58,10 +53,8 @@ BarWidget {
|
||||
readonly property bool anyOn: capsOn || numOn || scrollOn
|
||||
visible: ledsAvailable && (hideWhenOff ? anyOn : true)
|
||||
|
||||
readonly property bool vertical: bar ? bar.vertical : false
|
||||
|
||||
implicitWidth: vertical ? (bar ? bar.barSize : Style.bar.sizeVertical) : (lay.item ? lay.item.implicitWidth + Style.spacing.controlGap : 0)
|
||||
implicitHeight: vertical ? (lay.item ? lay.item.implicitHeight + Style.spacing.controlGap : 0) : (bar ? bar.barSize : Style.bar.sizeHorizontal)
|
||||
implicitWidth: vertical ? barSize : (lay.item ? lay.item.implicitWidth + Style.spacing.controlGap : 0)
|
||||
implicitHeight: vertical ? (lay.item ? lay.item.implicitHeight + Style.spacing.controlGap : 0) : barSize
|
||||
|
||||
Loader {
|
||||
id: lay
|
||||
|
||||
Reference in New Issue
Block a user