Simplify Whisper UI when auto-detected
This commit is contained in:
parent
f502ad912f
commit
29a88a6a47
|
|
@ -186,6 +186,26 @@ func buildSubtitlesView(state *appState) fyne.CanvasObject {
|
||||||
state.persistSubtitlesConfig()
|
state.persistSubtitlesConfig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
backendLabel := widget.NewLabel("")
|
||||||
|
modelLabel := widget.NewLabel("")
|
||||||
|
refreshWhisperUI := func() {
|
||||||
|
if strings.TrimSpace(state.subtitleBackendPath) != "" {
|
||||||
|
backendLabel.SetText(fmt.Sprintf("Whisper backend: %s", state.subtitleBackendPath))
|
||||||
|
backendEntry.Hide()
|
||||||
|
} else {
|
||||||
|
backendLabel.SetText("")
|
||||||
|
backendEntry.Show()
|
||||||
|
}
|
||||||
|
if strings.TrimSpace(state.subtitleModelPath) != "" {
|
||||||
|
modelLabel.SetText(fmt.Sprintf("Whisper model: %s", state.subtitleModelPath))
|
||||||
|
modelEntry.Hide()
|
||||||
|
} else {
|
||||||
|
modelLabel.SetText("")
|
||||||
|
modelEntry.Show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
refreshWhisperUI()
|
||||||
|
|
||||||
outputEntry := widget.NewEntry()
|
outputEntry := widget.NewEntry()
|
||||||
outputEntry.SetPlaceHolder("Output video path (for embed/burn)")
|
outputEntry.SetPlaceHolder("Output video path (for embed/burn)")
|
||||||
outputEntry.SetText(state.subtitleBurnOutput)
|
outputEntry.SetText(state.subtitleBurnOutput)
|
||||||
|
|
@ -435,6 +455,7 @@ func buildSubtitlesView(state *appState) fyne.CanvasObject {
|
||||||
modelEntry.SetText(state.subtitleModelPath)
|
modelEntry.SetText(state.subtitleModelPath)
|
||||||
outputEntry.SetText(state.subtitleBurnOutput)
|
outputEntry.SetText(state.subtitleBurnOutput)
|
||||||
offsetEntry.SetText(fmt.Sprintf("%.2f", state.subtitleTimeOffset))
|
offsetEntry.SetText(fmt.Sprintf("%.2f", state.subtitleTimeOffset))
|
||||||
|
refreshWhisperUI()
|
||||||
}
|
}
|
||||||
|
|
||||||
loadCfgBtn := widget.NewButton("Load Config", func() {
|
loadCfgBtn := widget.NewButton("Load Config", func() {
|
||||||
|
|
@ -485,7 +506,9 @@ func buildSubtitlesView(state *appState) fyne.CanvasObject {
|
||||||
applyOffsetBtn,
|
applyOffsetBtn,
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
widget.NewLabelWithStyle("Offline Speech-to-Text (whisper.cpp)", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
widget.NewLabelWithStyle("Offline Speech-to-Text (whisper.cpp)", fyne.TextAlignLeading, fyne.TextStyle{Bold: true}),
|
||||||
|
backendLabel,
|
||||||
backendEntry,
|
backendEntry,
|
||||||
|
modelLabel,
|
||||||
modelEntry,
|
modelEntry,
|
||||||
container.NewHBox(generateBtn),
|
container.NewHBox(generateBtn),
|
||||||
widget.NewSeparator(),
|
widget.NewSeparator(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user