-
Notifications
You must be signed in to change notification settings - Fork 0
/
SettingDlg.cpp
47 lines (37 loc) · 1.33 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
44
45
46
47
#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);
// QStringList langList;
// langList<< "System";
// langList<< "Chinese";
// langList<< "English";
// ui->comboBox_Lang->addItems(langList);
ui->comboBox_Lang->addItem(tr("System"), "System");
ui->comboBox_Lang->addItem("Simplified Chinese (简体中文)", "SimplifiedChinese");
ui->comboBox_Lang->addItem("English", "English");
IniSetting cfg("config.ini");
int idx = ui->comboBox_Lang->findData(cfg.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 cfg("config.ini");
QString sLang = ui->comboBox_Lang->itemData(index).toString();
cfg.setValue("language", sLang);
QMessageBox::information(this, "", tr("Take effect after restart"));
accept();
}