2023-10-04 22:21:35 +08:00
|
|
|
package types
|
|
|
|
|
|
|
|
import "tinyrdm/backend/consts"
|
|
|
|
|
|
|
|
type Preferences struct {
|
|
|
|
Behavior PreferencesBehavior `json:"behavior" yaml:"behavior"`
|
|
|
|
General PreferencesGeneral `json:"general" yaml:"general"`
|
|
|
|
Editor PreferencesEditor `json:"editor" yaml:"editor"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewPreferences() Preferences {
|
|
|
|
return Preferences{
|
|
|
|
Behavior: PreferencesBehavior{
|
|
|
|
AsideWidth: consts.DEFAULT_ASIDE_WIDTH,
|
|
|
|
WindowWidth: consts.DEFAULT_WINDOW_WIDTH,
|
|
|
|
WindowHeight: consts.DEFAULT_WINDOW_HEIGHT,
|
|
|
|
},
|
|
|
|
General: PreferencesGeneral{
|
|
|
|
Theme: "auto",
|
|
|
|
Language: "auto",
|
|
|
|
FontSize: consts.DEFAULT_FONT_SIZE,
|
2023-10-20 18:22:53 +08:00
|
|
|
ScanSize: consts.DEFAULT_SCAN_SIZE,
|
2023-10-04 22:21:35 +08:00
|
|
|
CheckUpdate: true,
|
|
|
|
},
|
|
|
|
Editor: PreferencesEditor{
|
|
|
|
FontSize: consts.DEFAULT_FONT_SIZE,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type PreferencesBehavior struct {
|
|
|
|
AsideWidth int `json:"asideWidth" yaml:"aside_width"`
|
|
|
|
WindowWidth int `json:"windowWidth" yaml:"window_width"`
|
|
|
|
WindowHeight int `json:"windowHeight" yaml:"window_height"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PreferencesGeneral struct {
|
|
|
|
Theme string `json:"theme" yaml:"theme"`
|
|
|
|
Language string `json:"language" yaml:"language"`
|
|
|
|
Font string `json:"font" yaml:"font,omitempty"`
|
|
|
|
FontSize int `json:"fontSize" yaml:"font_size"`
|
2023-10-20 18:22:53 +08:00
|
|
|
ScanSize int `json:"scanSize" yaml:"scan_size"`
|
2023-10-04 22:21:35 +08:00
|
|
|
UseSysProxy bool `json:"useSysProxy" yaml:"use_sys_proxy,omitempty"`
|
|
|
|
UseSysProxyHttp bool `json:"useSysProxyHttp" yaml:"use_sys_proxy_http,omitempty"`
|
|
|
|
CheckUpdate bool `json:"checkUpdate" yaml:"check_update"`
|
|
|
|
SkipVersion string `json:"skipVersion" yaml:"skip_version,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type PreferencesEditor struct {
|
|
|
|
Font string `json:"font" yaml:"font,omitempty"`
|
|
|
|
FontSize int `json:"fontSize" yaml:"font_size"`
|
|
|
|
}
|