Compare commits

..

No commits in common. "22eb734df2461e7d7e952c4a55eb77649e5229e6" and "f5d78cc2181792ccb8d0ff8f454a2f9ca6552e1e" have entirely different histories.

2 changed files with 20 additions and 59 deletions

View File

@ -62,23 +62,31 @@ func buildAuthorView(state *appState) fyne.CanvasObject {
func buildVideoClipsTab(state *appState) fyne.CanvasObject {
list := container.NewVBox()
listScroll := container.NewVScroll(list)
var rebuildList func()
var emptyOverlay *fyne.Container
rebuildList = func() {
list.Objects = nil
if len(state.authorClips) == 0 {
if emptyOverlay != nil {
emptyOverlay.Show()
}
emptyLabel := widget.NewLabel("Drag and drop video files here\nor click 'Add Files' to select videos")
emptyLabel.Alignment = fyne.TextAlignCenter
emptyDrop := ui.NewDroppable(container.NewCenter(emptyLabel), func(items []fyne.URI) {
var paths []string
for _, uri := range items {
if uri.Scheme() == "file" {
paths = append(paths, uri.Path())
}
}
if len(paths) > 0 {
state.addAuthorFiles(paths)
}
})
list.Add(container.NewMax(emptyDrop))
return
}
if emptyOverlay != nil {
emptyOverlay.Hide()
}
for i, clip := range state.authorClips {
idx := i
card := widget.NewCard(clip.DisplayName, fmt.Sprintf("%.2fs", clip.Duration), nil)
@ -109,7 +117,6 @@ func buildVideoClipsTab(state *appState) fyne.CanvasObject {
}
defer reader.Close()
state.addAuthorFiles([]string{reader.URI().Path()})
rebuildList()
}, state.window)
})
addBtn.Importance = widget.HighImportance
@ -129,31 +136,11 @@ func buildVideoClipsTab(state *appState) fyne.CanvasObject {
})
compileBtn.Importance = widget.HighImportance
dropTarget := ui.NewDroppable(listScroll, func(items []fyne.URI) {
var paths []string
for _, uri := range items {
if uri.Scheme() == "file" {
paths = append(paths, uri.Path())
}
}
if len(paths) > 0 {
state.addAuthorFiles(paths)
rebuildList()
}
})
emptyLabel := widget.NewLabel("Drag and drop video files here\nor click 'Add Files' to select videos")
emptyLabel.Alignment = fyne.TextAlignCenter
emptyOverlay = container.NewCenter(emptyLabel)
listArea := container.NewMax(dropTarget, emptyOverlay)
controls := container.NewBorder(
controls := container.NewVBox(
widget.NewLabel("Video Clips:"),
container.NewScroll(list),
widget.NewSeparator(),
container.NewHBox(addBtn, clearBtn, compileBtn),
nil,
nil,
listArea,
)
rebuildList()

28
main.go
View File

@ -9425,32 +9425,6 @@ func (s *appState) handleDrop(pos fyne.Position, items []fyne.URI) {
return
}
// If in author module, add video clips
if s.active == "author" {
var videoPaths []string
for _, uri := range items {
if uri.Scheme() != "file" {
continue
}
path := uri.Path()
if info, err := os.Stat(path); err == nil && info.IsDir() {
videos := s.findVideoFiles(path)
videoPaths = append(videoPaths, videos...)
} else if s.isVideoFile(path) {
videoPaths = append(videoPaths, path)
}
}
if len(videoPaths) == 0 {
logging.Debug(logging.CatUI, "no valid video files in dropped items")
return
}
s.addAuthorFiles(videoPaths)
s.showAuthorView()
return
}
// If in compare module, handle up to 2 video files
if s.active == "compare" {
// Collect all video files from the dropped items
@ -13105,7 +13079,7 @@ func buildPlayerView(state *appState) fyne.CanvasObject {
var videoContainer fyne.CanvasObject
if state.playerFile != nil {
fileLabel.SetText(fmt.Sprintf("File: %s", filepath.Base(state.playerFile.Path)))
videoContainer = buildVideoPane(state, fyne.NewSize(1280, 720), state.playerFile, nil)
videoContainer = buildVideoPane(state, fyne.NewSize(640, 360), state.playerFile, nil)
} else {
videoContainer = container.NewCenter(widget.NewLabel("No video loaded"))
}