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,6 +411,19 @@ bool Config::saveFavorite(void){ | ||
411 | return false; | 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 | void Config::insertFavorite(Define::ConfigType idx){ | 427 | void Config::insertFavorite(Define::ConfigType idx){ |
415 | m_setFavorite.insert((uint32_t)idx); | 428 | m_setFavorite.insert((uint32_t)idx); |
416 | } | 429 | } |
app/gui/oven_control/config.h
@@ -433,6 +433,7 @@ public: | @@ -433,6 +433,7 @@ public: | ||
433 | QList<uint32_t> getConstSortedFavorite(); | 433 | QList<uint32_t> getConstSortedFavorite(); |
434 | bool loadFavorite(void); | 434 | bool loadFavorite(void); |
435 | bool saveFavorite(void); | 435 | bool saveFavorite(void); |
436 | + void copyConfigArea(const char* buff); | ||
436 | void insertFavorite(Define::ConfigType idx); | 437 | void insertFavorite(Define::ConfigType idx); |
437 | void removeFavorite(Define::ConfigType idx); | 438 | void removeFavorite(Define::ConfigType idx); |
438 | static QString getDateTimeString(uint32_t sec); | 439 | static QString getDateTimeString(uint32_t sec); |
app/gui/oven_control/fileprocessdlg.cpp
@@ -696,38 +696,36 @@ void FileProcessDlg::configUpload(){ | @@ -696,38 +696,36 @@ void FileProcessDlg::configUpload(){ | ||
696 | QString strSrcPath; | 696 | QString strSrcPath; |
697 | Config *cfg = Config::getInstance(); | 697 | Config *cfg = Config::getInstance(); |
698 | if(FileProcessor::detectUSB(strUsbPath)){ | 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 | QFile srcFile(strSrcPath); | 700 | QFile srcFile(strSrcPath); |
701 | //Check Source File is valid this machine | 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 | cfg->applyConfig(); | 719 | cfg->applyConfig(); |
721 | - ui->ctrWjProcess->setValue(50); | ||
722 | - ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초")); | ||
723 | } | 720 | } |
724 | else{ | 721 | else{ |
722 | + qDebug() << "SRC config.ini file open fail"; | ||
725 | ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다.")); | 723 | ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다.")); |
726 | QTimer::singleShot(1000,this,SLOT(close())); | 724 | QTimer::singleShot(1000,this,SLOT(close())); |
727 | return; | 725 | return; |
728 | } | 726 | } |
729 | strSrcPath = QString("%1/%2").arg(strUsbPath).arg(FAVORITE_FILE_NAME); | 727 | strSrcPath = QString("%1/%2").arg(strUsbPath).arg(FAVORITE_FILE_NAME); |
730 | - file.setFileName(FAVORITE_FILE_NAME); | 728 | + QFile file(FAVORITE_FILE_NAME); |
731 | file.remove(); | 729 | file.remove(); |
732 | if(QFile::copy( strSrcPath , FAVORITE_FILE_NAME)){ | 730 | if(QFile::copy( strSrcPath , FAVORITE_FILE_NAME)){ |
733 | sync(); | 731 | sync(); |
app/gui/oven_control/functiontestwindow.ui
@@ -579,7 +579,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b | @@ -579,7 +579,7 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/b | ||
579 | <property name="geometry"> | 579 | <property name="geometry"> |
580 | <rect> | 580 | <rect> |
581 | <x>100</x> | 581 | <x>100</x> |
582 | - <y>1210</y> | 582 | + <y>1209</y> |
583 | <width>30</width> | 583 | <width>30</width> |
584 | <height>1</height> | 584 | <height>1</height> |
585 | </rect> | 585 | </rect> |