Commit 08101d26 authored by m2ko's avatar m2ko Committed by eekkelund

Add most animations and lockscreen functions

parent 7020765f
......@@ -16,44 +16,6 @@ Item {
property bool shouldAuthenticate: Lipstick.compositor.visible
property int remainingAttempts
property AuthenticationInput authenticationInput
signal codeEntered(string code)
onShouldAuthenticateChanged: {
if (shouldAuthenticate) {
console.log("Requesting security code "+JSON.stringify(authenticationInput))
} else {
authenticator.cancel()
DeviceLock.authorization.relinquishChallenge()
}
}
/*Component.onCompleted: {
console.log("Requesting security code "+ authenticationInput.Status)
authenticationInput.requestSecurityCode()
}*/
/*Connections {
target: DeviceLock.authorization
onChallengeIssued: {
authenticator.authenticate(
DeviceLock.authorization.challengeCode,
DeviceLock.authorization.allowedMethods)
}
}*/
/*authenticationInput.onAuthenticationUnavailable: {
console.log("Authentication unavailable: "+error)
}
authenticationInput.onFeedback: {
console.log("Feedback: "+feedback)
}
authenticationInput.onAuthenticationStarted: {
console.log("Authentication started")
}
authenticationInput.onAuthenticationEnded: {
console.log("Ended "+confirmed)
}*/
ColumnLayout {
anchors.fill: parent
......@@ -118,15 +80,10 @@ Item {
feedbackLabel.text = " "
attemptsRemainingLabel.text = " "
if (numLabel.text !== "Ca" && numLabel.text !== "OK") {
console.log(authenticationInput.Status)
lockCodeField.insert(lockCodeField.cursorPosition, numLabel.text)
authenticationInput.requestSecurityCode()
} else {
if (numLabel.text === "OK") {
console.log("DeviceLockUI: "+JSON.stringify(authenticationInput))
//auth.authenticate(Authorization.challengeCode, auth.availableMethods)
authenticationInput.enterSecurityCode(lockCodeField.text)
//codeEntered(lockCodeField.text)
lockCodeField.text = ""
} else if (numLabel.text === "Ca"){
lockCodeField.text = ""
......
......@@ -56,7 +56,7 @@ Image {
startX = mouseX;
}
onMouseXChanged: {
// Checks which swipe
// Checks which was it left or right swipe
if(mouseX > (startX+threshold)) {
gesture = "right"
gestureStarted = true;
......@@ -88,9 +88,9 @@ Image {
}
}
// Animation to sna codepad into view or out of view
// Animation to snap codepad into view or out of view
onReleased: {
displayOffTimer.restart()
if(codePad.inView) {
if(gesture == "right") {
if(swipeDistance > threshold) {
......@@ -146,7 +146,24 @@ Image {
easing.type: Easing.OutQuint
}
}
SequentialAnimation {
id: unlockAnimation
property alias valueTo: unlockNumAnimation.to
property alias setProperty: unlockNumAnimation.property
NumberAnimation {
id: unlockNumAnimation
target: lockScreen
property: "y"
to: -height
duration: 250
easing.type: Easing.OutQuint
}
onStopped: {
setLockScreen(false)
}
}
Connections {
target:Lipstick.compositor
onDisplayOff: {
......@@ -188,49 +205,46 @@ Image {
id: codePad
property bool inView: false
property bool gestureStarted: mouseArea.gestureStarted
x: 1000
x: width * 2
visible: DeviceLock.state == DeviceLock.Locked && lockscreenVisible()
width: lockScreen.width
height: lockScreen.height / 2
onCodeEntered: {
//authenticationInput.enterSecurityCode(code)
console.log("Security code entered: "+authenticationInput.minimumCodeLength)
}
opacity: (1-Math.abs((1 - (-1)) * (x - (-parent.width)) / (parent.width - (-parent.width)) + (-1)))
authenticationInput: DeviceLockAuthenticationInput {
//property bool unlocked: DeviceLock.state >= DeviceLock.Locked
readonly property bool unlocking: registered
&& DeviceLock.state >= DeviceLock.Locked && DeviceLock.state < DeviceLock.Undefined
registered: true
active: true
//active: lockscreenVisible()
// onUnlockedChanged: console.log("Unlock")
onStatusChanged: {
console.log("Status changed")
}
registered: lockscreenVisible()
active: lockscreenVisible()
onUnlockingChanged: {
console.log("Unlock")
if (unlocking) {
DeviceLock.unlock()
} else {
DeviceLock.cancel()
}
}
onAuthenticationUnavailable: {
console.log("Authentication unavailable: "+error)
}
onAuthenticationEnded: {
if(confirmed) {
unlockAnimationHelper(mouseArea.gesture)
}else {
onFeedback: {
console.log("Feedback: "+feedback)
}
}
onAuthenticationStarted: {
console.log("Authentication started")
}
onAuthenticationEnded: {
console.log("Ended "+confirmed)
function unlockAnimationHelper(gesture) {
if(gesture == "left") {
unlockAnimation.setProperty = "x"
unlockAnimation.valueTo = -width
unlockAnimation.start()
}
if(gesture == "right") {
unlockAnimation.setProperty = "x"
unlockAnimation.valueTo = width
unlockAnimation.start()
}
}
}
......
......@@ -67,7 +67,6 @@ Page {
property alias lockscreen: lockScreen
property alias switcher: switcher
//property alias codepad: codePad
property int statusBarHeight: statusbar.height
property bool codepadVisible: false
property bool deviceLocked: DeviceLock.state >= DeviceLock.Locked
......@@ -170,13 +169,6 @@ Page {
width: parent.width
height: parent.height
z: 200
/*Item {
id: codePad
visible: false
}*/
/*DeviceLockUI {
id:codePad
}*/
}
}
......@@ -148,12 +148,6 @@ Compositor {
else if (!root.appActive && DeviceLock.state !== DeviceLock.Locked) {
state = "cover"
}
else if (Desktop.instance.lockscreenVisible() && DeviceLock.state === DeviceLock.Locked && !Desktop.instance.codepadVisible) {
//state = "pullCodepad"
}
else if (Desktop.instance.lockscreenVisible() && DeviceLock.state === DeviceLock.Locked && Desktop.instance.codepadVisible) {
//state = "pushCodepad"
}
}
onGestureFinished: {
......@@ -180,15 +174,7 @@ Compositor {
if(gesture == "down") {
setDisplayOff()
}
}/*
// Brings up codepad, only left and right swipes allowed for it for now
else if (Desktop.instance.lockscreenVisible() && !Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked && (gesture !== "down" && gesture !== "up")) {
Desktop.instance.codepadVisible = true
}
// Hides codepad but does not unlock the code, only left and right swipes allowed for now
else if (Desktop.instance.lockscreenVisible() && Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked && gesture !== "down" && gesture !== "up") {
Desktop.instance.codepadVisible = false
}*/
// Unlocks if no security code required
else if (DeviceLock.state !== DeviceLock.Locked && Desktop.instance.lockscreenVisible()) {
Desktop.instance.setLockScreen(false)
......@@ -247,64 +233,7 @@ Compositor {
Desktop.instance.lockscreen.height :
Desktop.instance.lockscreen.width)+gestureArea.value) ) )
}
}/*
// pullCodepad is when you are pulling codepad into view to enter security code
State {
name: "pullCodepad"
when: DeviceLock.state >= DeviceLock.Locked//Desktop.instance.codepadVisible
PropertyChanges {
target: Desktop.instance
codepadVisible: true
}
PropertyChanges {
target: gestureArea
delayReset: true
}
PropertyChanges {
target: Desktop.instance.codepad
// Confusing logic and math to get the codepad follow your finger
x: gestureArea.lockscreenX + (gestureArea.value < 0 ? Desktop.instance.lockscreen.width : -Desktop.instance.lockscreen.width) +
((gestureArea.horizontal) ? (Desktop.instance.lockscreenVisible()?(gestureArea.value) :
(gestureArea.gesture == "right" ?
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
-Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.height)+Math.abs(gestureArea.value) :
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
Desktop.instance.lockscreen.width :
Desktop.instance.lockscreen.height)+gestureArea.value) ) : 0 )
// Bringing up the codepad opacity from 0 to 1
opacity: gestureArea.horizontal ? (gestureArea.value < 0 ? (gestureArea.value / -Desktop.instance.lockscreen.width) :
gestureArea.value / Desktop.instance.lockscreen.width) : 0
}
},
// pushCodepad is when you are pushing the codepad away without entering a security code
State {
name: "pushCodepad"
when: Desktop.instance.lockscreenVisible() && DeviceLock.state === DeviceLock.Locked && Desktop.instance.codepadVisible
PropertyChanges {
target: gestureArea
delayReset: true
}
PropertyChanges {
target: Desktop.instance.codepad
// Confusing logic for the codepad to follow your swipe
x: gestureArea.lockscreenX +
((gestureArea.horizontal) ? (Desktop.instance.lockscreenVisible()?(gestureArea.value) :
(gestureArea.gesture == "right" ?
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
-Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.height)+Math.abs(gestureArea.value) :
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
Desktop.instance.lockscreen.width :
Desktop.instance.lockscreen.height)+gestureArea.value) ) : 0 )
// Hiding the codepad with opacity fading from 1 to 0
opacity: 1 - (gestureArea.horizontal ? (gestureArea.value < 0 ? (gestureArea.value / -Desktop.instance.lockscreen.width) :
gestureArea.value / Desktop.instance.lockscreen.width) : 0)
}
}*/
}
]
SequentialAnimation {
......
......@@ -86,7 +86,7 @@ Item {
property real lockThreshold: 0.25
property int lockscreenX
property int lockscreenY
enabled: true //DeviceLock.state != DeviceLock.Locked
enabled: true
onGestureStarted: {
swipeAnimation.stop()
......@@ -128,14 +128,6 @@ Item {
setDisplayOff()
}
}
// Brings up codepad, only left and right swipes allowed for it for now
else if (Desktop.instance.lockscreenVisible() && !Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked && (gesture !== "down" && gesture !== "up")) {
Desktop.instance.codepadVisible = true
}
// Hides codepad but does not unlock the code, only left and right swipes allowed for now
else if (Desktop.instance.lockscreenVisible() && Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked && gesture !== "down" && gesture !== "up") {
Desktop.instance.codepadVisible = false
}
// Unlocks if no security code required
else if (DeviceLock.state !== DeviceLock.Locked && Desktop.instance.lockscreenVisible()) {
Desktop.instance.setLockScreen(false)
......@@ -167,10 +159,6 @@ Item {
State {
name: "lock"
when: Desktop.instance.state === "locked"
/*PropertyChanges {
target: Desktop.instance.lockscreen
visible: true
}*/
PropertyChanges {
target: gestureArea
delayReset: true
......@@ -195,63 +183,6 @@ Item {
Desktop.instance.lockscreen.height :
Desktop.instance.lockscreen.width)+gestureArea.value) ) )
}
},
// pullCodepad is when you are pulling codepad into view to enter security code
State {
name: "pullCodepad"
when: Desktop.instance.state === "locked" && !Desktop.instance.codepadVisible
PropertyChanges {
target: Desktop.instance
codepadVisible: true
}
PropertyChanges {
target: gestureArea
delayReset: true
}
PropertyChanges {
target: Desktop.instance.codepad
// Confusing logic and math to get the codepad follow your finger
x: gestureArea.lockscreenX + (gestureArea.value < 0 ? Desktop.instance.lockscreen.width : -Desktop.instance.lockscreen.width) +
((gestureArea.horizontal) ? (Desktop.instance.lockscreenVisible()?(gestureArea.value) :
(gestureArea.gesture == "right" ?
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
-Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.height)+Math.abs(gestureArea.value) :
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
Desktop.instance.lockscreen.width :
Desktop.instance.lockscreen.height)+gestureArea.value) ) : 0 )
// Bringing up the codepad opacity from 0 to 1
opacity: gestureArea.horizontal ? (gestureArea.value < 0 ? (gestureArea.value / -Desktop.instance.lockscreen.width) :
gestureArea.value / Desktop.instance.lockscreen.width) : 0
}
},
// pushCodepad is when you are pushing the codepad away without entering a security code
State {
name: "pushCodepad"
when: Desktop.instance.state === "locked" && Desktop.instance.codepadVisible
PropertyChanges {
target: gestureArea
delayReset: true
}
PropertyChanges {
target: Desktop.instance.codepad
// Confusing logic for the codepad to follow your swipe
x: gestureArea.lockscreenX +
((gestureArea.horizontal) ? (Desktop.instance.lockscreenVisible()?(gestureArea.value) :
(gestureArea.gesture == "right" ?
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
-Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.height)+Math.abs(gestureArea.value) :
((Desktop.instance.lockscreen.width === topmostWindow.width) ?
Desktop.instance.lockscreen.width :
Desktop.instance.lockscreen.height)+gestureArea.value) ) : 0 )
// Hiding the codepad with opacity fading from 1 to 0
opacity: 1 - (gestureArea.horizontal ? (gestureArea.value < 0 ? (gestureArea.value / -Desktop.instance.lockscreen.width) :
gestureArea.value / Desktop.instance.lockscreen.width) : 0)
}
}
]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment