Commit 6c2810f46afcaa3f2ea906aab8262fd9d721022c
1 parent
f616ce7162
Exists in
master
and in
2 other branches
프로그램 업로드시 모델 정보 변경 되는 문제 수정
- 파일 복사가 아닌 환경 설정 영역만 복사하도록 수정 - 업로드시 파일 검증 루틴 추가
Showing
4 changed files
with
35 additions
and
23 deletions
Show diff stats
app/gui/oven_control/config.cpp
... | ... | @@ -411,6 +411,19 @@ bool Config::saveFavorite(void){ |
411 | 411 | return false; |
412 | 412 | } |
413 | 413 | |
414 | +//Sytem Config Area Copy | |
415 | +void Config::copyConfigArea(const char *buff) | |
416 | +{ | |
417 | + config_item* end = &configlist.items.model; | |
418 | + config_item *start = &configlist.values[0]; | |
419 | + | |
420 | + uint32_t size = end - start; | |
421 | + | |
422 | + qDebug() << "size is "<< size; | |
423 | + | |
424 | + memcpy(&configlist.data[0], buff, sizeof(config_item)*size); | |
425 | +} | |
426 | + | |
414 | 427 | void Config::insertFavorite(Define::ConfigType idx){ |
415 | 428 | m_setFavorite.insert((uint32_t)idx); |
416 | 429 | } | ... | ... |
app/gui/oven_control/config.h
... | ... | @@ -433,6 +433,7 @@ public: |
433 | 433 | QList<uint32_t> getConstSortedFavorite(); |
434 | 434 | bool loadFavorite(void); |
435 | 435 | bool saveFavorite(void); |
436 | + void copyConfigArea(const char* buff); | |
436 | 437 | void insertFavorite(Define::ConfigType idx); |
437 | 438 | void removeFavorite(Define::ConfigType idx); |
438 | 439 | static QString getDateTimeString(uint32_t sec); | ... | ... |
app/gui/oven_control/fileprocessdlg.cpp
... | ... | @@ -696,38 +696,36 @@ void FileProcessDlg::configUpload(){ |
696 | 696 | QString strSrcPath; |
697 | 697 | Config *cfg = Config::getInstance(); |
698 | 698 | if(FileProcessor::detectUSB(strUsbPath)){ |
699 | - strSrcPath = QString("%1/%2").arg(strUsbPath).arg(CONFIG_FILE_NAME); | |
699 | + strSrcPath = QString("%1%2").arg(strUsbPath).arg(CONFIG_FILE_NAME); | |
700 | 700 | QFile srcFile(strSrcPath); |
701 | 701 | //Check Source File is valid this machine |
702 | - readlen = srcFile.read(buff,sizeof(config_lists)+1); | |
703 | - if(readlen != (sizeof(config_lists)+1)) { | |
704 | - qDebug() << "SRC config.ini file size wrong"; | |
705 | - ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다.")); | |
706 | - QTimer::singleShot(1000,this,SLOT(close())); | |
707 | - return; | |
708 | - } | |
709 | - if(buff[sizeof(config_lists)] != 0x9C){ | |
710 | - qDebug() << "SRC config.ini file check fail"; | |
711 | - ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다.")); | |
712 | - QTimer::singleShot(1000,this,SLOT(close())); | |
713 | - return; | |
714 | - } | |
715 | - QFile file(CONFIG_FILE_NAME); | |
716 | - file.remove(); | |
717 | - if(QFile::copy( strSrcPath , CONFIG_FILE_NAME)){ | |
718 | - sync(); | |
719 | - cfg->loadConfig(); | |
702 | + if(srcFile.open(QIODevice::ReadOnly)){ | |
703 | + readlen = srcFile.read(buff,sizeof(config_lists)+1); | |
704 | + srcFile.close(); | |
705 | + if(readlen != (sizeof(config_lists)+1)) { | |
706 | + qDebug() << "SRC config.ini file size wrong"; | |
707 | + ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다.")); | |
708 | + QTimer::singleShot(1000,this,SLOT(close())); | |
709 | + return; | |
710 | + } | |
711 | + if(buff[sizeof(config_lists)] != 0x9C){ | |
712 | + qDebug() << "SRC config.ini file check fail"; | |
713 | + ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다.")); | |
714 | + QTimer::singleShot(1000,this,SLOT(close())); | |
715 | + return; | |
716 | + } | |
717 | + cfg->copyConfigArea(buff); | |
718 | + cfg->saveConfig(); | |
720 | 719 | cfg->applyConfig(); |
721 | - ui->ctrWjProcess->setValue(50); | |
722 | - ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초")); | |
723 | 720 | } |
724 | 721 | else{ |
722 | + qDebug() << "SRC config.ini file open fail"; | |
725 | 723 | ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다.")); |
726 | 724 | QTimer::singleShot(1000,this,SLOT(close())); |
727 | 725 | return; |
728 | 726 | } |
729 | 727 | strSrcPath = QString("%1/%2").arg(strUsbPath).arg(FAVORITE_FILE_NAME); |
730 | - file.setFileName(FAVORITE_FILE_NAME); | |
728 | + QFile file(FAVORITE_FILE_NAME); | |
731 | 729 | file.remove(); |
732 | 730 | if(QFile::copy( strSrcPath , FAVORITE_FILE_NAME)){ |
733 | 731 | sync(); | ... | ... |
app/gui/oven_control/functiontestwindow.ui