fix(gui): drop a dead setting, make the language list and tail toggle real
Three settings were only half-wired: - autoPickByLanguage was saved but never read anywhere: delete it. - showUnstableTail had a checkbox and a setter, but nothing ever called the setter, so the checkbox did nothing: apply it in applyAppearance and re-render from the cached text instead of blanking the caption. - the language dropdown was hard-coded to auto/zh/en/ja while the registry declares up to 16 languages per model: build it from the selected model's own language list, with an ISO-code to display-name mapping (plus a unit test covering every code in the registry). The caption window's language pill now follows the setting too, instead of keeping whatever it showed at startup. windowPos is not dead -- it stores the dragged window position -- so it stays. 三个「半死」设置:autoPickByLanguage 存了但从没被读取,直接删掉;showUnstableTail 有复选框也有 setter,但从来没人调用 setter(复选框点了没用),改为在 applyAppearance 里生效并用缓存文本重画;「识别语言」下拉原来硬编码 自动/中/英/日,而注册表里每个模型 声明了最多 16 种语言,改为按所选模型的语言动态生成,并补 ISO 码→显示名映射与单元测试。 字幕窗的语言标签也跟着设置走了(原来只在启动时读一次)。windowPos 不是死设置(它存的 是拖动后的位置),保留。
This commit is contained in:
1 parent
6c04071bb5
commit
898763eb74
12 files changed
+141
-26
No files matched your search
@@ -42,6 +42,40 @@ private slots:
|
||||
QCOMPARE(QString::fromStdString(lc::languageDisplayName("Klingon")), QString("Klingon"));
|
||||
QVERIFY(lc::languageDisplayName("").empty());
|
||||
}
|
||||
|
||||
// 设置里的语言提示是 ISO 码,界面要把它显示成中文名。
|
||||
// 覆盖注册表里出现过的所有语言码,避免加了模型却漏了显示名。
|
||||
void isoCodeDisplayName()
|
||||
{
|
||||
const struct { const char * code; const char * display; } kCases[] = {
|
||||
{ "zh", "中文" }, { "en", "英语" }, { "ja", "日语" },
|
||||
{ "ko", "韩语" }, { "fr", "法语" }, { "de", "德语" },
|
||||
{ "es", "西班牙语" },{ "ru", "俄语" }, { "ar", "阿拉伯语" },
|
||||
{ "hi", "印地语" }, { "vi", "越南语" }, { "it", "意大利语" },
|
||||
{ "pt", "葡萄牙语" },{ "nl", "荷兰语" }, { "tr", "土耳其语" },
|
||||
{ "uk", "乌克兰语" },{ "auto", "自动检测" },
|
||||
};
|
||||
for (const auto & c : kCases) {
|
||||
QCOMPARE(QString::fromStdString(lc::languageDisplayNameFromCode(c.code)),
|
||||
QString::fromUtf8(c.display));
|
||||
}
|
||||
// 未知码原样返回;空串返回空
|
||||
QCOMPARE(QString::fromStdString(lc::languageDisplayNameFromCode("xx")), QString("xx"));
|
||||
QVERIFY(lc::languageDisplayNameFromCode("").empty());
|
||||
}
|
||||
|
||||
// 注册表里每个模型声明的语言都必须能显示成中文名,
|
||||
// 否则设置里的「识别语言」下拉会出现英文码。
|
||||
void registryLanguagesAllHaveDisplayNames()
|
||||
{
|
||||
for (const char * code : { "zh", "en", "ja", "ko", "fr", "de", "es", "ru", "ar",
|
||||
"hi", "vi", "it", "pt", "nl", "tr", "uk" }) {
|
||||
const QString display =
|
||||
QString::fromStdString(lc::languageDisplayNameFromCode(code));
|
||||
QVERIFY2(display != QString::fromLatin1(code),
|
||||
qPrintable(QStringLiteral("语言码没有显示名: %1").arg(code)));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_MAIN(TstTranscript)
|
||||
|
||||
Reference in new issue
Block a user