summaryrefslogtreecommitdiff
path: root/modules/lock
diff options
context:
space:
mode:
Diffstat (limited to 'modules/lock')
-rw-r--r--modules/lock/Backgrounds.qml79
-rw-r--r--modules/lock/Clock.qml1
-rw-r--r--modules/lock/LockSurface.qml10
-rw-r--r--modules/lock/WeatherInfo.qml64
4 files changed, 143 insertions, 11 deletions
diff --git a/modules/lock/Backgrounds.qml b/modules/lock/Backgrounds.qml
index 15836b5..3bcedd6 100644
--- a/modules/lock/Backgrounds.qml
+++ b/modules/lock/Backgrounds.qml
@@ -9,9 +9,12 @@ Item {
id: root
required property bool locked
+ required property real weatherWidth
readonly property real clockBottom: innerMask.anchors.margins + clockPath.height
readonly property real inputTop: innerMask.anchors.margins + inputPath.height
+ readonly property real weatherTop: innerMask.anchors.margins + weatherPath.height
+ readonly property real weatherRight: innerMask.anchors.margins + weatherPath.width
anchors.fill: parent
@@ -34,21 +37,12 @@ Item {
id: innerMask
anchors.fill: parent
- anchors.margins: root.locked ? Config.lock.sizes.border : 0
-
+ anchors.margins: root.locked ? Config.lock.sizes.border : -radius / 2
radius: Appearance.rounding.large * 2
Behavior on anchors.margins {
Anim {}
}
-
- Behavior on anchors.leftMargin {
- Anim {}
- }
-
- Behavior on anchors.rightMargin {
- Anim {}
- }
}
}
@@ -202,6 +196,71 @@ Item {
}
}
}
+
+ ShapePath {
+ id: weatherPath
+
+ property int width: root.locked ? root.weatherWidth - Config.lock.sizes.border / 4 : 0
+ property real height: root.locked ? Config.lock.sizes.weatherHeight : 0
+
+ readonly property real rounding: Appearance.rounding.large * 2
+ readonly property real roundingX: width < rounding * 2 ? width / 2 : rounding
+ readonly property real roundingY: height < rounding * 2 ? height / 2 : rounding
+
+ strokeWidth: -1
+ fillColor: Config.border.colour
+
+ startY: Math.ceil(innerMask.height) - height - roundingY
+
+ PathArc {
+ relativeX: weatherPath.roundingX
+ relativeY: weatherPath.roundingY
+ radiusX: Math.min(weatherPath.rounding, weatherPath.width)
+ radiusY: Math.min(weatherPath.rounding, weatherPath.height)
+ direction: PathArc.Counterclockwise
+ }
+ PathLine {
+ relativeX: weatherPath.width - weatherPath.roundingX * 2
+ relativeY: 0
+ }
+ PathArc {
+ relativeX: weatherPath.roundingX
+ relativeY: weatherPath.roundingY
+ radiusX: Math.min(weatherPath.rounding, weatherPath.width)
+ radiusY: Math.min(weatherPath.rounding, weatherPath.height)
+ }
+ PathLine {
+ relativeX: 0
+ relativeY: weatherPath.height - weatherPath.roundingY * 2
+ }
+ PathArc {
+ relativeX: weatherPath.roundingX
+ relativeY: weatherPath.roundingY
+ radiusX: Math.min(weatherPath.rounding, weatherPath.width)
+ radiusY: Math.min(weatherPath.rounding, weatherPath.height)
+ direction: PathArc.Counterclockwise
+ }
+ PathLine {
+ relativeX: -weatherPath.width - weatherPath.roundingX
+ relativeY: 0
+ }
+
+ Behavior on width {
+ Anim {}
+ }
+
+ Behavior on height {
+ Anim {}
+ }
+
+ Behavior on fillColor {
+ ColorAnimation {
+ duration: Appearance.anim.durations.normal
+ easing.type: Easing.BezierSpline
+ easing.bezierCurve: Appearance.anim.curves.standard
+ }
+ }
+ }
}
component Anim: NumberAnimation {
diff --git a/modules/lock/Clock.qml b/modules/lock/Clock.qml
index 3d4da9e..62209e7 100644
--- a/modules/lock/Clock.qml
+++ b/modules/lock/Clock.qml
@@ -1,7 +1,6 @@
import "root:/widgets"
import "root:/services"
import "root:/config"
-import QtQuick
import QtQuick.Layouts
ColumnLayout {
diff --git a/modules/lock/LockSurface.qml b/modules/lock/LockSurface.qml
index 1b98c2c..4751c70 100644
--- a/modules/lock/LockSurface.qml
+++ b/modules/lock/LockSurface.qml
@@ -62,6 +62,7 @@ WlSessionLockSurface {
id: backgrounds
locked: root.locked
+ weatherWidth: weather.implicitWidth
visible: false
}
@@ -89,6 +90,15 @@ WlSessionLockSurface {
lock: root
}
+ WeatherInfo {
+ id: weather
+
+ anchors.top: parent.bottom
+ anchors.right: parent.left
+ anchors.topMargin: -backgrounds.weatherTop
+ anchors.rightMargin: -backgrounds.weatherRight
+ }
+
component Anim: NumberAnimation {
duration: Appearance.anim.durations.large
easing.type: Easing.BezierSpline
diff --git a/modules/lock/WeatherInfo.qml b/modules/lock/WeatherInfo.qml
new file mode 100644
index 0000000..3d627a9
--- /dev/null
+++ b/modules/lock/WeatherInfo.qml
@@ -0,0 +1,64 @@
+import "root:/widgets"
+import "root:/services"
+import "root:/config"
+import QtQuick
+import QtQuick.Layouts
+
+RowLayout {
+ id: root
+
+ Timer {
+ running: true
+ triggeredOnStart: true
+ repeat: true
+ interval: 900000 // 15 minutes
+ onTriggered: Weather.reload()
+ }
+
+ spacing: Appearance.spacing.large
+
+ MaterialIcon {
+ id: icon
+
+ Layout.alignment: Qt.AlignVCenter
+ Layout.topMargin: Config.lock.sizes.border / 4
+
+ animate: true
+ text: Weather.icon || "cloud_alert"
+ color: Colours.palette.m3secondary
+ font.pointSize: Appearance.font.size.extraLarge * 2.5
+ font.variableAxes: ({
+ opsz: Appearance.font.size.extraLarge * 1.2
+ })
+ }
+
+ ColumnLayout {
+ Layout.alignment: Qt.AlignVCenter
+ Layout.topMargin: Config.lock.sizes.border / 4
+ Layout.rightMargin: Config.lock.sizes.border / 2
+
+ spacing: Appearance.spacing.small
+
+ StyledText {
+ Layout.fillWidth: true
+
+ animate: true
+ text: `${Weather.temperature}°C`
+ color: Colours.palette.m3primary
+ horizontalAlignment: Text.AlignHCenter
+ font.pointSize: Appearance.font.size.extraLarge
+ font.weight: 500
+ }
+
+ StyledText {
+ Layout.fillWidth: true
+ Layout.maximumWidth: Config.lock.sizes.weatherWidth - icon.implicitWidth
+
+ animate: true
+ text: Weather.description || qsTr("No weather")
+ horizontalAlignment: Text.AlignHCenter
+ font.pointSize: Appearance.font.size.large
+ elide: Text.ElideRight
+ }
+ }
+}