Skip to content

Commit

Permalink
Locale: add (locale) beside language names
Browse files Browse the repository at this point in the history
  • Loading branch information
cardinot committed Mar 31, 2014
1 parent 92adefc commit 1018286
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/dlgprefcontrols.cpp
Expand Up @@ -142,7 +142,6 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx,
QStringList fileNames = translationsDir.entryList(QStringList("mixxx_*.qm"));

ComboBoxLocale->addItem("System", ""); // System default locale
ComboBoxLocale->setCurrentIndex(0);

for (int i = 0; i < fileNames.size(); ++i) {
// Extract locale from filename
Expand All @@ -154,12 +153,14 @@ DlgPrefControls::DlgPrefControls(QWidget * parent, MixxxMainWindow * mixxx,
if (lang == "C") { // Ugly hack to remove the non-resolving locales
continue;
}

lang = QString("%1 (%2)").arg(lang).arg(locale);
ComboBoxLocale->addItem(lang, locale); // locale as userdata (for storing to config)
if (locale == currentLocale) { // Set the currently selected locale
ComboBoxLocale->setCurrentIndex(ComboBoxLocale->count() - 1);
}
}
// Set the currently selected locale
int selectedIndex = ComboBoxLocale->findData(currentLocale);
selectedIndex = selectedIndex>0? selectedIndex:0;
ComboBoxLocale->setCurrentIndex(selectedIndex);

connect(ComboBoxLocale, SIGNAL(activated(int)),
this, SLOT(slotSetLocale(int)));

Expand Down

0 comments on commit 1018286

Please sign in to comment.