Commit 2ddb05828aa84d628c44e03d3fefd79f1f8c5d20

Authored by 고영탁
1 parent 0faa32511e
Exists in master and in 2 other branches fhd, fhd-demo

다국어 처리 추가

 - 부팅시 다국어 처리
app/gui/oven_control/config.cpp
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 #include <QDateTime> 2 #include <QDateTime>
3 #include <QFile> 3 #include <QFile>
4 #include <QIODevice> 4 #include <QIODevice>
  5 +#include <QApplication>
5 #include "config.h" 6 #include "config.h"
6 #include "configdatetimedlg.h" 7 #include "configdatetimedlg.h"
7 #include "configlanguagedlg.h" 8 #include "configlanguagedlg.h"
@@ -38,6 +39,7 @@ Config::Config(QObject *parent) : QObject(parent) @@ -38,6 +39,7 @@ Config::Config(QObject *parent) : QObject(parent)
38 loadConfig(); 39 loadConfig();
39 loadFavorite(); 40 loadFavorite();
40 qApp->installEventFilter(&watcher); 41 qApp->installEventFilter(&watcher);
  42 + applyCurrentConfigLanguage();
41 applyConfig(); 43 applyConfig();
42 44
43 45
@@ -439,6 +441,24 @@ QString Config::getProductSerial() @@ -439,6 +441,24 @@ QString Config::getProductSerial()
439 return strProductSerial; 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 void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ 462 void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){
443 QDialog *dlg; 463 QDialog *dlg;
444 QString usbPath = ""; 464 QString usbPath = "";
app/gui/oven_control/config.h
@@ -439,6 +439,7 @@ public: @@ -439,6 +439,7 @@ public:
439 void insertFavorite(Define::ConfigType idx); 439 void insertFavorite(Define::ConfigType idx);
440 void removeFavorite(Define::ConfigType idx); 440 void removeFavorite(Define::ConfigType idx);
441 QString getProductSerial(); 441 QString getProductSerial();
  442 + void applyCurrentConfigLanguage();
442 443
443 444
444 445
app/gui/oven_control/configlanguagedlg.cpp
  1 +#include <QDebug>
1 #include "config.h" 2 #include "config.h"
2 #include "configlanguagedlg.h" 3 #include "configlanguagedlg.h"
3 #include "ui_configlanguagedlg.h" 4 #include "ui_configlanguagedlg.h"
@@ -27,7 +28,7 @@ ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) : @@ -27,7 +28,7 @@ ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) :
27 28
28 Config *cfg = Config::getInstance(); 29 Config *cfg = Config::getInstance();
29 config_item item; 30 config_item item;
30 - cfg->getConfigValue(config_language); 31 + item = cfg->getConfigValue(config_language);
31 m_nCurSelLang = item.d32; 32 m_nCurSelLang = item.d32;
32 33
33 m_pSignalMapper = new QSignalMapper(this); 34 m_pSignalMapper = new QSignalMapper(this);
@@ -74,6 +75,7 @@ void ConfigLanguageDlg::onConfigBtnClicked(const int sel){ @@ -74,6 +75,7 @@ void ConfigLanguageDlg::onConfigBtnClicked(const int sel){
74 } 75 }
75 76
76 void ConfigLanguageDlg::reloadUi(){ 77 void ConfigLanguageDlg::reloadUi(){
  78 + qDebug() << "Set Lang checked " << m_nCurSelLang;
77 switch(m_nCurSelLang){ 79 switch(m_nCurSelLang){
78 case 0: 80 case 0:
79 ui->pushButton_1->setChecked(true); 81 ui->pushButton_1->setChecked(true);