Show CRF entry when bitrate mode is CRF

This commit is contained in:
Stu Leak 2026-01-06 20:30:34 -05:00
parent 93d92ba97e
commit fc8e4d51d5

37
main.go
View File

@ -7060,6 +7060,7 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
var crfEntry *widget.Entry var crfEntry *widget.Entry
var manualCrfRow *fyne.Container var manualCrfRow *fyne.Container
var crfContainer *fyne.Container var crfContainer *fyne.Container
var manualCrfLabel *widget.Label
normalizeBitrateMode := func(mode string) string { normalizeBitrateMode := func(mode string) string {
switch { switch {
@ -8181,7 +8182,10 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
}) })
manualCrfRow = container.NewVBox( manualCrfRow = container.NewVBox(
widget.NewLabelWithStyle("Manual CRF (overrides Quality preset)", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}), func() *widget.Label {
manualCrfLabel = widget.NewLabelWithStyle("Manual CRF (overrides Quality preset)", fyne.TextAlignLeading, fyne.TextStyle{Bold: true})
return manualCrfLabel
}(),
crfEntryWrapper, crfEntryWrapper,
) )
if state.convert.Quality == manualQualityOption { if state.convert.Quality == manualQualityOption {
@ -8771,19 +8775,34 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
} }
} }
if showCRF && showManualCRF { if showCRF {
if crfEntry != nil { if manualCrfLabel != nil {
crfEntry.Enable() if showManualCRF {
manualCrfLabel.SetText("Manual CRF (overrides Quality preset)")
} else {
manualCrfLabel.SetText("CRF (auto from Quality preset)")
}
} }
if manualCrfRow != nil { if manualCrfRow != nil {
manualCrfRow.Show() manualCrfRow.Show()
} }
crfContainer.Show() if crfEntry != nil {
if showManualCRF {
crfEntry.Enable()
} else {
crfEntry.Disable()
}
}
if crfContainer != nil {
crfContainer.Show()
}
} else { } else {
if manualCrfRow != nil { if manualCrfRow != nil {
manualCrfRow.Hide() manualCrfRow.Hide()
} }
crfContainer.Hide() if crfContainer != nil {
crfContainer.Hide()
}
} }
if showBitrate { if showBitrate {
bitrateContainer.Show() bitrateContainer.Show()
@ -9161,22 +9180,20 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
) )
updateQualityVisibility = func() { updateQualityVisibility = func() {
hide := strings.Contains(strings.ToLower(state.convert.SelectedFormat.Label), "h.265") ||
strings.EqualFold(state.convert.VideoCodec, "H.265")
mode := normalizeBitrateMode(state.convert.BitrateMode) mode := normalizeBitrateMode(state.convert.BitrateMode)
hideQuality := mode != "" && mode != "CRF" hideQuality := mode != "" && mode != "CRF"
remux := strings.EqualFold(state.convert.SelectedFormat.VideoCodec, "copy") || remux := strings.EqualFold(state.convert.SelectedFormat.VideoCodec, "copy") ||
strings.EqualFold(state.convert.VideoCodec, "Copy") strings.EqualFold(state.convert.VideoCodec, "Copy")
if qualitySectionSimple != nil { if qualitySectionSimple != nil {
if hide || hideQuality || remux { if hideQuality || remux {
qualitySectionSimple.Hide() qualitySectionSimple.Hide()
} else { } else {
qualitySectionSimple.Show() qualitySectionSimple.Show()
} }
} }
if qualitySectionAdv != nil { if qualitySectionAdv != nil {
if hide || hideQuality || remux { if hideQuality || remux {
qualitySectionAdv.Hide() qualitySectionAdv.Hide()
} else { } else {
qualitySectionAdv.Show() qualitySectionAdv.Show()