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"`
|
2024-01-23 20:39:45 +08:00
|
|
|
Cli PreferencesCli `json:"cli" yaml:"cli"`
|
2023-10-04 22:21:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewPreferences() Preferences {
|
|
|
|
return Preferences{
|
|
|
|
Behavior: PreferencesBehavior{
|
|
|
|
AsideWidth: consts.DEFAULT_ASIDE_WIDTH,
|
|
|
|
WindowWidth: consts.DEFAULT_WINDOW_WIDTH,
|
|
|
|
WindowHeight: consts.DEFAULT_WINDOW_HEIGHT,
|
|
|
|
},
|
|
|
|
General: PreferencesGeneral{
|
2023-12-05 12:03:00 +08:00
|
|
|
Theme: "auto",
|
|
|
|
Language: "auto",
|
|
|
|
FontSize: consts.DEFAULT_FONT_SIZE,
|
|
|
|
ScanSize: consts.DEFAULT_SCAN_SIZE,
|
|
|
|
KeyIconStyle: 0,
|
|
|
|
CheckUpdate: true,
|
2023-10-04 22:21:35 +08:00
|
|
|
},
|
|
|
|
Editor: PreferencesEditor{
|
2023-12-03 22:51:14 +08:00
|
|
|
FontSize: consts.DEFAULT_FONT_SIZE,
|
|
|
|
ShowLineNum: true,
|
2023-12-12 10:35:29 +08:00
|
|
|
ShowFolding: true,
|
2023-10-04 22:21:35 +08:00
|
|
|
},
|
2024-01-23 20:39:45 +08:00
|
|
|
Cli: PreferencesCli{
|
2024-01-23 20:55:38 +08:00
|
|
|
FontSize: consts.DEFAULT_FONT_SIZE,
|
|
|
|
CursorStyle: "block",
|
2024-01-23 20:39:45 +08:00
|
|
|
},
|
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-12-12 11:40:22 +08:00
|
|
|
WindowPosX int `json:"windowPosX" yaml:"window_pos_x"`
|
|
|
|
WindowPosY int `json:"windowPosY" yaml:"window_pos_y"`
|
2023-10-04 22:21:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type PreferencesGeneral struct {
|
2024-01-23 19:44:11 +08:00
|
|
|
Theme string `json:"theme" yaml:"theme"`
|
|
|
|
Language string `json:"language" yaml:"language"`
|
|
|
|
Font string `json:"font" yaml:"font,omitempty"`
|
|
|
|
FontFamily []string `json:"fontFamily" yaml:"font_family,omitempty"`
|
|
|
|
FontSize int `json:"fontSize" yaml:"font_size"`
|
|
|
|
ScanSize int `json:"scanSize" yaml:"scan_size"`
|
|
|
|
KeyIconStyle int `json:"keyIconStyle" yaml:"key_icon_style"`
|
|
|
|
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"`
|
2023-10-04 22:21:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
type PreferencesEditor struct {
|
2024-01-23 19:44:11 +08:00
|
|
|
Font string `json:"font" yaml:"font,omitempty"`
|
|
|
|
FontFamily []string `json:"fontFamily" yaml:"font_family,omitempty"`
|
|
|
|
FontSize int `json:"fontSize" yaml:"font_size"`
|
|
|
|
ShowLineNum bool `json:"showLineNum" yaml:"show_line_num"`
|
|
|
|
ShowFolding bool `json:"showFolding" yaml:"show_folding"`
|
2023-10-04 22:21:35 +08:00
|
|
|
}
|
2024-01-23 20:39:45 +08:00
|
|
|
|
|
|
|
type PreferencesCli struct {
|
2024-01-23 20:55:38 +08:00
|
|
|
FontFamily []string `json:"fontFamily" yaml:"font_family,omitempty"`
|
|
|
|
FontSize int `json:"fontSize" yaml:"font_size"`
|
|
|
|
CursorStyle string `json:"cursorStyle" yaml:"cursor_style,omitempty"`
|
2024-01-23 20:39:45 +08:00
|
|
|
}
|