Replace hardcoded font with check for default fonts, fall back to

inter/roboto
Settings: use font detection function
GeneralTab: let user know that it uses default fonts and falls back to
inter/roboto
FontService: add proper checks for default fonts (sans & mono)
This commit is contained in:
Ly-sec 2025-09-12 22:00:05 +02:00
parent 62b12d5436
commit be4a69f6e0
3 changed files with 126 additions and 3 deletions

View file

@ -203,6 +203,17 @@ Singleton {
BluetoothService.init()
}
// -----------------------------------------------------
// Update font defaults when system fonts are detected
function updateFontDefaults() {
if (FontService.systemFontsDetected) {
Logger.log("Settings", "Updating font defaults with detected system fonts")
adapter.ui.fontDefault = FontService.getSystemSansFont()
adapter.ui.fontFixed = FontService.getSystemMonospaceFont()
adapter.ui.fontBillboard = FontService.getSystemDisplayFont()
}
}
// -----------------------------------------------------
// Ensure directories exist before FileView tries to read files
Component.onCompleted: {
@ -213,6 +224,9 @@ Singleton {
// Mark directories as created and trigger file loading
directoriesCreated = true
// Connect to font service signal to update defaults when system fonts are detected
FontService.systemFontsDetected.connect(updateFontDefaults)
}
// Don't write settings to disk immediately
@ -415,9 +429,9 @@ Singleton {
// ui
property JsonObject ui: JsonObject {
property string fontDefault: "Roboto"
property string fontFixed: "DejaVu Sans Mono"
property string fontBillboard: "Inter"
property string fontDefault: FontService.getSystemSansFont()
property string fontFixed: FontService.getSystemMonospaceFont()
property string fontBillboard: FontService.getSystemDisplayFont()
property list<var> monitorsScaling: []
property bool idleInhibitorEnabled: false
}