Commit cb1e6464c8cedb00f9457e5cb30fb0b6e624b5f5

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

제품 정보 변경 기능 추가 및 버그 수정, 파일 다운로드 개선

 - 제품 정보 변경 기능을 위한 파일 업로드 기능 수정
 - 제품 설정 다운로드, 업로드 지정 폴더 개선
app/gui/oven_control/config.cpp
@@ -28,8 +28,6 @@ @@ -28,8 +28,6 @@
28 using namespace Define; 28 using namespace Define;
29 using namespace System; 29 using namespace System;
30 30
31 -#define CONFIG_FILE_NAME "/prime/config/config.ini"  
32 -#define FAVORITE_FILE_NAME "/prime/config/favorite.ini"  
33 31
34 Config* Config::instance = NULL; 32 Config* Config::instance = NULL;
35 33
app/gui/oven_control/config.h
@@ -14,6 +14,14 @@ @@ -14,6 +14,14 @@
14 #define MAX_HOTLINE_CHEF_CNT 3 14 #define MAX_HOTLINE_CHEF_CNT 3
15 #define MAX_HOTLINE_SERVICE_CNT 2 15 #define MAX_HOTLINE_SERVICE_CNT 2
16 16
  17 +#define CONFIG_FILE_NAME "/prime/config/config.ini"
  18 +#define FAVORITE_FILE_NAME "/prime/config/favorite.ini"
  19 +
  20 +
  21 +#define MODEL_INFO_FILE_NAME "/prime/config/model_info.csv"
  22 +#define CHEF_INFO_FILE_NAME "/prime/config/chef_info.csv"
  23 +#define SERVICE_INFO_FILE_NAME "/prime/config/service_info.csv"
  24 +
17 25
18 static const char rest_time_type_menu[2][16] = { 26 static const char rest_time_type_menu[2][16] = {
19 QT_TRANSLATE_NOOP("Config","잔여시간\0"), 27 QT_TRANSLATE_NOOP("Config","잔여시간\0"),
@@ -152,7 +160,8 @@ namespace Define @@ -152,7 +160,8 @@ namespace Define
152 config_demo_mode, 160 config_demo_mode,
153 config_enter_engineer_mode, 161 config_enter_engineer_mode,
154 config_model, 162 config_model,
155 - config_invalid = MAX_CONFIG_COUNT 163 + config_standard_info_upload,
  164 + config_invalid = MAX_CONFIG_COUNT+1
156 }; 165 };
157 166
158 typedef union _config_item{ 167 typedef union _config_item{
app/gui/oven_control/configinfodlg.cpp
@@ -6,9 +6,7 @@ @@ -6,9 +6,7 @@
6 #include "soundplayer.h" 6 #include "soundplayer.h"
7 #include "config.h" 7 #include "config.h"
8 8
9 -#define MODEL_INFO_FILE_NAME "/prime/config/model_info.txt"  
10 -#define CHEF_INFO_FILE_NAME "/prime/config/chef_info.txt"  
11 -#define SERVICE_INFO_FILE_NAME "/prime/config/service_info.txt" 9 +
12 10
13 static const char* g_strModelTypeName[] ={ 11 static const char* g_strModelTypeName[] ={
14 QT_TRANSLATE_NOOP("ConfigInfoDlg", "전기식 10단"), 12 QT_TRANSLATE_NOOP("ConfigInfoDlg", "전기식 10단"),
app/gui/oven_control/engineermenuwindow.cpp
@@ -8,6 +8,9 @@ @@ -8,6 +8,9 @@
8 #include "adjustmentwindow.h" 8 #include "adjustmentwindow.h"
9 #include "modelsettingwindow.h" 9 #include "modelsettingwindow.h"
10 #include "soundplayer.h" 10 #include "soundplayer.h"
  11 +#include "fileprocessor.h"
  12 +#include "fileprocessdlg.h"
  13 +#include "usbcheckpopupdlg.h"
11 14
12 #include <QKeyEvent> 15 #include <QKeyEvent>
13 16
@@ -107,7 +110,17 @@ void EngineerMenuWindow::on_engAdjustButton_clicked() @@ -107,7 +110,17 @@ void EngineerMenuWindow::on_engAdjustButton_clicked()
107 110
108 void EngineerMenuWindow::on_stdConfigButton_clicked() 111 void EngineerMenuWindow::on_stdConfigButton_clicked()
109 { 112 {
110 - 113 + QDialog* dlg;
  114 + QString usbPath="";
  115 + if(!FileProcessor::detectUSB(usbPath)){
  116 + dlg = new UsbCheckPopupDlg(this);
  117 + dlg->exec();
  118 + }
  119 + if(FileProcessor::detectUSB(usbPath)){
  120 + qDebug() << "standard upload exe";
  121 + dlg = new FileProcessDlg(this,Define::config_standard_info_upload, false);
  122 + dlg->exec();
  123 + }
111 } 124 }
112 125
113 void EngineerMenuWindow::on_modelTypeConfigButton_clicked() 126 void EngineerMenuWindow::on_modelTypeConfigButton_clicked()
app/gui/oven_control/fileprocessdlg.cpp
@@ -5,6 +5,7 @@ @@ -5,6 +5,7 @@
5 #include "fileprocessor.h" 5 #include "fileprocessor.h"
6 #include "ovenstatics.h" 6 #include "ovenstatics.h"
7 #include "stringer.h" 7 #include "stringer.h"
  8 +#include "config.h"
8 #include <QDebug> 9 #include <QDebug>
9 10
10 11
@@ -264,6 +265,9 @@ FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) : @@ -264,6 +265,9 @@ FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) :
264 case config_set_upload: 265 case config_set_upload:
265 QTimer::singleShot(100,this,SLOT(configUpload())); 266 QTimer::singleShot(100,this,SLOT(configUpload()));
266 break; 267 break;
  268 + case config_standard_info_upload:
  269 + QTimer::singleShot(100,this,SLOT(standardInfoUpload()));
  270 + break;
267 default: 271 default:
268 QTimer::singleShot(200,this,SLOT(deleteLater())); 272 QTimer::singleShot(200,this,SLOT(deleteLater()));
269 break; 273 break;
@@ -646,13 +650,16 @@ void FileProcessDlg::programUpload(){ @@ -646,13 +650,16 @@ void FileProcessDlg::programUpload(){
646 650
647 void FileProcessDlg::configDownload(){ 651 void FileProcessDlg::configDownload(){
648 QString strUsbPath; 652 QString strUsbPath;
  653 + QString strSrcPath;
649 if(FileProcessor::detectUSB(strUsbPath)){ 654 if(FileProcessor::detectUSB(strUsbPath)){
650 - strUsbPath.append("/config.ini");  
651 - qDebug() << strUsbPath; 655 + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(CONFIG_FILE_NAME);
  656 + QFileInfo finfo(strSrcPath);
  657 + QDir fdir = finfo.absoluteDir();
  658 + if(finfo.absoluteDir().exists() == false) fdir.mkpath(finfo.absolutePath());
652 QFile file; 659 QFile file;
653 - file.setFileName(strUsbPath); 660 + file.setFileName(strSrcPath);
654 if(file.exists()) file.remove(); 661 if(file.exists()) file.remove();
655 - if(QFile::copy("/prime/config/config.ini", strUsbPath)){ 662 + if(QFile::copy(CONFIG_FILE_NAME, strSrcPath)){
656 sync(); 663 sync();
657 ui->ctrWjProcess->setValue(50); 664 ui->ctrWjProcess->setValue(50);
658 ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초")); 665 ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초"));
@@ -662,10 +669,10 @@ void FileProcessDlg::configDownload(){ @@ -662,10 +669,10 @@ void FileProcessDlg::configDownload(){
662 QTimer::singleShot(1000,this,SLOT(close())); 669 QTimer::singleShot(1000,this,SLOT(close()));
663 return; 670 return;
664 } 671 }
665 - strUsbPath.replace("/config.ini","/favorite.ini");  
666 - file.setFileName(strUsbPath); 672 + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(FAVORITE_FILE_NAME);
  673 + file.setFileName(strSrcPath);
667 if(file.exists()) file.remove(); 674 if(file.exists()) file.remove();
668 - if(QFile::copy("/prime/config/favorite.ini", strUsbPath)){ 675 + if(QFile::copy(FAVORITE_FILE_NAME, strSrcPath)){
669 sync(); 676 sync();
670 ui->ctrWjProcess->setValue(100); 677 ui->ctrWjProcess->setValue(100);
671 ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료")); 678 ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
@@ -684,13 +691,13 @@ void FileProcessDlg::configDownload(){ @@ -684,13 +691,13 @@ void FileProcessDlg::configDownload(){
684 691
685 void FileProcessDlg::configUpload(){ 692 void FileProcessDlg::configUpload(){
686 QString strUsbPath; 693 QString strUsbPath;
  694 + QString strSrcPath;
687 Config *cfg = Config::getInstance(); 695 Config *cfg = Config::getInstance();
688 if(FileProcessor::detectUSB(strUsbPath)){ 696 if(FileProcessor::detectUSB(strUsbPath)){
689 - strUsbPath.append("/config.ini");  
690 - qDebug() << strUsbPath;  
691 - QFile file("/prime/config/config.ini"); 697 + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(CONFIG_FILE_NAME);
  698 + QFile file(CONFIG_FILE_NAME);
692 file.remove(); 699 file.remove();
693 - if(QFile::copy( strUsbPath , "/prime/config/config.ini")){ 700 + if(QFile::copy( strSrcPath , CONFIG_FILE_NAME)){
694 sync(); 701 sync();
695 cfg->loadConfig(); 702 cfg->loadConfig();
696 cfg->applyConfig(); 703 cfg->applyConfig();
@@ -702,11 +709,10 @@ void FileProcessDlg::configUpload(){ @@ -702,11 +709,10 @@ void FileProcessDlg::configUpload(){
702 QTimer::singleShot(1000,this,SLOT(close())); 709 QTimer::singleShot(1000,this,SLOT(close()));
703 return; 710 return;
704 } 711 }
705 - QFile file2("/prime/config/favorite.ini");  
706 - file2.remove();  
707 - strUsbPath.replace("/config.ini", "/favorite.ini");  
708 - qDebug() << strUsbPath;  
709 - if(QFile::copy( strUsbPath , "/prime/config/favorite.ini")){ 712 + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(FAVORITE_FILE_NAME);
  713 + file.setFileName(FAVORITE_FILE_NAME);
  714 + file.remove();
  715 + if(QFile::copy( strSrcPath , FAVORITE_FILE_NAME)){
710 sync(); 716 sync();
711 cfg->loadFavorite(); 717 cfg->loadFavorite();
712 ui->ctrWjProcess->setValue(100); 718 ui->ctrWjProcess->setValue(100);
@@ -730,6 +736,63 @@ void FileProcessDlg::haccpdataDownload(){ @@ -730,6 +736,63 @@ void FileProcessDlg::haccpdataDownload(){
730 QTimer::singleShot(1000,this,SLOT(close())); 736 QTimer::singleShot(1000,this,SLOT(close()));
731 } 737 }
732 738
  739 +void FileProcessDlg::standardInfoUpload()
  740 +{
  741 + QString strUsbPath;
  742 + QString strSrcPath;
  743 + Config *cfg = Config::getInstance();
  744 + if(FileProcessor::detectUSB(strUsbPath)){
  745 + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(MODEL_INFO_FILE_NAME);
  746 + QFile file(MODEL_INFO_FILE_NAME);
  747 + file.remove();
  748 + if(QFile::copy( strSrcPath ,MODEL_INFO_FILE_NAME)){
  749 + sync();
  750 + ui->ctrWjProcess->setValue(40);
  751 + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 2초"));
  752 + }
  753 + else{
  754 + ui->ctrLbRemainTime->setText(tr("모델 정보 업로드에 실패하였습니다."));
  755 + QTimer::singleShot(1000,this,SLOT(close()));
  756 + return;
  757 + }
  758 + //QThread::msleep(800);
  759 + file.setFileName(CHEF_INFO_FILE_NAME);
  760 + file.remove();
  761 + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(CHEF_INFO_FILE_NAME);
  762 + qDebug() << strSrcPath;
  763 + if(QFile::copy( strSrcPath ,CHEF_INFO_FILE_NAME)){
  764 + sync();
  765 + ui->ctrWjProcess->setValue(70);
  766 + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1"));
  767 + QTimer::singleShot(1000,this,SLOT(close()));
  768 + }
  769 + else{
  770 + ui->ctrLbRemainTime->setText(tr("핫라인 쉐프 정보 업로드에 실패하였습니다."));
  771 + QTimer::singleShot(1000,this,SLOT(close()));
  772 + }
  773 + //QThread::msleep(800);
  774 + file.setFileName(SERVICE_INFO_FILE_NAME);
  775 + file.remove();
  776 + strSrcPath = QString("%1/%2").arg(strUsbPath).arg(SERVICE_INFO_FILE_NAME);
  777 + qDebug() << strSrcPath;
  778 + if(QFile::copy( strSrcPath ,SERVICE_INFO_FILE_NAME)){
  779 + sync();
  780 + ui->ctrWjProcess->setValue(100);
  781 + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
  782 + qDebug() << "standard upload success";
  783 + QTimer::singleShot(1000,this,SLOT(close()));
  784 + }
  785 + else{
  786 + ui->ctrLbRemainTime->setText(tr("핫라인 서비스 정보 업로드에 실패하였습니다."));
  787 + QTimer::singleShot(1000,this,SLOT(close()));
  788 + }
  789 + }
  790 + else{
  791 + ui->ctrLbRemainTime->setText(tr("USB 인식을 실패하였습니다."));
  792 + QTimer::singleShot(1000,this,SLOT(close()));
  793 + }
  794 +}
  795 +
733 void FileProcessDlg::keyPressEvent(QKeyEvent *event){ 796 void FileProcessDlg::keyPressEvent(QKeyEvent *event){
734 797
735 } 798 }
app/gui/oven_control/fileprocessdlg.h
@@ -66,6 +66,7 @@ private slots: @@ -66,6 +66,7 @@ private slots:
66 void configDownload(); 66 void configDownload();
67 void configUpload(); 67 void configUpload();
68 void haccpdataDownload(); 68 void haccpdataDownload();
  69 + void standardInfoUpload();
69 70
70 signals: 71 signals:
71 void stopcopy(); 72 void stopcopy();
app/gui/oven_control/oven_control.pro
@@ -127,6 +127,7 @@ SOURCES += main.cpp\ @@ -127,6 +127,7 @@ SOURCES += main.cpp\
127 demoicon.cpp \ 127 demoicon.cpp \
128 halfenergyicon.cpp 128 halfenergyicon.cpp
129 129
  130 +
130 HEADERS += mainwindow.h \ 131 HEADERS += mainwindow.h \
131 cook.h \ 132 cook.h \
132 oven.h \ 133 oven.h \