Commit 2ddb05828aa84d628c44e03d3fefd79f1f8c5d20
1 parent
0faa32511e
Exists in
master
and in
2 other branches
다국어 처리 추가
- 부팅시 다국어 처리
Showing
3 changed files
with
24 additions
and
1 deletions
Show diff stats
app/gui/oven_control/config.cpp
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | #include <QDateTime> |
3 | 3 | #include <QFile> |
4 | 4 | #include <QIODevice> |
5 | +#include <QApplication> | |
5 | 6 | #include "config.h" |
6 | 7 | #include "configdatetimedlg.h" |
7 | 8 | #include "configlanguagedlg.h" |
... | ... | @@ -38,6 +39,7 @@ Config::Config(QObject *parent) : QObject(parent) |
38 | 39 | loadConfig(); |
39 | 40 | loadFavorite(); |
40 | 41 | qApp->installEventFilter(&watcher); |
42 | + applyCurrentConfigLanguage(); | |
41 | 43 | applyConfig(); |
42 | 44 | |
43 | 45 | |
... | ... | @@ -439,6 +441,24 @@ QString Config::getProductSerial() |
439 | 441 | return strProductSerial; |
440 | 442 | } |
441 | 443 | |
444 | +void Config::applyCurrentConfigLanguage() | |
445 | +{ | |
446 | + if(configlist.items.language.d32 == 0){ | |
447 | +// QApplication::removeTranslator(); | |
448 | +// QTranslator* trans = new QTranslator(); | |
449 | +// qDebug() << trans->load(":/lang_en.qm"); | |
450 | +// QApplication::removeTranslator(QApplication::) | |
451 | + } | |
452 | + else if(configlist.items.language.d32 ==2){ | |
453 | + QTranslator* trans = new QTranslator(); | |
454 | + qDebug() << trans->load(":/lang_en.qm"); | |
455 | + QApplication::installTranslator(trans); | |
456 | + } | |
457 | + else if(configlist.items.language.d32 == 2){ | |
458 | + //QTranslator *tr | |
459 | + } | |
460 | +} | |
461 | + | |
442 | 462 | void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ |
443 | 463 | QDialog *dlg; |
444 | 464 | QString usbPath = ""; | ... | ... |
app/gui/oven_control/config.h
app/gui/oven_control/configlanguagedlg.cpp
1 | +#include <QDebug> | |
1 | 2 | #include "config.h" |
2 | 3 | #include "configlanguagedlg.h" |
3 | 4 | #include "ui_configlanguagedlg.h" |
... | ... | @@ -27,7 +28,7 @@ ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) : |
27 | 28 | |
28 | 29 | Config *cfg = Config::getInstance(); |
29 | 30 | config_item item; |
30 | - cfg->getConfigValue(config_language); | |
31 | + item = cfg->getConfigValue(config_language); | |
31 | 32 | m_nCurSelLang = item.d32; |
32 | 33 | |
33 | 34 | m_pSignalMapper = new QSignalMapper(this); |
... | ... | @@ -74,6 +75,7 @@ void ConfigLanguageDlg::onConfigBtnClicked(const int sel){ |
74 | 75 | } |
75 | 76 | |
76 | 77 | void ConfigLanguageDlg::reloadUi(){ |
78 | + qDebug() << "Set Lang checked " << m_nCurSelLang; | |
77 | 79 | switch(m_nCurSelLang){ |
78 | 80 | case 0: |
79 | 81 | ui->pushButton_1->setChecked(true); | ... | ... |