Skip to content

Commit

Permalink
Change Always-on-Display to configuration item
Browse files Browse the repository at this point in the history
This changes the Always-on-Display setting to a stored setting instead
of reading from the lowPowerModeEnabled value.  This allows for
independent settings of AoD in both main screen and Nightstand mode and
helps address AsteroidOS/asteroid#131

Signed-off-by: Ed Beroset <[email protected]>
  • Loading branch information
beroset authored and MagneFire committed Sep 12, 2023
1 parent ed7401c commit 10daa47
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
13 changes: 11 additions & 2 deletions src/qml/DisplayPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ Item {
defaultValue: DeviceInfo.needsBurnInProtection
}

ConfigurationValue {
id: alwaysOnDisplay
key: "/org/asteroidos/settings/always-on-display"
defaultValue: true
}

property string rowHeight: Dims.h(25)

Flickable {
Expand Down Expand Up @@ -82,8 +88,11 @@ Item {
width: parent.width
//% "Always on Display"
text: qsTrId("id-always-on-display")
checked: displaySettings.lowPowerModeEnabled
onCheckedChanged: displaySettings.lowPowerModeEnabled = checked
checked: alwaysOnDisplay.value
onCheckedChanged: {
displaySettings.lowPowerModeEnabled = checked
alwaysOnDisplay.value = checked
}
}

LabeledSwitch {
Expand Down
14 changes: 11 additions & 3 deletions src/qml/NightstandPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import QtQuick.Layouts 1.3
import org.asteroid.controls 1.0
import org.asteroid.utils 1.0
import org.asteroid.settings 1.0
import org.nemomobile.systemsettings 1.0
import org.nemomobile.systemsettings 1.0 as NemoSystemSettings
import Nemo.Configuration 1.0

Item {
Expand Down Expand Up @@ -54,9 +54,14 @@ Item {
ConfigurationValue {
id: nightstandAlwaysOnDisplay
key: "/desktop/asteroid/nightstand/always-on-display"
defaultValue: false
defaultValue: true
}

NemoSystemSettings.DisplaySettings {
id: displaySettings
}


property string rowHeight: Dims.h(25)

Flickable {
Expand Down Expand Up @@ -143,7 +148,10 @@ Item {
//% "Always on Display"
text: qsTrId("id-always-on-display")
checked: nightstandAlwaysOnDisplay.value
onCheckedChanged: nightstandAlwaysOnDisplay.value = checked
onCheckedChanged: {
nightstandAlwaysOnDisplay.value = checked
displaySettings.lowPowerModeEnabled = checked
}
}
}

Expand Down

0 comments on commit 10daa47

Please sign in to comment.