Compare commits

..

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

2 changed files with 33 additions and 75 deletions

View File

@ -9,7 +9,6 @@ import (
"strings"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/layout"
@ -50,7 +49,7 @@ func buildAuthorView(state *appState) fyne.CanvasObject {
bottomBar := moduleFooter(authorColor, layout.NewSpacer(), state.statsBar)
tabs := container.NewAppTabs(
container.NewTabItem("Videos", buildVideoClipsTab(state)),
container.NewTabItem("Video Clips", buildVideoClipsTab(state)),
container.NewTabItem("Chapters", buildChaptersTab(state)),
container.NewTabItem("Subtitles", buildSubtitlesTab(state)),
container.NewTabItem("Settings", buildAuthorSettingsTab(state)),
@ -74,7 +73,6 @@ func buildVideoClipsTab(state *appState) fyne.CanvasObject {
if emptyOverlay != nil {
emptyOverlay.Show()
}
list.Refresh()
return
}
@ -83,32 +81,25 @@ func buildVideoClipsTab(state *appState) fyne.CanvasObject {
}
for i, clip := range state.authorClips {
idx := i
nameLabel := widget.NewLabel(clip.DisplayName)
nameLabel.TextStyle = fyne.TextStyle{Bold: true}
durationLabel := widget.NewLabel(fmt.Sprintf("%.2fs", clip.Duration))
durationLabel.TextStyle = fyne.TextStyle{Italic: true}
durationLabel.Alignment = fyne.TextAlignTrailing
card := widget.NewCard(clip.DisplayName, fmt.Sprintf("%.2fs", clip.Duration), nil)
removeBtn := widget.NewButton("Remove", func() {
state.authorClips = append(state.authorClips[:idx], state.authorClips[idx+1:]...)
rebuildList()
state.updateAuthorSummary()
})
removeBtn.Importance = widget.MediumImportance
row := container.NewBorder(
nil,
nil,
nil,
container.NewVBox(durationLabel, removeBtn),
container.NewVBox(nameLabel),
durationLabel := widget.NewLabel(fmt.Sprintf("Duration: %.2f seconds", clip.Duration))
durationLabel.TextStyle = fyne.TextStyle{Italic: true}
cardContent := container.NewVBox(
durationLabel,
widget.NewSeparator(),
removeBtn,
)
cardBg := canvas.NewRectangle(utils.MustHex("#171C2A"))
cardBg.CornerRadius = 6
cardBg.SetMinSize(fyne.NewSize(0, nameLabel.MinSize().Height+durationLabel.MinSize().Height+12))
list.Add(container.NewPadded(container.NewMax(cardBg, row)))
card.SetContent(cardContent)
list.Add(card)
}
list.Refresh()
}
addBtn := widget.NewButton("Add Files", func() {
@ -126,7 +117,6 @@ func buildVideoClipsTab(state *appState) fyne.CanvasObject {
clearBtn := widget.NewButton("Clear All", func() {
state.authorClips = []authorClip{}
rebuildList()
state.updateAuthorSummary()
})
clearBtn.Importance = widget.MediumImportance
@ -159,7 +149,7 @@ func buildVideoClipsTab(state *appState) fyne.CanvasObject {
listArea := container.NewMax(dropTarget, emptyOverlay)
controls := container.NewBorder(
widget.NewLabel("Videos:"),
widget.NewLabel("Video Clips:"),
container.NewHBox(addBtn, clearBtn, compileBtn),
nil,
nil,
@ -243,24 +233,32 @@ func buildChaptersTab(state *appState) fyne.CanvasObject {
func buildSubtitlesTab(state *appState) fyne.CanvasObject {
list := container.NewVBox()
listScroll := container.NewVScroll(list)
var buildSubList func()
var emptyOverlay *fyne.Container
buildSubList = func() {
list.Objects = nil
if len(state.authorSubtitles) == 0 {
if emptyOverlay != nil {
emptyOverlay.Show()
}
list.Refresh()
emptyLabel := widget.NewLabel("Drag and drop subtitle files here\nor click 'Add Subtitles' to select")
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.authorSubtitles = append(state.authorSubtitles, paths...)
buildSubList()
}
})
list.Add(container.NewMax(emptyDrop))
return
}
if emptyOverlay != nil {
emptyOverlay.Hide()
}
for i, path := range state.authorSubtitles {
idx := i
card := widget.NewCard(filepath.Base(path), "", nil)
@ -268,7 +266,6 @@ func buildSubtitlesTab(state *appState) fyne.CanvasObject {
removeBtn := widget.NewButton("Remove", func() {
state.authorSubtitles = append(state.authorSubtitles[:idx], state.authorSubtitles[idx+1:]...)
buildSubList()
state.updateAuthorSummary()
})
removeBtn.Importance = widget.MediumImportance
@ -276,7 +273,6 @@ func buildSubtitlesTab(state *appState) fyne.CanvasObject {
card.SetContent(cardContent)
list.Add(card)
}
list.Refresh()
}
addBtn := widget.NewButton("Add Subtitles", func() {
@ -287,7 +283,6 @@ func buildSubtitlesTab(state *appState) fyne.CanvasObject {
defer reader.Close()
state.authorSubtitles = append(state.authorSubtitles, reader.URI().Path())
buildSubList()
state.updateAuthorSummary()
}, state.window)
})
addBtn.Importance = widget.HighImportance
@ -295,36 +290,14 @@ func buildSubtitlesTab(state *appState) fyne.CanvasObject {
clearBtn := widget.NewButton("Clear All", func() {
state.authorSubtitles = []string{}
buildSubList()
state.updateAuthorSummary()
})
clearBtn.Importance = widget.MediumImportance
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.authorSubtitles = append(state.authorSubtitles, paths...)
buildSubList()
state.updateAuthorSummary()
}
})
emptyLabel := widget.NewLabel("Drag and drop subtitle files here\nor click 'Add Subtitles' to select")
emptyLabel.Alignment = fyne.TextAlignCenter
emptyOverlay = container.NewCenter(emptyLabel)
listArea := container.NewMax(dropTarget, emptyOverlay)
controls := container.NewBorder(
controls := container.NewVBox(
widget.NewLabel("Subtitle Tracks:"),
container.NewScroll(list),
widget.NewSeparator(),
container.NewHBox(addBtn, clearBtn),
nil,
nil,
listArea,
)
buildSubList()
@ -338,7 +311,6 @@ func buildAuthorSettingsTab(state *appState) fyne.CanvasObject {
} else {
state.authorOutputType = "iso"
}
state.updateAuthorSummary()
})
if state.authorOutputType == "iso" {
outputType.SetSelected("ISO Image")
@ -348,7 +320,6 @@ func buildAuthorSettingsTab(state *appState) fyne.CanvasObject {
regionSelect := widget.NewSelect([]string{"AUTO", "NTSC", "PAL"}, func(value string) {
state.authorRegion = value
state.updateAuthorSummary()
})
if state.authorRegion == "" {
regionSelect.SetSelected("AUTO")
@ -358,7 +329,6 @@ func buildAuthorSettingsTab(state *appState) fyne.CanvasObject {
aspectSelect := widget.NewSelect([]string{"AUTO", "4:3", "16:9"}, func(value string) {
state.authorAspectRatio = value
state.updateAuthorSummary()
})
if state.authorAspectRatio == "" {
aspectSelect.SetSelected("AUTO")
@ -371,12 +341,10 @@ func buildAuthorSettingsTab(state *appState) fyne.CanvasObject {
titleEntry.SetText(state.authorTitle)
titleEntry.OnChanged = func(value string) {
state.authorTitle = value
state.updateAuthorSummary()
}
createMenuCheck := widget.NewCheck("Create DVD Menu", func(checked bool) {
state.authorCreateMenu = checked
state.updateAuthorSummary()
})
createMenuCheck.SetChecked(state.authorCreateMenu)
@ -414,7 +382,6 @@ func buildAuthorDiscTab(state *appState) fyne.CanvasObject {
summaryLabel := widget.NewLabel(authorSummary(state))
summaryLabel.Wrapping = fyne.TextWrapWord
state.authorSummaryLabel = summaryLabel
controls := container.NewVBox(
widget.NewLabel("Generate DVD/ISO:"),
@ -430,7 +397,7 @@ func buildAuthorDiscTab(state *appState) fyne.CanvasObject {
func authorSummary(state *appState) string {
summary := "Ready to generate:\n\n"
if len(state.authorClips) > 0 {
summary += fmt.Sprintf("Videos: %d\n", len(state.authorClips))
summary += fmt.Sprintf("Video Clips: %d\n", len(state.authorClips))
for i, clip := range state.authorClips {
summary += fmt.Sprintf(" %d. %s (%.2fs)\n", i+1, clip.DisplayName, clip.Duration)
}
@ -470,14 +437,6 @@ func (s *appState) addAuthorFiles(paths []string) {
}
s.authorClips = append(s.authorClips, clip)
}
s.updateAuthorSummary()
}
func (s *appState) updateAuthorSummary() {
if s.authorSummaryLabel == nil {
return
}
s.authorSummaryLabel.SetText(authorSummary(s))
}
func (s *appState) startAuthorGeneration() {

View File

@ -915,7 +915,6 @@ type appState struct {
authorTitle string // DVD title
authorSubtitles []string // Subtitle file paths
authorAudioTracks []string // Additional audio tracks
authorSummaryLabel *widget.Label
}
type mergeClip struct {