Hold power actions to confirm instead of a confirm row
Logout, reboot and shut down now fill with accent liquid while held and run once full; letting go early drains it. A tap hints to hold. Replaces the Confirm/Cancel rows in the control center tile and dashboard tab. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e918414d1
commit
d37f9b7121
10 files changed
+350
-102
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import QtQuick
|
||||
import "../components"
|
||||
import "../theme"
|
||||
|
||||
// Round glyph button used by the media controls and the power tab.
|
||||
@@ -12,7 +13,17 @@ Rectangle {
|
||||
property bool active: false
|
||||
property bool danger: false
|
||||
property bool interactive: true
|
||||
// Hold-to-confirm: liquid fills the button while held, held() fires once
|
||||
// full and clicked() is not emitted.
|
||||
property bool hold: false
|
||||
// Callers may withhold filling, e.g. until an action is pending.
|
||||
property bool armed: true
|
||||
readonly property bool holding: hold && armed && area.pressed && area.containsMouse
|
||||
readonly property bool pressed: area.pressed
|
||||
readonly property bool filled: fill.active
|
||||
signal clicked
|
||||
signal held
|
||||
signal holdCancelled
|
||||
implicitWidth: size
|
||||
implicitHeight: size
|
||||
radius: size / 2
|
||||
@@ -42,13 +53,25 @@ Rectangle {
|
||||
font.pixelSize: Math.round(root.size * root.glyphScale)
|
||||
color: root.accented ? Theme.accentText : root.active ? Theme.accentVivid : Theme.text
|
||||
}
|
||||
HoldFill {
|
||||
id: fill
|
||||
anchors.fill: parent
|
||||
visible: root.hold
|
||||
holding: root.holding
|
||||
glyph: root.glyph
|
||||
fallback: root.fallback
|
||||
glyphSize: Math.round(root.size * root.glyphScale)
|
||||
onCompleted: root.held()
|
||||
onCancelled: root.holdCancelled()
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
enabled: root.interactive
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.clicked()
|
||||
onClicked: if (!root.hold)
|
||||
root.clicked()
|
||||
}
|
||||
Accessible.role: Accessible.Button
|
||||
}
|
||||
Reference in new issue
Block a user