Версия 0.3.0 #3
@ -17,6 +17,8 @@ import (
|
||||
type ConvertorHandlerContract interface {
|
||||
MainConvertor()
|
||||
FfPathSelection()
|
||||
GetFfmpegVersion() (string, error)
|
||||
GetFfprobeVersion() (string, error)
|
||||
}
|
||||
|
||||
type ConvertorHandler struct {
|
||||
@ -54,6 +56,14 @@ func (h ConvertorHandler) FfPathSelection() {
|
||||
h.convertorView.SelectFFPath(ffmpeg, ffprobe, h.saveSettingFFPath, h.MainConvertor)
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) GetFfmpegVersion() (string, error) {
|
||||
return h.convertorService.GetFFmpegVesrion()
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) GetFfprobeVersion() (string, error) {
|
||||
return h.convertorService.GetFFprobeVersion()
|
||||
}
|
||||
|
||||
func (h ConvertorHandler) runConvert(setting convertor.HandleConvertSetting, progressbar *widget.ProgressBar) error {
|
||||
totalDuration, err := h.convertorService.GetTotalDuration(setting.VideoFileInput)
|
||||
if err != nil {
|
||||
|
@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"ffmpegGui/localizer"
|
||||
"ffmpegGui/menu"
|
||||
"fyne.io/fyne/v2"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
)
|
||||
@ -18,6 +19,7 @@ type menuItems struct {
|
||||
|
||||
type MenuHandler struct {
|
||||
convertorHandler ConvertorHandlerContract
|
||||
menuView menu.ViewContract
|
||||
localizerService localizer.ServiceContract
|
||||
localizerView localizer.ViewContract
|
||||
localizerRepository localizer.RepositoryContract
|
||||
@ -26,12 +28,14 @@ type MenuHandler struct {
|
||||
|
||||
func NewMenuHandler(
|
||||
convertorHandler ConvertorHandlerContract,
|
||||
menuView menu.ViewContract,
|
||||
localizerService localizer.ServiceContract,
|
||||
localizerView localizer.ViewContract,
|
||||
localizerRepository localizer.RepositoryContract,
|
||||
) *MenuHandler {
|
||||
return &MenuHandler{
|
||||
convertorHandler: convertorHandler,
|
||||
menuView: menuView,
|
||||
localizerService: localizerService,
|
||||
localizerView: localizerView,
|
||||
localizerRepository: localizerRepository,
|
||||
@ -40,6 +44,13 @@ func NewMenuHandler(
|
||||
}
|
||||
|
||||
func (h MenuHandler) GetMainMenu() *fyne.MainMenu {
|
||||
settings := h.getMenuSettings()
|
||||
help := h.getMenuHelp()
|
||||
|
||||
return fyne.NewMainMenu(settings, help)
|
||||
}
|
||||
|
||||
func (h MenuHandler) getMenuSettings() *fyne.Menu {
|
||||
quit := fyne.NewMenuItem(h.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "exit",
|
||||
}), nil)
|
||||
@ -61,7 +72,38 @@ func (h MenuHandler) GetMainMenu() *fyne.MainMenu {
|
||||
}), languageSelection, ffPathSelection, quit)
|
||||
h.menuItems.menu["settings"] = settings
|
||||
|
||||
return fyne.NewMainMenu(settings)
|
||||
return settings
|
||||
}
|
||||
|
||||
func (h MenuHandler) getMenuHelp() *fyne.Menu {
|
||||
about := fyne.NewMenuItem(h.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "about",
|
||||
}), h.openAbout)
|
||||
h.menuItems.menuItem["about"] = about
|
||||
|
||||
help := fyne.NewMenu(h.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "help",
|
||||
}), about)
|
||||
h.menuItems.menu["help"] = help
|
||||
|
||||
return help
|
||||
}
|
||||
|
||||
func (h MenuHandler) openAbout() {
|
||||
ffmpeg, err := h.convertorHandler.GetFfmpegVersion()
|
||||
if err != nil {
|
||||
ffmpeg = h.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorFFmpegVersion",
|
||||
})
|
||||
}
|
||||
ffprobe, err := h.convertorHandler.GetFfprobeVersion()
|
||||
if err != nil {
|
||||
ffprobe = h.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "errorFFprobeVersion",
|
||||
})
|
||||
}
|
||||
|
||||
h.menuView.About(ffmpeg, ffprobe)
|
||||
}
|
||||
|
||||
func (h MenuHandler) LanguageSelection() {
|
||||
|
BIN
src/icon.png
BIN
src/icon.png
Binary file not shown.
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 29 KiB |
@ -1,3 +1,11 @@
|
||||
[about]
|
||||
hash = "sha1-3da0b9ef719fd707f443ac00404447f29445976f"
|
||||
other = "About"
|
||||
|
||||
[aboutText]
|
||||
hash = "sha1-8bd565814118ba8b90c40eb5b62acf8d2676e7d6"
|
||||
other = "A simple interface for the FFmpeg console utility. \nBut I am not the author of the FFmpeg utility itself."
|
||||
|
||||
[buttonForSelectedDirTitle]
|
||||
hash = "sha1-52b13f1b13e82d22e8c4102332db5d4ec551247b"
|
||||
other = "Folder where it will be saved:"
|
||||
@ -46,10 +54,18 @@ other = "could not create file 'database' in folder 'data'"
|
||||
hash = "sha1-ccf0b95c0d1b392dc215258d917eb4e5d0b88ed0"
|
||||
other = "this is not FFmpeg"
|
||||
|
||||
[errorFFmpegVersion]
|
||||
hash = "sha1-9a4148d42186b6b32cf83bef726e23022c53283f"
|
||||
other = "Could not determine FFmpeg version"
|
||||
|
||||
[errorFFprobe]
|
||||
hash = "sha1-86d1b0b4c4ccd6a4f71e758fc67ce11aff4ba9b8"
|
||||
other = "this is not FFprobe"
|
||||
|
||||
[errorFFprobeVersion]
|
||||
hash = "sha1-da7b37d7df3fafbd153665b13888413d52b24c17"
|
||||
other = "Failed to determine FFprobe version"
|
||||
|
||||
[errorSelectedFolderSave]
|
||||
hash = "sha1-83da899677cdc90e4344e3b94ee03c46b51bee4c"
|
||||
other = "You haven't selected a folder to save!"
|
||||
@ -58,10 +74,22 @@ other = "You haven't selected a folder to save!"
|
||||
hash = "sha1-c42457057d1ab7950cea00719cbe0b078891775f"
|
||||
other = "Exit"
|
||||
|
||||
[ffmpegLGPL]
|
||||
hash = "sha1-d395b16cc8f8eab98a8a970307c5b010ba22dde6"
|
||||
other = "This software uses libraries from the **FFmpeg** project under the **[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)**."
|
||||
|
||||
[ffmpegTrademark]
|
||||
hash = "sha1-45f772b2eca5098cd6d31f2d1dc6edec1987a617"
|
||||
other = "**FFmpeg** is a trademark of **[Fabrice Bellard](http://bellard.org/)**, originator of the **[FFmpeg](https://ffmpeg.org/about.html)** project."
|
||||
|
||||
[fileVideoForConversionTitle]
|
||||
hash = "sha1-5e727d4a2ff3f21080e51e81641595b2e668f3be"
|
||||
other = "File for conversion:"
|
||||
|
||||
[help]
|
||||
hash = "sha1-6a45cef900c668effcb2ab10da05855c1fd10f6f"
|
||||
other = "Help"
|
||||
|
||||
[languageSelectionFormHead]
|
||||
hash = "sha1-0ff5fa82cf684112660128cba1711297acf11003"
|
||||
other = "Switch language"
|
||||
@ -70,13 +98,25 @@ other = "Switch language"
|
||||
hash = "sha1-daf1108fc10d3b1a908288d611f749b3cc651e4b"
|
||||
other = "Choose language"
|
||||
|
||||
[licenseLink]
|
||||
hash = "sha1-ea18ab849f0eea030d770da82c2a6b3484a7bd13"
|
||||
other = "License information"
|
||||
|
||||
[pathToFfmpeg]
|
||||
hash = "sha1-2eba439f365640ff77e0ed6a7486fcb662573850"
|
||||
other = "Path to ffmpeg:"
|
||||
hash = "sha1-fafc50f1db0f720fe83a96cd70a9e1ad824e96b6"
|
||||
other = "Path to FFmpeg:"
|
||||
|
||||
[pathToFfprobe]
|
||||
hash = "sha1-02ad53337801906f8ebfee4616100dd9f43eabd7"
|
||||
other = "Path to ffprobe:"
|
||||
hash = "sha1-b872edc9633a2e81ef678dc46fe46a7e91732024"
|
||||
other = "Path to FFprobe:"
|
||||
|
||||
[programmLink]
|
||||
hash = "sha1-18f9a3fad6aacefe1b05eed23122800b391ff5ca"
|
||||
other = "Project website"
|
||||
|
||||
[programmVersion]
|
||||
hash = "sha1-fa2e4994a301bb24bc2a8fa166e5486ea95a7475"
|
||||
other = "**Program version:** {{.Version}}"
|
||||
|
||||
[save]
|
||||
hash = "sha1-4864057d626a868fa60f999bed3191d61d045ddc"
|
||||
|
@ -1,3 +1,11 @@
|
||||
[about]
|
||||
hash = "sha1-3da0b9ef719fd707f443ac00404447f29445976f"
|
||||
other = "Бағдарлама туралы"
|
||||
|
||||
[aboutText]
|
||||
hash = "sha1-8bd565814118ba8b90c40eb5b62acf8d2676e7d6"
|
||||
other = "FFmpeg консоль утилитасы үшін қарапайым интерфейс. \nБірақ мен FFmpeg утилитасының авторы емеспін."
|
||||
|
||||
[buttonForSelectedDirTitle]
|
||||
hash = "sha1-52b13f1b13e82d22e8c4102332db5d4ec551247b"
|
||||
other = "Файлды сақтауға арналған каталог:"
|
||||
@ -46,10 +54,18 @@ other = "'data' қалтасында 'database' файлын жасау мүмк
|
||||
hash = "sha1-ccf0b95c0d1b392dc215258d917eb4e5d0b88ed0"
|
||||
other = "бұл FFmpeg емес"
|
||||
|
||||
[errorFFmpegVersion]
|
||||
hash = "sha1-9a4148d42186b6b32cf83bef726e23022c53283f"
|
||||
other = "FFmpeg нұсқасын анықтау мүмкін болмады"
|
||||
|
||||
[errorFFprobe]
|
||||
hash = "sha1-86d1b0b4c4ccd6a4f71e758fc67ce11aff4ba9b8"
|
||||
other = "бұл FFprobe емес"
|
||||
|
||||
[errorFFprobeVersion]
|
||||
hash = "sha1-da7b37d7df3fafbd153665b13888413d52b24c17"
|
||||
other = "FFprobe нұсқасын анықтау мүмкін болмады"
|
||||
|
||||
[errorSelectedFolderSave]
|
||||
hash = "sha1-83da899677cdc90e4344e3b94ee03c46b51bee4c"
|
||||
other = "Сіз сақталатын қалтаны таңдамадыңыз!"
|
||||
@ -58,10 +74,22 @@ other = "Сіз сақталатын қалтаны таңдамадыңыз!"
|
||||
hash = "sha1-c42457057d1ab7950cea00719cbe0b078891775f"
|
||||
other = "Шығу"
|
||||
|
||||
[ffmpegLGPL]
|
||||
hash = "sha1-d395b16cc8f8eab98a8a970307c5b010ba22dde6"
|
||||
other = "Бұл бағдарламалық құрал **[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)** астында **FFmpeg** жобасының кітапханаларын пайдаланады."
|
||||
|
||||
[ffmpegTrademark]
|
||||
hash = "sha1-45f772b2eca5098cd6d31f2d1dc6edec1987a617"
|
||||
other = "FFmpeg — **[FFmpeg](https://ffmpeg.org/about.html)** жобасын жасаушы **[Fabrice Bellard](http://bellard.org/)** сауда белгісі."
|
||||
|
||||
[fileVideoForConversionTitle]
|
||||
hash = "sha1-5e727d4a2ff3f21080e51e81641595b2e668f3be"
|
||||
other = "Түрлендіруге арналған файл:"
|
||||
|
||||
[help]
|
||||
hash = "sha1-6a45cef900c668effcb2ab10da05855c1fd10f6f"
|
||||
other = "Анықтама"
|
||||
|
||||
[languageSelectionFormHead]
|
||||
hash = "sha1-0ff5fa82cf684112660128cba1711297acf11003"
|
||||
other = "Тілді ауыстыру"
|
||||
@ -70,13 +98,25 @@ other = "Тілді ауыстыру"
|
||||
hash = "sha1-daf1108fc10d3b1a908288d611f749b3cc651e4b"
|
||||
other = "Тілді таңдаңыз"
|
||||
|
||||
[licenseLink]
|
||||
hash = "sha1-ea18ab849f0eea030d770da82c2a6b3484a7bd13"
|
||||
other = "Лицензия туралы ақпарат"
|
||||
|
||||
[pathToFfmpeg]
|
||||
hash = "sha1-2eba439f365640ff77e0ed6a7486fcb662573850"
|
||||
other = "ffmpeg жол:"
|
||||
hash = "sha1-fafc50f1db0f720fe83a96cd70a9e1ad824e96b6"
|
||||
other = "FFmpeg жол:"
|
||||
|
||||
[pathToFfprobe]
|
||||
hash = "sha1-02ad53337801906f8ebfee4616100dd9f43eabd7"
|
||||
other = "ffprobe жол:"
|
||||
hash = "sha1-b872edc9633a2e81ef678dc46fe46a7e91732024"
|
||||
other = "FFprobe жол:"
|
||||
|
||||
[programmLink]
|
||||
hash = "sha1-18f9a3fad6aacefe1b05eed23122800b391ff5ca"
|
||||
other = "Жобаның веб-сайты"
|
||||
|
||||
[programmVersion]
|
||||
hash = "sha1-fa2e4994a301bb24bc2a8fa166e5486ea95a7475"
|
||||
other = "**Бағдарлама нұсқасы:** {{.Version}}"
|
||||
|
||||
[save]
|
||||
hash = "sha1-4864057d626a868fa60f999bed3191d61d045ddc"
|
||||
|
@ -1,3 +1,5 @@
|
||||
about = "О программе"
|
||||
aboutText = "Простенький интерфейс для консольной утилиты FFmpeg. \nНо я не являюсь автором самой утилиты FFmpeg."
|
||||
buttonForSelectedDirTitle = "Папка куда будет сохраняться:"
|
||||
cancel = "Отмена"
|
||||
changeFFPath = "FFmpeg и FFprobe"
|
||||
@ -10,14 +12,22 @@ error = "Произошла ошибка!"
|
||||
errorConverter = "не смогли отконвертировать видео"
|
||||
errorDatabase = "не смогли создать файл 'database' в папке 'data'"
|
||||
errorFFmpeg = "это не FFmpeg"
|
||||
errorFFmpegVersion = "Не смогли определить версию FFmpeg"
|
||||
errorFFprobe = "это не FFprobe"
|
||||
errorFFprobeVersion = "Не смогли определить версию FFprobe"
|
||||
errorSelectedFolderSave = "Не выбрали папку для сохранения!"
|
||||
exit = "Выход"
|
||||
ffmpegLGPL = "Это программное обеспечение использует библиотеки из проекта **FFmpeg** под **[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)**."
|
||||
ffmpegTrademark = "**FFmpeg** — торговая марка **[Fabrice Bellard](http://bellard.org/)** , создателя проекта **[FFmpeg](https://ffmpeg.org/about.html)**."
|
||||
fileVideoForConversionTitle = "Файл для ковертации:"
|
||||
help = "Справка"
|
||||
languageSelectionFormHead = "Переключить язык"
|
||||
languageSelectionHead = "Выберите язык"
|
||||
pathToFfmpeg = "Путь к ffmpeg:"
|
||||
pathToFfprobe = "Путь к ffprobe:"
|
||||
licenseLink = "Сведения о лицензии"
|
||||
pathToFfmpeg = "Путь к FFmpeg:"
|
||||
pathToFfprobe = "Путь к FFprobe:"
|
||||
programmLink = "Сайт проекта"
|
||||
programmVersion = "**Версия программы:** {{.Version}}"
|
||||
save = "Сохранить"
|
||||
selectFFPathTitle = "Укажите путь к FFmpeg и к FFprobe"
|
||||
settings = "Настройки"
|
||||
|
@ -1,3 +1,47 @@
|
||||
[changeFFPath]
|
||||
hash = "sha1-46793a2844600d0eb19fa3540fb9564ee5705491"
|
||||
other = "FFmpeg and FFprobe"
|
||||
[about]
|
||||
hash = "sha1-3da0b9ef719fd707f443ac00404447f29445976f"
|
||||
other = "About"
|
||||
|
||||
[aboutText]
|
||||
hash = "sha1-8bd565814118ba8b90c40eb5b62acf8d2676e7d6"
|
||||
other = "A simple interface for the FFmpeg console utility. \nBut I am not the author of the FFmpeg utility itself."
|
||||
|
||||
[errorFFmpegVersion]
|
||||
hash = "sha1-9a4148d42186b6b32cf83bef726e23022c53283f"
|
||||
other = "Could not determine FFmpeg version"
|
||||
|
||||
[errorFFprobeVersion]
|
||||
hash = "sha1-da7b37d7df3fafbd153665b13888413d52b24c17"
|
||||
other = "Failed to determine FFprobe version"
|
||||
|
||||
[ffmpegLGPL]
|
||||
hash = "sha1-d395b16cc8f8eab98a8a970307c5b010ba22dde6"
|
||||
other = "This software uses libraries from the **FFmpeg** project under the **[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)**."
|
||||
|
||||
[ffmpegTrademark]
|
||||
hash = "sha1-45f772b2eca5098cd6d31f2d1dc6edec1987a617"
|
||||
other = "**FFmpeg** is a trademark of **[Fabrice Bellard](http://bellard.org/)**, originator of the **[FFmpeg](https://ffmpeg.org/about.html)** project."
|
||||
|
||||
[help]
|
||||
hash = "sha1-6a45cef900c668effcb2ab10da05855c1fd10f6f"
|
||||
other = "Help"
|
||||
|
||||
[licenseLink]
|
||||
hash = "sha1-ea18ab849f0eea030d770da82c2a6b3484a7bd13"
|
||||
other = "License information"
|
||||
|
||||
[pathToFfmpeg]
|
||||
hash = "sha1-fafc50f1db0f720fe83a96cd70a9e1ad824e96b6"
|
||||
other = "Path to FFmpeg:"
|
||||
|
||||
[pathToFfprobe]
|
||||
hash = "sha1-b872edc9633a2e81ef678dc46fe46a7e91732024"
|
||||
other = "Path to FFprobe:"
|
||||
|
||||
[programmLink]
|
||||
hash = "sha1-18f9a3fad6aacefe1b05eed23122800b391ff5ca"
|
||||
other = "Project website"
|
||||
|
||||
[programmVersion]
|
||||
hash = "sha1-fa2e4994a301bb24bc2a8fa166e5486ea95a7475"
|
||||
other = "**Program version:** {{.Version}}"
|
||||
|
@ -1,3 +1,47 @@
|
||||
[changeFFPath]
|
||||
hash = "sha1-46793a2844600d0eb19fa3540fb9564ee5705491"
|
||||
other = "FFmpeg және FFprobe"
|
||||
[about]
|
||||
hash = "sha1-3da0b9ef719fd707f443ac00404447f29445976f"
|
||||
other = "Бағдарлама туралы"
|
||||
|
||||
[aboutText]
|
||||
hash = "sha1-8bd565814118ba8b90c40eb5b62acf8d2676e7d6"
|
||||
other = "FFmpeg консоль утилитасы үшін қарапайым интерфейс. \nБірақ мен FFmpeg утилитасының авторы емеспін."
|
||||
|
||||
[errorFFmpegVersion]
|
||||
hash = "sha1-9a4148d42186b6b32cf83bef726e23022c53283f"
|
||||
other = "FFmpeg нұсқасын анықтау мүмкін болмады"
|
||||
|
||||
[errorFFprobeVersion]
|
||||
hash = "sha1-da7b37d7df3fafbd153665b13888413d52b24c17"
|
||||
other = "FFprobe нұсқасын анықтау мүмкін болмады"
|
||||
|
||||
[ffmpegLGPL]
|
||||
hash = "sha1-d395b16cc8f8eab98a8a970307c5b010ba22dde6"
|
||||
other = "Бұл бағдарламалық құрал **[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)** астында **FFmpeg** жобасының кітапханаларын пайдаланады."
|
||||
|
||||
[ffmpegTrademark]
|
||||
hash = "sha1-45f772b2eca5098cd6d31f2d1dc6edec1987a617"
|
||||
other = "FFmpeg — **[FFmpeg](https://ffmpeg.org/about.html)** жобасын жасаушы **[Fabrice Bellard](http://bellard.org/)** сауда белгісі."
|
||||
|
||||
[help]
|
||||
hash = "sha1-6a45cef900c668effcb2ab10da05855c1fd10f6f"
|
||||
other = "Анықтама"
|
||||
|
||||
[licenseLink]
|
||||
hash = "sha1-ea18ab849f0eea030d770da82c2a6b3484a7bd13"
|
||||
other = "Лицензия туралы ақпарат"
|
||||
|
||||
[pathToFfmpeg]
|
||||
hash = "sha1-fafc50f1db0f720fe83a96cd70a9e1ad824e96b6"
|
||||
other = "FFmpeg жол:"
|
||||
|
||||
[pathToFfprobe]
|
||||
hash = "sha1-b872edc9633a2e81ef678dc46fe46a7e91732024"
|
||||
other = "FFprobe жол:"
|
||||
|
||||
[programmLink]
|
||||
hash = "sha1-18f9a3fad6aacefe1b05eed23122800b391ff5ca"
|
||||
other = "Жобаның веб-сайты"
|
||||
|
||||
[programmVersion]
|
||||
hash = "sha1-fa2e4994a301bb24bc2a8fa166e5486ea95a7475"
|
||||
other = "**Бағдарлама нұсқасы:** {{.Version}}"
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
error2 "ffmpegGui/error"
|
||||
"ffmpegGui/handler"
|
||||
"ffmpegGui/localizer"
|
||||
"ffmpegGui/menu"
|
||||
"ffmpegGui/migration"
|
||||
"ffmpegGui/setting"
|
||||
"fyne.io/fyne/v2"
|
||||
@ -19,7 +20,7 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
//const appVersion string = "0.2.0"
|
||||
const appVersion string = "0.3.0"
|
||||
|
||||
func main() {
|
||||
a := app.New()
|
||||
@ -27,7 +28,7 @@ func main() {
|
||||
if err == nil {
|
||||
a.SetIcon(iconResource)
|
||||
}
|
||||
w := a.NewWindow("FFMpeg GUI!")
|
||||
w := a.NewWindow("GUI for FFmpeg")
|
||||
w.Resize(fyne.Size{Width: 800, Height: 600})
|
||||
w.CenterOnScreen()
|
||||
|
||||
@ -85,7 +86,8 @@ func main() {
|
||||
convertorHandler := handler.NewConvertorHandler(convertorService, convertorView, convertorRepository, localizerService)
|
||||
|
||||
localizerRepository := localizer.NewRepository(settingRepository)
|
||||
mainMenu := handler.NewMenuHandler(convertorHandler, localizerService, localizerView, localizerRepository)
|
||||
menuView := menu.NewView(w, a, appVersion, localizerService)
|
||||
mainMenu := handler.NewMenuHandler(convertorHandler, menuView, localizerService, localizerView, localizerRepository)
|
||||
|
||||
mainHandler := handler.NewMainHandler(convertorHandler, mainMenu, localizerRepository, localizerService)
|
||||
mainHandler.Start()
|
||||
|
167
src/menu/view.go
Normal file
167
src/menu/view.go
Normal file
@ -0,0 +1,167 @@
|
||||
package menu
|
||||
|
||||
import (
|
||||
"ffmpegGui/localizer"
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/nicksnyder/go-i18n/v2/i18n"
|
||||
"golang.org/x/image/colornames"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
type ViewContract interface {
|
||||
About(ffmpegVersion string, ffprobeVersion string)
|
||||
}
|
||||
|
||||
type View struct {
|
||||
w fyne.Window
|
||||
app fyne.App
|
||||
appVersion string
|
||||
localizerService localizer.ServiceContract
|
||||
}
|
||||
|
||||
func NewView(w fyne.Window, app fyne.App, appVersion string, localizerService localizer.ServiceContract) *View {
|
||||
return &View{
|
||||
w: w,
|
||||
app: app,
|
||||
appVersion: appVersion,
|
||||
localizerService: localizerService,
|
||||
}
|
||||
}
|
||||
|
||||
func (v View) About(ffmpegVersion string, ffprobeVersion string) {
|
||||
view := v.app.NewWindow(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "about",
|
||||
}))
|
||||
view.Resize(fyne.Size{Width: 793, Height: 550})
|
||||
view.SetFixedSize(true)
|
||||
|
||||
programmName := canvas.NewText(" GUI for FFmpeg", colornames.Darkgreen)
|
||||
programmName.TextStyle = fyne.TextStyle{Bold: true}
|
||||
programmName.TextSize = 20
|
||||
|
||||
programmLink := widget.NewHyperlink(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "programmLink",
|
||||
}), &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "git.kor-elf.net",
|
||||
Path: "kor-elf/gui-for-ffmpeg/releases",
|
||||
})
|
||||
|
||||
licenseLink := widget.NewHyperlink(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "licenseLink",
|
||||
}), &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "git.kor-elf.net",
|
||||
Path: "kor-elf/gui-for-ffmpeg/src/branch/main/LICENSE",
|
||||
})
|
||||
|
||||
programmVersion := widget.NewRichTextFromMarkdown(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "programmVersion",
|
||||
TemplateData: map[string]string{
|
||||
"Version": v.appVersion,
|
||||
},
|
||||
}))
|
||||
|
||||
aboutText := widget.NewRichText(
|
||||
&widget.TextSegment{
|
||||
Text: v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "aboutText",
|
||||
}),
|
||||
},
|
||||
)
|
||||
image := canvas.NewImageFromFile("icon.png")
|
||||
image.SetMinSize(fyne.Size{Width: 100, Height: 100})
|
||||
image.FillMode = canvas.ImageFillContain
|
||||
|
||||
ffmpegTrademark := widget.NewRichTextFromMarkdown(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "ffmpegTrademark",
|
||||
}))
|
||||
ffmpegLGPL := widget.NewRichTextFromMarkdown(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "ffmpegLGPL",
|
||||
}))
|
||||
|
||||
view.SetContent(
|
||||
container.NewScroll(container.NewVBox(
|
||||
container.NewBorder(nil, nil, container.NewVBox(image), nil, container.NewVBox(
|
||||
programmName,
|
||||
programmVersion,
|
||||
aboutText,
|
||||
ffmpegTrademark,
|
||||
ffmpegLGPL,
|
||||
v.getCopyright(),
|
||||
container.NewHBox(programmLink, licenseLink),
|
||||
)),
|
||||
v.getAboutFfmpeg(ffmpegVersion),
|
||||
v.getAboutFfprobe(ffprobeVersion),
|
||||
)),
|
||||
)
|
||||
view.CenterOnScreen()
|
||||
view.Show()
|
||||
}
|
||||
|
||||
func (v View) getCopyright() *widget.RichText {
|
||||
return widget.NewRichTextFromMarkdown("Copyright (c) 2024 **[Leonid Nikitin (kor-elf)](https://git.kor-elf.net/kor-elf/)**.")
|
||||
}
|
||||
|
||||
func (v View) getAboutFfmpeg(version string) *fyne.Container {
|
||||
programmName := canvas.NewText(" FFmpeg", colornames.Darkgreen)
|
||||
programmName.TextStyle = fyne.TextStyle{Bold: true}
|
||||
programmName.TextSize = 20
|
||||
|
||||
programmLink := widget.NewHyperlink(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "programmLink",
|
||||
}), &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "ffmpeg.org",
|
||||
Path: "",
|
||||
})
|
||||
|
||||
licenseLink := widget.NewHyperlink(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "licenseLink",
|
||||
}), &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "ffmpeg.org",
|
||||
Path: "legal.html",
|
||||
})
|
||||
|
||||
return container.NewVBox(
|
||||
programmName,
|
||||
widget.NewLabel(version),
|
||||
widget.NewRichTextFromMarkdown("**FFmpeg** is a trademark of **[Fabrice Bellard](http://bellard.org/)**, originator of the **[FFmpeg](https://ffmpeg.org/about.html)** project."),
|
||||
widget.NewRichTextFromMarkdown("This software uses libraries from the **FFmpeg** project under the **[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)**."),
|
||||
container.NewHBox(programmLink, licenseLink),
|
||||
)
|
||||
}
|
||||
|
||||
func (v View) getAboutFfprobe(version string) *fyne.Container {
|
||||
programmName := canvas.NewText(" FFprobe", colornames.Darkgreen)
|
||||
programmName.TextStyle = fyne.TextStyle{Bold: true}
|
||||
programmName.TextSize = 20
|
||||
|
||||
programmLink := widget.NewHyperlink(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "programmLink",
|
||||
}), &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "ffmpeg.org",
|
||||
Path: "ffprobe.html",
|
||||
})
|
||||
|
||||
licenseLink := widget.NewHyperlink(v.localizerService.GetMessage(&i18n.LocalizeConfig{
|
||||
MessageID: "licenseLink",
|
||||
}), &url.URL{
|
||||
Scheme: "https",
|
||||
Host: "ffmpeg.org",
|
||||
Path: "legal.html",
|
||||
})
|
||||
|
||||
return container.NewVBox(
|
||||
programmName,
|
||||
widget.NewLabel(version),
|
||||
widget.NewRichTextFromMarkdown("**FFmpeg** is a trademark of **[Fabrice Bellard](http://bellard.org/)**, originator of the **[FFmpeg](https://ffmpeg.org/about.html)** project."),
|
||||
widget.NewRichTextFromMarkdown("This software uses libraries from the **FFmpeg** project under the **[LGPLv2.1](http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html)**."),
|
||||
container.NewHBox(programmLink, licenseLink),
|
||||
)
|
||||
}
|
Loading…
Reference in New Issue
Block a user