refactor: improve UI flexibility and code formatting
- Remove hardcoded minimum sizes from scroll containers and UI elements for better responsiveness across different screen sizes - Fix indentation and alignment across multiple modules - Improve code consistency and readability
This commit is contained in:
parent
bf70a1934e
commit
9cc8c073d6
|
|
@ -462,11 +462,11 @@ func buildChaptersTab(state *appState) fyne.CanvasObject {
|
|||
}
|
||||
state.authorFile = src
|
||||
fileLabel.SetText(fmt.Sprintf("File: %s", filepath.Base(src.Path)))
|
||||
// Clear the custom title so it can be re-derived from the new content.
|
||||
// This addresses the user's request for the title to "reset".
|
||||
state.authorTitle = ""
|
||||
state.updateAuthorSummary()
|
||||
// Update the UI for the title entry if the settings tab is currently visible.
|
||||
// Clear the custom title so it can be re-derived from the new content.
|
||||
// This addresses the user's request for the title to "reset".
|
||||
state.authorTitle = ""
|
||||
state.updateAuthorSummary()
|
||||
// Update the UI for the title entry if the settings tab is currently visible.
|
||||
if state.active == "author" && state.window.Canvas() != nil {
|
||||
app := fyne.CurrentApp()
|
||||
if app != nil && app.Driver() != nil {
|
||||
|
|
@ -1370,9 +1370,9 @@ func concatDVDMpg(inputs []string, output string) error {
|
|||
"-safe", "0",
|
||||
"-i", listPath,
|
||||
"-c", "copy",
|
||||
"-f", "dvd", // Maintain DVD format
|
||||
"-f", "dvd", // Maintain DVD format
|
||||
"-muxrate", "10080000", // DVD mux rate
|
||||
"-packetsize", "2048", // DVD packet size
|
||||
"-packetsize", "2048", // DVD packet size
|
||||
output,
|
||||
}
|
||||
cmd := utils.CreateCommandRaw(utils.GetFFmpegPath(), args...)
|
||||
|
|
@ -2120,7 +2120,6 @@ func runAuthorFFmpeg(ctx context.Context, args []string, duration float64, logFn
|
|||
return nil
|
||||
}
|
||||
|
||||
|
||||
func (s *appState) executeAuthorJob(ctx context.Context, job *queue.Job, progressCallback func(float64)) error {
|
||||
cfg := job.Config
|
||||
if cfg == nil {
|
||||
|
|
@ -2421,9 +2420,9 @@ func buildAuthorFFmpegArgs(inputPath, outputPath, region, aspect string, progres
|
|||
"-b:a", "192k",
|
||||
"-ar", "48000",
|
||||
"-ac", "2",
|
||||
"-f", "dvd", // DVD-compliant MPEG-PS format
|
||||
"-f", "dvd", // DVD-compliant MPEG-PS format
|
||||
"-muxrate", "10080000", // DVD mux rate (10.08 Mbps)
|
||||
"-packetsize", "2048", // DVD packet size
|
||||
"-packetsize", "2048", // DVD packet size
|
||||
outputPath,
|
||||
)
|
||||
|
||||
|
|
@ -2695,7 +2694,7 @@ func (s *appState) showChapterPreview(videoPath string, chapters []authorChapter
|
|||
|
||||
grid := container.NewGridWrap(fyne.NewSize(170, 120), thumbnails...)
|
||||
scroll := container.NewVScroll(grid)
|
||||
scroll.SetMinSize(fyne.NewSize(780, 500))
|
||||
// scroll.SetMinSize(fyne.NewSize(780, 500)) // Removed for flexible sizing
|
||||
|
||||
infoText := fmt.Sprintf("Found %d chapters", len(chapters))
|
||||
if len(chapters) > previewCount {
|
||||
|
|
|
|||
|
|
@ -665,7 +665,7 @@ func buildFiltersView(state *appState) fyne.CanvasObject {
|
|||
|
||||
settingsScroll := container.NewVScroll(settingsPanel)
|
||||
// Adaptive height for small screens - allow content to flow
|
||||
settingsScroll.SetMinSize(fyne.NewSize(350, 400))
|
||||
// settingsScroll.SetMinSize(fyne.NewSize(350, 400)) // Removed for flexible sizing
|
||||
|
||||
mainContent := container.New(&fixedHSplitLayout{ratio: 0.6},
|
||||
container.NewVBox(leftPanel, container.NewCenter(videoContainer)),
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ func buildInspectView(state *appState) fyne.CanvasObject {
|
|||
|
||||
// Metadata scroll
|
||||
metadataScroll := container.NewScroll(metadataText)
|
||||
metadataScroll.SetMinSize(fyne.NewSize(400, 200))
|
||||
// metadataScroll.SetMinSize(fyne.NewSize(400, 200)) // Removed for flexible sizing
|
||||
|
||||
// Helper function to format metadata
|
||||
formatMetadata := func(src *videoSource) string {
|
||||
|
|
|
|||
|
|
@ -97,9 +97,9 @@ func NewModuleTile(label string, col color.Color, enabled bool, missingDeps bool
|
|||
label: strings.ToUpper(label),
|
||||
color: col,
|
||||
missingDependencies: missingDeps,
|
||||
enabled: enabled,
|
||||
onTapped: tapped,
|
||||
onDropped: dropped,
|
||||
enabled: enabled,
|
||||
onTapped: tapped,
|
||||
onDropped: dropped,
|
||||
}
|
||||
m.ExtendBaseWidget(m)
|
||||
return m
|
||||
|
|
@ -220,10 +220,10 @@ func (m *ModuleTile) CreateRenderer() fyne.WidgetRenderer {
|
|||
})
|
||||
|
||||
return &moduleTileRenderer{
|
||||
tile: m,
|
||||
bg: bg,
|
||||
label: txt,
|
||||
lockIcon: lockIcon,
|
||||
tile: m,
|
||||
bg: bg,
|
||||
label: txt,
|
||||
lockIcon: lockIcon,
|
||||
disabledStripe: disabledStripe,
|
||||
}
|
||||
}
|
||||
|
|
@ -235,10 +235,10 @@ func (m *ModuleTile) Tapped(*fyne.PointEvent) {
|
|||
}
|
||||
|
||||
type moduleTileRenderer struct {
|
||||
tile *ModuleTile
|
||||
bg *canvas.Rectangle
|
||||
label *canvas.Text
|
||||
lockIcon *canvas.Text
|
||||
tile *ModuleTile
|
||||
bg *canvas.Rectangle
|
||||
label *canvas.Text
|
||||
lockIcon *canvas.Text
|
||||
disabledStripe *canvas.Raster
|
||||
}
|
||||
|
||||
|
|
@ -327,7 +327,7 @@ func (r *moduleTileRenderer) Objects() []fyne.CanvasObject {
|
|||
// TintedBar creates a colored bar container
|
||||
func TintedBar(col color.Color, body fyne.CanvasObject) fyne.CanvasObject {
|
||||
rect := canvas.NewRectangle(col)
|
||||
rect.SetMinSize(fyne.NewSize(0, 48))
|
||||
// rect.SetMinSize(fyne.NewSize(0, 48)) // Removed for flexible sizing
|
||||
padded := container.NewPadded(body)
|
||||
return container.NewMax(rect, padded)
|
||||
}
|
||||
|
|
@ -883,7 +883,7 @@ func (w *FFmpegCommandWidget) SetCommand(command string) {
|
|||
// CreateRenderer creates the widget renderer
|
||||
func (w *FFmpegCommandWidget) CreateRenderer() fyne.WidgetRenderer {
|
||||
scroll := container.NewVScroll(w.commandLabel)
|
||||
scroll.SetMinSize(fyne.NewSize(0, 80))
|
||||
// scroll.SetMinSize(fyne.NewSize(0, 80)) // Removed for flexible sizing
|
||||
|
||||
content := container.NewBorder(
|
||||
nil,
|
||||
|
|
@ -952,7 +952,7 @@ func BuildModuleBadge(jobType queue.JobType) fyne.CanvasObject {
|
|||
|
||||
rect := canvas.NewRectangle(badgeColor)
|
||||
rect.CornerRadius = 3
|
||||
rect.SetMinSize(fyne.NewSize(70, 20))
|
||||
// rect.SetMinSize(fyne.NewSize(70, 20)) // Removed for flexible sizing
|
||||
|
||||
text := canvas.NewText(badgeText, color.White)
|
||||
text.Alignment = fyne.TextAlignCenter
|
||||
|
|
@ -967,7 +967,7 @@ func BuildModuleBadge(jobType queue.JobType) fyne.CanvasObject {
|
|||
func SectionHeader(title string, accentColor color.Color) fyne.CanvasObject {
|
||||
// Left accent bar (Memphis geometric style)
|
||||
accent := canvas.NewRectangle(accentColor)
|
||||
accent.SetMinSize(fyne.NewSize(4, 20))
|
||||
// accent.SetMinSize(fyne.NewSize(4, 20)) // Removed for flexible sizing
|
||||
|
||||
// Title text
|
||||
label := widget.NewLabel(title)
|
||||
|
|
@ -988,14 +988,14 @@ func SectionHeader(title string, accentColor color.Color) fyne.CanvasObject {
|
|||
// SectionSpacer creates vertical spacing between sections for better readability
|
||||
func SectionSpacer() fyne.CanvasObject {
|
||||
spacer := canvas.NewRectangle(color.Transparent)
|
||||
spacer.SetMinSize(fyne.NewSize(0, 12))
|
||||
// spacer.SetMinSize(fyne.NewSize(0, 12)) // Removed for flexible sizing
|
||||
return spacer
|
||||
}
|
||||
|
||||
// ColoredDivider creates a thin horizontal divider with accent color
|
||||
func ColoredDivider(accentColor color.Color) fyne.CanvasObject {
|
||||
divider := canvas.NewRectangle(accentColor)
|
||||
divider.SetMinSize(fyne.NewSize(0, 2))
|
||||
// divider.SetMinSize(fyne.NewSize(0, 2)) // Removed for flexible sizing
|
||||
return divider
|
||||
}
|
||||
|
||||
|
|
@ -1005,7 +1005,7 @@ func ColoredDivider(accentColor color.Color) fyne.CanvasObject {
|
|||
func NewColorCodedSelectContainer(selectWidget *widget.Select, accentColor color.Color) (*fyne.Container, *canvas.Rectangle) {
|
||||
// Create colored left border rectangle
|
||||
border := canvas.NewRectangle(accentColor)
|
||||
border.SetMinSize(fyne.NewSize(4, 44))
|
||||
// border.SetMinSize(fyne.NewSize(4, 44)) // Removed for flexible sizing
|
||||
|
||||
// Return container with [ColoredBorder][Select] and the border for future updates
|
||||
container := container.NewBorder(nil, nil, border, nil, selectWidget)
|
||||
|
|
@ -1015,13 +1015,13 @@ func NewColorCodedSelectContainer(selectWidget *widget.Select, accentColor color
|
|||
// ColoredSelect is a custom select widget with color-coded dropdown items
|
||||
type ColoredSelect struct {
|
||||
widget.BaseWidget
|
||||
options []string
|
||||
selected string
|
||||
colorMap map[string]color.Color
|
||||
onChanged func(string)
|
||||
popup *widget.PopUp
|
||||
window fyne.Window
|
||||
placeHolder string
|
||||
options []string
|
||||
selected string
|
||||
colorMap map[string]color.Color
|
||||
onChanged func(string)
|
||||
popup *widget.PopUp
|
||||
window fyne.Window
|
||||
placeHolder string
|
||||
}
|
||||
|
||||
// NewColoredSelect creates a new colored select widget
|
||||
|
|
@ -1095,7 +1095,7 @@ func (cs *ColoredSelect) showPopup() {
|
|||
|
||||
// Create colored indicator bar
|
||||
colorBar := canvas.NewRectangle(itemColor)
|
||||
colorBar.SetMinSize(fyne.NewSize(4, 32))
|
||||
// colorBar.SetMinSize(fyne.NewSize(4, 32)) // Removed for flexible sizing
|
||||
|
||||
// Create label
|
||||
label := widget.NewLabel(opt)
|
||||
|
|
|
|||
4
main.go
4
main.go
|
|
@ -371,7 +371,7 @@ func (s *appState) openLogViewer(title, path string, live bool) {
|
|||
bg := canvas.NewRectangle(color.NRGBA{0x15, 0x1a, 0x24, 0xff}) // slightly lighter than app bg
|
||||
scroll := container.NewVScroll(container.NewMax(bg, text))
|
||||
// Adaptive min size - allows proper scaling on small screens
|
||||
scroll.SetMinSize(fyne.NewSize(600, 350))
|
||||
// scroll.SetMinSize(fyne.NewSize(600, 350)) // Removed for flexible sizing
|
||||
|
||||
stop := make(chan struct{})
|
||||
var d dialog.Dialog
|
||||
|
|
@ -1187,7 +1187,7 @@ Config:
|
|||
|
||||
// Job details in scrollable area
|
||||
detailsScroll := container.NewVScroll(detailsLabel)
|
||||
detailsScroll.SetMinSize(fyne.NewSize(650, 250))
|
||||
// detailsScroll.SetMinSize(fyne.NewSize(650, 250)) // Removed for flexible sizing
|
||||
|
||||
// FFmpeg Command section at bottom
|
||||
var ffmpegSection fyne.CanvasObject
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ func buildRipView(state *appState) fyne.CanvasObject {
|
|||
logEntry.SetText(state.ripLogText)
|
||||
state.ripLogEntry = logEntry
|
||||
logScroll := container.NewVScroll(logEntry)
|
||||
logScroll.SetMinSize(fyne.NewSize(0, 200))
|
||||
// logScroll.SetMinSize(fyne.NewSize(0, 200)) // Removed for flexible sizing
|
||||
state.ripLogScroll = logScroll
|
||||
|
||||
addQueueBtn := widget.NewButton("Add Rip to Queue", func() {
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ func buildDependenciesTab(state *appState) fyne.CanvasObject {
|
|||
|
||||
statusBg := canvas.NewRectangle(statusColor)
|
||||
statusBg.CornerRadius = 3
|
||||
statusBg.SetMinSize(fyne.NewSize(12, 12))
|
||||
// statusBg.SetMinSize(fyne.NewSize(12, 12)) // Removed for flexible sizing
|
||||
|
||||
statusRow := container.NewHBox(statusBg, statusLabel)
|
||||
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ func buildSubtitlesView(state *appState) fyne.CanvasObject {
|
|||
row := container.NewBorder(nil, nil, timesCol, removeBtn, textEntry)
|
||||
cardBg := canvas.NewRectangle(utils.MustHex("#171C2A"))
|
||||
cardBg.CornerRadius = 6
|
||||
cardBg.SetMinSize(fyne.NewSize(0, startEntry.MinSize().Height+endEntry.MinSize().Height+textEntry.MinSize().Height+24))
|
||||
// cardBg.SetMinSize(fyne.NewSize(0, startEntry.MinSize().Height+endEntry.MinSize().Height+textEntry.MinSize().Height+24)) // Removed for flexible sizing
|
||||
cueList.Add(container.NewPadded(container.NewMax(cardBg, row)))
|
||||
}
|
||||
cueList.Refresh()
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ func buildThumbView(state *appState) fyne.CanvasObject {
|
|||
img := canvas.NewImageFromFile(contactSheetPath)
|
||||
img.FillMode = canvas.ImageFillContain
|
||||
// Adaptive size for small screens - use scrollable dialog
|
||||
img.SetMinSize(fyne.NewSize(640, 480))
|
||||
// img.SetMinSize(fyne.NewSize(640, 480)) // Removed for flexible sizing
|
||||
|
||||
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||
// Wrap in scroll container for large contact sheets
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user