added language combo box in preferences
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include "ui_settingsdialog.h"
|
||||
#include "utils/utils.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
: QDialog(parent), ui(new Ui::settingsdialog),
|
||||
settings(Settings(get_path_relative_to_home(
|
||||
@@ -32,6 +34,9 @@ SettingsDialog::SettingsDialog(QWidget *parent)
|
||||
|
||||
ui->printHeaderCheckBox->setChecked(this->settings.get_all_settings()["print_header"]);
|
||||
ui->printTotalCheckBox->setChecked(this->settings.get_all_settings()["print_total"]);
|
||||
|
||||
int index = ui->languageComboBox->findText(QString::fromStdString(this->settings.get_all_settings()["language"]));
|
||||
ui->languageComboBox->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
SettingsDialog::~SettingsDialog() { delete ui; }
|
||||
@@ -121,4 +126,14 @@ void SettingsDialog::on_buttonBox_accepted() { this->settings.flush(); }
|
||||
|
||||
void SettingsDialog::on_buttonBox_rejected() { this->close(); }
|
||||
|
||||
void SettingsDialog::on_languageComboBox_currentTextChanged(const QString &changed) {
|
||||
if (changed == QString::fromStdString(this->settings.get_all_settings()["language"])) return;
|
||||
this->settings.get_all_settings()["language"] = changed.toStdString();
|
||||
|
||||
QMessageBox infoDialog;
|
||||
infoDialog.setText(tr("You need to restart program to apply language changes"));
|
||||
infoDialog.setIcon(QMessageBox::Information);
|
||||
infoDialog.setWindowTitle(tr("Restart required"));
|
||||
infoDialog.exec();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user