Add layout system and file selection logic
Introduce a new layout system for managing main window content and tabs. Integrate file selection and drag-and-drop functionality for adding files to the conversion list, with automatic tab switching to "Added Files". Refactor existing components to support these features.
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
type ItemsToConvertContract interface {
|
||||
Add(file *File)
|
||||
Add(file *ffmpeg.File)
|
||||
Clear()
|
||||
GetItems() map[int]ItemToConvertContract
|
||||
GetItemsContainer() *fyne.Container
|
||||
@@ -41,7 +41,7 @@ func (items *itemsToConvert) GetItemsContainer() *fyne.Container {
|
||||
return items.itemsContainer
|
||||
}
|
||||
|
||||
func (items *itemsToConvert) Add(file *File) {
|
||||
func (items *itemsToConvert) Add(file *ffmpeg.File) {
|
||||
nextId := items.nextId
|
||||
var content *fyne.Container
|
||||
var buttonPlay *widget.Button
|
||||
@@ -49,9 +49,15 @@ func (items *itemsToConvert) Add(file *File) {
|
||||
buttonPlay = widget.NewButtonWithIcon("", theme.Icon(theme.IconNameMediaPlay), func() {
|
||||
buttonPlay.Disable()
|
||||
go func() {
|
||||
//_ = items.ffplayService.Run(FFplaySetting{
|
||||
// PathToFile: file.Path,
|
||||
//})
|
||||
ffplay, err := items.ffmpeg.GetFFplay()
|
||||
if err != nil {
|
||||
fyne.Do(func() {
|
||||
buttonPlay.Enable()
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
_ = ffplay.Play(file)
|
||||
fyne.Do(func() {
|
||||
buttonPlay.Enable()
|
||||
})
|
||||
@@ -108,23 +114,23 @@ func (items *itemsToConvert) Clear() {
|
||||
}
|
||||
|
||||
type ItemToConvertContract interface {
|
||||
GetFile() *File
|
||||
GetFile() *ffmpeg.File
|
||||
GetContent() *fyne.Container
|
||||
}
|
||||
|
||||
type itemToConvert struct {
|
||||
file *File
|
||||
file *ffmpeg.File
|
||||
content *fyne.Container
|
||||
}
|
||||
|
||||
func newItemToConvert(file *File, content *fyne.Container) ItemToConvertContract {
|
||||
func newItemToConvert(file *ffmpeg.File, content *fyne.Container) ItemToConvertContract {
|
||||
return &itemToConvert{
|
||||
file: file,
|
||||
content: content,
|
||||
}
|
||||
}
|
||||
|
||||
func (item *itemToConvert) GetFile() *File {
|
||||
func (item *itemToConvert) GetFile() *ffmpeg.File {
|
||||
return item.file
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user