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.
37 lines
775 B
Go
37 lines
775 B
Go
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
|
|
}
|