2023-10-04 22:21:35 +08:00
|
|
|
package types
|
|
|
|
|
|
|
|
import "tinyrdm/backend/consts"
|
|
|
|
|
|
|
|
type Preferences struct {
|
2024-02-03 15:06:23 +08:00
|
|
|
Behavior PreferencesBehavior `json:"behavior" yaml:"behavior"`
|
|
|
|
General PreferencesGeneral `json:"general" yaml:"general"`
|
|
|
|
Editor PreferencesEditor `json:"editor" yaml:"editor"`
|
|
|
|
Cli PreferencesCli `json:"cli" yaml:"cli"`
|
|
|
|
Decoder []PreferencesDecoder `json:"decoder" yaml:"decoder,omitempty"`
|
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,
|
2024-03-14 00:40:39 +08:00
|
|
|
AllowTrack: 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,
|
2024-02-03 15:24:18 +08:00
|
|
|
DropText: true,
|
2024-02-18 21:46:00 +08:00
|
|
|
Links: 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
|
|
|
},
|
2024-02-03 15:06:23 +08:00
|
|
|
Decoder: []PreferencesDecoder{},
|
2023-10-04 22:21:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type PreferencesBehavior struct {
|
2024-03-14 00:40:39 +08:00
|
|
|
Welcomed bool `json:"welcomed" yaml:"welcomed"`
|
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"`
|
2024-03-14 00:40:39 +08:00
|
|
|
AllowTrack bool `json:"allowTrack" yaml:"allow_track"`
|
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"`
|
2024-02-03 15:24:18 +08:00
|
|
|
DropText bool `json:"dropText" yaml:"drop_text"`
|
2024-02-18 21:46:00 +08:00
|
|
|
Links bool `json:"links" yaml:"links"`
|
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
|
|
|
}
|
2024-02-03 15:06:23 +08:00
|
|
|
|
|
|
|
type PreferencesDecoder struct {
|
|
|
|
Name string `json:"name" yaml:"name"`
|
|
|
|
Enable bool `json:"enable" yaml:"enable"`
|
|
|
|
Auto bool `json:"auto" yaml:"auto"`
|
|
|
|
DecodePath string `json:"decodePath" yaml:"decode_path"`
|
|
|
|
DecodeArgs []string `json:"decodeArgs" yaml:"decode_args,omitempty"`
|
|
|
|
EncodePath string `json:"encodePath" yaml:"encode_path"`
|
|
|
|
EncodeArgs []string `json:"encodeArgs" yaml:"encode_args,omitempty"`
|
|
|
|
}
|