Add descriptive labels to bitrate mode dropdown

Bitrate Mode Options Now Show:
- CRF (Constant Rate Factor)
- CBR (Constant Bitrate)
- VBR (Variable Bitrate)
- Target Size (Calculate from file size)

Implementation:
- Added bidirectional mapping between short codes and full labels
- Internally still uses short codes (CRF, CBR, VBR, Target Size)
- Preserves compatibility with existing config files
- Maps display label to internal code on selection
- Maps internal code to display label when loading

Makes it immediately clear what each bitrate mode does without
needing to reference documentation or tooltips.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-18 16:13:10 -05:00
parent 83c8e68f80
commit f7bb87e20a

38
main.go
View File

@ -5713,10 +5713,33 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
widget.NewSeparator(),
)
// Bitrate Mode
bitrateModeSelect = widget.NewSelect([]string{"CRF", "CBR", "VBR", "Target Size"}, func(value string) {
state.convert.BitrateMode = value
logging.Debug(logging.CatUI, "bitrate mode set to %s", value)
// Bitrate Mode with descriptions
bitrateModeOptions := []string{
"CRF (Constant Rate Factor)",
"CBR (Constant Bitrate)",
"VBR (Variable Bitrate)",
"Target Size (Calculate from file size)",
}
bitrateModeMap := map[string]string{
"CRF (Constant Rate Factor)": "CRF",
"CBR (Constant Bitrate)": "CBR",
"VBR (Variable Bitrate)": "VBR",
"Target Size (Calculate from file size)": "Target Size",
}
reverseMap := map[string]string{
"CRF": "CRF (Constant Rate Factor)",
"CBR": "CBR (Constant Bitrate)",
"VBR": "VBR (Variable Bitrate)",
"Target Size": "Target Size (Calculate from file size)",
}
bitrateModeSelect = widget.NewSelect(bitrateModeOptions, func(value string) {
// Extract short code from label
if shortCode, ok := bitrateModeMap[value]; ok {
state.convert.BitrateMode = shortCode
} else {
state.convert.BitrateMode = value
}
logging.Debug(logging.CatUI, "bitrate mode set to %s", state.convert.BitrateMode)
if updateEncodingControls != nil {
updateEncodingControls()
}
@ -5724,7 +5747,12 @@ func buildConvertView(state *appState, src *videoSource) fyne.CanvasObject {
buildCommandPreview()
}
})
bitrateModeSelect.SetSelected(state.convert.BitrateMode)
// Set selected using full label
if fullLabel, ok := reverseMap[state.convert.BitrateMode]; ok {
bitrateModeSelect.SetSelected(fullLabel)
} else {
bitrateModeSelect.SetSelected(state.convert.BitrateMode)
}
// Manual CRF entry
crfEntry = widget.NewEntry()