diff --git a/app/gui/oven_control/config.cpp b/app/gui/oven_control/config.cpp index e83af7c..ffea9d4 100644 --- a/app/gui/oven_control/config.cpp +++ b/app/gui/oven_control/config.cpp @@ -28,8 +28,6 @@ using namespace Define; using namespace System; -#define CONFIG_FILE_NAME "/prime/config/config.ini" -#define FAVORITE_FILE_NAME "/prime/config/favorite.ini" Config* Config::instance = NULL; diff --git a/app/gui/oven_control/config.h b/app/gui/oven_control/config.h index 0c6647c..4a2cb30 100644 --- a/app/gui/oven_control/config.h +++ b/app/gui/oven_control/config.h @@ -14,6 +14,14 @@ #define MAX_HOTLINE_CHEF_CNT 3 #define MAX_HOTLINE_SERVICE_CNT 2 +#define CONFIG_FILE_NAME "/prime/config/config.ini" +#define FAVORITE_FILE_NAME "/prime/config/favorite.ini" + + +#define MODEL_INFO_FILE_NAME "/prime/config/model_info.csv" +#define CHEF_INFO_FILE_NAME "/prime/config/chef_info.csv" +#define SERVICE_INFO_FILE_NAME "/prime/config/service_info.csv" + static const char rest_time_type_menu[2][16] = { QT_TRANSLATE_NOOP("Config","잔여시간\0"), @@ -152,7 +160,8 @@ namespace Define config_demo_mode, config_enter_engineer_mode, config_model, - config_invalid = MAX_CONFIG_COUNT + config_standard_info_upload, + config_invalid = MAX_CONFIG_COUNT+1 }; typedef union _config_item{ diff --git a/app/gui/oven_control/configinfodlg.cpp b/app/gui/oven_control/configinfodlg.cpp index 047ffa6..593482f 100644 --- a/app/gui/oven_control/configinfodlg.cpp +++ b/app/gui/oven_control/configinfodlg.cpp @@ -6,9 +6,7 @@ #include "soundplayer.h" #include "config.h" -#define MODEL_INFO_FILE_NAME "/prime/config/model_info.txt" -#define CHEF_INFO_FILE_NAME "/prime/config/chef_info.txt" -#define SERVICE_INFO_FILE_NAME "/prime/config/service_info.txt" + static const char* g_strModelTypeName[] ={ QT_TRANSLATE_NOOP("ConfigInfoDlg", "전기식 10단"), diff --git a/app/gui/oven_control/engineermenuwindow.cpp b/app/gui/oven_control/engineermenuwindow.cpp index bce913a..f1b759a 100644 --- a/app/gui/oven_control/engineermenuwindow.cpp +++ b/app/gui/oven_control/engineermenuwindow.cpp @@ -8,6 +8,9 @@ #include "adjustmentwindow.h" #include "modelsettingwindow.h" #include "soundplayer.h" +#include "fileprocessor.h" +#include "fileprocessdlg.h" +#include "usbcheckpopupdlg.h" #include @@ -107,7 +110,17 @@ void EngineerMenuWindow::on_engAdjustButton_clicked() void EngineerMenuWindow::on_stdConfigButton_clicked() { - + QDialog* dlg; + QString usbPath=""; + if(!FileProcessor::detectUSB(usbPath)){ + dlg = new UsbCheckPopupDlg(this); + dlg->exec(); + } + if(FileProcessor::detectUSB(usbPath)){ + qDebug() << "standard upload exe"; + dlg = new FileProcessDlg(this,Define::config_standard_info_upload, false); + dlg->exec(); + } } void EngineerMenuWindow::on_modelTypeConfigButton_clicked() diff --git a/app/gui/oven_control/fileprocessdlg.cpp b/app/gui/oven_control/fileprocessdlg.cpp index d8f2c37..fa1524a 100644 --- a/app/gui/oven_control/fileprocessdlg.cpp +++ b/app/gui/oven_control/fileprocessdlg.cpp @@ -5,6 +5,7 @@ #include "fileprocessor.h" #include "ovenstatics.h" #include "stringer.h" +#include "config.h" #include @@ -264,6 +265,9 @@ FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) : case config_set_upload: QTimer::singleShot(100,this,SLOT(configUpload())); break; + case config_standard_info_upload: + QTimer::singleShot(100,this,SLOT(standardInfoUpload())); + break; default: QTimer::singleShot(200,this,SLOT(deleteLater())); break; @@ -646,13 +650,16 @@ void FileProcessDlg::programUpload(){ void FileProcessDlg::configDownload(){ QString strUsbPath; + QString strSrcPath; if(FileProcessor::detectUSB(strUsbPath)){ - strUsbPath.append("/config.ini"); - qDebug() << strUsbPath; + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(CONFIG_FILE_NAME); + QFileInfo finfo(strSrcPath); + QDir fdir = finfo.absoluteDir(); + if(finfo.absoluteDir().exists() == false) fdir.mkpath(finfo.absolutePath()); QFile file; - file.setFileName(strUsbPath); + file.setFileName(strSrcPath); if(file.exists()) file.remove(); - if(QFile::copy("/prime/config/config.ini", strUsbPath)){ + if(QFile::copy(CONFIG_FILE_NAME, strSrcPath)){ sync(); ui->ctrWjProcess->setValue(50); ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초")); @@ -662,10 +669,10 @@ void FileProcessDlg::configDownload(){ QTimer::singleShot(1000,this,SLOT(close())); return; } - strUsbPath.replace("/config.ini","/favorite.ini"); - file.setFileName(strUsbPath); + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(FAVORITE_FILE_NAME); + file.setFileName(strSrcPath); if(file.exists()) file.remove(); - if(QFile::copy("/prime/config/favorite.ini", strUsbPath)){ + if(QFile::copy(FAVORITE_FILE_NAME, strSrcPath)){ sync(); ui->ctrWjProcess->setValue(100); ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료")); @@ -684,13 +691,13 @@ void FileProcessDlg::configDownload(){ void FileProcessDlg::configUpload(){ QString strUsbPath; + QString strSrcPath; Config *cfg = Config::getInstance(); if(FileProcessor::detectUSB(strUsbPath)){ - strUsbPath.append("/config.ini"); - qDebug() << strUsbPath; - QFile file("/prime/config/config.ini"); + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(CONFIG_FILE_NAME); + QFile file(CONFIG_FILE_NAME); file.remove(); - if(QFile::copy( strUsbPath , "/prime/config/config.ini")){ + if(QFile::copy( strSrcPath , CONFIG_FILE_NAME)){ sync(); cfg->loadConfig(); cfg->applyConfig(); @@ -702,11 +709,10 @@ void FileProcessDlg::configUpload(){ QTimer::singleShot(1000,this,SLOT(close())); return; } - QFile file2("/prime/config/favorite.ini"); - file2.remove(); - strUsbPath.replace("/config.ini", "/favorite.ini"); - qDebug() << strUsbPath; - if(QFile::copy( strUsbPath , "/prime/config/favorite.ini")){ + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(FAVORITE_FILE_NAME); + file.setFileName(FAVORITE_FILE_NAME); + file.remove(); + if(QFile::copy( strSrcPath , FAVORITE_FILE_NAME)){ sync(); cfg->loadFavorite(); ui->ctrWjProcess->setValue(100); @@ -730,6 +736,63 @@ void FileProcessDlg::haccpdataDownload(){ QTimer::singleShot(1000,this,SLOT(close())); } +void FileProcessDlg::standardInfoUpload() +{ + QString strUsbPath; + QString strSrcPath; + Config *cfg = Config::getInstance(); + if(FileProcessor::detectUSB(strUsbPath)){ + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(MODEL_INFO_FILE_NAME); + QFile file(MODEL_INFO_FILE_NAME); + file.remove(); + if(QFile::copy( strSrcPath ,MODEL_INFO_FILE_NAME)){ + sync(); + ui->ctrWjProcess->setValue(40); + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 2초")); + } + else{ + ui->ctrLbRemainTime->setText(tr("모델 정보 업로드에 실패하였습니다.")); + QTimer::singleShot(1000,this,SLOT(close())); + return; + } + //QThread::msleep(800); + file.setFileName(CHEF_INFO_FILE_NAME); + file.remove(); + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(CHEF_INFO_FILE_NAME); + qDebug() << strSrcPath; + if(QFile::copy( strSrcPath ,CHEF_INFO_FILE_NAME)){ + sync(); + ui->ctrWjProcess->setValue(70); + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1")); + QTimer::singleShot(1000,this,SLOT(close())); + } + else{ + ui->ctrLbRemainTime->setText(tr("핫라인 쉐프 정보 업로드에 실패하였습니다.")); + QTimer::singleShot(1000,this,SLOT(close())); + } + //QThread::msleep(800); + file.setFileName(SERVICE_INFO_FILE_NAME); + file.remove(); + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(SERVICE_INFO_FILE_NAME); + qDebug() << strSrcPath; + if(QFile::copy( strSrcPath ,SERVICE_INFO_FILE_NAME)){ + sync(); + ui->ctrWjProcess->setValue(100); + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료")); + qDebug() << "standard upload success"; + QTimer::singleShot(1000,this,SLOT(close())); + } + else{ + ui->ctrLbRemainTime->setText(tr("핫라인 서비스 정보 업로드에 실패하였습니다.")); + QTimer::singleShot(1000,this,SLOT(close())); + } + } + else{ + ui->ctrLbRemainTime->setText(tr("USB 인식을 실패하였습니다.")); + QTimer::singleShot(1000,this,SLOT(close())); + } +} + void FileProcessDlg::keyPressEvent(QKeyEvent *event){ } diff --git a/app/gui/oven_control/fileprocessdlg.h b/app/gui/oven_control/fileprocessdlg.h index 683c961..7a73421 100644 --- a/app/gui/oven_control/fileprocessdlg.h +++ b/app/gui/oven_control/fileprocessdlg.h @@ -66,6 +66,7 @@ private slots: void configDownload(); void configUpload(); void haccpdataDownload(); + void standardInfoUpload(); signals: void stopcopy(); diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index f673428..f00c178 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -127,6 +127,7 @@ SOURCES += main.cpp\ demoicon.cpp \ halfenergyicon.cpp + HEADERS += mainwindow.h \ cook.h \ oven.h \