Fix #179: add experimental setting to scale down or up UI size
This commit is contained in:
@@ -45,6 +45,7 @@ type AppConfig struct {
|
||||
// Experimental - may be removed in future
|
||||
FontNormalTTF string
|
||||
FontBoldTTF string
|
||||
UIScaleSize string
|
||||
}
|
||||
|
||||
type AlbumPageConfig struct {
|
||||
@@ -145,6 +146,7 @@ func DefaultConfig(appVersionTag string) *Config {
|
||||
SettingsTab: "General",
|
||||
AllowMultiInstance: false,
|
||||
MaxImageCacheSizeMB: 50,
|
||||
UIScaleSize: "Normal",
|
||||
},
|
||||
AlbumPage: AlbumPageConfig{
|
||||
TracklistColumns: []string{"Artist", "Time", "Plays", "Favorite", "Rating"},
|
||||
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"log"
|
||||
"math"
|
||||
"os"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
@@ -22,6 +23,12 @@ func main() {
|
||||
log.Fatalf("fatal startup error: %v", err.Error())
|
||||
}
|
||||
|
||||
if myApp.Config.Application.UIScaleSize == "Smaller" {
|
||||
os.Setenv("FYNE_SCALE", "0.85")
|
||||
} else if myApp.Config.Application.UIScaleSize == "Larger" {
|
||||
os.Setenv("FYNE_SCALE", "1.1")
|
||||
}
|
||||
|
||||
fyneApp := app.New()
|
||||
fyneApp.SetIcon(res.ResAppicon256Png)
|
||||
|
||||
|
||||
@@ -406,9 +406,22 @@ func (s *SettingsDialog) createExperimentalTab(window fyne.Window) *container.Ta
|
||||
s.doChooseTTFFile(window, boldFontEntry)
|
||||
})
|
||||
|
||||
uiScaleRadio := widget.NewRadioGroup([]string{"Smaller", "Normal", "Larger"}, func(choice string) {
|
||||
s.config.Application.UIScaleSize = choice
|
||||
s.setRestartRequired()
|
||||
})
|
||||
uiScaleRadio.Horizontal = true
|
||||
if s.config.Application.UIScaleSize == "Smaller" || s.config.Application.UIScaleSize == "Larger" {
|
||||
uiScaleRadio.Selected = s.config.Application.UIScaleSize
|
||||
} else {
|
||||
uiScaleRadio.Selected = "Normal"
|
||||
}
|
||||
return container.NewTabItem("Experimental", container.NewVBox(
|
||||
warningLabel,
|
||||
s.newSectionSeparator(),
|
||||
widget.NewRichText(&widget.TextSegment{Text: "UI Scaling", Style: boldStyle}),
|
||||
uiScaleRadio,
|
||||
s.newSectionSeparator(),
|
||||
widget.NewRichText(&widget.TextSegment{Text: "Application Font", Style: boldStyle}),
|
||||
container.New(layout.NewFormLayout(),
|
||||
widget.NewLabel("Normal font"), container.NewBorder(nil, nil, nil, normalFontBrowse, normalFontEntry),
|
||||
|
||||
Reference in New Issue
Block a user