gui-for-ffmpeg/handler/main.go

38 lines
940 B
Go
Raw Normal View History

package handler
import (
2024-02-12 22:21:47 +06:00
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/localizer"
)
type MainHandler struct {
convertorHandler ConvertorHandlerContract
menuHandler MenuHandlerContract
localizerRepository localizer.RepositoryContract
localizerService localizer.ServiceContract
}
func NewMainHandler(
convertorHandler ConvertorHandlerContract,
menuHandler MenuHandlerContract,
localizerRepository localizer.RepositoryContract,
localizerService localizer.ServiceContract,
) *MainHandler {
return &MainHandler{
convertorHandler: convertorHandler,
menuHandler: menuHandler,
localizerRepository: localizerRepository,
localizerService: localizerService,
}
}
func (h MainHandler) Start() {
language, err := h.localizerRepository.GetCode()
if err != nil {
h.menuHandler.LanguageSelection()
return
}
_ = h.localizerService.SetCurrentLanguageByCode(language)
h.convertorHandler.MainConvertor()
}