Skip to content

Commit

Permalink
Store user preferred brightness level.
Browse files Browse the repository at this point in the history
Partial fix for AsteroidOS#45.  We store the user's preferred brightness as a
setting.  The second half of the fix will be to change the quick
settings to allow 1%-user setting-100% three-step change instead of the
current 1%-100% two-step toggle.
  • Loading branch information
beroset committed Feb 17, 2022
1 parent 60ab9c2 commit da7a4ac
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/qml/DisplayPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Item {
key: "/org/asteroidos/settings/use-burn-in-protection"
defaultValue: DeviceInfo.needsBurnInProtection
}
ConfigurationValue {
id: userBrightness
key: "/org/asteroidos/settings/user-preferred-brightness"
defaultValue: 42
}

PageHeader {
id: title
Expand Down Expand Up @@ -71,14 +76,15 @@ Item {
anchors.top: parent.top
anchors.topMargin: Dims.h(10)
onClicked: {
var newVal = displaySettings.brightness - 10
var newVal = userBrightness.value - 10
if(newVal < 0) newVal = 0
displaySettings.brightness = newVal
userBrightness.value = newVal
}
}

Label {
text: displaySettings.brightness + "%"
text: userBrightness.value + "%"
font.pixelSize: Dims.l(6)
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Expand All @@ -98,9 +104,10 @@ Item {
anchors.top: parent.top
anchors.topMargin: Dims.h(10)
onClicked: {
var newVal = displaySettings.brightness + 10
var newVal = userBrightness.value + 10
if(newVal > 100) newVal = 100
displaySettings.brightness = newVal
userBrightness.value = newVal
}
}
}
Expand Down

0 comments on commit da7a4ac

Please sign in to comment.