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
|
||||
}
|
||||
|
||||
|
@@ -1,9 +1,12 @@
|
||||
package convertor
|
||||
|
||||
import "errors"
|
||||
import (
|
||||
"errors"
|
||||
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg"
|
||||
)
|
||||
|
||||
type Queue struct {
|
||||
Setting *ConvertSetting
|
||||
Setting *ffmpeg.ConvertSetting
|
||||
Status StatusContract
|
||||
Error error
|
||||
}
|
||||
@@ -46,7 +49,7 @@ type QueueListenerContract interface {
|
||||
type QueueListContract interface {
|
||||
AddListener(queueListener QueueListenerContract)
|
||||
GetItems() map[int]*Queue
|
||||
Add(setting *ConvertSetting)
|
||||
Add(setting *ffmpeg.ConvertSetting)
|
||||
EventChangeQueue(key int, queue *Queue)
|
||||
Remove(key int)
|
||||
GetItem(key int) (*Queue, error)
|
||||
@@ -72,7 +75,7 @@ func (l *queueList) GetItems() map[int]*Queue {
|
||||
return l.items
|
||||
}
|
||||
|
||||
func (l *queueList) Add(setting *ConvertSetting) {
|
||||
func (l *queueList) Add(setting *ffmpeg.ConvertSetting) {
|
||||
queue := Queue{
|
||||
Setting: setting,
|
||||
Status: StatusType(Waiting),
|
||||
|
Reference in New Issue
Block a user