Commit 1f685a2a558c9c43b5734e5330a1a5ad033970a5
1 parent
8ae91cce9d
Exists in
master
and in
2 other branches
설정 시스템 관리 기능 개발
- 파일 복사 프로그레스 바 적용 - 파일 복사 다이얼로그 추가 - 기본 설정 다운로드/업로드 기능 개발
Showing
20 changed files
with
488 additions
and
16 deletions
Show diff stats
app/gui/oven_control/config.cpp
| @@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
| 18 | #include "confighalfenergydlg.h" | 18 | #include "confighalfenergydlg.h" |
| 19 | #include "config1digitsetdlg.h" | 19 | #include "config1digitsetdlg.h" |
| 20 | #include "configdutywashdlg.h" | 20 | #include "configdutywashdlg.h" |
| 21 | +#include "fileprocessor.h" | ||
| 21 | 22 | ||
| 22 | using namespace Define; | 23 | using namespace Define; |
| 23 | 24 | ||
| @@ -325,6 +326,7 @@ QString Config::getTempString(int cel_temp){ | @@ -325,6 +326,7 @@ QString Config::getTempString(int cel_temp){ | ||
| 325 | void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ | 326 | void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ |
| 326 | QDialog *dlg; | 327 | QDialog *dlg; |
| 327 | bool bUsbDetect = false; | 328 | bool bUsbDetect = false; |
| 329 | + QString usbPath = ""; | ||
| 328 | switch(idx){ | 330 | switch(idx){ |
| 329 | case config_language: | 331 | case config_language: |
| 330 | dlg = new ConfigLanguageDlg(parent); | 332 | dlg = new ConfigLanguageDlg(parent); |
| @@ -362,21 +364,26 @@ void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ | @@ -362,21 +364,26 @@ void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ | ||
| 362 | case config_service_data_download: | 364 | case config_service_data_download: |
| 363 | case config_program_download: | 365 | case config_program_download: |
| 364 | case config_set_download: | 366 | case config_set_download: |
| 365 | - if(!bUsbDetect){ | 367 | + if(!FileProcessor::detectUSB(usbPath)){ |
| 366 | dlg = new UsbCheckPopupDlg(parent); | 368 | dlg = new UsbCheckPopupDlg(parent); |
| 367 | dlg->exec(); | 369 | dlg->exec(); |
| 368 | } | 370 | } |
| 369 | - dlg = new ConfigFileProcessDlg(parent,idx); | ||
| 370 | - dlg->exec(); | 371 | + if(FileProcessor::detectUSB(usbPath)){ |
| 372 | + dlg = new ConfigFileProcessDlg(parent,idx); | ||
| 373 | + dlg->exec(); | ||
| 374 | + } | ||
| 371 | return; | 375 | return; |
| 372 | case config_set_upload: | 376 | case config_set_upload: |
| 373 | case config_program_upload: | 377 | case config_program_upload: |
| 374 | - if(!bUsbDetect){ | 378 | + |
| 379 | + if(!FileProcessor::detectUSB(usbPath)){ | ||
| 375 | dlg = new UsbCheckPopupDlg(parent); | 380 | dlg = new UsbCheckPopupDlg(parent); |
| 376 | dlg->exec(); | 381 | dlg->exec(); |
| 377 | } | 382 | } |
| 378 | - dlg = new ConfigFileProcessDlg(parent,idx,false); | ||
| 379 | - dlg->exec(); | 383 | + if(FileProcessor::detectUSB(usbPath)){ |
| 384 | + dlg = new ConfigFileProcessDlg(parent,idx,false); | ||
| 385 | + dlg->exec(); | ||
| 386 | + } | ||
| 380 | return; | 387 | return; |
| 381 | case config_set_half_energy: | 388 | case config_set_half_energy: |
| 382 | dlg = new ConfigHalfEnergyDlg(parent); | 389 | dlg = new ConfigHalfEnergyDlg(parent); |
app/gui/oven_control/configfileprocessdlg.cpp
| 1 | #include "configfileprocessdlg.h" | 1 | #include "configfileprocessdlg.h" |
| 2 | #include "ui_configfileprocessdlg.h" | 2 | #include "ui_configfileprocessdlg.h" |
| 3 | #include "config.h" | 3 | #include "config.h" |
| 4 | +#include "fileprocessdlg.h" | ||
| 4 | 5 | ||
| 5 | ConfigFileProcessDlg::ConfigFileProcessDlg(QWidget *parent, ConfigType type, bool isDown) : | 6 | ConfigFileProcessDlg::ConfigFileProcessDlg(QWidget *parent, ConfigType type, bool isDown) : |
| 6 | QDialog(parent), | 7 | QDialog(parent), |
| @@ -12,6 +13,7 @@ ConfigFileProcessDlg::ConfigFileProcessDlg(QWidget *parent, ConfigType type, boo | @@ -12,6 +13,7 @@ ConfigFileProcessDlg::ConfigFileProcessDlg(QWidget *parent, ConfigType type, boo | ||
| 12 | setAttribute(Qt::WA_NoSystemBackground); | 13 | setAttribute(Qt::WA_NoSystemBackground); |
| 13 | setAttribute(Qt::WA_TranslucentBackground); | 14 | setAttribute(Qt::WA_TranslucentBackground); |
| 14 | setAttribute(Qt::WA_DeleteOnClose); | 15 | setAttribute(Qt::WA_DeleteOnClose); |
| 16 | + m_bIsDown = isDown; | ||
| 15 | if(type < config_invalid) | 17 | if(type < config_invalid) |
| 16 | { | 18 | { |
| 17 | m_nCfgtype = type; | 19 | m_nCfgtype = type; |
| @@ -26,6 +28,7 @@ ConfigFileProcessDlg::ConfigFileProcessDlg(QWidget *parent, ConfigType type, boo | @@ -26,6 +28,7 @@ ConfigFileProcessDlg::ConfigFileProcessDlg(QWidget *parent, ConfigType type, boo | ||
| 26 | 28 | ||
| 27 | } | 29 | } |
| 28 | } | 30 | } |
| 31 | + | ||
| 29 | } | 32 | } |
| 30 | 33 | ||
| 31 | ConfigFileProcessDlg::~ConfigFileProcessDlg() | 34 | ConfigFileProcessDlg::~ConfigFileProcessDlg() |
| @@ -35,11 +38,9 @@ ConfigFileProcessDlg::~ConfigFileProcessDlg() | @@ -35,11 +38,9 @@ ConfigFileProcessDlg::~ConfigFileProcessDlg() | ||
| 35 | 38 | ||
| 36 | void ConfigFileProcessDlg::on_ctrBtnOk_clicked() | 39 | void ConfigFileProcessDlg::on_ctrBtnOk_clicked() |
| 37 | { | 40 | { |
| 38 | - switch(m_nCfgtype){ | ||
| 39 | - default: | ||
| 40 | - break; | ||
| 41 | - } | ||
| 42 | - | 41 | + QDialog *dg; |
| 42 | + dg = new FileProcessDlg(parentWidget(),m_nCfgtype, m_bIsDown); | ||
| 43 | + dg->exec(); | ||
| 43 | deleteLater(); | 44 | deleteLater(); |
| 44 | } | 45 | } |
| 45 | 46 |
app/gui/oven_control/configfileprocessdlg.h
| @@ -26,6 +26,7 @@ private slots: | @@ -26,6 +26,7 @@ private slots: | ||
| 26 | private: | 26 | private: |
| 27 | Ui::ConfigFileProcessDlg *ui; | 27 | Ui::ConfigFileProcessDlg *ui; |
| 28 | ConfigType m_nCfgtype; | 28 | ConfigType m_nCfgtype; |
| 29 | + bool m_bIsDown; | ||
| 29 | }; | 30 | }; |
| 30 | 31 | ||
| 31 | #endif // CONFIGFILEPROCESSDLG_H | 32 | #endif // CONFIGFILEPROCESSDLG_H |
app/gui/oven_control/configwindow.cpp
| @@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
| 9 | #include "yesnopopupdlg.h" | 9 | #include "yesnopopupdlg.h" |
| 10 | #include "configdatetimedlg.h" | 10 | #include "configdatetimedlg.h" |
| 11 | #include "servicepassinputdlg.h" | 11 | #include "servicepassinputdlg.h" |
| 12 | - | 12 | +#include "fileprocessor.h" |
| 13 | 13 | ||
| 14 | 14 | ||
| 15 | ConfigWindow::ConfigWindow(QWidget *parent) : | 15 | ConfigWindow::ConfigWindow(QWidget *parent) : |
app/gui/oven_control/fileprocessdlg.cpp
| @@ -0,0 +1,123 @@ | @@ -0,0 +1,123 @@ | ||
| 1 | +#include <QTimer> | ||
| 2 | +#include <QFile> | ||
| 3 | +#include "fileprocessdlg.h" | ||
| 4 | +#include "ui_fileprocessdlg.h" | ||
| 5 | +#include "fileprocessor.h" | ||
| 6 | +#include "ovenstatics.h" | ||
| 7 | +#include <QDebug> | ||
| 8 | +FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) : | ||
| 9 | + QDialog(parent), | ||
| 10 | + ui(new Ui::FileProcessDlg) | ||
| 11 | +{ | ||
| 12 | + ui->setupUi(this); | ||
| 13 | + setAttribute(Qt::WA_DeleteOnClose); | ||
| 14 | + setAttribute(Qt::WA_TranslucentBackground); | ||
| 15 | + setWindowFlags(Qt::FramelessWindowHint); | ||
| 16 | + | ||
| 17 | + ui->ctrWjProcess->setMinimum(0); | ||
| 18 | + ui->ctrWjProcess->setMaximum(100); | ||
| 19 | + | ||
| 20 | + if(isDown){ | ||
| 21 | + QPixmap pxmap; | ||
| 22 | + pxmap.load(":/images/config/102_usb_upload_icon.png"); | ||
| 23 | + ui->label_2->setPixmap(pxmap); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + switch(type){ | ||
| 27 | + case config_info_data_download: | ||
| 28 | + QTimer::singleShot(100,this,SLOT(infodataDownload())); | ||
| 29 | + break; | ||
| 30 | + case config_service_data_download: | ||
| 31 | + QTimer::singleShot(100,this,SLOT(servicedataDownload())); | ||
| 32 | + break; | ||
| 33 | + case config_program_download: | ||
| 34 | + QTimer::singleShot(100,this,SLOT(programDownload())); | ||
| 35 | + break; | ||
| 36 | + case config_program_upload: | ||
| 37 | + QTimer::singleShot(100,this,SLOT(programUpload())); | ||
| 38 | + break; | ||
| 39 | + case config_set_download: | ||
| 40 | + QTimer::singleShot(100,this,SLOT(configDownload())); | ||
| 41 | + break; | ||
| 42 | + case config_set_upload: | ||
| 43 | + QTimer::singleShot(100,this,SLOT(configUpload())); | ||
| 44 | + break; | ||
| 45 | + default: | ||
| 46 | + QTimer::singleShot(200,this,SLOT(deleteLater())); | ||
| 47 | + break; | ||
| 48 | + } | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +FileProcessDlg::~FileProcessDlg() | ||
| 52 | +{ | ||
| 53 | + delete ui; | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +void FileProcessDlg::on_ctrBtnCancel_clicked() | ||
| 57 | +{ | ||
| 58 | + close(); | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +void FileProcessDlg::infodataDownload(){ | ||
| 62 | + | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +void FileProcessDlg::servicedataDownload(){ | ||
| 66 | + | ||
| 67 | + | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +void FileProcessDlg::programDownload(){ | ||
| 71 | + | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +void FileProcessDlg::programUpload(){ | ||
| 75 | + | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +void FileProcessDlg::configDownload(){ | ||
| 79 | + QString strUsbPath; | ||
| 80 | + if(FileProcessor::detectUSB(strUsbPath)){ | ||
| 81 | + strUsbPath.append("/config.ini"); | ||
| 82 | + qDebug() << strUsbPath; | ||
| 83 | + if(QFile::copy("/prime/config/config.ini", strUsbPath)){ | ||
| 84 | + ui->ctrWjProcess->setValue(100); | ||
| 85 | + ui->ctrLbRemainTime->setText("남은 예상 시간 : 0초"); | ||
| 86 | + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료")); | ||
| 87 | + QTimer::singleShot(1000,this,SLOT(close())); | ||
| 88 | + } | ||
| 89 | + else{ | ||
| 90 | + ui->ctrLbRemainTime->setText(tr("다운로드에 실패하였습니다.")); | ||
| 91 | + QTimer::singleShot(1000,this,SLOT(close())); | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + else{ | ||
| 95 | + ui->ctrLbRemainTime->setText(tr("다운로드에 실패하였습니다.")); | ||
| 96 | + QTimer::singleShot(1000,this,SLOT(close())); | ||
| 97 | + } | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +void FileProcessDlg::configUpload(){ | ||
| 101 | + QString strUsbPath; | ||
| 102 | + if(FileProcessor::detectUSB(strUsbPath)){ | ||
| 103 | + strUsbPath.append("/config.ini"); | ||
| 104 | + qDebug() << strUsbPath; | ||
| 105 | + QFile file("/prime/config/config.ini"); | ||
| 106 | + file.remove(); | ||
| 107 | + if(QFile::copy( strUsbPath , "/prime/config/config.ini")){ | ||
| 108 | + OvenStatistics* ovs = OvenStatistics::getInstance(); | ||
| 109 | + ovs->srvdata->loadServiceData(); | ||
| 110 | + ui->ctrWjProcess->setValue(100); | ||
| 111 | + ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료")); | ||
| 112 | + QTimer::singleShot(1000,this,SLOT(close())); | ||
| 113 | + } | ||
| 114 | + else{ | ||
| 115 | + ui->ctrLbRemainTime->setText(tr("업로드에 실패하였습니다.")); | ||
| 116 | + QTimer::singleShot(1000,this,SLOT(close())); | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + else{ | ||
| 120 | + ui->ctrLbRemainTime->setText(tr("업로드에 실패하였습니다.")); | ||
| 121 | + QTimer::singleShot(1000,this,SLOT(close())); | ||
| 122 | + } | ||
| 123 | +} |
app/gui/oven_control/fileprocessdlg.h
| @@ -0,0 +1,48 @@ | @@ -0,0 +1,48 @@ | ||
| 1 | +#ifndef FILEPROCESSDLG_H | ||
| 2 | +#define FILEPROCESSDLG_H | ||
| 3 | + | ||
| 4 | +#include <QDialog> | ||
| 5 | +#include "config.h" | ||
| 6 | +#include "servicedata.h" | ||
| 7 | + | ||
| 8 | +using namespace Define; | ||
| 9 | + | ||
| 10 | +namespace Ui { | ||
| 11 | +class FileProcessDlg; | ||
| 12 | +} | ||
| 13 | + | ||
| 14 | +class FileProcessDlg : public QDialog | ||
| 15 | +{ | ||
| 16 | + Q_OBJECT | ||
| 17 | + | ||
| 18 | + const uint8_t m_arrErrorMaxIdx[4] = {3,4,3,11}; | ||
| 19 | + | ||
| 20 | + const char m_strInfoName[4][64] = {"Top Ignition Box\0", | ||
| 21 | + "Steam Ignition Box\0","Bottom Ignition Box\0","Service Total\0"}; | ||
| 22 | + const uint16_t m_arrErrorIdxs[3][20] = { //서비스 에러 기록 종합은 합산 | ||
| 23 | + {ERROR_IDX_upper_fire_fail,ERROR_IDX_upper_pan_fail,ERROR_IDX_upper_motor_fail}, | ||
| 24 | + {ERROR_IDX_steam_fire_fail,ERROR_IDX_steam_pan_fail,ERROR_IDX_water_level_sensor_fail,ERROR_IDX_steam_gen_temp_high_alram}, | ||
| 25 | + {ERROR_IDX_lower_fire_fail,ERROR_IDX_lower_pan_fail,ERROR_IDX_lower_motor_fail} | ||
| 26 | + }; | ||
| 27 | + | ||
| 28 | + | ||
| 29 | + | ||
| 30 | +public: | ||
| 31 | + explicit FileProcessDlg(QWidget *parent = 0, ConfigType type = config_invalid, bool isDown = true); | ||
| 32 | + ~FileProcessDlg(); | ||
| 33 | + | ||
| 34 | +private slots: | ||
| 35 | + void on_ctrBtnCancel_clicked(); | ||
| 36 | + void infodataDownload(); | ||
| 37 | + void servicedataDownload(); | ||
| 38 | + void programDownload(); | ||
| 39 | + void programUpload(); | ||
| 40 | + void configDownload(); | ||
| 41 | + void configUpload(); | ||
| 42 | + | ||
| 43 | +private: | ||
| 44 | + Ui::FileProcessDlg *ui; | ||
| 45 | + ConfigType m_nCfgtype; | ||
| 46 | +}; | ||
| 47 | + | ||
| 48 | +#endif // FILEPROCESSDLG_H |
app/gui/oven_control/fileprocessdlg.ui
| @@ -0,0 +1,164 @@ | @@ -0,0 +1,164 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<ui version="4.0"> | ||
| 3 | + <class>FileProcessDlg</class> | ||
| 4 | + <widget class="QDialog" name="FileProcessDlg"> | ||
| 5 | + <property name="geometry"> | ||
| 6 | + <rect> | ||
| 7 | + <x>0</x> | ||
| 8 | + <y>0</y> | ||
| 9 | + <width>900</width> | ||
| 10 | + <height>1600</height> | ||
| 11 | + </rect> | ||
| 12 | + </property> | ||
| 13 | + <property name="windowTitle"> | ||
| 14 | + <string>Dialog</string> | ||
| 15 | + </property> | ||
| 16 | + <property name="windowOpacity"> | ||
| 17 | + <double>1.000000000000000</double> | ||
| 18 | + </property> | ||
| 19 | + <property name="styleSheet"> | ||
| 20 | + <string notr="true">#centralWidget { background-image: url(:/images/background/popup/503.png); | ||
| 21 | +} | ||
| 22 | +</string> | ||
| 23 | + </property> | ||
| 24 | + <property name="modal"> | ||
| 25 | + <bool>true</bool> | ||
| 26 | + </property> | ||
| 27 | + <widget class="QWidget" name="centralWidget" native="true"> | ||
| 28 | + <property name="geometry"> | ||
| 29 | + <rect> | ||
| 30 | + <x>0</x> | ||
| 31 | + <y>430</y> | ||
| 32 | + <width>900</width> | ||
| 33 | + <height>503</height> | ||
| 34 | + </rect> | ||
| 35 | + </property> | ||
| 36 | + <property name="styleSheet"> | ||
| 37 | + <string notr="true"/> | ||
| 38 | + </property> | ||
| 39 | + <widget class="QWidget" name="verticalLayoutWidget"> | ||
| 40 | + <property name="geometry"> | ||
| 41 | + <rect> | ||
| 42 | + <x>0</x> | ||
| 43 | + <y>0</y> | ||
| 44 | + <width>901</width> | ||
| 45 | + <height>520</height> | ||
| 46 | + </rect> | ||
| 47 | + </property> | ||
| 48 | + <layout class="QVBoxLayout" name="verticalLayout"> | ||
| 49 | + <property name="topMargin"> | ||
| 50 | + <number>30</number> | ||
| 51 | + </property> | ||
| 52 | + <property name="bottomMargin"> | ||
| 53 | + <number>30</number> | ||
| 54 | + </property> | ||
| 55 | + <item> | ||
| 56 | + <widget class="QLabel" name="label_2"> | ||
| 57 | + <property name="text"> | ||
| 58 | + <string/> | ||
| 59 | + </property> | ||
| 60 | + <property name="pixmap"> | ||
| 61 | + <pixmap resource="resources.qrc">:/images/config/102_usb_download_icon.png</pixmap> | ||
| 62 | + </property> | ||
| 63 | + <property name="alignment"> | ||
| 64 | + <set>Qt::AlignCenter</set> | ||
| 65 | + </property> | ||
| 66 | + </widget> | ||
| 67 | + </item> | ||
| 68 | + <item alignment="Qt::AlignHCenter"> | ||
| 69 | + <widget class="FileProcessGauge" name="ctrWjProcess" native="true"> | ||
| 70 | + <property name="minimumSize"> | ||
| 71 | + <size> | ||
| 72 | + <width>820</width> | ||
| 73 | + <height>120</height> | ||
| 74 | + </size> | ||
| 75 | + </property> | ||
| 76 | + <property name="maximumSize"> | ||
| 77 | + <size> | ||
| 78 | + <width>820</width> | ||
| 79 | + <height>120</height> | ||
| 80 | + </size> | ||
| 81 | + </property> | ||
| 82 | + </widget> | ||
| 83 | + </item> | ||
| 84 | + <item> | ||
| 85 | + <widget class="QLabel" name="ctrLbRemainTime"> | ||
| 86 | + <property name="minimumSize"> | ||
| 87 | + <size> | ||
| 88 | + <width>0</width> | ||
| 89 | + <height>30</height> | ||
| 90 | + </size> | ||
| 91 | + </property> | ||
| 92 | + <property name="font"> | ||
| 93 | + <font> | ||
| 94 | + <family>나눔바른고딕</family> | ||
| 95 | + <pointsize>14</pointsize> | ||
| 96 | + </font> | ||
| 97 | + </property> | ||
| 98 | + <property name="styleSheet"> | ||
| 99 | + <string notr="true">color : white; | ||
| 100 | +padding-left : 65px;</string> | ||
| 101 | + </property> | ||
| 102 | + <property name="text"> | ||
| 103 | + <string>남은 예상 시간 : 1초</string> | ||
| 104 | + </property> | ||
| 105 | + <property name="alignment"> | ||
| 106 | + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> | ||
| 107 | + </property> | ||
| 108 | + </widget> | ||
| 109 | + </item> | ||
| 110 | + <item alignment="Qt::AlignRight"> | ||
| 111 | + <widget class="QPushButton" name="ctrBtnCancel"> | ||
| 112 | + <property name="sizePolicy"> | ||
| 113 | + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||
| 114 | + <horstretch>0</horstretch> | ||
| 115 | + <verstretch>0</verstretch> | ||
| 116 | + </sizepolicy> | ||
| 117 | + </property> | ||
| 118 | + <property name="minimumSize"> | ||
| 119 | + <size> | ||
| 120 | + <width>220</width> | ||
| 121 | + <height>100</height> | ||
| 122 | + </size> | ||
| 123 | + </property> | ||
| 124 | + <property name="font"> | ||
| 125 | + <font> | ||
| 126 | + <family>나눔바른고딕</family> | ||
| 127 | + <pointsize>17</pointsize> | ||
| 128 | + <weight>75</weight> | ||
| 129 | + <bold>true</bold> | ||
| 130 | + <underline>true</underline> | ||
| 131 | + </font> | ||
| 132 | + </property> | ||
| 133 | + <property name="styleSheet"> | ||
| 134 | + <string notr="true">QPushButton{ | ||
| 135 | + border : none; | ||
| 136 | + color : white; | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +QPushButton::pressed, QPushButton::focus{ | ||
| 140 | + color : yellow; | ||
| 141 | +}</string> | ||
| 142 | + </property> | ||
| 143 | + <property name="text"> | ||
| 144 | + <string>취소</string> | ||
| 145 | + </property> | ||
| 146 | + </widget> | ||
| 147 | + </item> | ||
| 148 | + </layout> | ||
| 149 | + </widget> | ||
| 150 | + </widget> | ||
| 151 | + </widget> | ||
| 152 | + <customwidgets> | ||
| 153 | + <customwidget> | ||
| 154 | + <class>FileProcessGauge</class> | ||
| 155 | + <extends>QWidget</extends> | ||
| 156 | + <header>fileprocessgauge.h</header> | ||
| 157 | + <container>1</container> | ||
| 158 | + </customwidget> | ||
| 159 | + </customwidgets> | ||
| 160 | + <resources> | ||
| 161 | + <include location="resources.qrc"/> | ||
| 162 | + </resources> | ||
| 163 | + <connections/> | ||
| 164 | +</ui> |
app/gui/oven_control/fileprocessgauge.cpp
| @@ -0,0 +1,40 @@ | @@ -0,0 +1,40 @@ | ||
| 1 | +#include "fileprocessgauge.h" | ||
| 2 | +#include <QPainter> | ||
| 3 | +#include <QDebug> | ||
| 4 | + | ||
| 5 | +FileProcessGauge::FileProcessGauge(QWidget *parent) : PreheatTempGauge(parent) | ||
| 6 | +{ | ||
| 7 | + border.load(":/images/gauge/103_usb_graph_01.png"); | ||
| 8 | + indicator.load(":/images/gauge/103_usb_graph_02.png"); | ||
| 9 | + body.load(":/images/gauge/103_usb_graph_03.png"); | ||
| 10 | + min = 0; | ||
| 11 | + max = 100; | ||
| 12 | + val = 30; | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +void FileProcessGauge::paintEvent(QPaintEvent *event){ | ||
| 16 | + QPainter painter(this); | ||
| 17 | + painter.setBrush(Qt::NoBrush); | ||
| 18 | + painter.setPen(Qt::NoPen); | ||
| 19 | + QRect textRect(0,0,72,40); | ||
| 20 | + | ||
| 21 | + qreal percentage = (qreal) (val - min) / qMax(max - min, 1); | ||
| 22 | + percentage = qBound((qreal) 0.0, percentage, (qreal) 1.0); | ||
| 23 | + | ||
| 24 | + QRect targetRect( | ||
| 25 | + (border.size().width() - body.size().width()) / 2 + textRect.width()/2, | ||
| 26 | + (border.size().height() - body.size().height()) / 2 + indicator.size().height()+textRect.height(), | ||
| 27 | + body.size().width() * percentage, body.height()); | ||
| 28 | + | ||
| 29 | + QRect sourceRect(0, 0, body.size().width() * percentage, body.height()); | ||
| 30 | + QFont font; | ||
| 31 | + font.setFamily("나눔맑은고딕"); | ||
| 32 | + font.setPixelSize(30); | ||
| 33 | + painter.setFont(font); | ||
| 34 | + painter.setPen(Qt::white); | ||
| 35 | + painter.drawPixmap(targetRect, body, sourceRect); | ||
| 36 | + painter.drawPixmap(textRect.width()/ 2, textRect.height()+indicator.size().height(), border); | ||
| 37 | + painter.drawPixmap(targetRect.right() - indicator.size().width() / 2, textRect.height(), indicator); | ||
| 38 | + textRect.setRect(targetRect.right() - textRect.size().width()/2, textRect.top(),72,40); | ||
| 39 | + painter.drawText(textRect,Qt::AlignCenter, QString("%1%").arg(val)); | ||
| 40 | +} |
app/gui/oven_control/fileprocessgauge.h
| @@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
| 1 | +#ifndef FILEPROCESSGAUGE_H | ||
| 2 | +#define FILEPROCESSGAUGE_H | ||
| 3 | + | ||
| 4 | +#include "preheattempgauge.h" | ||
| 5 | + | ||
| 6 | +class FileProcessGauge : public PreheatTempGauge | ||
| 7 | +{ | ||
| 8 | +public: | ||
| 9 | + FileProcessGauge(QWidget *parent=0); | ||
| 10 | + | ||
| 11 | +protected: | ||
| 12 | + void paintEvent(QPaintEvent *event); | ||
| 13 | + | ||
| 14 | +}; | ||
| 15 | + | ||
| 16 | +#endif // FILEPROCESSGAUGE_H |
app/gui/oven_control/fileprocessor.cpp
| @@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
| 1 | +#include <QDebug> | ||
| 2 | +#include "fileprocessor.h" | ||
| 3 | + | ||
| 4 | +FileProcessor::FileProcessor() | ||
| 5 | +{ | ||
| 6 | + | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +bool FileProcessor::folderExist(const QString &path){ | ||
| 10 | + QDir qdir(path); | ||
| 11 | + qDebug() << "check path" << path; | ||
| 12 | + return qdir.exists(); | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +bool FileProcessor::fileExist(const QString &path_file){ | ||
| 16 | + QFile qfile(path_file); | ||
| 17 | + return qfile.exists(); | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +bool FileProcessor::detectUSB(QString &usbPath){ | ||
| 21 | + int curUsbNum=0xff; | ||
| 22 | + bool usbMountErr = false; | ||
| 23 | + QString checkUsbName[3] = { | ||
| 24 | + "sda", | ||
| 25 | + "sdb", | ||
| 26 | + "sdc" | ||
| 27 | + }; | ||
| 28 | + | ||
| 29 | + for(int i =2;i >=0 ; i--){ | ||
| 30 | + | ||
| 31 | + if(folderExist(QString("/sys/block/").append(checkUsbName[i]))){ | ||
| 32 | + if(folderExist(QString("/mnt/%111").arg(checkUsbName[i]))){ | ||
| 33 | + usbPath = QString("/mnt/%111").arg(checkUsbName[i]); | ||
| 34 | + return true; | ||
| 35 | + } | ||
| 36 | + break; | ||
| 37 | + } | ||
| 38 | + } | ||
| 39 | + qDebug() << "usb detect fail"; | ||
| 40 | + return false; | ||
| 41 | +} |
app/gui/oven_control/fileprocessor.h
| @@ -0,0 +1,16 @@ | @@ -0,0 +1,16 @@ | ||
| 1 | +#ifndef FILEPROCESSOR_H | ||
| 2 | +#define FILEPROCESSOR_H | ||
| 3 | + | ||
| 4 | +#include <QtCore> | ||
| 5 | + | ||
| 6 | +class FileProcessor | ||
| 7 | +{ | ||
| 8 | +public: | ||
| 9 | + FileProcessor(); | ||
| 10 | +static bool folderExist(const QString &path); | ||
| 11 | +static bool fileExist(const QString &path_file); | ||
| 12 | +static bool detectUSB(QString &usbpath); | ||
| 13 | + | ||
| 14 | +}; | ||
| 15 | + | ||
| 16 | +#endif // FILEPROCESSOR_H |
app/gui/oven_control/images/config/102_usb_download_icon.png
3.16 KB
app/gui/oven_control/images/config/102_usb_upload_icon.png
3.12 KB
app/gui/oven_control/images/gauge/103_usb_graph_01.png
578 Bytes
app/gui/oven_control/images/gauge/103_usb_graph_02.png
289 Bytes
app/gui/oven_control/images/gauge/103_usb_graph_03.png
250 Bytes
app/gui/oven_control/oven_control.pro
| @@ -103,7 +103,10 @@ SOURCES += main.cpp\ | @@ -103,7 +103,10 @@ SOURCES += main.cpp\ | ||
| 103 | backlight.cpp \ | 103 | backlight.cpp \ |
| 104 | dirtylevel.cpp \ | 104 | dirtylevel.cpp \ |
| 105 | washwarnicon.cpp \ | 105 | washwarnicon.cpp \ |
| 106 | - coretempsettingpopup.cpp | 106 | + coretempsettingpopup.cpp \ |
| 107 | + fileprocessor.cpp \ | ||
| 108 | + fileprocessgauge.cpp \ | ||
| 109 | + fileprocessdlg.cpp | ||
| 107 | 110 | ||
| 108 | HEADERS += mainwindow.h \ | 111 | HEADERS += mainwindow.h \ |
| 109 | cook.h \ | 112 | cook.h \ |
| @@ -196,7 +199,10 @@ HEADERS += mainwindow.h \ | @@ -196,7 +199,10 @@ HEADERS += mainwindow.h \ | ||
| 196 | backlight.h \ | 199 | backlight.h \ |
| 197 | dirtylevel.h \ | 200 | dirtylevel.h \ |
| 198 | washwarnicon.h \ | 201 | washwarnicon.h \ |
| 199 | - coretempsettingpopup.h | 202 | + coretempsettingpopup.h \ |
| 203 | + fileprocessor.h \ | ||
| 204 | + fileprocessgauge.h \ | ||
| 205 | + fileprocessdlg.h | ||
| 200 | 206 | ||
| 201 | FORMS += mainwindow.ui \ | 207 | FORMS += mainwindow.ui \ |
| 202 | manualcookwindow.ui \ | 208 | manualcookwindow.ui \ |
| @@ -259,7 +265,8 @@ FORMS += mainwindow.ui \ | @@ -259,7 +265,8 @@ FORMS += mainwindow.ui \ | ||
| 259 | gasmodelsettingwindow.ui \ | 265 | gasmodelsettingwindow.ui \ |
| 260 | electricmodelsettingwindow.ui \ | 266 | electricmodelsettingwindow.ui \ |
| 261 | servicepassinputdlg.ui \ | 267 | servicepassinputdlg.ui \ |
| 262 | - coretempsettingpopup.ui | 268 | + coretempsettingpopup.ui \ |
| 269 | + fileprocessdlg.ui | ||
| 263 | 270 | ||
| 264 | RESOURCES += \ | 271 | RESOURCES += \ |
| 265 | resources.qrc | 272 | resources.qrc |
app/gui/oven_control/resources.qrc
| @@ -557,5 +557,10 @@ | @@ -557,5 +557,10 @@ | ||
| 557 | <file>images/cook_type/meat_hide.png</file> | 557 | <file>images/cook_type/meat_hide.png</file> |
| 558 | <file>images/cook_type/poultry_hide.png</file> | 558 | <file>images/cook_type/poultry_hide.png</file> |
| 559 | <file>images/cook_type/vegetable_hide.png</file> | 559 | <file>images/cook_type/vegetable_hide.png</file> |
| 560 | + <file>images/gauge/103_usb_graph_01.png</file> | ||
| 561 | + <file>images/gauge/103_usb_graph_02.png</file> | ||
| 562 | + <file>images/gauge/103_usb_graph_03.png</file> | ||
| 563 | + <file>images/config/102_usb_upload_icon.png</file> | ||
| 564 | + <file>images/config/102_usb_download_icon.png</file> | ||
| 560 | </qresource> | 565 | </qresource> |
| 561 | </RCC> | 566 | </RCC> |
app/gui/oven_control/servicepassinputdlg.cpp
| @@ -30,6 +30,7 @@ void ServicePassInputDlg::on_ctrBtnOk_clicked() | @@ -30,6 +30,7 @@ void ServicePassInputDlg::on_ctrBtnOk_clicked() | ||
| 30 | connect(w,SIGNAL(destroyed(QObject*)),this,SLOT(close())); | 30 | connect(w,SIGNAL(destroyed(QObject*)),this,SLOT(close())); |
| 31 | w->setWindowModality(Qt::WindowModal); | 31 | w->setWindowModality(Qt::WindowModal); |
| 32 | w->show(); | 32 | w->show(); |
| 33 | + this->hide(); | ||
| 33 | } | 34 | } |
| 34 | else { | 35 | else { |
| 35 | qDebug()<< "pass incorrect " << ui->lineEdit->text(); | 36 | qDebug()<< "pass incorrect " << ui->lineEdit->text(); |
app/gui/oven_control/usbcheckpopupdlg.cpp
| 1 | #include <QTimer> | 1 | #include <QTimer> |
| 2 | #include "usbcheckpopupdlg.h" | 2 | #include "usbcheckpopupdlg.h" |
| 3 | #include "ui_usbcheckpopupdlg.h" | 3 | #include "ui_usbcheckpopupdlg.h" |
| 4 | +#include "fileprocessor.h" | ||
| 4 | 5 | ||
| 5 | UsbCheckPopupDlg::UsbCheckPopupDlg(QWidget *parent) : | 6 | UsbCheckPopupDlg::UsbCheckPopupDlg(QWidget *parent) : |
| 6 | QDialog(parent), | 7 | QDialog(parent), |
| @@ -29,7 +30,8 @@ void UsbCheckPopupDlg::on_ctrBtnYes_clicked() | @@ -29,7 +30,8 @@ void UsbCheckPopupDlg::on_ctrBtnYes_clicked() | ||
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | void UsbCheckPopupDlg::usbCheckTimerFired(){ | 32 | void UsbCheckPopupDlg::usbCheckTimerFired(){ |
| 32 | - bool usbDetect = false; | 33 | + QString strTemp; |
| 34 | + bool usbDetect = FileProcessor::detectUSB(strTemp); | ||
| 33 | if(usbDetect){ | 35 | if(usbDetect){ |
| 34 | accept(); | 36 | accept(); |
| 35 | } | 37 | } |