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
c56a936fac
commit
ca779fd60b
|
|
@ -2120,7 +2120,6 @@ func runAuthorFFmpeg(ctx context.Context, args []string, duration float64, logFn
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (s *appState) executeAuthorJob(ctx context.Context, job *queue.Job, progressCallback func(float64)) error {
|
func (s *appState) executeAuthorJob(ctx context.Context, job *queue.Job, progressCallback func(float64)) error {
|
||||||
cfg := job.Config
|
cfg := job.Config
|
||||||
if cfg == nil {
|
if cfg == nil {
|
||||||
|
|
@ -2695,7 +2694,7 @@ func (s *appState) showChapterPreview(videoPath string, chapters []authorChapter
|
||||||
|
|
||||||
grid := container.NewGridWrap(fyne.NewSize(170, 120), thumbnails...)
|
grid := container.NewGridWrap(fyne.NewSize(170, 120), thumbnails...)
|
||||||
scroll := container.NewVScroll(grid)
|
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))
|
infoText := fmt.Sprintf("Found %d chapters", len(chapters))
|
||||||
if len(chapters) > previewCount {
|
if len(chapters) > previewCount {
|
||||||
|
|
|
||||||
|
|
@ -665,7 +665,7 @@ func buildFiltersView(state *appState) fyne.CanvasObject {
|
||||||
|
|
||||||
settingsScroll := container.NewVScroll(settingsPanel)
|
settingsScroll := container.NewVScroll(settingsPanel)
|
||||||
// Adaptive height for small screens - allow content to flow
|
// 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},
|
mainContent := container.New(&fixedHSplitLayout{ratio: 0.6},
|
||||||
container.NewVBox(leftPanel, container.NewCenter(videoContainer)),
|
container.NewVBox(leftPanel, container.NewCenter(videoContainer)),
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ func buildInspectView(state *appState) fyne.CanvasObject {
|
||||||
|
|
||||||
// Metadata scroll
|
// Metadata scroll
|
||||||
metadataScroll := container.NewScroll(metadataText)
|
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
|
// Helper function to format metadata
|
||||||
formatMetadata := func(src *videoSource) string {
|
formatMetadata := func(src *videoSource) string {
|
||||||
|
|
|
||||||
|
|
@ -327,7 +327,7 @@ func (r *moduleTileRenderer) Objects() []fyne.CanvasObject {
|
||||||
// TintedBar creates a colored bar container
|
// TintedBar creates a colored bar container
|
||||||
func TintedBar(col color.Color, body fyne.CanvasObject) fyne.CanvasObject {
|
func TintedBar(col color.Color, body fyne.CanvasObject) fyne.CanvasObject {
|
||||||
rect := canvas.NewRectangle(col)
|
rect := canvas.NewRectangle(col)
|
||||||
rect.SetMinSize(fyne.NewSize(0, 48))
|
// rect.SetMinSize(fyne.NewSize(0, 48)) // Removed for flexible sizing
|
||||||
padded := container.NewPadded(body)
|
padded := container.NewPadded(body)
|
||||||
return container.NewMax(rect, padded)
|
return container.NewMax(rect, padded)
|
||||||
}
|
}
|
||||||
|
|
@ -883,7 +883,7 @@ func (w *FFmpegCommandWidget) SetCommand(command string) {
|
||||||
// CreateRenderer creates the widget renderer
|
// CreateRenderer creates the widget renderer
|
||||||
func (w *FFmpegCommandWidget) CreateRenderer() fyne.WidgetRenderer {
|
func (w *FFmpegCommandWidget) CreateRenderer() fyne.WidgetRenderer {
|
||||||
scroll := container.NewVScroll(w.commandLabel)
|
scroll := container.NewVScroll(w.commandLabel)
|
||||||
scroll.SetMinSize(fyne.NewSize(0, 80))
|
// scroll.SetMinSize(fyne.NewSize(0, 80)) // Removed for flexible sizing
|
||||||
|
|
||||||
content := container.NewBorder(
|
content := container.NewBorder(
|
||||||
nil,
|
nil,
|
||||||
|
|
@ -952,7 +952,7 @@ func BuildModuleBadge(jobType queue.JobType) fyne.CanvasObject {
|
||||||
|
|
||||||
rect := canvas.NewRectangle(badgeColor)
|
rect := canvas.NewRectangle(badgeColor)
|
||||||
rect.CornerRadius = 3
|
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 := canvas.NewText(badgeText, color.White)
|
||||||
text.Alignment = fyne.TextAlignCenter
|
text.Alignment = fyne.TextAlignCenter
|
||||||
|
|
@ -967,7 +967,7 @@ func BuildModuleBadge(jobType queue.JobType) fyne.CanvasObject {
|
||||||
func SectionHeader(title string, accentColor color.Color) fyne.CanvasObject {
|
func SectionHeader(title string, accentColor color.Color) fyne.CanvasObject {
|
||||||
// Left accent bar (Memphis geometric style)
|
// Left accent bar (Memphis geometric style)
|
||||||
accent := canvas.NewRectangle(accentColor)
|
accent := canvas.NewRectangle(accentColor)
|
||||||
accent.SetMinSize(fyne.NewSize(4, 20))
|
// accent.SetMinSize(fyne.NewSize(4, 20)) // Removed for flexible sizing
|
||||||
|
|
||||||
// Title text
|
// Title text
|
||||||
label := widget.NewLabel(title)
|
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
|
// SectionSpacer creates vertical spacing between sections for better readability
|
||||||
func SectionSpacer() fyne.CanvasObject {
|
func SectionSpacer() fyne.CanvasObject {
|
||||||
spacer := canvas.NewRectangle(color.Transparent)
|
spacer := canvas.NewRectangle(color.Transparent)
|
||||||
spacer.SetMinSize(fyne.NewSize(0, 12))
|
// spacer.SetMinSize(fyne.NewSize(0, 12)) // Removed for flexible sizing
|
||||||
return spacer
|
return spacer
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColoredDivider creates a thin horizontal divider with accent color
|
// ColoredDivider creates a thin horizontal divider with accent color
|
||||||
func ColoredDivider(accentColor color.Color) fyne.CanvasObject {
|
func ColoredDivider(accentColor color.Color) fyne.CanvasObject {
|
||||||
divider := canvas.NewRectangle(accentColor)
|
divider := canvas.NewRectangle(accentColor)
|
||||||
divider.SetMinSize(fyne.NewSize(0, 2))
|
// divider.SetMinSize(fyne.NewSize(0, 2)) // Removed for flexible sizing
|
||||||
return divider
|
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) {
|
func NewColorCodedSelectContainer(selectWidget *widget.Select, accentColor color.Color) (*fyne.Container, *canvas.Rectangle) {
|
||||||
// Create colored left border rectangle
|
// Create colored left border rectangle
|
||||||
border := canvas.NewRectangle(accentColor)
|
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
|
// Return container with [ColoredBorder][Select] and the border for future updates
|
||||||
container := container.NewBorder(nil, nil, border, nil, selectWidget)
|
container := container.NewBorder(nil, nil, border, nil, selectWidget)
|
||||||
|
|
@ -1095,7 +1095,7 @@ func (cs *ColoredSelect) showPopup() {
|
||||||
|
|
||||||
// Create colored indicator bar
|
// Create colored indicator bar
|
||||||
colorBar := canvas.NewRectangle(itemColor)
|
colorBar := canvas.NewRectangle(itemColor)
|
||||||
colorBar.SetMinSize(fyne.NewSize(4, 32))
|
// colorBar.SetMinSize(fyne.NewSize(4, 32)) // Removed for flexible sizing
|
||||||
|
|
||||||
// Create label
|
// Create label
|
||||||
label := widget.NewLabel(opt)
|
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
|
bg := canvas.NewRectangle(color.NRGBA{0x15, 0x1a, 0x24, 0xff}) // slightly lighter than app bg
|
||||||
scroll := container.NewVScroll(container.NewMax(bg, text))
|
scroll := container.NewVScroll(container.NewMax(bg, text))
|
||||||
// Adaptive min size - allows proper scaling on small screens
|
// 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{})
|
stop := make(chan struct{})
|
||||||
var d dialog.Dialog
|
var d dialog.Dialog
|
||||||
|
|
@ -1187,7 +1187,7 @@ Config:
|
||||||
|
|
||||||
// Job details in scrollable area
|
// Job details in scrollable area
|
||||||
detailsScroll := container.NewVScroll(detailsLabel)
|
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
|
// FFmpeg Command section at bottom
|
||||||
var ffmpegSection fyne.CanvasObject
|
var ffmpegSection fyne.CanvasObject
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ func buildRipView(state *appState) fyne.CanvasObject {
|
||||||
logEntry.SetText(state.ripLogText)
|
logEntry.SetText(state.ripLogText)
|
||||||
state.ripLogEntry = logEntry
|
state.ripLogEntry = logEntry
|
||||||
logScroll := container.NewVScroll(logEntry)
|
logScroll := container.NewVScroll(logEntry)
|
||||||
logScroll.SetMinSize(fyne.NewSize(0, 200))
|
// logScroll.SetMinSize(fyne.NewSize(0, 200)) // Removed for flexible sizing
|
||||||
state.ripLogScroll = logScroll
|
state.ripLogScroll = logScroll
|
||||||
|
|
||||||
addQueueBtn := widget.NewButton("Add Rip to Queue", func() {
|
addQueueBtn := widget.NewButton("Add Rip to Queue", func() {
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ func buildDependenciesTab(state *appState) fyne.CanvasObject {
|
||||||
|
|
||||||
statusBg := canvas.NewRectangle(statusColor)
|
statusBg := canvas.NewRectangle(statusColor)
|
||||||
statusBg.CornerRadius = 3
|
statusBg.CornerRadius = 3
|
||||||
statusBg.SetMinSize(fyne.NewSize(12, 12))
|
// statusBg.SetMinSize(fyne.NewSize(12, 12)) // Removed for flexible sizing
|
||||||
|
|
||||||
statusRow := container.NewHBox(statusBg, statusLabel)
|
statusRow := container.NewHBox(statusBg, statusLabel)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,7 @@ func buildSubtitlesView(state *appState) fyne.CanvasObject {
|
||||||
row := container.NewBorder(nil, nil, timesCol, removeBtn, textEntry)
|
row := container.NewBorder(nil, nil, timesCol, removeBtn, textEntry)
|
||||||
cardBg := canvas.NewRectangle(utils.MustHex("#171C2A"))
|
cardBg := canvas.NewRectangle(utils.MustHex("#171C2A"))
|
||||||
cardBg.CornerRadius = 6
|
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.Add(container.NewPadded(container.NewMax(cardBg, row)))
|
||||||
}
|
}
|
||||||
cueList.Refresh()
|
cueList.Refresh()
|
||||||
|
|
|
||||||
|
|
@ -309,7 +309,7 @@ func buildThumbView(state *appState) fyne.CanvasObject {
|
||||||
img := canvas.NewImageFromFile(contactSheetPath)
|
img := canvas.NewImageFromFile(contactSheetPath)
|
||||||
img.FillMode = canvas.ImageFillContain
|
img.FillMode = canvas.ImageFillContain
|
||||||
// Adaptive size for small screens - use scrollable dialog
|
// 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() {
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
// Wrap in scroll container for large contact sheets
|
// Wrap in scroll container for large contact sheets
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user