Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qml: add config setting for max brightness on qr display #9321

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions electrum/gui/qml/components/Preferences.qml
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,27 @@ Pane {
wrapMode: Text.Wrap
}
}
}

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
}
}
}
}
}

}

Component {
Expand All @@ -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')
}
Expand Down
5 changes: 3 additions & 2 deletions electrum/gui/qml/components/controls/QRImage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

}
4 changes: 4 additions & 0 deletions electrum/gui/qml/qeapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ def doShare(self, data, title):
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)
Expand Down
9 changes: 9 additions & 0 deletions electrum/gui/qml/qeconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ def alwaysAllowScreenshots(self, enable):
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):
Expand Down
1 change: 1 addition & 0 deletions electrum/simple_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ def __setattr__(self, name, value):
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(
Expand Down