5.1 KiB · text History e49521d
import QtQuick
import QtQuick.Controls as QQC2
import QtQuick.Layouts
import org.kde.kirigami as Kirigami
import org.kde.kcmutils as KCM

KCM.SimpleKCM {
    id: configBehavior

    property alias cfg_updateInterval: updateIntervalSpinBox.value
    property alias cfg_activeInterval: activeIntervalSpinBox.value
    property alias cfg_runsPerRepo: runsPerRepoSpinBox.value
    property alias cfg_hideIdle: hideIdleCheckBox.checked
    property alias cfg_notifyMyFailures: notifyMyFailuresCheckBox.checked
    property alias cfg_desktopWall: desktopWallCheckBox.checked
    property alias cfg_wallTint: wallTintCheckBox.checked
    property alias cfg_wallTintHue: wallTintHueSpinBox.value

    Kirigami.FormLayout {
        QQC2.SpinBox {
            id: updateIntervalSpinBox
            Kirigami.FormData.label: i18n("Refresh every (seconds):")
            from: 10
            to: 3600
            value: 60
        }

        QQC2.SpinBox {
            id: activeIntervalSpinBox
            Kirigami.FormData.label: i18n("While a run is in flight (seconds):")
            from: 2
            to: 300
            value: 5
        }

        QQC2.Label {
            Layout.fillWidth: true
            wrapMode: Text.WordWrap
            font: Kirigami.Theme.smallFont
            color: Kirigami.Theme.disabledTextColor
            text: i18n("While anything is queued, waiting or running the widget polls faster, and only refetches repositories whose status moved or hasn't finished. A fork's run waiting for approval is checked at the normal pace.")
        }

        QQC2.SpinBox {
            id: runsPerRepoSpinBox
            Kirigami.FormData.label: i18n("Runs listed per repository:")
            from: 1
            to: 50
            value: 10
        }

        QQC2.CheckBox {
            id: hideIdleCheckBox
            Kirigami.FormData.label: i18n("Circles:")
            text: i18n("Hide repositories that have never run CI")
        }

        QQC2.CheckBox {
            id: desktopWallCheckBox
            Kirigami.FormData.label: i18n("Live CI wall:")
            text: i18n("Wall mode: on the desktop, show the wall")
        }

        QQC2.Label {
            Layout.fillWidth: true
            wrapMode: Text.WordWrap
            font: Kirigami.Theme.smallFont
            color: Kirigami.Theme.disabledTextColor
            text: i18n("Every job running right now, a card each, tiled to fill the widget. Resize it, or give it a screen of its own. In a panel the widget stays the circles; open the wall from the popup or the right-click menu instead.")
        }

        QQC2.CheckBox {
            id: wallTintCheckBox
            text: i18n("Tint all text one hue")
        }

        RowLayout {
            Kirigami.FormData.label: i18n("Tint hue:")
            enabled: wallTintCheckBox.checked
            spacing: Kirigami.Units.smallSpacing

            QQC2.SpinBox {
                id: wallTintHueSpinBox
                from: 0
                to: 359
                value: 120
                // The wheel goes round: past 359 is 0 again.
                wrap: true
                textFromValue: function(value) { return value + "°" }
                valueFromText: function(text) { return parseInt(text, 10) || 0 }
            }

            // What the wall's text will look like, on a dark theme.
            Rectangle {
                Layout.preferredWidth: Kirigami.Units.gridUnit * 3
                Layout.preferredHeight: wallTintHueSpinBox.implicitHeight
                radius: Kirigami.Units.cornerRadius
                color: "#1b1e20"
                opacity: parent.enabled ? 1 : 0.5
                QQC2.Label {
                    anchors.centerIn: parent
                    font.family: "monospace"
                    font.bold: true
                    color: Qt.hsla(wallTintHueSpinBox.value / 360, 0.85, 0.62, 1)
                    text: "0:42"
                }
            }

            QQC2.Button {
                text: i18n("Green")
                visible: wallTintHueSpinBox.value !== 120
                onClicked: wallTintHueSpinBox.value = 120
            }
        }

        QQC2.Label {
            Layout.fillWidth: true
            wrapMode: Text.WordWrap
            font: Kirigami.Theme.smallFont
            color: Kirigami.Theme.disabledTextColor
            text: i18n("Labels, the clock, card borders and icons, for a terminal look that pairs with the window's translucent background. Failed steps and errors keep their colours. H toggles it in the window, as does the header's tint button.")
        }

        QQC2.CheckBox {
            id: notifyMyFailuresCheckBox
            Kirigami.FormData.label: i18n("Notifications:")
            text: i18n("Notify when any run I triggered fails")
        }

        QQC2.Label {
            Layout.fillWidth: true
            wrapMode: Text.WordWrap
            font: Kirigami.Theme.smallFont
            color: Kirigami.Theme.disabledTextColor
            text: i18n("\"I\" is the user the access token belongs to. Only runs in watched repositories that the widget saw in flight count. To hear about one particular run whatever its outcome, use the bell on that run.")
        }
    }
}