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
|
// Experimental - may be removed in future
|
||||||
FontNormalTTF string
|
FontNormalTTF string
|
||||||
FontBoldTTF string
|
FontBoldTTF string
|
||||||
|
UIScaleSize string
|
||||||
}
|
}
|
||||||
|
|
||||||
type AlbumPageConfig struct {
|
type AlbumPageConfig struct {
|
||||||
@@ -145,6 +146,7 @@ func DefaultConfig(appVersionTag string) *Config {
|
|||||||
SettingsTab: "General",
|
SettingsTab: "General",
|
||||||
AllowMultiInstance: false,
|
AllowMultiInstance: false,
|
||||||
MaxImageCacheSizeMB: 50,
|
MaxImageCacheSizeMB: 50,
|
||||||
|
UIScaleSize: "Normal",
|
||||||
},
|
},
|
||||||
AlbumPage: AlbumPageConfig{
|
AlbumPage: AlbumPageConfig{
|
||||||
TracklistColumns: []string{"Artist", "Time", "Plays", "Favorite", "Rating"},
|
TracklistColumns: []string{"Artist", "Time", "Plays", "Favorite", "Rating"},
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"math"
|
"math"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -22,6 +23,12 @@ func main() {
|
|||||||
log.Fatalf("fatal startup error: %v", err.Error())
|
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 := app.New()
|
||||||
fyneApp.SetIcon(res.ResAppicon256Png)
|
fyneApp.SetIcon(res.ResAppicon256Png)
|
||||||
|
|
||||||
|
|||||||
@@ -406,9 +406,22 @@ func (s *SettingsDialog) createExperimentalTab(window fyne.Window) *container.Ta
|
|||||||
s.doChooseTTFFile(window, boldFontEntry)
|
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(
|
return container.NewTabItem("Experimental", container.NewVBox(
|
||||||
warningLabel,
|
warningLabel,
|
||||||
s.newSectionSeparator(),
|
s.newSectionSeparator(),
|
||||||
|
widget.NewRichText(&widget.TextSegment{Text: "UI Scaling", Style: boldStyle}),
|
||||||
|
uiScaleRadio,
|
||||||
|
s.newSectionSeparator(),
|
||||||
widget.NewRichText(&widget.TextSegment{Text: "Application Font", Style: boldStyle}),
|
widget.NewRichText(&widget.TextSegment{Text: "Application Font", Style: boldStyle}),
|
||||||
container.New(layout.NewFormLayout(),
|
container.New(layout.NewFormLayout(),
|
||||||
widget.NewLabel("Normal font"), container.NewBorder(nil, nil, nil, normalFontBrowse, normalFontEntry),
|
widget.NewLabel("Normal font"), container.NewBorder(nil, nil, nil, normalFontBrowse, normalFontEntry),
|
||||||
|
|||||||
Reference in New Issue
Block a user