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:
@@ -9,20 +9,13 @@ BarWidget {
|
||||
moduleName: "activeWindow"
|
||||
|
||||
|
||||
function setting(name, fallback) {
|
||||
var value = settings ? settings[name] : undefined
|
||||
return value === undefined || value === null ? fallback : value
|
||||
}
|
||||
|
||||
readonly property var toplevel: ToplevelManager.activeToplevel
|
||||
readonly property string title: toplevel ? (toplevel.title || toplevel.appId || "") : ""
|
||||
readonly property int maxLabelWidth: Number(setting("maxWidth", 280))
|
||||
|
||||
readonly property bool vertical: bar ? bar.vertical : false
|
||||
|
||||
visible: title !== "" && !vertical
|
||||
implicitWidth: visible ? Math.min(maxLabelWidth, labelText.implicitWidth) + Style.spacing.controlPaddingX * 2 : 0
|
||||
implicitHeight: bar ? bar.barSize : 26
|
||||
implicitHeight: barSize
|
||||
|
||||
Behavior on implicitWidth {
|
||||
NumberAnimation { duration: 180; easing.type: Easing.OutCubic }
|
||||
|
||||
Reference in New Issue
Block a user