mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-02 05:38:06 -06:00
Sort languages combobox by language code
* Avoid creating redundant file lists * Sort languages combobox by language code PR #20365.
This commit is contained in:
@@ -1379,13 +1379,11 @@ void OptionsDialog::saveWebUITabOptions() const
|
||||
void OptionsDialog::initializeLanguageCombo()
|
||||
{
|
||||
// List language files
|
||||
const QDir langDir(u":/lang"_s);
|
||||
const QStringList langFiles = langDir.entryList(QStringList(u"qbittorrent_*.qm"_s), QDir::Files);
|
||||
const QStringList langFiles = QDir(u":/lang"_s).entryList({u"qbittorrent_*.qm"_s}, QDir::Files, QDir::Name);
|
||||
for (const QString &langFile : langFiles)
|
||||
{
|
||||
const QString localeStr = langFile.section(u"_"_s, 1, -1).section(u"."_s, 0, 0); // remove "qbittorrent_" and ".qm"
|
||||
m_ui->comboI18n->addItem(/*QIcon(":/icons/flags/"+country+".svg"), */ Utils::Misc::languageToLocalizedString(localeStr), localeStr);
|
||||
qDebug() << "Supported locale:" << localeStr;
|
||||
const QString langCode = QStringView(langFile).sliced(12).chopped(3).toString(); // remove "qbittorrent_" and ".qm"
|
||||
m_ui->comboI18n->addItem(Utils::Misc::languageToLocalizedString(langCode), langCode);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -153,20 +153,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="comboI18n">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="modelColumn">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="comboI18n"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_111">
|
||||
@@ -1097,7 +1084,7 @@
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkUnwantedFolder">
|
||||
<property name="text">
|
||||
<string>Keep unselected files in ".unwanted" folder</string>
|
||||
<string>Keep unselected files in ".unwanted" folder</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
Reference in New Issue
Block a user