2017-12-04 20:11:11 +01:00
|
|
|
#include "settingsdialog.h"
|
|
|
|
|
#include "ui_settingsdialog.h"
|
|
|
|
|
|
2017-12-05 21:24:55 +01:00
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
2017-12-04 20:11:11 +01:00
|
|
|
#include "zeiterfassungsettings.h"
|
|
|
|
|
|
|
|
|
|
SettingsDialog::SettingsDialog(ZeiterfassungSettings &settings, QWidget *parent) :
|
|
|
|
|
QDialog(parent),
|
|
|
|
|
ui(new Ui::SettingsDialog),
|
|
|
|
|
m_settings(settings)
|
|
|
|
|
{
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
2017-12-05 21:24:55 +01:00
|
|
|
ui->comboBoxLanguage->addItem(tr("English"), QLocale::English);
|
|
|
|
|
ui->comboBoxLanguage->addItem(tr("German"), QLocale::German);
|
|
|
|
|
|
|
|
|
|
ui->comboBoxLanguage->setCurrentIndex(ui->comboBoxLanguage->findData(settings.language()));
|
2017-12-04 20:11:11 +01:00
|
|
|
|
|
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::submit);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SettingsDialog::~SettingsDialog()
|
|
|
|
|
{
|
|
|
|
|
delete ui;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void SettingsDialog::submit()
|
|
|
|
|
{
|
2017-12-05 21:24:55 +01:00
|
|
|
if(ui->comboBoxLanguage->currentData().value<QLocale::Language>() != m_settings.language())
|
|
|
|
|
{
|
|
|
|
|
m_settings.setLanguage(ui->comboBoxLanguage->currentData().value<QLocale::Language>());
|
|
|
|
|
QMessageBox::warning(this, tr("Restart required!"), tr("To apply the new language a restart is required!"));
|
|
|
|
|
}
|
2017-12-04 20:11:11 +01:00
|
|
|
|
|
|
|
|
accept();
|
|
|
|
|
}
|