ii-base and ii-phone each carried a 357-line BarContent to express eight differences, all of them either "is this widget shown" or "which slot is it in". No behaviour differed. Every bar edit had to be made twice or diverge silently against the pin. Widgets are now declared once as Components in a registry; each slot is a Repeater over a list of widget names, so placement and order are data. Config names a slot or a device profile picks it. "auto" derives the profile from the same cramped-ness test behind useShortenedForm, so the phone keeps its arrangement with no config file. Loaders are active only when placed, so an unplaced widget is never constructed. The agent island becomes a placeable widget rather than a mount smuggled into UtilButtons: it reaches every device bar from one declaration. ClockWidget is unified for the same reason. Its phone fork existed solely to add customFormat, which BarContent now sets on every device. bar.agentSessions was landing under background.widgets, not bar, so Config.options.bar.agentSessions was always undefined and only the ?? true fallback made the island appear wired. Moved, and merged into the existing bar.indicators rather than declaring a second one.
58 lines
1.8 KiB
QML
58 lines
1.8 KiB
QML
import qs.modules.common
|
|
import qs.modules.common.widgets
|
|
import qs.services
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
Item {
|
|
id: root
|
|
property bool borderless: Config.options.bar.borderless
|
|
property bool showDate: Config.options.bar.verbose
|
|
// Per-instance Qt date format; empty = the global DateTime.time
|
|
// (time.format in config.json, which the desktop clock also uses).
|
|
//
|
|
// Souveraine-owned override of the ii ClockWidget. This property was the
|
|
// ENTIRE content of ii-phone's 8-line fork of this file, and BarContent
|
|
// now sets it on every device — so without unifying here, the desktop
|
|
// clock would be handed a property that does not exist on it. Additive
|
|
// and defaulted to "", so the ii behaviour is unchanged when unset.
|
|
property string customFormat: ""
|
|
implicitWidth: rowLayout.implicitWidth
|
|
implicitHeight: Appearance.sizes.barHeight
|
|
|
|
RowLayout {
|
|
id: rowLayout
|
|
anchors.centerIn: parent
|
|
spacing: 4
|
|
|
|
StyledText {
|
|
font.pixelSize: Appearance.font.pixelSize.large
|
|
color: Appearance.colors.colOnLayer1
|
|
text: root.customFormat ? Qt.locale().toString(DateTime.clock.date, root.customFormat) : DateTime.time
|
|
}
|
|
|
|
StyledText {
|
|
visible: root.showDate
|
|
font.pixelSize: Appearance.font.pixelSize.small
|
|
color: Appearance.colors.colOnLayer1
|
|
text: "•"
|
|
}
|
|
|
|
StyledText {
|
|
visible: root.showDate
|
|
font.pixelSize: Appearance.font.pixelSize.small
|
|
color: Appearance.colors.colOnLayer1
|
|
text: DateTime.longDate
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
id: mouseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: !Config.options.bar.tooltips.clickToShow
|
|
|
|
ClockWidgetPopup {
|
|
hoverTarget: mouseArea
|
|
}
|
|
}
|
|
}
|