fix(@desktop): various UI scaling fixes
This commit is contained in:
parent
9dd35904ea
commit
f74d1a67a5
|
@ -189,3 +189,12 @@ QtObject:
|
|||
read = getNewVersion
|
||||
notify = newVersionChanged
|
||||
|
||||
proc readTextFile*(self: UtilsView, filepath: string): string {.slot.} =
|
||||
return readFile(filepath)
|
||||
|
||||
proc writeTextFile*(self: UtilsView, filepath: string, text: string): bool {.slot.} =
|
||||
try:
|
||||
writeFile(filepath, text)
|
||||
return true
|
||||
except:
|
||||
return false
|
|
@ -49,7 +49,8 @@ proc mainProc() =
|
|||
status.tasks.marathon.registerWorker(mailserverWorker)
|
||||
status.initNode()
|
||||
|
||||
enableHDPI()
|
||||
let uiScaleFilePath = joinPath(DATADIR, "ui-scale")
|
||||
enableHDPI(uiScaleFilePath)
|
||||
initializeOpenGL()
|
||||
|
||||
let app = newQGuiApplication()
|
||||
|
@ -95,6 +96,7 @@ proc mainProc() =
|
|||
defer: engine.delete()
|
||||
engine.addImportPath("qrc:/./StatusQ/src")
|
||||
engine.setNetworkAccessManagerFactory(networkAccessFactory)
|
||||
engine.setRootContextProperty("uiScaleFilePath", newQVariant(uiScaleFilePath))
|
||||
|
||||
# Register events objects
|
||||
let dockShowAppEvent = newStatusDockShowAppEventObject(engine)
|
||||
|
|
|
@ -172,6 +172,72 @@ ScrollView {
|
|||
}
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: labelZoom
|
||||
anchors.top: fontSizeSliderLegend.bottom
|
||||
anchors.topMargin: Style.current.xlPadding
|
||||
anchors.left: parent.left
|
||||
font.pixelSize: 15
|
||||
text: qsTr("Change Zoom (requires restart)")
|
||||
}
|
||||
|
||||
StatusSlider {
|
||||
id: zoomSlider
|
||||
anchors.top: labelZoom.bottom
|
||||
anchors.topMargin: Style.current.padding
|
||||
width: parent.width
|
||||
minimumValue: 50
|
||||
maximumValue: 200
|
||||
stepSize: 50
|
||||
value: parseFloat(utilsModel.readTextFile(uiScaleFilePath)) * 100
|
||||
onValueChanged: {
|
||||
utilsModel.writeTextFile(uiScaleFilePath, value / 100.0)
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: zoomSliderLegend
|
||||
anchors.top: zoomSlider.bottom
|
||||
anchors.topMargin: Style.current.padding
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
spacing: 0
|
||||
|
||||
StyledText {
|
||||
font.pixelSize: 15
|
||||
text: "50%"
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
StyledText {
|
||||
font.pixelSize: 15
|
||||
Layout.leftMargin: width / 2
|
||||
text: "100%"
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
StyledText {
|
||||
font.pixelSize: 15
|
||||
Layout.leftMargin: width / 2
|
||||
text: "150%"
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
StyledText {
|
||||
font.pixelSize: 15
|
||||
text: "200%"
|
||||
}
|
||||
}
|
||||
|
||||
// StatusSectionHeadline {
|
||||
// id: sectionHeadlineChatMode
|
||||
// //% "Chat mode"
|
||||
|
@ -225,7 +291,7 @@ ScrollView {
|
|||
//% "Appearance"
|
||||
text: qsTrId("appearance")
|
||||
// anchors.top: chatModeSection.bottom
|
||||
anchors.top: fontSizeSliderLegend.bottom
|
||||
anchors.top: zoomSliderLegend.bottom
|
||||
anchors.topMargin: Style.current.padding*3
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit c18777749a2574d743ca2b7e5abc654152154f00
|
||||
Subproject commit 595e151080b999bbe6f2bc366b87917994f2b444
|
Loading…
Reference in New Issue