This commit is contained in:
Andrei Smirnov 2021-09-02 09:54:02 +03:00 committed by Iuri Matias
parent 616090da3d
commit 979fea1cee
2 changed files with 11 additions and 2 deletions

View File

@ -190,7 +190,10 @@ QtObject:
notify = newVersionChanged
proc readTextFile*(self: UtilsView, filepath: string): string {.slot.} =
return readFile(filepath)
try:
return readFile(filepath)
except:
return ""
proc writeTextFile*(self: UtilsView, filepath: string, text: string): bool {.slot.} =
try:

View File

@ -189,7 +189,13 @@ ScrollView {
minimumValue: 50
maximumValue: 200
stepSize: 50
value: parseFloat(utilsModel.readTextFile(uiScaleFilePath)) * 100
value: {
let scaleFactorStr = utilsModel.readTextFile(uiScaleFilePath)
if (scaleFactorStr === "") {
return 100
}
return parseFloat(scaleFactorStr) * 100
}
onValueChanged: {
utilsModel.writeTextFile(uiScaleFilePath, value / 100.0)
}