From 97cad9eeba0b4ac672a26380ed06bf217486b979 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sat, 20 Dec 2025 15:49:49 -0500 Subject: [PATCH] Hide irrelevant bitrate controls by mode --- DONE.md | 1 + TODO.md | 1 + main.go | 43 +++++++++++++++++++------------------------ 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/DONE.md b/DONE.md index c05c7c8..47b0706 100644 --- a/DONE.md +++ b/DONE.md @@ -824,6 +824,7 @@ This file tracks completed features, fixes, and milestones. - ✅ Restored 25%/33%/50%/75% target size reduction presets - ✅ Default bitrate preset set to 2.5 Mbps and added 2.0 Mbps option - ✅ Default encoder preset set to slow +- ✅ Bitrate mode now strictly hides unrelated controls (CRF only in CRF mode) - ✅ Stabilized video seeking and embedded rendering - ✅ Improved player window positioning - ✅ Fixed clear video functionality diff --git a/TODO.md b/TODO.md index cf653fd..d9ab5ae 100644 --- a/TODO.md +++ b/TODO.md @@ -57,6 +57,7 @@ This file tracks upcoming features, improvements, and known issues. - Target size reduction presets restored (25/33/50/75%) - Default bitrate preset set to 2.5 Mbps with added 2.0 Mbps option - Default encoder preset set to slow + - Bitrate mode hides unrelated controls (CRF only in CRF mode) *Last Updated: 2025-12-20* diff --git a/main.go b/main.go index 91b2190..1f56794 100644 --- a/main.go +++ b/main.go @@ -6346,6 +6346,9 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { supportsLossless := codecSupportsLossless(state.convert.VideoCodec) hint := "" + showCRF := mode == "CRF" || mode == "" + showBitrate := mode == "CBR" || mode == "VBR" + showTarget := mode == "Target Size" if isLossless && supportsLossless { // Lossless with H.265/AV1: Allow all bitrate modes @@ -6357,24 +6360,12 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { } state.convert.CRF = "0" crfEntry.Disable() - crfContainer.Show() - bitrateContainer.Hide() - targetSizeContainer.Hide() hint = "Lossless mode with CRF 0. Perfect quality preservation for H.265/AV1." case "CBR": - crfContainer.Hide() - bitrateContainer.Show() - targetSizeContainer.Hide() hint = "Lossless quality with constant bitrate. May achieve smaller file size than pure lossless CRF." case "VBR": - crfContainer.Hide() - bitrateContainer.Show() - targetSizeContainer.Hide() hint = "Lossless quality with variable bitrate. Efficient file size while maintaining lossless quality." case "Target Size": - crfContainer.Hide() - bitrateContainer.Hide() - targetSizeContainer.Show() hint = "Lossless quality with target size. Calculates bitrate to achieve exact file size with best possible quality." } } else { @@ -6382,31 +6373,35 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject { switch mode { case "CRF", "": // Show only CRF controls - crfContainer.Show() - bitrateContainer.Hide() - targetSizeContainer.Hide() hint = "CRF mode: Constant quality - file size varies. Lower CRF = better quality." case "CBR": // Show only bitrate controls - crfContainer.Hide() - bitrateContainer.Show() - targetSizeContainer.Hide() hint = "CBR mode: Constant bitrate - predictable file size, variable quality. Use for strict size requirements or streaming." case "VBR": // Show only bitrate controls - crfContainer.Hide() - bitrateContainer.Show() - targetSizeContainer.Hide() hint = "VBR mode: Variable bitrate - targets average bitrate with 2x peak cap. Efficient quality. Uses 2-pass encoding." case "Target Size": // Show only target size controls - crfContainer.Hide() - bitrateContainer.Hide() - targetSizeContainer.Show() hint = "Target Size mode: Calculates bitrate to hit exact file size. Best for strict size limits." } } + if showCRF { + crfContainer.Show() + } else { + crfContainer.Hide() + } + if showBitrate { + bitrateContainer.Show() + } else { + bitrateContainer.Hide() + } + if showTarget { + targetSizeContainer.Show() + } else { + targetSizeContainer.Hide() + } + encodingHint.SetText(hint) if buildCommandPreview != nil { buildCommandPreview()