Use locale (name) enumeration helper in basic settings window

This commit is contained in:
Palana 2014-07-11 20:12:32 +02:00
parent 0413ada9b5
commit 5623f1d62d
2 changed files with 4 additions and 13 deletions

View File

@ -137,11 +137,6 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
if (!GetDataFilePath("locale.ini", path))
throw "Could not find locale.ini path";
if (localeIni.Open(path.c_str(), CONFIG_OPEN_EXISTING) != 0)
throw "Could not open locale.ini";
HookWidget(ui->language, COMBO_CHANGED, GENERAL_CHANGED); HookWidget(ui->language, COMBO_CHANGED, GENERAL_CHANGED);
HookWidget(ui->outputMode, COMBO_CHANGED, OUTPUTS_CHANGED); HookWidget(ui->outputMode, COMBO_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->simpleOutputPath, EDIT_CHANGED, OUTPUTS_CHANGED); HookWidget(ui->simpleOutputPath, EDIT_CHANGED, OUTPUTS_CHANGED);
@ -262,16 +257,13 @@ void OBSBasicSettings::LoadLanguageList()
ui->language->clear(); ui->language->clear();
size_t numSections = config_num_sections(localeIni); for (const auto &locale : GetLocaleNames()) {
for (size_t i = 0; i < numSections; i++) {
const char *tag = config_get_section(localeIni, i);
const char *name = config_get_string(localeIni, tag, "Name");
int idx = ui->language->count(); int idx = ui->language->count();
ui->language->addItem(QT_UTF8(name), QT_UTF8(tag)); ui->language->addItem(QT_UTF8(locale.second.c_str()),
QT_UTF8(locale.first.c_str()));
if (strcmp(tag, currentLang) == 0) if (locale.first == currentLang)
ui->language->setCurrentIndex(idx); ui->language->setCurrentIndex(idx);
} }

View File

@ -37,7 +37,6 @@ private:
OBSBasic *main; OBSBasic *main;
std::unique_ptr<Ui::OBSBasicSettings> ui; std::unique_ptr<Ui::OBSBasicSettings> ui;
ConfigFile localeIni;
bool generalChanged; bool generalChanged;
bool outputsChanged; bool outputsChanged;
bool audioChanged; bool audioChanged;