Add a persistent zoom setting to settings.json

The zoom keybinds now modify this setting directly.
The `uiScale` property in themes now default to using this zoom setting,
since just removing it would need of annoying changes through theme
files and QML code, and is best left to until the future theming
overhaul update.
This commit is contained in:
miruka 2020-09-01 14:19:40 -04:00
parent bd8c6ec0fc
commit 8b37ca2524
5 changed files with 16 additions and 6 deletions

View File

@ -3,7 +3,6 @@
- handle invalid access token - handle invalid access token
- If an account is gone from the user's config, discard UI state last page - If an account is gone from the user's config, discard UI state last page
- room A-Z sorting - room A-Z sorting
- move uiScale to settings.json
- up/down doesn't work in the middle of a @word for which autocompletion isn't - up/down doesn't work in the middle of a @word for which autocompletion isn't
open because no matches open because no matches
- filter > enter > room list is always scrolled to top - filter > enter > room list is always scrolled to top

View File

@ -285,6 +285,8 @@ class UISettings(JSONDataFile):
"ownMessagesOnLeftAboveWidth": 895, "ownMessagesOnLeftAboveWidth": 895,
"theme": "Midnight.qpl", "theme": "Midnight.qpl",
"writeAliases": {}, "writeAliases": {},
"zoom": 1.0,
"media": { "media": {
"autoLoad": True, "autoLoad": True,
"autoPlay": False, "autoPlay": False,

View File

@ -64,17 +64,26 @@ Item {
HShortcut { HShortcut {
sequences: window.settings.keys.zoomIn sequences: window.settings.keys.zoomIn
onActivated: theme.uiScale += 0.1 onActivated: {
window.settings.zoom += 0.1
window.settingsChanged()
}
} }
HShortcut { HShortcut {
sequences: window.settings.keys.zoomOut sequences: window.settings.keys.zoomOut
onActivated: theme.uiScale = Math.max(0.1, theme.uiScale - 0.1) onActivated: {
window.settings.zoom = Math.max(0.1, window.settings.zoom - 0.1)
window.settingsChanged()
}
} }
HShortcut { HShortcut {
sequences: window.settings.keys.zoomReset sequences: window.settings.keys.zoomReset
onActivated: theme.uiScale = 1 onActivated: {
window.settings.zoom = 1
window.settingsChanged()
}
} }
HShortcut { HShortcut {

View File

@ -2,7 +2,7 @@
// Base variables // Base variables
real uiScale: 1.0 real uiScale: window.settings.zoom
int minimumSupportedWidth: 240 * uiScale int minimumSupportedWidth: 240 * uiScale
int minimumSupportedHeight: 120 * uiScale int minimumSupportedHeight: 120 * uiScale

View File

@ -2,7 +2,7 @@
// Base variables // Base variables
real uiScale: 1.0 real uiScale: window.settings.zoom
int minimumSupportedWidth: 240 * uiScale int minimumSupportedWidth: 240 * uiScale
int minimumSupportedHeight: 120 * uiScale int minimumSupportedHeight: 120 * uiScale