Commit 473f44f3 authored by m2ko's avatar m2ko

Mainly lockscreen functionality, some minor scaling changes

parent adbe1224
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
// Copyright (c) 2011, Tom Swindell <t.swindell@rubyx.co.uk> // Copyright (c) 2011, Tom Swindell <t.swindell@rubyx.co.uk>
// Copyright (c) 2012, Timur Kristóf <venemo@fedoraproject.org> // Copyright (c) 2012, Timur Kristóf <venemo@fedoraproject.org>
import QtQuick 2.2 import QtQuick 2.6
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
import QtQuick.Controls 1.0
import QtQuick.Controls.Nemo 1.0 import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0 import QtQuick.Controls.Styles.Nemo 1.0
import org.nemomobile.glacier 1.0 import org.nemomobile.glacier 1.0
...@@ -33,7 +34,6 @@ import org.nemomobile.glacier 1.0 ...@@ -33,7 +34,6 @@ import org.nemomobile.glacier 1.0
Item { Item {
id: switcherRoot id: switcherRoot
property bool closeMode: false property bool closeMode: false
property bool visibleInHome: false property bool visibleInHome: false
property alias runningAppsCount: switcherModel.itemCount property alias runningAppsCount: switcherModel.itemCount
...@@ -46,12 +46,32 @@ Item { ...@@ -46,12 +46,32 @@ Item {
closeMode = false; closeMode = false;
} }
} }
// Empty switcher indicator
Rectangle {
id: topText
visible: switcherModel.itemCount === 0
width: noAppsLabel.width
anchors {
horizontalCenter: parent.horizontalCenter
topMargin: Theme.itemSpacingLarge
}
color: "black"
Label {
id: noAppsLabel
text: qsTr("No apps open")
anchors {
top: parent.top
left: parent.left
}
font.weight: Font.Light
font.pointSize: Theme.fontSizeTiny
}
}
Flickable { Flickable {
id: flickable id: flickable
contentHeight: gridview.height contentHeight: gridview.height
width: closeMode ? parent.width - 20 : parent.width // see comment re right anchor below width: closeMode ? parent.width - 20 : parent.width // see comment re right anchor below
MouseArea { MouseArea {
height: flickable.contentHeight > flickable.height ? flickable.contentHeight : flickable.height height: flickable.contentHeight > flickable.height ? flickable.contentHeight : flickable.height
width: flickable.width width: flickable.width
...@@ -181,12 +201,4 @@ Item { ...@@ -181,12 +201,4 @@ Item {
} }
} }
} }
// Empty switcher indicator
Label {
visible: switcherModel.itemCount === 0
text: qsTr("No apps open")
width: parent.width
fontSizeMode: Text.HorizontalFit
}
} }
...@@ -7,6 +7,8 @@ import QtQuick.Layouts 1.0 ...@@ -7,6 +7,8 @@ import QtQuick.Layouts 1.0
import org.nemomobile.lipstick 0.1 import org.nemomobile.lipstick 0.1
import org.nemomobile.devicelock 1.0 import org.nemomobile.devicelock 1.0
import "scripts/desktop.js" as Desktop
Item { Item {
id: root id: root
...@@ -39,6 +41,8 @@ Item { ...@@ -39,6 +41,8 @@ Item {
id: authenticator id: authenticator
onAuthenticated: { onAuthenticated: {
DeviceLock.unlock(authenticationToken) DeviceLock.unlock(authenticationToken)
Desktop.instance.setLockScreen(false)
Desktop.instance.codepadVisible = false
} }
onFeedback: { onFeedback: {
console.log('### still locked', feedback, attemptsRemaining) console.log('### still locked', feedback, attemptsRemaining)
......
...@@ -43,7 +43,7 @@ Flickable { ...@@ -43,7 +43,7 @@ Flickable {
// Day of week // Day of week
Rectangle { Rectangle {
id: daterow id: daterow
height: displayCurrentDate.height + 15 height: Theme.itemHeightMedium
width: childrenRect.width width: childrenRect.width
anchors{ anchors{
...@@ -59,8 +59,8 @@ Flickable { ...@@ -59,8 +59,8 @@ Flickable {
id: displayDayOfWeek id: displayDayOfWeek
text: Qt.formatDateTime(wallClock.time, "dddd") + ", " text: Qt.formatDateTime(wallClock.time, "dddd") + ", "
color: Theme.textColor color: Theme.textColor
font.pixelSize: Theme.fontSizeExtraLarge font.pointSize: Theme.fontSizeTiny / 1.5
font.bold: true font.weight: Font.Bold
anchors { anchors {
top: parent.top top: parent.top
left: parent.left left: parent.left
...@@ -71,8 +71,9 @@ Flickable { ...@@ -71,8 +71,9 @@ Flickable {
Label { Label {
id: displayCurrentDate id: displayCurrentDate
text: Qt.formatDate(wallClock.time, "d MMMM yyyy") text: Qt.formatDate(wallClock.time, "d MMMM yyyy")
font.pixelSize: Theme.fontSizeExtraLarge font.pointSize: Theme.fontSizeTiny / 1.5
color: Theme.textColor color: Theme.textColor
font.weight: Font.Light
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
anchors { anchors {
left: displayDayOfWeek.right left: displayDayOfWeek.right
...@@ -86,7 +87,7 @@ Flickable { ...@@ -86,7 +87,7 @@ Flickable {
width: parent.width width: parent.width
anchors{ anchors{
top: daterow.bottom top: daterow.bottom
topMargin: 50 topMargin: Theme.itemSpacingHuge
} }
spacing: Theme.itemSpacingHuge spacing: Theme.itemSpacingHuge
Repeater { Repeater {
......
...@@ -14,7 +14,6 @@ Image { ...@@ -14,7 +14,6 @@ Image {
key: "/home/glacier/lockScreen/wallpaperImage" key: "/home/glacier/lockScreen/wallpaperImage"
defaultValue: "/usr/share/lipstick-glacier-home-qt5/qml/images/graphics-wallpaper-home.jpg" defaultValue: "/usr/share/lipstick-glacier-home-qt5/qml/images/graphics-wallpaper-home.jpg"
} }
LockscreenClock { LockscreenClock {
id: clock id: clock
anchors { anchors {
...@@ -25,6 +24,7 @@ Image { ...@@ -25,6 +24,7 @@ Image {
} }
DeviceLockUI { DeviceLockUI {
id: deviceLockUI id: deviceLockUI
visible: false//DeviceLock.state === DeviceLock.Locked
anchors { anchors {
top: clock.bottom top: clock.bottom
left: parent.left left: parent.left
......
import QtQuick 2.0 import QtQuick 2.1
import org.nemomobile.devicelock 1.0
import QtQuick.Controls.Nemo 1.0
import QtQuick.Controls.Styles.Nemo 1.0
Rectangle { Rectangle {
id: lockscreenClock id: lockscreenClock
...@@ -22,10 +25,10 @@ Rectangle { ...@@ -22,10 +25,10 @@ Rectangle {
Text { Text {
id: timeDisplay id: timeDisplay
font.pointSize: 16 font.pointSize: Theme.fontSizeExtraLarge
font.weight: Font.Light font.weight: Font.Light
lineHeight: 0.85 lineHeight: 0.85
color: "white" color: Theme.textColor
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
anchors { anchors {
...@@ -35,22 +38,46 @@ Rectangle { ...@@ -35,22 +38,46 @@ Rectangle {
text: Qt.formatDateTime(wallClock.time, "hh:mm") text: Qt.formatDateTime(wallClock.time, "hh:mm")
} }
Rectangle {
id: dateRow
height: weekdayDisplay.height
width: weekdayDisplay.width + dateDisplay.width
anchors {
horizontalCenter: parent.horizontalCenter
}
Text { color: "transparent"
id: dateDisplay
font.pointSize: 14 Label {
color: "white" id: weekdayDisplay
opacity: 0.8
horizontalAlignment: Text.AlignHCenter
anchors { font.pointSize: Theme.fontSizeTiny / 1.5
left: parent.left color: Theme.textColor
right: parent.right horizontalAlignment: Text.AlignHCenter
font.weight: Font.Bold
anchors {
left: parent.left
}
text: Qt.formatDateTime(wallClock.time, "dddd") + ", "
} }
text: Qt.formatDateTime(wallClock.time, "<b>dddd</b>, d MMMM yyyy") Label {
id: dateDisplay
font.pointSize: Theme.fontSizeTiny / 1.5
color: Theme.textColor
horizontalAlignment: Text.AlignHCenter
font.weight: Font.Light
anchors {
left: weekdayDisplay.right
top: parent.top
}
text: Qt.formatDate(wallClock.time, "d MMMM yyyy")
}
} }
} }
} }
...@@ -58,7 +58,10 @@ Page { ...@@ -58,7 +58,10 @@ Page {
id: desktop id: desktop
property alias lockscreen: lockScreen property alias lockscreen: lockScreen
property alias switcher: switcher property alias switcher: switcher
property alias codepad: codePad
property int statusBarHeight: statusbar.height property int statusBarHeight: statusbar.height
property bool codepadVisible: false
// Implements back key navigation // Implements back key navigation
Keys.onReleased: { Keys.onReleased: {
...@@ -142,7 +145,7 @@ Page { ...@@ -142,7 +145,7 @@ Page {
} }
// Initial view should be the AppLauncher // Initial view should be the AppLauncher
currentIndex: 0 //currentIndex: 0
} }
Image { Image {
id:wallpaper id:wallpaper
...@@ -153,10 +156,19 @@ Page { ...@@ -153,10 +156,19 @@ Page {
} }
Lockscreen { Lockscreen {
id: lockScreen id: lockScreen
visible: DeviceLock.state >= DeviceLock.Locked visible: lockscreenVisible()//DeviceLock.state == DeviceLock.Locked
width: parent.width width: parent.width
height: parent.height height: parent.height
z: 200 z: 200
} }
DeviceLockUI {
id: codePad
visible: DeviceLock.state == DeviceLock.Locked && codepadVisible
width: lockScreen.width
height:lockScreen.height / 2
anchors.centerIn: lockScreen
z: 200
}
} }
...@@ -42,13 +42,13 @@ import "statusbar" ...@@ -42,13 +42,13 @@ import "statusbar"
Item { Item {
id: root id: root
z: 201 z: 201
height: Math.min(parent.width,parent.height)/10 height: Theme.itemHeightMedium
width: parent.width width: parent.width
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Rectangle { Rectangle {
id: statusbar id: statusbar
color: "black" color: Theme.fillDarkColor
anchors.fill: parent anchors.fill: parent
opacity: 0.5 opacity: 0.5
z: 200 z: 200
......
...@@ -135,7 +135,7 @@ Compositor { ...@@ -135,7 +135,7 @@ Compositor {
property real lockThreshold: 0.25 property real lockThreshold: 0.25
property int lockscreenX property int lockscreenX
property int lockscreenY property int lockscreenY
enabled: DeviceLock.state != DeviceLock.Locked enabled: !Desktop.instance.codepadVisible//DeviceLock.state != DeviceLock.Locked
onGestureStarted: { onGestureStarted: {
swipeAnimation.stop() swipeAnimation.stop()
...@@ -158,27 +158,34 @@ Compositor { ...@@ -158,27 +158,34 @@ Compositor {
cancelAnimation.start() cancelAnimation.start()
} }
} else if (root.homeActive){ } else if (root.homeActive){
if (gestureArea.progress >= lockThreshold) { if (gestureArea.progress >= lockThreshold) {
lockAnimation.valueTo = (gesture == "left" ? lockAnimation.valueTo = (gesture == "left" ?
Desktop.instance.lockscreen.width : Desktop.instance.lockscreen.width :
-Desktop.instance.lockscreen.width) -Desktop.instance.lockscreen.width)
lockAnimation.start() lockAnimation.start()
// Locks or unlocks depending if the screen is locked. // Locks, unlocks or brings up codepad to enter security code
if (!Desktop.instance.lockscreenVisible()) { //Locks
Desktop.instance.setLockScreen(true) if (!Desktop.instance.lockscreenVisible()) {
Desktop.instance.setLockScreen(true)
}
//Brings up codepad
else if (Desktop.instance.lockscreenVisible() && !Desktop.instance.codepad.visible && DeviceLock.state == DeviceLock.Locked) {
Desktop.instance.codepadVisible = true
}
//Unlocks if no security code required
else if (DeviceLock.state !== DeviceLock.Locked && Desktop.instance.lockscreenVisible()) {
Desktop.instance.setLockScreen(false)
}
} else { } else {
Desktop.instance.setLockScreen(false) cancelAnimation.start()
} }
} else {
cancelAnimation.start()
} }
} }
}
states: [ states: [
State { State {
name: "swipe" name: "swipe"
when: DeviceLock.state != DeviceLock.Locked when: !Desktop.instance.codepadVisible
PropertyChanges { PropertyChanges {
target: gestureArea target: gestureArea
delayReset: true delayReset: true
...@@ -192,7 +199,7 @@ Compositor { ...@@ -192,7 +199,7 @@ Compositor {
}, },
State { State {
name: "lock" name: "lock"
when: DeviceLock.state == DeviceLock.Locked when: Desktop.instance.lockscreenVisible()
PropertyChanges { PropertyChanges {
target: Desktop.instance.lockscreen target: Desktop.instance.lockscreen
visible: true visible: true
...@@ -221,7 +228,6 @@ Compositor { ...@@ -221,7 +228,6 @@ Compositor {
Desktop.instance.lockscreen.width)+gestureArea.value) ) ) Desktop.instance.lockscreen.width)+gestureArea.value) ) )
} }
} }
] ]
SequentialAnimation { SequentialAnimation {
...@@ -242,6 +248,23 @@ Compositor { ...@@ -242,6 +248,23 @@ Compositor {
} }
} }
SequentialAnimation {
id: codePadAnimation
property alias valueTo: valueAnimationCode.to
SmoothedAnimation {
id: valueAnimationCode
target: Desktop.instance.codepad
property: "opacity"
easing.type: Easing.OutQuint
}
PropertyAction {
target: gestureArea
property: "state"
value: ""
}
}
SequentialAnimation { SequentialAnimation {
id: lockAnimation id: lockAnimation
property alias valueTo: valueAnimationLock.to property alias valueTo: valueAnimationLock.to
......
...@@ -145,7 +145,7 @@ Item { ...@@ -145,7 +145,7 @@ Item {
//bottomMargin: notificationArea.notificationMargin //bottomMargin: notificationArea.notificationMargin
} }
font.pixelSize: Theme.fontSizeLarge font.pixelSize: Theme.fontSizeLarge
text: "Notification"//notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewSummary : "" text: notificationPreviewPresenter.notification != null ? notificationPreviewPresenter.notification.previewSummary : ""
color: Theme.textColor color: Theme.textColor
clip: true clip: true
elide: Text.ElideRight elide: Text.ElideRight
......
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