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{
|
2023-12-03 22:51:14 +08:00
|
|
|
FontSize: consts.DEFAULT_FONT_SIZE,
|
|
|
|
ShowLineNum: true,
|
2023-10-04 22:21:35 +08:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type PreferencesBehavior struct {
|
2023-11-24 11:49:59 +08:00
|
|
|
AsideWidth int `json:"asideWidth" yaml:"aside_width"`
|
|
|
|
WindowWidth int `json:"windowWidth" yaml:"window_width"`
|
|
|
|
WindowHeight int `json:"windowHeight" yaml:"window_height"`
|
|
|
|
WindowMaximised bool `json:"windowMaximised" yaml:"window_maximised"`
|
2023-10-04 22:21:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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 {
|
2023-12-03 22:51:14 +08:00
|
|
|
Font string `json:"font" yaml:"font,omitempty"`
|
|
|
|
FontSize int `json:"fontSize" yaml:"font_size"`
|
|
|
|
ShowLineNum bool `json:"showLineNum" yaml:"show_line_num,omitempty"`
|
2023-10-04 22:21:35 +08:00
|
|
|
}
|