diff --git a/app/gui/oven_control/config.cpp b/app/gui/oven_control/config.cpp index 7ab22b0..d70b4aa 100644 --- a/app/gui/oven_control/config.cpp +++ b/app/gui/oven_control/config.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "config.h" #include "configdatetimedlg.h" #include "configlanguagedlg.h" @@ -38,6 +39,7 @@ Config::Config(QObject *parent) : QObject(parent) loadConfig(); loadFavorite(); qApp->installEventFilter(&watcher); + applyCurrentConfigLanguage(); applyConfig(); @@ -439,6 +441,24 @@ QString Config::getProductSerial() return strProductSerial; } +void Config::applyCurrentConfigLanguage() +{ + if(configlist.items.language.d32 == 0){ +// QApplication::removeTranslator(); +// QTranslator* trans = new QTranslator(); +// qDebug() << trans->load(":/lang_en.qm"); +// QApplication::removeTranslator(QApplication::) + } + else if(configlist.items.language.d32 ==2){ + QTranslator* trans = new QTranslator(); + qDebug() << trans->load(":/lang_en.qm"); + QApplication::installTranslator(trans); + } + else if(configlist.items.language.d32 == 2){ + //QTranslator *tr + } +} + void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ QDialog *dlg; QString usbPath = ""; diff --git a/app/gui/oven_control/config.h b/app/gui/oven_control/config.h index 1238cf8..7ed1027 100644 --- a/app/gui/oven_control/config.h +++ b/app/gui/oven_control/config.h @@ -439,6 +439,7 @@ public: void insertFavorite(Define::ConfigType idx); void removeFavorite(Define::ConfigType idx); QString getProductSerial(); + void applyCurrentConfigLanguage(); diff --git a/app/gui/oven_control/configlanguagedlg.cpp b/app/gui/oven_control/configlanguagedlg.cpp index 8eebc85..a2cc3fd 100644 --- a/app/gui/oven_control/configlanguagedlg.cpp +++ b/app/gui/oven_control/configlanguagedlg.cpp @@ -1,3 +1,4 @@ +#include #include "config.h" #include "configlanguagedlg.h" #include "ui_configlanguagedlg.h" @@ -27,7 +28,7 @@ ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) : Config *cfg = Config::getInstance(); config_item item; - cfg->getConfigValue(config_language); + item = cfg->getConfigValue(config_language); m_nCurSelLang = item.d32; m_pSignalMapper = new QSignalMapper(this); @@ -74,6 +75,7 @@ void ConfigLanguageDlg::onConfigBtnClicked(const int sel){ } void ConfigLanguageDlg::reloadUi(){ + qDebug() << "Set Lang checked " << m_nCurSelLang; switch(m_nCurSelLang){ case 0: ui->pushButton_1->setChecked(true);