Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

quickshell/nuguland/features/connectivity/ConnectivityEmptyState.qml

Raw
import QtQuick
import "../.."

// A section without rows: glyph, one sentence, its next step and, where the
// section header holds no such control, one action.
Item {
    id: root

    required property Theme theme
    property string icon: ""
    property string title: ""
    property string detail: ""
    property string actionText: ""
    property string actionName: actionText
    // The action control, e.g. for the panel's initial focus.
    readonly property Item actionControl: action
    signal activated

    implicitHeight: Math.max(56, content.implicitHeight + root.theme.spaceSm * 2)

    Text {
        id: glyph

        anchors.left: parent.left
        anchors.leftMargin: root.theme.spaceXs
        anchors.verticalCenter: parent.verticalCenter
        width: 28
        horizontalAlignment: Text.AlignHCenter
        font.family: root.theme.fontIcon
        font.pixelSize: 24
        color: root.theme.ui.minor
        text: root.icon
        Accessible.ignored: true
    }

    Column {
        id: content

        anchors.left: glyph.right
        anchors.leftMargin: root.theme.spaceMd
        anchors.right: action.visible ? action.left : parent.right
        anchors.rightMargin: action.visible ? root.theme.spaceMd : 0
        anchors.verticalCenter: parent.verticalCenter
        spacing: 2

        NuguText {
            width: parent.width
            theme: root.theme
            text: root.title
            wrapMode: Text.WordWrap
        }

        NuguText {
            visible: text.length > 0
            width: parent.width
            theme: root.theme
            variant: "meta"
            text: root.detail
            color: root.theme.ui.minor
            wrapMode: Text.WordWrap
        }
    }

    PopupButton {
        id: action

        visible: root.actionText.length > 0
        anchors.right: parent.right
        anchors.verticalCenter: parent.verticalCenter
        theme: root.theme
        height: 30
        width: implicitWidth
        text: root.actionText
        accessibleName: root.actionName
        onClicked: root.activated()
    }
}