// Accessibility.
//
// Pointer size and text scale have to agree across three consumers that share
// no configuration system -- the compositor, GTK applications, and the shell.
// Panama's store is the source of truth and services/Accessibility.qml pushes
// the value to the other two.

import QtQuick
import qs.config
import qs.services

SettingsPage {
    id: root

    title: "Accessibility"
    lede: "Make the desktop easier to see and easier to hit."

    SettingsCard {
        title: "Pointer"
        subtitle: "Applied to the compositor and to applications at the same time."

        SliderRow { setting: "cursorSize" }
        SliderRow { setting: "cursorInactiveTimeout"; zeroLabel: "Never"; divider: false }
    }

    SettingsCard {
        title: "Text"
        subtitle: "Scales text in applications. Panama's own panels are drawn at their design size, so the shell is unaffected."

        SliderRow { setting: "textScale"; divider: false }
    }

    SettingsCard {
        title: "Motion"
        subtitle: "Panama never animates while idle. This affects motion you asked for — windows opening, workspaces sliding, panels appearing."

        ToggleRow { setting: "animationsEnabled"; divider: false }
    }

    SettingsCard {
        title: "Contrast"
        subtitle: "Unfocused windows can be faded to make the focused one obvious, or left at full strength if that is harder to read."

        SliderRow { setting: "inactiveOpacity"; divider: false }
    }

    SettingsCard {
        title: "System accessibility"
        subtitle: "Screen reader, zoom, and on-screen keyboard are provided by GNOME's accessibility stack."

        ActionRow {
            label: "GNOME accessibility settings"
            detail: "Opens in GNOME Settings"
            action: "Open"
            divider: false
            onTriggered: SystemSettings.openGnomePanel("universal-access")
        }
    }

    SettingsCard {
        visible: Accessibility.lastError !== ""
        title: "Could not apply"
        subtitle: Accessibility.lastError
    }
}
