Fix numbers appearing in places where the language code should
The original code paired the position inside the langComboBox with an address into the shortLangList/fullLangList arrays by leveraging the second QVariant argument of QComboBox::addItem. This was achieved by casting the pointer firstly to a void*, and then to a qulonglong. However, the code using these QVariants in QComboBox signal handler functions has since been changed to always call toString(), which was incorrect and led to addresses being shown in the UI in the form of longish decimal numbers. Funnily enough, it looks like these shenanigans weren't even really needed : the only part of the language pair used in the signal handler functions is the three-letter code, which can be simply converted to a QString at the time QComboBox::addItem is called. Fixes #87.
This commit is contained in:
parent
cee050aee6
commit
c22aada8df
File diff suppressed because it is too large
Load Diff
@ -563,18 +563,14 @@ TsMuxerWindow::TsMuxerWindow()
|
||||
|
||||
ui.langComboBox->addItem("und (Undetermined)");
|
||||
ui.langComboBox->addItem("--------- common ---------");
|
||||
for (int i = 0; i < sizeof(shortLangList) / 2 / sizeof(char *); ++i) {
|
||||
const char *addr = shortLangList[i][0];
|
||||
ui.langComboBox->addItem(QString(shortLangList[i][0]) + " (" +
|
||||
shortLangList[i][1] + ")",
|
||||
(qlonglong)(void *)addr);
|
||||
for (auto&& lang : shortLangList) {
|
||||
ui.langComboBox->addItem(QString("%1 (%2)").arg(lang.code).arg(lang.lang),
|
||||
QString::fromUtf8(lang.code));
|
||||
}
|
||||
ui.langComboBox->addItem("---------- all ----------");
|
||||
for (int i = 0; i < sizeof(fullLangList) / 2 / sizeof(char *); ++i) {
|
||||
const char *addr = fullLangList[i][0];
|
||||
ui.langComboBox->addItem(QString(fullLangList[i][0]) + " (" +
|
||||
fullLangList[i][1] + ")",
|
||||
(qlonglong)(void *)addr);
|
||||
for (auto&& lang : fullLangList) {
|
||||
ui.langComboBox->addItem(QString("%1 (%2)").arg(lang.code).arg(lang.lang),
|
||||
QString::fromUtf8(lang.code));
|
||||
}
|
||||
trackLVItemSelectionChanged();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user