Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

quickshell/nuguland/features/brightness/LightConfig.qml

Raw
import QtQuick
import "../.."
import "brightness.js" as BrightnessModel

ConfigSection {
    id: root
    required property Brightness service
    name: "light"
    label: "light"
    property bool showSteps: false
    readonly property var summary: BrightnessModel.setupSummary(root.service.setupStages, root.service.setupRunning, root.service.setupError)
    rows: [
        ConfigRow {
            kind: ConfigRow.Action
            label: root.service.setupReady ? "monitor control ready" : "set up monitor control"
            enabled: root.service.setupReady || (!root.service.setupExpanded && root.service.setupAvailable)
            onActivated: {
                if (root.service.setupReady)
                    root.service.toggleSetup();
                else
                    root.service.setupDdc();
            }
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupExpanded && !root.service.setupReady
            status: root.summary.text
        },
        ConfigRow {
            kind: ConfigRow.Action
            label: root.showSteps ? "hide steps" : "show steps"
            visible: root.service.setupExpanded && !root.service.setupReady
            onActivated: root.showSteps = !root.showSteps
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupReady ? root.service.setupExpanded : root.showSteps && root.service.setupExpanded
            status: root.service.setupStages.length > 0 ? BrightnessModel.stageLine(root.service.setupStages[0]) : ""
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupReady ? root.service.setupExpanded : root.showSteps && root.service.setupExpanded
            status: root.service.setupStages.length > 1 ? BrightnessModel.stageLine(root.service.setupStages[1]) : ""
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupReady ? root.service.setupExpanded : root.showSteps && root.service.setupExpanded
            status: root.service.setupStages.length > 2 ? BrightnessModel.stageLine(root.service.setupStages[2]) : ""
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupReady ? root.service.setupExpanded : root.showSteps && root.service.setupExpanded
            status: root.service.setupStages.length > 3 ? BrightnessModel.stageLine(root.service.setupStages[3]) : ""
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupReady ? root.service.setupExpanded : root.showSteps && root.service.setupExpanded
            status: root.service.setupStages.length > 4 ? BrightnessModel.stageLine(root.service.setupStages[4]) : ""
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupReady ? root.service.setupExpanded : root.showSteps && root.service.setupExpanded
            status: root.service.setupStages.length > 5 ? BrightnessModel.stageLine(root.service.setupStages[5]) : ""
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupReady ? root.service.setupExpanded : root.showSteps && root.service.setupExpanded
            status: root.service.setupStages.length > 6 ? BrightnessModel.stageLine(root.service.setupStages[6]) : ""
        },
        ConfigRow {
            kind: ConfigRow.Status
            label: ""
            visible: root.service.setupExpanded && root.service.setupError.length > 0 && root.service.setupError !== root.summary.detail
            status: root.service.setupError
        },
        ConfigRow {
            kind: ConfigRow.Action
            label: root.service.cancelRequested ? "cancelling" : "cancel setup"
            visible: root.service.setupRunning
            enabled: !root.service.cancelRequested
            onActivated: root.service.cancelSetup()
        },
        ConfigRow {
            kind: ConfigRow.Action
            label: "retry setup"
            visible: !root.service.setupRunning && root.service.setupError.length > 0
            enabled: root.service.setupAvailable
            onActivated: root.service.retrySetup()
        }
    ]
}