Reword code comments in plain technical language
Comments only, no code changes. Replaces vague or personified phrasing with explicit statements of what the code does and why, uses bullet lists for multi-case behavior, and fixes the settings path in WindowSettings.h (~/.config/sloposk/sloposk.conf). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -1,7 +1,7 @@
|
||||
import QtQuick
|
||||
|
||||
// A small on/off button in the grab bar; lit while on. The icon goes inside
|
||||
// and should draw in `foreground`.
|
||||
// On/off button in the grab bar, highlighted while on.
|
||||
// Child items form the icon and should use `foreground` as their color.
|
||||
Item {
|
||||
id: toggle
|
||||
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
import QtQuick
|
||||
|
||||
// The grab bar under the floating keyboard. Moving the window is up to the
|
||||
// owner (the window manager's move, so it works for mouse and touch alike).
|
||||
// Grab bar below the keyboard. Only emits dragStarted(); the parent starts
|
||||
// the window manager's move (works for mouse and touch).
|
||||
Item {
|
||||
id: handle
|
||||
|
||||
// Narrower when the bar's buttons leave less room in the middle.
|
||||
// Set smaller when the bar's buttons take up more width.
|
||||
property real pillWidth: 120
|
||||
signal dragStarted()
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import QtQuick
|
||||
|
||||
// The dismiss key left floating while the keyboard is shrunk; see-through so
|
||||
// it hides less. Tap to bring the keyboard back; dragging is up to the owner
|
||||
// (the window manager's move).
|
||||
// Button shown in place of the keyboard while it is collapsed. Semi-transparent
|
||||
// so it covers less. Tap emits tapped() (expand); drag emits dragStarted() and
|
||||
// the parent starts the window manager's move.
|
||||
Item {
|
||||
id: button
|
||||
|
||||
@@ -28,7 +28,7 @@ Item {
|
||||
|
||||
TapHandler {
|
||||
id: tap
|
||||
// The move ends with a release that would otherwise count as a tap.
|
||||
// Set during a drag, so the release that ends the drag isn't treated as a tap.
|
||||
property bool moved: false
|
||||
onPressedChanged: if (pressed) moved = false
|
||||
onTapped: if (!moved) button.tapped()
|
||||
|
||||
+3
-3
@@ -30,9 +30,9 @@ Item {
|
||||
return modifierModes[modifier] ?? KeyboardController.Off
|
||||
return KeyboardController.Off
|
||||
}
|
||||
// Shift shows locking with its glyph; the others turn accent-coloured.
|
||||
// Accent color for locked modifiers. Shift is excluded: its glyph shows the lock.
|
||||
readonly property bool locked: latch === KeyboardController.Locked && keyType !== "shift"
|
||||
// Character keys darken when pressed; function keys lighten (as on iPad).
|
||||
// Light background: character keys at rest, function keys while pressed or latched (as on iPad).
|
||||
readonly property bool lit: (isCharacter !== pressed) || latch !== KeyboardController.Off
|
||||
|
||||
readonly property var defaultGlyphs: ({
|
||||
@@ -46,7 +46,7 @@ Item {
|
||||
return ["⇧", "⬆", "⇪"][shiftMode]
|
||||
return label !== "" ? label : (defaultGlyphs[keyType] ?? "")
|
||||
}
|
||||
// Count code points, not UTF-16 units, so emoji glyphs aren't treated as words.
|
||||
// Multi-character label (e.g. "return"). Counts code points, not UTF-16 units, so an emoji counts as one.
|
||||
readonly property bool isWord: [...displayLabel].length > 1 && !isCharacter
|
||||
|
||||
x: keyX
|
||||
|
||||
+9
-9
@@ -12,36 +12,36 @@ Window {
|
||||
property var collapse: null // CollapseController, set from C++
|
||||
readonly property bool collapsed: collapse?.collapsed ?? false
|
||||
property bool settingsOpen: false
|
||||
// Height of the key area, for C++ keeping key sizes when rows change.
|
||||
// Read by C++ to keep key size constant when rows are added or removed.
|
||||
readonly property real keysHeight: keyboard.height
|
||||
|
||||
// Transparent room above the keyboard for long-press popups on the top row.
|
||||
// Transparent space above the keyboard for the top row's long-press popups.
|
||||
readonly property real popupMargin: 90
|
||||
// Outside this, input passes through to whatever is below the window.
|
||||
// Input outside this rect goes to the window underneath.
|
||||
readonly property rect inputRegion: collapsed
|
||||
? Qt.rect(floatingButton.x, floatingButton.y, floatingButton.width, floatingButton.height)
|
||||
: keyboard.alternates.open
|
||||
? Qt.rect(0, 0, width, height)
|
||||
: Qt.rect(panel.x, panel.y, panel.width, panel.height)
|
||||
// Empty when nothing shows through, so the compositor skips the blur.
|
||||
// Empty (no blur) when collapsed, blur is off, or the background is opaque.
|
||||
readonly property rect blurRegion: !collapsed && settings.blurBackground && settings.backgroundOpacity < 1
|
||||
? Qt.rect(panel.x, panel.y, panel.width, panel.height)
|
||||
: Qt.rect(0, 0, 0, 0)
|
||||
|
||||
width: 1000
|
||||
height: 340 + popupMargin
|
||||
// None while shrunk to the floating button.
|
||||
// No minimum while collapsed, so the window can shrink to the button.
|
||||
minimumWidth: collapsed ? 0 : 480
|
||||
minimumHeight: collapsed ? 0 : 180 + popupMargin
|
||||
visible: false
|
||||
color: "transparent"
|
||||
|
||||
// Alt+F4 or the task manager would hide it behind the visibility
|
||||
// controller's back; the dismiss key and the tray toggle hide it instead.
|
||||
// Ignore close requests (Alt+F4, task manager): they would hide the window
|
||||
// without VisibilityController knowing. Hiding goes through the dismiss key or tray toggle.
|
||||
onClosing: close => close.accepted = false
|
||||
onInputRegionChanged: placement?.setInputRegion(inputRegion)
|
||||
onBlurRegionChanged: placement?.setBlurRegion(blurRegion, Theme.windowRadius)
|
||||
// For CollapseController.
|
||||
// Called by CollapseController.
|
||||
function dismissKeyRect() {
|
||||
return keyboard.keyRect("dismiss");
|
||||
}
|
||||
@@ -107,7 +107,7 @@ Window {
|
||||
FloatingButton {
|
||||
id: floatingButton
|
||||
readonly property rect keyRect: root.collapse?.keyRect ?? Qt.rect(0, 0, 0, 0)
|
||||
// Over the key while the window is full size, then in the shrunk window.
|
||||
// keyRect is in full-window coordinates; the clamp keeps the button inside the window once it has shrunk.
|
||||
x: Math.max(0, Math.min(keyRect.x, root.width - width))
|
||||
y: Math.max(0, Math.min(keyRect.y, root.height - height))
|
||||
width: keyRect.width
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import QtQuick
|
||||
import Sloposk
|
||||
|
||||
// One-tap switches for the most changed key options, beside the gear.
|
||||
// Icons are drawn from boxes so they don't depend on the fonts installed.
|
||||
// Toggle buttons for frequently changed key options, next to the settings button.
|
||||
// Icons are built from Rectangles, so they don't depend on installed fonts.
|
||||
Row {
|
||||
id: toggles
|
||||
|
||||
@@ -13,8 +13,8 @@ Row {
|
||||
return layoutModel.sections.some(s => s.id === id);
|
||||
}
|
||||
|
||||
// Shows or hides one of the template's optional sections; absent from
|
||||
// layouts without it.
|
||||
// Shows or hides an optional template section. Not displayed if the
|
||||
// layout has no such section.
|
||||
component SectionToggle: BarToggle {
|
||||
required property string section
|
||||
|
||||
@@ -23,7 +23,7 @@ Row {
|
||||
onToggled: checked => toggles.settings.setSectionVisible(section, checked)
|
||||
}
|
||||
|
||||
// A grid of tiny keys, optionally in a keyboard outline.
|
||||
// Icon: grid of small keys, optionally inside a keyboard outline.
|
||||
component KeyGrid: Item {
|
||||
id: keyGrid
|
||||
required property color color
|
||||
@@ -58,7 +58,7 @@ Row {
|
||||
}
|
||||
}
|
||||
|
||||
// A key outline with a label on it.
|
||||
// Icon: key outline with a text label.
|
||||
component LabelledKey: Rectangle {
|
||||
property alias label: caption.text
|
||||
property alias textColor: caption.color
|
||||
@@ -90,7 +90,7 @@ Row {
|
||||
label: qsTr("Hold Keys")
|
||||
checked: toggles.settings.holdKeys
|
||||
onToggled: checked => toggles.settings.holdKeys = checked
|
||||
// A fingertip resting on a key, holding it down.
|
||||
// Icon: finger pressing a key (hold-keys mode).
|
||||
Rectangle {
|
||||
anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom }
|
||||
width: 18
|
||||
@@ -119,7 +119,7 @@ Row {
|
||||
id: navigation
|
||||
section: "navigation"
|
||||
label: qsTr("Navigation Keys")
|
||||
// The inverted T of the arrow keys.
|
||||
// Icon: arrow keys in an inverted T.
|
||||
Repeater {
|
||||
model: [[1, 0], [0, 1], [1, 1], [2, 1]]
|
||||
Rectangle {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import QtQuick
|
||||
|
||||
// Corner grip. Resizing is up to the owner (the window manager's resize).
|
||||
// Corner grip. Only emits dragStarted(); the parent starts the window manager's resize.
|
||||
Item {
|
||||
id: grip
|
||||
|
||||
@@ -28,7 +28,7 @@ Item {
|
||||
|
||||
DragHandler {
|
||||
target: null
|
||||
// The grab bar lies underneath and would take the drag over.
|
||||
// Prevent the grab bar underneath from taking over the drag.
|
||||
grabPermissions: PointerHandler.TakeOverForbidden
|
||||
cursorShape: Qt.SizeFDiagCursor
|
||||
onActiveChanged: if (active) grip.dragStarted()
|
||||
|
||||
@@ -5,7 +5,7 @@ Item {
|
||||
id: button
|
||||
|
||||
property bool checked: false
|
||||
// Something doesn't work (see Diagnostics): a dot invites a look in settings.
|
||||
// Shows a dot when Diagnostics reports a problem.
|
||||
property bool alert: false
|
||||
signal clicked()
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import QtQuick
|
||||
import Sloposk
|
||||
|
||||
// Replaces the keys while open, over the window's own background so
|
||||
// opacity changes show live. Binds straight to Settings, which persists.
|
||||
// Shown instead of the keys while open. Drawn on the window background, so
|
||||
// opacity changes are visible immediately. Bound directly to Settings, which saves to disk.
|
||||
Flickable {
|
||||
id: panel
|
||||
|
||||
@@ -113,7 +113,7 @@ Flickable {
|
||||
}
|
||||
|
||||
Repeater {
|
||||
// "main" is the typing keys; the rest come from the template.
|
||||
// "main" = the typing keys; other ids are template sections.
|
||||
model: [{ id: "main", name: qsTr("Typing keys") }].concat(panel.layoutModel.sections)
|
||||
|
||||
ToggleRow {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import QtQuick
|
||||
|
||||
// A labelled slider in the iOS style; value runs from `from` to 1.
|
||||
// iOS-style labelled slider; value range is `from`..1.
|
||||
Item {
|
||||
id: row
|
||||
|
||||
|
||||
Reference in New Issue
Block a user