1
0

qml: add config setting for max brightness on qr display

This commit is contained in:
Josh Geden
2024-11-23 21:44:02 -08:00
committed by Sander van Grieken
parent a084ccc74c
commit 6331448860
5 changed files with 36 additions and 4 deletions

View File

@@ -231,6 +231,24 @@ Pane {
}
}
RowLayout {
Layout.columnSpan: 2
Layout.fillWidth: true
spacing: 0
Switch {
id: setMaxBrightnessOnQrDisplay
onCheckedChanged: {
if (activeFocus)
Config.setMaxBrightnessOnQrDisplay = checked
}
}
Label {
Layout.fillWidth: true
text: qsTr('Set display to max brightness when displaying QR codes')
wrapMode: Text.Wrap
}
}
PrefsHeading {
Layout.columnSpan: 2
text: qsTr('Wallet behavior')
@@ -423,10 +441,8 @@ Pane {
}
}
}
}
}
}
Component {
@@ -447,6 +463,7 @@ Pane {
useFallbackAddress.checked = Config.useFallbackAddress
enableDebugLogs.checked = Config.enableDebugLogs
alwaysAllowScreenshots.checked = Config.alwaysAllowScreenshots
setMaxBrightnessOnQrDisplay.checked = Config.setMaxBrightnessOnQrDisplay
useRecoverableChannels.checked = Config.useRecoverableChannels
syncLabels.checked = AppController.isPluginEnabled('labels')
}

View File

@@ -78,10 +78,11 @@ Item {
onVisibleChanged: {
if (root.visible) {
// set max brightness to make qr code easier to scan
AppController.setMaxScreenBrightness()
if (AppController.isMaxBrightnessOnQrDisplayEnabled()) {
AppController.setMaxScreenBrightness()
}
} else {
AppController.resetScreenBrightness()
}
}
}

View File

@@ -210,6 +210,10 @@ class QEAppController(BaseCrashReporter, QObject):
it = jIntent.createChooser(sendIntent, cast('java.lang.CharSequence', jString(title)))
jpythonActivity.startActivity(it)
@pyqtSlot()
def isMaxBrightnessOnQrDisplayEnabled(self):
return self.config.GUI_QML_SET_MAX_BRIGHTNESS_ON_QR_DISPLAY
@pyqtSlot()
def setMaxScreenBrightness(self):
self._set_screen_brightness(1.0)

View File

@@ -189,6 +189,15 @@ class QEConfig(AuthMixin, QObject):
self.config.GUI_QML_ALWAYS_ALLOW_SCREENSHOTS = enable
self.alwaysAllowScreenshotsChanged.emit()
setMaxBrightnessOnQrDisplayChanged = pyqtSignal()
@pyqtProperty(bool, notify=setMaxBrightnessOnQrDisplayChanged)
def setMaxBrightnessOnQrDisplay(self):
return self.config.GUI_QML_SET_MAX_BRIGHTNESS_ON_QR_DISPLAY
@setMaxBrightnessOnQrDisplay.setter
def setMaxBrightnessOnQrDisplay(self, enable):
self.config.GUI_QML_SET_MAX_BRIGHTNESS_ON_QR_DISPLAY = enable
useRecoverableChannelsChanged = pyqtSignal()
@pyqtProperty(bool, notify=useRecoverableChannelsChanged)
def useRecoverableChannels(self):

View File

@@ -1121,6 +1121,7 @@ Warning: setting this to too low will result in lots of payment failures."""),
GUI_QML_ADDRESS_LIST_SHOW_TYPE = ConfigVar('address_list_show_type', default=1, type_=int)
GUI_QML_ADDRESS_LIST_SHOW_USED = ConfigVar('address_list_show_used', default=False, type_=bool)
GUI_QML_ALWAYS_ALLOW_SCREENSHOTS = ConfigVar('android_always_allow_screenshots', default=False, type_=bool)
GUI_QML_SET_MAX_BRIGHTNESS_ON_QR_DISPLAY = ConfigVar('android_set_max_brightness_on_qr_display', default=True, type_=bool)
BTC_AMOUNTS_DECIMAL_POINT = ConfigVar('decimal_point', default=DECIMAL_POINT_DEFAULT, type_=int)
BTC_AMOUNTS_FORCE_NZEROS_AFTER_DECIMAL_POINT = ConfigVar(