Files
elgato-cli/plasmoid/at.sub-net.elgato/contents/ui/FullRepresentation.qml
T
tina.schellander ca36b15af1 Initial implementation: CLI + KDE Plasma 6 widget for Elgato Key Light
- Python CLI (click): discover, status, on/off/toggle, brightness, temperature, info
- mDNS discovery via zeroconf for automatic light detection
- Shared config at ~/.config/elgato-cli/config.json
- KDE Plasma 6 plasmoid with system tray icon, power/brightness/temperature controls
- Plasmoid uses XMLHttpRequest directly to light API (no CLI dependency)
- Unit tests for API client with mocked HTTP responses
2026-02-07 11:14:01 +01:00

124 lines
3.6 KiB
QML

import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.plasma.components as PC3
ColumnLayout {
id: fullRoot
Layout.preferredWidth: Kirigami.Units.gridUnit * 18
Layout.preferredHeight: Kirigami.Units.gridUnit * 10
Layout.minimumWidth: Kirigami.Units.gridUnit * 14
spacing: Kirigami.Units.smallSpacing
// Not configured state
PC3.Label {
Layout.alignment: Qt.AlignCenter
text: "Run 'elgato discover' or configure host in widget settings"
visible: root.lightHost === ""
wrapMode: Text.WordWrap
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
}
// Unreachable state
PC3.Label {
Layout.alignment: Qt.AlignCenter
text: "Light unreachable (" + root.lightHost + ")"
visible: root.lightHost !== "" && !root.lightReachable
wrapMode: Text.WordWrap
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
}
// Controls (only when reachable)
ColumnLayout {
visible: root.lightHost !== "" && root.lightReachable
Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing
Layout.margins: Kirigami.Units.smallSpacing
// Header: Power switch
RowLayout {
Layout.fillWidth: true
Kirigami.Icon {
source: "video-television"
Layout.preferredWidth: Kirigami.Units.iconSizes.medium
Layout.preferredHeight: Kirigami.Units.iconSizes.medium
}
PC3.Label {
text: "Elgato Key Light"
font.bold: true
Layout.fillWidth: true
}
QQC2.Switch {
checked: root.lightOn
onToggled: root.toggleLight()
}
}
Kirigami.Separator {
Layout.fillWidth: true
}
// Brightness slider
RowLayout {
Layout.fillWidth: true
Kirigami.Icon {
source: "brightness-high"
Layout.preferredWidth: Kirigami.Units.iconSizes.small
Layout.preferredHeight: Kirigami.Units.iconSizes.small
}
PC3.Slider {
id: brightnessSlider
Layout.fillWidth: true
from: 3
to: 100
stepSize: 1
value: root.lightBrightness
onMoved: root.setBrightness(Math.round(value))
}
PC3.Label {
text: Math.round(brightnessSlider.value) + "%"
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
horizontalAlignment: Text.AlignRight
}
}
// Temperature slider
RowLayout {
Layout.fillWidth: true
Kirigami.Icon {
source: "color-management"
Layout.preferredWidth: Kirigami.Units.iconSizes.small
Layout.preferredHeight: Kirigami.Units.iconSizes.small
}
PC3.Slider {
id: temperatureSlider
Layout.fillWidth: true
from: 143
to: 344
stepSize: 1
value: root.lightTemperature
onMoved: root.setTemperature(Math.round(value))
}
PC3.Label {
text: Math.round(1000000 / temperatureSlider.value) + "K"
Layout.preferredWidth: Kirigami.Units.gridUnit * 3
horizontalAlignment: Text.AlignRight
}
}
}
}