Manager: Add a language selector in Preferences
This commit is contained in:
@@ -18,12 +18,14 @@
|
||||
#include <QFileDialog>
|
||||
#include <QStyle>
|
||||
|
||||
#include "qt_progsettings.hpp"
|
||||
#include "qt_vmmanager_preferences.hpp"
|
||||
#include "qt_vmmanager_config.hpp"
|
||||
#include "ui_qt_vmmanager_preferences.h"
|
||||
|
||||
extern "C" {
|
||||
#include <86box/86box.h>
|
||||
#include <86box/config.h>
|
||||
#include <86box/version.h>
|
||||
}
|
||||
|
||||
@@ -44,6 +46,15 @@ VMManagerPreferences(QWidget *parent) : ui(new Ui::VMManagerPreferences)
|
||||
ui->systemDirectory->setText(QDir(vmm_path).path());
|
||||
}
|
||||
|
||||
ui->comboBoxLanguage->setItemData(0, 0);
|
||||
for (int i = 1; i < ProgSettings::languages.length(); i++) {
|
||||
ui->comboBoxLanguage->addItem(ProgSettings::languages[i].second, i);
|
||||
if (i == lang_id) {
|
||||
ui->comboBoxLanguage->setCurrentIndex(ui->comboBoxLanguage->findData(i));
|
||||
}
|
||||
}
|
||||
ui->comboBoxLanguage->model()->sort(Qt::AscendingOrder);
|
||||
|
||||
// TODO: Defaults
|
||||
#if EMU_BUILD_NUM != 0
|
||||
const auto configUpdateCheck = config->getStringValue("update_check").toInt();
|
||||
@@ -70,11 +81,21 @@ VMManagerPreferences::chooseDirectoryLocation()
|
||||
ui->systemDirectory->setText(QDir::toNativeSeparators(directory));
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerPreferences::on_pushButtonLanguage_released()
|
||||
{
|
||||
ui->comboBoxLanguage->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void
|
||||
VMManagerPreferences::accept()
|
||||
{
|
||||
const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General);
|
||||
config->setStringValue("system_directory", ui->systemDirectory->text());
|
||||
|
||||
lang_id = ui->comboBoxLanguage->currentData().toInt();
|
||||
config_save_global();
|
||||
|
||||
#if EMU_BUILD_NUM != 0
|
||||
config->setStringValue("update_check", ui->updateCheckBox->isChecked() ? "1" : "0");
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user