b7fea83ed6
Deliver the initial local bridge, Noctalia v4/v5 adapters, desktop client, service unit, tests, and implementation documentation for persistent Pi status and control.
56 lines
2.1 KiB
QML
56 lines
2.1 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import Quickshell
|
|
import qs.Commons
|
|
import qs.Widgets
|
|
|
|
Item {
|
|
id: root
|
|
property var pluginApi: null
|
|
property ShellScreen screen
|
|
property string widgetId: ""
|
|
property string section: ""
|
|
property int sectionWidgetIndex: -1
|
|
property int sectionWidgetsCount: 0
|
|
|
|
readonly property string screenName: screen?.name ?? ""
|
|
readonly property real capsuleHeight: Style.getCapsuleHeightForScreen(screenName)
|
|
readonly property string bridgeState: pluginApi?.pluginSettings?.bridgeState ?? "idle"
|
|
readonly property string projectLabel: pluginApi?.pluginSettings?.projectLabel ?? "Home"
|
|
readonly property int attentionCount: pluginApi?.pluginSettings?.attentionCount ?? 0
|
|
readonly property string glyph: bridgeState === "streaming" ? "◒" : bridgeState === "failed" ? "!" : attentionCount > 0 ? "●" : "●"
|
|
readonly property color stateColor: bridgeState === "failed" ? Color.mError : attentionCount > 0 ? Color.mPrimary : Color.mOnSurface
|
|
implicitWidth: content.implicitWidth + Style.marginM * 2
|
|
implicitHeight: capsuleHeight
|
|
|
|
Rectangle {
|
|
id: visualCapsule
|
|
anchors.centerIn: parent
|
|
width: root.implicitWidth
|
|
height: root.implicitHeight
|
|
radius: Style.radiusL
|
|
color: mouseArea.containsMouse ? Color.mHover : Style.capsuleColor
|
|
border.color: Style.capsuleBorderColor
|
|
border.width: Style.capsuleBorderWidth
|
|
|
|
RowLayout {
|
|
id: content
|
|
anchors.centerIn: parent
|
|
spacing: Style.marginS
|
|
Text { text: root.glyph; color: root.stateColor; font.bold: true }
|
|
Text { text: root.projectLabel; color: Color.mOnSurface; elide: Text.ElideRight; Layout.maximumWidth: 160 }
|
|
Text { visible: root.attentionCount > 0; text: root.attentionCount; color: root.stateColor; font.bold: true }
|
|
}
|
|
|
|
MouseArea {
|
|
id: mouseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
onClicked: {
|
|
if (pluginApi)
|
|
pluginApi.togglePanel(root.screen, visualCapsule)
|
|
}
|
|
}
|
|
}
|
|
}
|