feat: persist main window state
This commit is contained in:
@@ -58,7 +58,7 @@ func settingsDefinitions() []models.AppSettingDefinition {
|
||||
Label: "启动窗口状态",
|
||||
Type: settingTypeSelect,
|
||||
DefaultValue: "normal",
|
||||
Description: "主窗口启动时默认状态;尺寸恢复由 T-015 继续落地。",
|
||||
Description: "主窗口启动时恢复的窗口状态。",
|
||||
Options: []models.AppSettingOption{
|
||||
{Value: "normal", Label: "普通窗口"},
|
||||
{Value: "maximized", Label: "最大化"},
|
||||
@@ -70,7 +70,7 @@ func settingsDefinitions() []models.AppSettingDefinition {
|
||||
Label: "默认宽度",
|
||||
Type: settingTypeNumber,
|
||||
DefaultValue: "1280",
|
||||
Description: "主窗口默认宽度,当前窗口创建逻辑使用固定默认值。",
|
||||
Description: "主窗口普通状态下保存的宽度。",
|
||||
},
|
||||
{
|
||||
Key: "window.height",
|
||||
@@ -78,15 +78,15 @@ func settingsDefinitions() []models.AppSettingDefinition {
|
||||
Label: "默认高度",
|
||||
Type: settingTypeNumber,
|
||||
DefaultValue: "800",
|
||||
Description: "主窗口默认高度,当前窗口创建逻辑使用固定默认值。",
|
||||
Description: "主窗口普通状态下保存的高度。",
|
||||
},
|
||||
{
|
||||
Key: "window.remember_state",
|
||||
Category: "window",
|
||||
Label: "记住窗口状态",
|
||||
Type: settingTypeBoolean,
|
||||
DefaultValue: "false",
|
||||
Description: "保存主窗口尺寸和最大化状态,T-015 使用该配置。",
|
||||
DefaultValue: "true",
|
||||
Description: "保存并恢复主窗口尺寸和最大化状态。",
|
||||
},
|
||||
{
|
||||
Key: "shortcut.open_second_window",
|
||||
@@ -221,6 +221,17 @@ func defaultAppConfigSQL() string {
|
||||
return builder.String()
|
||||
}
|
||||
|
||||
func appConfigDataMigrationSQL() string {
|
||||
return `
|
||||
UPDATE appconfig
|
||||
SET value = 'true',
|
||||
description = '保存并恢复主窗口尺寸和最大化状态。'
|
||||
WHERE key = 'window.remember_state'
|
||||
AND value = 'false'
|
||||
AND description = '保存主窗口尺寸和最大化状态,T-015 使用该配置。';
|
||||
`
|
||||
}
|
||||
|
||||
func sqlString(value string) string {
|
||||
return "'" + strings.ReplaceAll(value, "'", "''") + "'"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user