Commit 203824f4 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Remember last speech model used

parent 9e839752
Pipeline #50324 passed with stage
in 10 minutes and 20 seconds
......@@ -52,8 +52,18 @@ SpeechDialog::SpeechDialog(const std::shared_ptr<TimelineItemModel> &timeline, Q
speech_info->setMessageType(KMessageWidget::Information);
speech_info->setText(i18n("Please install speech recognition models"));
speech_info->animatedShow();
} else {
if (!KdenliveSettings::vosk_srt_model().isEmpty() && models.contains(KdenliveSettings::vosk_srt_model())) {
int ix = language_box->findText(KdenliveSettings::vosk_srt_model());
if (ix > -1) {
language_box->setCurrentIndex(ix);
}
}
}
});
connect(language_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), [this]() {
KdenliveSettings::setVosk_srt_model(language_box->currentText());
});
connect(buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked, [this, timeline, zone]() {
slotProcessSpeech(timeline, zone);
});
......
......@@ -57,8 +57,18 @@ TextBasedEdit::TextBasedEdit(QWidget *parent)
info_message->setMessageType(KMessageWidget::Information);
info_message->setText(i18n("Please install speech recognition models"));
info_message->animatedShow();
} else {
if (!KdenliveSettings::vosk_text_model().isEmpty() && models.contains(KdenliveSettings::vosk_text_model())) {
int ix = language_box->findText(KdenliveSettings::vosk_text_model());
if (ix > -1) {
language_box->setCurrentIndex(ix);
}
}
}
});
connect(language_box, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), [this]() {
KdenliveSettings::setVosk_text_model(language_box->currentText());
});
connect(listWidget, &QListWidget::currentRowChanged, [this] (int ix) {
if (ix > -1) {
QListWidgetItem *item = listWidget->item(ix);
......
......@@ -1144,5 +1144,13 @@
<label>Custom path for the folder containins the vosk speech models. Uses default XDG location if empty</label>
<default></default>
</entry>
<entry name="vosk_text_model" type="String">
<label>Last selected model for speech recognition</label>
<default></default>
</entry>
<entry name="vosk_srt_model" type="String">
<label>Last selected model for automatic subtitling</label>
<default></default>
</entry>
</group>
</kcfg>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment