From 992762ef0a1e1fff055c8f0ac91f92de0323b958 Mon Sep 17 00:00:00 2001 From: Leonid Nikitin Date: Sun, 11 May 2025 18:35:21 +0500 Subject: [PATCH] Add gratitude view and menu item Introduce a new "Gratitude" view with localized messages and display functionality. --- handler/menu.go | 13 ++++++++++++- languages/active.en.toml | 8 ++++++++ languages/active.kk.toml | 8 ++++++++ languages/active.ru.toml | 2 ++ menu/view.go | 35 +++++++++++++++++++++++++++++++++++ 5 files changed, 65 insertions(+), 1 deletion(-) diff --git a/handler/menu.go b/handler/menu.go index 5ec2ebd..79668c9 100644 --- a/handler/menu.go +++ b/handler/menu.go @@ -86,9 +86,16 @@ func (h MenuHandler) getMenuHelp() *fyne.Menu { about.Label = text }) + gratitude := fyne.NewMenuItem(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{ + MessageID: "gratitude", + }), h.openGratitude) + h.app.GetLocalizerService().AddChangeCallback("gratitude", func(text string) { + gratitude.Label = text + }) + help := fyne.NewMenu(h.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{ MessageID: "help", - }), about) + }), about, gratitude) h.app.GetLocalizerService().AddChangeCallback("help", func(text string) { help.Label = text help.Refresh() @@ -114,6 +121,10 @@ func (h MenuHandler) openAbout() { h.menuView.About(ffmpeg, ffprobe) } +func (h MenuHandler) openGratitude() { + h.menuView.Gratitude() +} + func (h MenuHandler) LanguageSelection() { h.localizerView.LanguageSelection(func(lang kernel.Lang) { _, _ = h.localizerRepository.Save(lang.Code) diff --git a/languages/active.en.toml b/languages/active.en.toml index ba1f596..fc2bb35 100644 --- a/languages/active.en.toml +++ b/languages/active.en.toml @@ -282,6 +282,14 @@ other = "File:" hash = "sha1-7759891ba1ef9f7adc70defc7ac18fbf149c1a68" other = "Preset" +[gratitude] +hash = "sha1-51968fc38e53a9a11c861126c62404674fd6096f" +other = "Gratitude" + +[gratitudeText] +hash = "sha1-cb343e4d39ca31e6da6f72b9394cc915cb7d1258" +other = "I sincerely thank you for your invaluable\n\r and timely assistance:" + [help] hash = "sha1-6a45cef900c668effcb2ab10da05855c1fd10f6f" other = "Help" diff --git a/languages/active.kk.toml b/languages/active.kk.toml index 88f96b5..c17d909 100644 --- a/languages/active.kk.toml +++ b/languages/active.kk.toml @@ -282,6 +282,14 @@ other = "Файл:" hash = "sha1-7759891ba1ef9f7adc70defc7ac18fbf149c1a68" other = "Алдын ала орнатылған" +[gratitude] +hash = "sha1-51968fc38e53a9a11c861126c62404674fd6096f" +other = "Алғыс" + +[gratitudeText] +hash = "sha1-cb343e4d39ca31e6da6f72b9394cc915cb7d1258" +other = "Сізге баға жетпес және уақтылы көмектескеніңіз\n\r үшін шын жүректен алғыс айтамын:" + [help] hash = "sha1-6a45cef900c668effcb2ab10da05855c1fd10f6f" other = "Анықтама" diff --git a/languages/active.ru.toml b/languages/active.ru.toml index e4dc5b9..39e1679 100644 --- a/languages/active.ru.toml +++ b/languages/active.ru.toml @@ -69,6 +69,8 @@ ffmpegLGPL = "Это программное обеспечение исполь ffmpegTrademark = "**FFmpeg** — торговая марка **[Fabrice Bellard](http://bellard.org/)** , создателя проекта **[FFmpeg](https://ffmpeg.org/about.html)**." fileForConversionTitle = "Файл:" formPreset = "Предустановка" +gratitude = "Благодарность" +gratitudeText = "Я искренне благодарю вас за неоценимую\n\rи своевременную помощь:" help = "Справка" inProgressQueue = "Выполняется" languageSelectionFormHead = "Переключить язык" diff --git a/menu/view.go b/menu/view.go index f0d6e24..1d4fde2 100644 --- a/menu/view.go +++ b/menu/view.go @@ -13,6 +13,7 @@ import ( type ViewContract interface { About(ffmpegVersion string, ffprobeVersion string) + Gratitude() } type View struct { @@ -25,6 +26,40 @@ func NewView(app kernel.AppContract) *View { } } +func (v View) Gratitude() { + view := v.app.GetAppFyne().NewWindow(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{ + MessageID: "gratitude", + })) + view.Resize(fyne.Size{Width: 500, Height: 400}) + view.SetFixedSize(true) + + image := canvas.NewImageFromFile("icon.png") + image.SetMinSize(fyne.Size{Width: 100, Height: 100}) + image.FillMode = canvas.ImageFillContain + + gratitude := canvas.NewText(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{ + MessageID: "gratitude", + }), colornames.Darkgreen) + gratitude.TextStyle = fyne.TextStyle{Bold: true} + gratitude.TextSize = 20 + + view.SetContent( + container.NewScroll(container.NewVBox( + container.NewBorder(nil, nil, container.NewVBox(image), nil, container.NewVBox( + gratitude, + widget.NewLabel(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{ + MessageID: "gratitudeText", + })), + widget.NewLabel("Екатерина"), + widget.NewLabel("Евгений"), + ), + ))), + ) + + view.CenterOnScreen() + view.Show() +} + func (v View) About(ffmpegVersion string, ffprobeVersion string) { view := v.app.GetAppFyne().NewWindow(v.app.GetLocalizerService().GetMessage(&i18n.LocalizeConfig{ MessageID: "about",