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:
36
internal/controller/menu.go
Normal file
36
internal/controller/menu.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user