127 lines
3.9 KiB
QML
127 lines
3.9 KiB
QML
// Guided enrollment, in place, for as long as it takes.
|
|
//
|
|
// fprintd wants the same finger pressed several times from slightly different
|
|
// angles, and it says how many it still needs. That count is the whole content
|
|
// of this panel: a person mid-enrollment is looking at the reader, not the
|
|
// screen, and the one thing they come back to the screen for is whether it
|
|
// worked and how much is left.
|
|
//
|
|
// Nothing here loops. The bar advances when a touch is accepted and then holds,
|
|
// so a panel left open on a desktop that never got touched costs no frames --
|
|
// see the note about repainting animations in the Appearance page.
|
|
|
|
import QtQuick
|
|
import qs.config
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
// Human label for the finger being enrolled, already resolved by the
|
|
// service so nothing here has to know fprintd's vocabulary.
|
|
property string finger: ""
|
|
property int stage: 0
|
|
property int total: 0
|
|
// Whatever the last stream line said, when it said anything worth showing --
|
|
// "enroll-retry-scan", a failure, a completion.
|
|
property string message: ""
|
|
|
|
signal cancelled
|
|
|
|
width: parent ? parent.width : 620
|
|
implicitHeight: body.implicitHeight + 28
|
|
radius: Theme.cardRadius
|
|
color: Theme.alpha(Theme.bgDark, 0.55)
|
|
border.width: 1
|
|
border.color: Theme.alpha(Theme.accent, 0.3)
|
|
|
|
Column {
|
|
id: body
|
|
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.top: parent.top
|
|
anchors.margins: 14
|
|
spacing: 7
|
|
|
|
Text {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
// md-fingerprint
|
|
text: "\u{F0306}"
|
|
color: Theme.accent
|
|
font.family: Theme.fontMono
|
|
font.pixelSize: 38
|
|
}
|
|
|
|
Text {
|
|
width: parent.width
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: root.finger === ""
|
|
? "Touch the reader"
|
|
: "Touch the reader with your " + root.finger.toLowerCase()
|
|
color: Theme.fg
|
|
font.family: Theme.fontFamily
|
|
font.pixelSize: Theme.fontSize
|
|
font.weight: Font.DemiBold
|
|
wrapMode: Text.WordWrap
|
|
}
|
|
|
|
Text {
|
|
width: parent.width
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: root.total > 0
|
|
? "Lift and press again — " + root.stage + " of " + root.total + " touches"
|
|
: "Lift and press again"
|
|
color: Theme.fgDim
|
|
font.family: Theme.fontFamily
|
|
font.features: Theme.tabularFigures
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
wrapMode: Text.WordWrap
|
|
}
|
|
|
|
Item { width: 1; height: 3 }
|
|
|
|
Rectangle {
|
|
width: parent.width
|
|
height: 5
|
|
radius: 3
|
|
color: Theme.alpha(Theme.fg, 0.1)
|
|
border.width: 0
|
|
|
|
Rectangle {
|
|
width: root.total > 0
|
|
? parent.width * Math.max(0, Math.min(1, root.stage / root.total))
|
|
: 0
|
|
height: parent.height
|
|
radius: parent.radius
|
|
color: Theme.accent
|
|
border.width: 0
|
|
|
|
// One step per accepted touch, then still.
|
|
Behavior on width {
|
|
NumberAnimation { duration: Theme.durFast; easing.type: Easing.OutCubic }
|
|
}
|
|
}
|
|
}
|
|
|
|
Text {
|
|
width: parent.width
|
|
visible: root.message !== ""
|
|
horizontalAlignment: Text.AlignHCenter
|
|
text: root.message
|
|
color: Theme.warn
|
|
font.family: Theme.fontFamily
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
wrapMode: Text.WordWrap
|
|
topPadding: 4
|
|
}
|
|
|
|
Item { width: 1; height: 3 }
|
|
|
|
SettingsButton {
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
text: "Cancel"
|
|
onClicked: root.cancelled()
|
|
}
|
|
}
|
|
}
|