Embed application icon as a resource and refactor icon usage
Replaced the external `icon.png` file with an embedded resource using Go's embed functionality. Updated all references to use the new resource, eliminating the need for the standalone icon file.
This commit is contained in:
parent
3241b88158
commit
43d794373a
@ -25,7 +25,6 @@
|
||||
* fyne-cross linux --icon icon.png --app-id "." -name "gui-for-ffmpeg"
|
||||
7. Создаться папка **fyne-cross/bin** и там будет созданна папка с тем названием под которую Вы компилировали приложения (linux-amd64 или windows-amd64).
|
||||
8. В папку **fyne-cross/bin/linux-amd64** или **fyne-cross/bin/windows-amd64** копируете:
|
||||
* icon.png
|
||||
* LICENSE
|
||||
* LICENSE-3RD-PARTY.txt
|
||||
<p><strong>Структура должна получиться такая:</strong></p>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.5 KiB |
13
internal/resources/icon.go
Normal file
13
internal/resources/icon.go
Normal file
@ -0,0 +1,13 @@
|
||||
package resources
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fyne.io/fyne/v2"
|
||||
)
|
||||
|
||||
//go:embed icons/logo.png
|
||||
var iconAppLogo []byte
|
||||
|
||||
func IconAppLogoResource() *fyne.StaticResource {
|
||||
return fyne.NewStaticResource("icon.png", iconAppLogo)
|
||||
}
|
BIN
internal/resources/icons/logo.png
Normal file
BIN
internal/resources/icons/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
5
main.go
5
main.go
@ -1,10 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fyne.io/fyne/v2"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/convertor"
|
||||
error2 "git.kor-elf.net/kor-elf/gui-for-ffmpeg/error"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/handler"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/resources"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/localizer"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/menu"
|
||||
@ -16,12 +18,11 @@ var application kernel.AppContract
|
||||
var ffPathUtilities *kernel.FFPathUtilities
|
||||
|
||||
func init() {
|
||||
iconResource, _ := fyne.LoadResourceFromPath("icon.png")
|
||||
appMetadata := &fyne.AppMetadata{
|
||||
ID: "net.kor-elf.projects.gui-for-ffmpeg",
|
||||
Name: "GUI for FFmpeg",
|
||||
Version: "0.9.0",
|
||||
Icon: iconResource,
|
||||
Icon: resources.IconAppLogoResource(),
|
||||
}
|
||||
|
||||
ffPathUtilities = &kernel.FFPathUtilities{FFmpeg: "", FFprobe: "", FFplay: ""}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/resources"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/kernel"
|
||||
"golang.org/x/image/colornames"
|
||||
"net/url"
|
||||
@ -32,7 +33,7 @@ func (v View) Gratitude() {
|
||||
view.Resize(fyne.Size{Width: 500, Height: 400})
|
||||
view.SetFixedSize(true)
|
||||
|
||||
image := canvas.NewImageFromFile("icon.png")
|
||||
image := canvas.NewImageFromResource(resources.IconAppLogoResource())
|
||||
image.SetMinSize(fyne.Size{Width: 100, Height: 100})
|
||||
image.FillMode = canvas.ImageFillContain
|
||||
|
||||
@ -103,7 +104,7 @@ func (v View) About(ffmpegVersion string, ffprobeVersion string, ffplayVersion s
|
||||
Text: v.app.GetLocalizerService().GetMessage("aboutText"),
|
||||
},
|
||||
)
|
||||
image := canvas.NewImageFromFile("icon.png")
|
||||
image := canvas.NewImageFromResource(resources.IconAppLogoResource())
|
||||
image.SetMinSize(fyne.Size{Width: 100, Height: 100})
|
||||
image.FillMode = canvas.ImageFillContain
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user