Add main settings view and theme management functionality

Introduce a new `MainSettings` view for managing application settings, including language and theme selection. Implement theme management methods in the `setting` package to handle theme initialization, retrieval, and updates.
This commit is contained in:
2025-06-09 00:27:40 +05:00
parent 690f84e2c8
commit fc4e585620
4 changed files with 243 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package controller
import (
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/gui/view"
)
func (c *controller) actionSettingConvertor() {
c.settingConvertor(true)
}
func (c *controller) actionMainSettings() {
currentLang, _ := c.app.GetSetting().GetCurrentLangOrDefaultLang()
content := view.MainSettings(
currentLang,
c.app.GetSetting().GetLanguages(),
c.app.GetSetting().GetTheme(),
c.app.GetSetting().GetThemes(),
c.actionMainSettingsSave,
c.convertor,
)
c.window.SetContent(content)
}
func (c *controller) actionMainSettingsSave(setting *view.MainSettingForm) error {
err := c.app.GetSetting().SetLang(setting.Language)
if err != nil {
return err
}
c.app.GetSetting().SetTheme(setting.ThemeInfo)
c.initLayout()
c.convertor()
return nil
}