From bf64dce48823cc8e11d2833542d659cabc37bfde Mon Sep 17 00:00:00 2001 From: MagneFire Date: Sun, 4 Apr 2021 20:51:52 +0200 Subject: [PATCH 1/2] QuickSettings: Use Mce for battery information. --- qml/quicksettings/QuickSettings.qml | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/qml/quicksettings/QuickSettings.qml b/qml/quicksettings/QuickSettings.qml index ee13e7c..344b72b 100644 --- a/qml/quicksettings/QuickSettings.qml +++ b/qml/quicksettings/QuickSettings.qml @@ -29,7 +29,7 @@ */ import QtQuick 2.9 -import org.freedesktop.contextkit 1.0 +import Nemo.Mce 1.0 import Nemo.DBus 2.0 import org.nemomobile.systemsettings 1.0 import Nemo.Ngf 1.0 @@ -44,17 +44,12 @@ Item { property bool forbidLeft: true property bool forbidRight: true - ContextProperty { + MceBatteryLevel { id: batteryChargePercentage - key: "Battery.ChargePercentage" - value: "100" - Component.onCompleted: batteryChargePercentage.subscribe() } - ContextProperty { - id: batteryIsCharging - key: "Battery.IsCharging" - value: false + MceBatteryState { + id: batteryChargeState } DBusInterface { @@ -149,9 +144,9 @@ Item { Icon { id: batteryIcon name: { - if(batteryIsCharging.value) return "ios-battery-charging" - else if(batteryChargePercentage.value > 15) return "ios-battery-full" - else return "ios-battery-dead" + if(batteryChargeState.value == MceBatteryState.Charging) return "ios-battery-charging" + else if(batteryChargePercentage.percent > 15) return "ios-battery-full" + else return "ios-battery-dead" } width: parent.height/2 height: width @@ -161,7 +156,7 @@ Item { Label { id: batteryIndicator font.pixelSize: parent.height/4 - text: batteryChargePercentage.value + "%" + text: batteryChargePercentage.percent + "%" anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter } From c9b69fc8a287b07d929a248df7b8c840a8618b61 Mon Sep 17 00:00:00 2001 From: MagneFire Date: Sun, 4 Apr 2021 23:07:39 +0200 Subject: [PATCH 2/2] Connections: Use Qt 5.15 API for connecting functions. As of Qt 5.15 the Connections QML type requires a different way of connecting functions. --- qml/MainScreen.qml | 19 ++++++++++--------- qml/misc/BluetoothAgent.qml | 2 +- qml/notifications/NotificationActions.qml | 2 +- qml/notifications/NotificationIndicator.qml | 4 ++-- qml/notifications/NotificationPreview.qml | 2 +- qml/notifications/NotificationView.qml | 2 +- watchfaces/000-default-digital.qml | 2 +- watchfaces/001-words-worte-palabras-mots.qml | 2 +- watchfaces/002-analog-70s-classic.qml | 2 +- watchfaces/003-alternative-digital-2.qml | 4 ++-- watchfaces/004-alternative-scifi.qml | 4 ++-- watchfaces/005-analog-nordic.qml | 2 +- watchfaces/006-analog-50s-americana.qml | 4 ++-- watchfaces/007-bold-hour-bebas.qml | 2 +- watchfaces/009-contemporary-digital-rings.qml | 2 +- 15 files changed, 28 insertions(+), 27 deletions(-) diff --git a/qml/MainScreen.qml b/qml/MainScreen.qml index 6a21772..f0199e4 100644 --- a/qml/MainScreen.qml +++ b/qml/MainScreen.qml @@ -146,22 +146,22 @@ Item { Connections { target: Lipstick.compositor - onDisplayAboutToBeOn: { + function onDisplayAboutToBeOn() { wallClockAmbientTimeout.stop() wallClock.enabled = true } - onDisplayAboutToBeOff: wallClock.enabled = false - onDisplayOn: { + function onDisplayAboutToBeOff() { wallClock.enabled = false } + function onDisplayOn() { grid.animateIndicators() if (Lipstick.compositor.ambientEnabled) grid.moveTo(0, 0) } - onDisplayAmbientChanged: wallpaperAnimation.duration = 300 - onDisplayAmbientEntered: wallpaperDarkener.opacity = 1 - onDisplayAmbientLeft: { + function onDisplayAmbientChanged() { wallpaperAnimation.duration = 300 } + function onDisplayAmbientEntered() { wallpaperDarkener.opacity = 1 } + function onDisplayAmbientLeft() { wallpaperDarkener.opacity = 0 if (burnInProtectionManager.enabled) leftIndicator.anchors.verticalCenterOffset = 0 } - onDisplayAmbientUpdate: { + function onDisplayAmbientUpdate() { // Perform burn in protection if (burnInProtectionManager.enabled) { grid.contentX = Math.random()*(burnInProtectionManager.leftOffset + burnInProtectionManager.rightOffset)-burnInProtectionManager.leftOffset @@ -184,7 +184,7 @@ Item { Connections { target: localeManager - onChangesObserverChanged: { + function onChangesObserverChanged() { var bkp = watchFaceSource.value watchFaceSource.value = "" watchFaceSource.value = bkp @@ -276,9 +276,10 @@ Item { repeat: false onTriggered: Desktop.onAboutToClose() } + Connections { target: Lipstick.compositor - onDisplayOff: lockscreenDelay.start(); + function onDisplayOff() { lockscreenDelay.start() } } // Wallpaper diff --git a/qml/misc/BluetoothAgent.qml b/qml/misc/BluetoothAgent.qml index 153c4f2..0e538d4 100644 --- a/qml/misc/BluetoothAgent.qml +++ b/qml/misc/BluetoothAgent.qml @@ -136,7 +136,7 @@ Item { Connections { target: agent - onStateChanged: { + function onStateChanged() { switch(agent.state) { case BluetoothAgent.AuthService: //% "Authorize:" diff --git a/qml/notifications/NotificationActions.qml b/qml/notifications/NotificationActions.qml index 825df7c..6182f66 100644 --- a/qml/notifications/NotificationActions.qml +++ b/qml/notifications/NotificationActions.qml @@ -77,7 +77,7 @@ Item { Connections { target: panelsGrid - onCurrentHorizontalPosChanged: { + function onCurrentHorizontalPosChanged() { if(forbidBottom) layerStack.pop(layerStack.currentLayer) updateTimestamp() diff --git a/qml/notifications/NotificationIndicator.qml b/qml/notifications/NotificationIndicator.qml index 8289a0e..2eb784f 100644 --- a/qml/notifications/NotificationIndicator.qml +++ b/qml/notifications/NotificationIndicator.qml @@ -135,8 +135,8 @@ Item { notifIndic.visible = false } - onCurrentHorizontalPosChanged: makeVisible() - onCurrentVerticalPosChanged: makeVisible() + function onCurrentHorizontalPosChanged() { makeVisible() } + function onCurrentVerticalPosChanged() { makeVisible() } } NotificationListModel { diff --git a/qml/notifications/NotificationPreview.qml b/qml/notifications/NotificationPreview.qml index ddf116f..44b0659 100644 --- a/qml/notifications/NotificationPreview.qml +++ b/qml/notifications/NotificationPreview.qml @@ -172,7 +172,7 @@ Item { Connections { target: notificationPreviewPresenter; - onNotificationChanged: notificationArea.state = (notificationPreviewPresenter.notification != null) ? "show" : "hide" + function onNotificationChanged() { notificationArea.state = (notificationPreviewPresenter.notification != null) ? "show" : "hide" } } } } diff --git a/qml/notifications/NotificationView.qml b/qml/notifications/NotificationView.qml index d23a7f1..b6799c3 100644 --- a/qml/notifications/NotificationView.qml +++ b/qml/notifications/NotificationView.qml @@ -105,7 +105,7 @@ MouseArea { Connections { target: panelsGrid - onCurrentHorizontalPosChanged: updateTimestamp() + function onCurrentHorizontalPosChanged() { updateTimestamp() } } } diff --git a/watchfaces/000-default-digital.qml b/watchfaces/000-default-digital.qml index 06c85b5..719855c 100644 --- a/watchfaces/000-default-digital.qml +++ b/watchfaces/000-default-digital.qml @@ -122,7 +122,7 @@ Item { Connections { target: wallClock - onTimeChanged: { + function onTimeChanged() { var hour = wallClock.time.getHours() var minute = wallClock.time.getMinutes() var date = wallClock.time.getDate() diff --git a/watchfaces/001-words-worte-palabras-mots.qml b/watchfaces/001-words-worte-palabras-mots.qml index 3e4e747..721be14 100644 --- a/watchfaces/001-words-worte-palabras-mots.qml +++ b/watchfaces/001-words-worte-palabras-mots.qml @@ -179,7 +179,7 @@ Item { Connections { target: localeManager - onChangesObserverChanged: { + function onChangesObserverChanged() { timeDisplay.text = Qt.binding(function() { return generateTime(wallClock.time) }) dateDisplay.text = Qt.binding(function() { return wallClock.time.toLocaleString(Qt.locale(), "ddd d MMM") }) } diff --git a/watchfaces/002-analog-70s-classic.qml b/watchfaces/002-analog-70s-classic.qml index 6913ecb..27003d7 100644 --- a/watchfaces/002-analog-70s-classic.qml +++ b/watchfaces/002-analog-70s-classic.qml @@ -323,7 +323,7 @@ Item { Connections { target: wallClock - onTimeChanged: { + function onTimeChanged() { var hour = wallClock.time.getHours() var minute = wallClock.time.getMinutes() var second = wallClock.time.getSeconds() diff --git a/watchfaces/003-alternative-digital-2.qml b/watchfaces/003-alternative-digital-2.qml index 886f890..f51a897 100644 --- a/watchfaces/003-alternative-digital-2.qml +++ b/watchfaces/003-alternative-digital-2.qml @@ -179,7 +179,7 @@ Item { Connections { target: wallClock - onTimeChanged: { + function onTimeChanged() { var hour = wallClock.time.getHours() var minute = wallClock.time.getMinutes() var second = wallClock.time.getSeconds() @@ -240,7 +240,7 @@ Item { Connections { target: localeManager - onChangesObserverChanged: { + function onChangesObserverChanged() { hourCanvas.requestPaint() minuteCanvas.requestPaint() secondCanvas.requestPaint() diff --git a/watchfaces/004-alternative-scifi.qml b/watchfaces/004-alternative-scifi.qml index 50543fd..8a8863a 100644 --- a/watchfaces/004-alternative-scifi.qml +++ b/watchfaces/004-alternative-scifi.qml @@ -198,7 +198,7 @@ Item { Connections { target: wallClock - onTimeChanged: { + function onTimeChanged() { var hour = wallClock.time.getHours() var minute = wallClock.time.getMinutes() var date = wallClock.time.getDate() @@ -245,7 +245,7 @@ Item { Connections { target: localeManager - onChangesObserverChanged: { + function onChangesObserverChanged() { hourCanvas.requestPaint() minuteCanvas.requestPaint() dateCanvas.requestPaint() diff --git a/watchfaces/005-analog-nordic.qml b/watchfaces/005-analog-nordic.qml index 2f59a1e..4224e3a 100644 --- a/watchfaces/005-analog-nordic.qml +++ b/watchfaces/005-analog-nordic.qml @@ -300,7 +300,7 @@ Item { Connections { target: wallClock - onTimeChanged: { + function onTimeChanged() { var hour = wallClock.time.getHours() var minute = wallClock.time.getMinutes() var second = wallClock.time.getSeconds() diff --git a/watchfaces/006-analog-50s-americana.qml b/watchfaces/006-analog-50s-americana.qml index b1a5f7d..cf631f9 100644 --- a/watchfaces/006-analog-50s-americana.qml +++ b/watchfaces/006-analog-50s-americana.qml @@ -261,7 +261,7 @@ Item { Connections { target: compositor - onDisplayAmbientChanged: { + function onDisplayAmbientChanged() { minuteHand.requestPaint() hourHand.requestPaint() } @@ -269,7 +269,7 @@ Item { Connections { target: wallClock - onTimeChanged: { + function onTimeChanged() { var hour = wallClock.time.getHours() var minute = wallClock.time.getMinutes() var second = wallClock.time.getSeconds() diff --git a/watchfaces/007-bold-hour-bebas.qml b/watchfaces/007-bold-hour-bebas.qml index 6da96f0..e8b72ea 100644 --- a/watchfaces/007-bold-hour-bebas.qml +++ b/watchfaces/007-bold-hour-bebas.qml @@ -112,7 +112,7 @@ Item { Connections { target: wallClock - onTimeChanged: { + function onTimeChanged() { var hour = wallClock.time.getHours() var minute = wallClock.time.getMinutes() if(minuteCircle.minute != minute) { diff --git a/watchfaces/009-contemporary-digital-rings.qml b/watchfaces/009-contemporary-digital-rings.qml index ab497ff..171344d 100644 --- a/watchfaces/009-contemporary-digital-rings.qml +++ b/watchfaces/009-contemporary-digital-rings.qml @@ -204,7 +204,7 @@ Item { Connections { target: wallClock - onTimeChanged: { + function onTimeChanged() { if (displayAmbient) return var hour = wallClock.time.getHours() var minute = wallClock.time.getMinutes()