mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-25 22:34:56 +00:00
Second-pass a11y work across all 12 component groups. Every interactive element now has activeFocusOnTab, Keys.onReturnPressed/SpacePressed, and context-aware Accessible.name/description bindings. Highlights: - Dialogs: keyboard handlers with enabled-guard on confirm buttons - CDropdownMenu: full keyboard nav (Up/Down/Enter/Escape) - CLoginForm: explicit KeyNavigation.tab chain (username→password→submit) - CNotificationBell: dynamic "3 notifications"/"No notifications" name - CJobProgressBar: Accessible.minimumValue/maximumValue/currentValue - CExecutionStatusDot: "Execution status: Running/Passed/Failed" binding - CKeyboardShortcuts: invisible Repeater exposes all shortcuts to a11y tree - CDataTable rows: "Row N of M" descriptions - Canvas elements: Accessible.Canvas role + keyboard zoom (+/- keys) - DropdownExpandedList: focus-highlight extended to :activeFocus - Dynamic names reflect loading state (e.g. "Signing in, please wait") Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
200 lines
6.1 KiB
QML
200 lines
6.1 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
Dialog {
|
|
id: dialog
|
|
objectName: "patchDialog"
|
|
Accessible.role: Accessible.Dialog
|
|
Accessible.name: "Git Patch"
|
|
|
|
title: "Git Patch"
|
|
width: 900
|
|
height: 650
|
|
modal: true
|
|
standardButtons: Dialog.Close
|
|
|
|
property string patchText: ""
|
|
property int additions: 0
|
|
property int deletions: 0
|
|
property var themeColors: ({})
|
|
|
|
// Internal colors with fallbacks
|
|
readonly property var colors: ({
|
|
background: themeColors.window || themeColors.background || "#0d0d0d",
|
|
paper: themeColors.alternateBase || "#1a1a1a",
|
|
text: themeColors.windowText || themeColors.text || "#ffffff",
|
|
textSecondary: themeColors.textSecondary || "#a0a0a0",
|
|
accent: themeColors.accent || "#10a37f",
|
|
success: themeColors.success || "#22c55e",
|
|
error: themeColors.error || "#ef4444",
|
|
border: themeColors.border || "#333333",
|
|
codeBackground: themeColors.codeBackground || "#1a1a1a"
|
|
})
|
|
|
|
background: Rectangle {
|
|
color: colors.background
|
|
radius: 8
|
|
border.color: colors.border
|
|
border.width: 1
|
|
}
|
|
|
|
header: Label {
|
|
text: dialog.title
|
|
font.bold: true
|
|
font.pixelSize: 16
|
|
color: colors.text
|
|
padding: 16
|
|
background: Rectangle {
|
|
color: colors.paper
|
|
radius: 8
|
|
}
|
|
}
|
|
|
|
function show(patch) {
|
|
patchText = patch
|
|
// Count additions and deletions
|
|
var lines = patch.split('\n')
|
|
additions = 0
|
|
deletions = 0
|
|
for (var i = 0; i < lines.length; i++) {
|
|
if (lines[i].startsWith('+') &&
|
|
!lines[i].startsWith('+++')) additions++
|
|
if (lines[i].startsWith('-') &&
|
|
!lines[i].startsWith('---')) deletions++
|
|
}
|
|
open()
|
|
}
|
|
|
|
ColumnLayout {
|
|
anchors.fill: parent
|
|
spacing: 12
|
|
|
|
// Stats and actions
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
spacing: 16
|
|
|
|
Label {
|
|
text: "+" + additions
|
|
color: colors.success
|
|
font.bold: true
|
|
}
|
|
|
|
Label {
|
|
text: "-" + deletions
|
|
color: colors.error
|
|
font.bold: true
|
|
}
|
|
|
|
Label {
|
|
text: patchText.split('\n').length + " lines"
|
|
color: colors.textSecondary
|
|
}
|
|
|
|
Item { Layout.fillWidth: true }
|
|
|
|
Button {
|
|
text: "📋 Copy to Clipboard"
|
|
objectName: "patchCopyBtn"
|
|
Accessible.role: Accessible.Button
|
|
Accessible.name: "Copy to clipboard"
|
|
Accessible.description: "Copy patch"
|
|
activeFocusOnTab: true
|
|
Keys.onReturnPressed:
|
|
app.copyToClipboard(patchText)
|
|
Keys.onSpacePressed:
|
|
app.copyToClipboard(patchText)
|
|
onClicked: app.copyToClipboard(
|
|
patchText)
|
|
background: Rectangle {
|
|
color: parent.hovered
|
|
? Qt.lighter(
|
|
colors.paper, 1.2)
|
|
: colors.paper
|
|
radius: 4
|
|
border.color: colors.border
|
|
}
|
|
contentItem: Text {
|
|
text: parent.text
|
|
color: colors.text
|
|
horizontalAlignment:
|
|
Text.AlignHCenter
|
|
verticalAlignment:
|
|
Text.AlignVCenter
|
|
}
|
|
}
|
|
|
|
Button {
|
|
text: "💾 Save to File"
|
|
objectName: "patchSaveBtn"
|
|
Accessible.role: Accessible.Button
|
|
Accessible.name: "Save to file"
|
|
Accessible.description: "Save patch"
|
|
activeFocusOnTab: true
|
|
Keys.onReturnPressed:
|
|
app.copyToClipboard(patchText)
|
|
Keys.onSpacePressed:
|
|
app.copyToClipboard(patchText)
|
|
onClicked: app.copyToClipboard(
|
|
patchText)
|
|
background: Rectangle {
|
|
color: parent.hovered
|
|
? Qt.lighter(
|
|
colors.paper, 1.2)
|
|
: colors.paper
|
|
radius: 4
|
|
border.color: colors.border
|
|
}
|
|
contentItem: Text {
|
|
text: parent.text
|
|
color: colors.text
|
|
horizontalAlignment:
|
|
Text.AlignHCenter
|
|
verticalAlignment:
|
|
Text.AlignVCenter
|
|
}
|
|
}
|
|
}
|
|
|
|
// Instructions
|
|
Label {
|
|
text: "Apply with: git apply < patch.diff"
|
|
color: colors.textSecondary
|
|
font.pixelSize: 12
|
|
}
|
|
|
|
// Diff view with syntax highlighting
|
|
ScrollView {
|
|
Layout.fillWidth: true
|
|
Layout.fillHeight: true
|
|
clip: true
|
|
|
|
TextArea {
|
|
id: patchArea
|
|
text: patchText
|
|
readOnly: true
|
|
font.family: "Menlo"
|
|
font.pixelSize: 12
|
|
wrapMode: Text.NoWrap
|
|
selectByMouse: true
|
|
textFormat: Text.PlainText
|
|
Accessible.role: Accessible.StaticText
|
|
Accessible.name: "Patch diff"
|
|
Accessible.description:
|
|
additions + " additions, "
|
|
+ deletions + " deletions"
|
|
|
|
background: Rectangle {
|
|
color: colors.codeBackground
|
|
radius: 4
|
|
border.color: colors.border
|
|
border.width: 1
|
|
}
|
|
|
|
color: colors.text
|
|
}
|
|
}
|
|
}
|
|
}
|