MCPcopy Create free account
hub / github.com/dail8859/NotepadNext / populateTranslationComboBox

Method populateTranslationComboBox

src/dialogs/PreferencesDialog.cpp:180–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void PreferencesDialog::populateTranslationComboBox()
181{
182 NotepadNextApplication *app = qobject_cast<NotepadNextApplication *>(qApp);
183
184 // Add the system default at the top
185 ui->comboBoxTranslation->addItem(tr("<System Default>"), QStringLiteral(""));
186
187 // TODO: sort this list and keep the system default at the top
188 for (const auto &localeName : app->getTranslationManager()->availableTranslations())
189 {
190 QLocale locale(localeName);
191 const QString localeDisplay = TranslationManager::FormatLocaleTerritoryAndLanguage(locale);
192 ui->comboBoxTranslation->addItem(localeDisplay, localeName);
193 }
194
195 // Select the current one
196 int index = ui->comboBoxTranslation->findData(settings->translation());
197 if (index != -1) {
198 ui->comboBoxTranslation->setCurrentIndex(index);
199 }
200}

Callers

nothing calls this directly

Calls 2

availableTranslationsMethod · 0.80
getTranslationManagerMethod · 0.80

Tested by

no test coverage detected