Commit cb1e6464c8cedb00f9457e5cb30fb0b6e624b5f5
1 parent
4e55b16605
Exists in
master
and in
2 other branches
제품 정보 변경 기능 추가 및 버그 수정, 파일 다운로드 개선
- 제품 정보 변경 기능을 위한 파일 업로드 기능 수정 - 제품 설정 다운로드, 업로드 지정 폴더 개선
Showing
7 changed files
with
106 additions
and
23 deletions
Show diff stats
app/gui/oven_control/config.cpp
app/gui/oven_control/config.h
... | ... | @@ -14,6 +14,14 @@ |
14 | 14 | #define MAX_HOTLINE_CHEF_CNT 3 |
15 | 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 | 26 | static const char rest_time_type_menu[2][16] = { |
19 | 27 | QT_TRANSLATE_NOOP("Config","잔여시간\0"), |
... | ... | @@ -152,7 +160,8 @@ namespace Define |
152 | 160 | config_demo_mode, |
153 | 161 | config_enter_engineer_mode, |
154 | 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 | 167 | typedef union _config_item{ | ... | ... |
app/gui/oven_control/configinfodlg.cpp
... | ... | @@ -6,9 +6,7 @@ |
6 | 6 | #include "soundplayer.h" |
7 | 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 | 11 | static const char* g_strModelTypeName[] ={ |
14 | 12 | QT_TRANSLATE_NOOP("ConfigInfoDlg", "전기식 10단"), | ... | ... |
app/gui/oven_control/engineermenuwindow.cpp
... | ... | @@ -8,6 +8,9 @@ |
8 | 8 | #include "adjustmentwindow.h" |
9 | 9 | #include "modelsettingwindow.h" |
10 | 10 | #include "soundplayer.h" |
11 | +#include "fileprocessor.h" | |
12 | +#include "fileprocessdlg.h" | |
13 | +#include "usbcheckpopupdlg.h" | |
11 | 14 | |
12 | 15 | #include <QKeyEvent> |
13 | 16 | |
... | ... | @@ -107,7 +110,17 @@ void EngineerMenuWindow::on_engAdjustButton_clicked() |
107 | 110 | |
108 | 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 | 126 | void EngineerMenuWindow::on_modelTypeConfigButton_clicked() | ... | ... |
app/gui/oven_control/fileprocessdlg.cpp
... | ... | @@ -5,6 +5,7 @@ |
5 | 5 | #include "fileprocessor.h" |
6 | 6 | #include "ovenstatics.h" |
7 | 7 | #include "stringer.h" |
8 | +#include "config.h" | |
8 | 9 | #include <QDebug> |
9 | 10 | |
10 | 11 | |
... | ... | @@ -264,6 +265,9 @@ FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) : |
264 | 265 | case config_set_upload: |
265 | 266 | QTimer::singleShot(100,this,SLOT(configUpload())); |
266 | 267 | break; |
268 | + case config_standard_info_upload: | |
269 | + QTimer::singleShot(100,this,SLOT(standardInfoUpload())); | |
270 | + break; | |
267 | 271 | default: |
268 | 272 | QTimer::singleShot(200,this,SLOT(deleteLater())); |
269 | 273 | break; |
... | ... | @@ -646,13 +650,16 @@ void FileProcessDlg::programUpload(){ |
646 | 650 | |
647 | 651 | void FileProcessDlg::configDownload(){ |
648 | 652 | QString strUsbPath; |
653 | + QString strSrcPath; | |
649 | 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 | 659 | QFile file; |
653 | - file.setFileName(strUsbPath); | |
660 | + file.setFileName(strSrcPath); | |
654 | 661 | if(file.exists()) file.remove(); |
655 | - if(QFile::copy("/prime/config/config.ini", strUsbPath)){ | |
662 | + if(QFile::copy(CONFIG_FILE_NAME, strSrcPath)){ | |
656 | 663 | sync(); |
657 | 664 | ui->ctrWjProcess->setValue(50); |
658 | 665 | ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초")); |
... | ... | @@ -662,10 +669,10 @@ void FileProcessDlg::configDownload(){ |
662 | 669 | QTimer::singleShot(1000,this,SLOT(close())); |
663 | 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 | 674 | if(file.exists()) file.remove(); |
668 | - if(QFile::copy("/prime/config/favorite.ini", strUsbPath)){ | |
675 | + if(QFile::copy(FAVORITE_FILE_NAME, strSrcPath)){ | |
669 | 676 | sync(); |
670 | 677 | ui->ctrWjProcess->setValue(100); |
671 | 678 | ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료")); |
... | ... | @@ -684,13 +691,13 @@ void FileProcessDlg::configDownload(){ |
684 | 691 | |
685 | 692 | void FileProcessDlg::configUpload(){ |
686 | 693 | QString strUsbPath; |
694 | + QString strSrcPath; | |
687 | 695 | Config *cfg = Config::getInstance(); |
688 | 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 | 699 | file.remove(); |
693 | - if(QFile::copy( strUsbPath , "/prime/config/config.ini")){ | |
700 | + if(QFile::copy( strSrcPath , CONFIG_FILE_NAME)){ | |
694 | 701 | sync(); |
695 | 702 | cfg->loadConfig(); |
696 | 703 | cfg->applyConfig(); |
... | ... | @@ -702,11 +709,10 @@ void FileProcessDlg::configUpload(){ |
702 | 709 | QTimer::singleShot(1000,this,SLOT(close())); |
703 | 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 | 716 | sync(); |
711 | 717 | cfg->loadFavorite(); |
712 | 718 | ui->ctrWjProcess->setValue(100); |
... | ... | @@ -730,6 +736,63 @@ void FileProcessDlg::haccpdataDownload(){ |
730 | 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 | 796 | void FileProcessDlg::keyPressEvent(QKeyEvent *event){ |
734 | 797 | |
735 | 798 | } | ... | ... |
app/gui/oven_control/fileprocessdlg.h