Compare commits
2 Commits
f5d78cc218
...
22eb734df2
| Author | SHA1 | Date | |
|---|---|---|---|
| 22eb734df2 | |||
| 9b4fedc181 |
|
|
@ -62,31 +62,23 @@ 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 {
|
||||
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))
|
||||
if emptyOverlay != nil {
|
||||
emptyOverlay.Show()
|
||||
}
|
||||
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)
|
||||
|
|
@ -117,6 +109,7 @@ func buildVideoClipsTab(state *appState) fyne.CanvasObject {
|
|||
}
|
||||
defer reader.Close()
|
||||
state.addAuthorFiles([]string{reader.URI().Path()})
|
||||
rebuildList()
|
||||
}, state.window)
|
||||
})
|
||||
addBtn.Importance = widget.HighImportance
|
||||
|
|
@ -136,11 +129,31 @@ func buildVideoClipsTab(state *appState) fyne.CanvasObject {
|
|||
})
|
||||
compileBtn.Importance = widget.HighImportance
|
||||
|
||||
controls := container.NewVBox(
|
||||
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(
|
||||
widget.NewLabel("Video Clips:"),
|
||||
container.NewScroll(list),
|
||||
widget.NewSeparator(),
|
||||
container.NewHBox(addBtn, clearBtn, compileBtn),
|
||||
nil,
|
||||
nil,
|
||||
listArea,
|
||||
)
|
||||
|
||||
rebuildList()
|
||||
|
|
|
|||
28
main.go
28
main.go
|
|
@ -9425,6 +9425,32 @@ 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
|
||||
|
|
@ -13079,7 +13105,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(640, 360), state.playerFile, nil)
|
||||
videoContainer = buildVideoPane(state, fyne.NewSize(1280, 720), state.playerFile, nil)
|
||||
} else {
|
||||
videoContainer = container.NewCenter(widget.NewLabel("No video loaded"))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user