-
Notifications
You must be signed in to change notification settings - Fork 0
/
SettingDlg.cpp
43 lines (32 loc) · 1.16 KB
/
SettingDlg.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "SettingDlg.h"
#include "ui_SettingDlg.h"
#include <NotPrjRel.h>
#include <QMessageBox>
SettingDlg::SettingDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::SettingDlg)
{
ui->setupUi(this);
ui->label_LangIcon->setMinimumSize(20, 20);
ui->label_LangIcon->setPixmap(QPixmap("://images/locale.png").scaledToHeight(20));
ui->comboBox_Lang->blockSignals(true);
ui->comboBox_Lang->addItem(tr("System"), "System");
ui->comboBox_Lang->addItem("Chinese(中文)", "Chinese");
ui->comboBox_Lang->addItem("English", "English");
IniSetting setting("setting.ini");
int idx = ui->comboBox_Lang->findData(setting.value("language", "System").toString());
ui->comboBox_Lang->setCurrentIndex(idx);
ui->comboBox_Lang->blockSignals(false);
}
SettingDlg::~SettingDlg()
{
delete ui;
}
void SettingDlg::on_comboBox_Lang_currentIndexChanged(int index)
{
IniSetting setting("setting.ini");
QString sLang = ui->comboBox_Lang->itemData(index).toString();
setting.setValue("language", sLang);
QMessageBox::information(this, "", tr("Take effect after restart"));
accept();
}