Commit b74dd3f0a9e90066ff8605c306de1f7aeda00188

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

엔지니어 모드 교정 기능 개발

 - 교정 기능 개발
 - 확인 팝업 추가
app/gui/oven_control/adjustmentwindow.cpp
... ... @@ -3,6 +3,7 @@
3 3 #include "ui_adjustmentwindow.h"
4 4 #include "yesnopopupdlg.h"
5 5 #include "soundplayer.h"
  6 +#include "notipopupdlg.h"
6 7  
7 8 AdjustmentWindow::AdjustmentWindow(QWidget *parent) :
8 9 QMainWindow(parent),
... ... @@ -15,6 +16,10 @@ AdjustmentWindow::AdjustmentWindow(QWidget *parent) :
15 16  
16 17 foreach (QPushButton *button, findChildren<QPushButton *>())
17 18 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  19 + m_nCurStep = 0;
  20 + m_bAdjustStarted = false;
  21 + m_tmrOneSec = new QTimer(this);
  22 + connect(m_tmrOneSec, SIGNAL(timeout()), this, SLOT(testTimerFired()));
18 23 }
19 24  
20 25 AdjustmentWindow::~AdjustmentWindow()
... ... @@ -26,20 +31,79 @@ void AdjustmentWindow::on_btnAdjust_clicked()
26 31 {
27 32 YesNoPopupDlg* w = new YesNoPopupDlg(this,tr("모든 설정 값을 공장(출고)초기화\n값으로 변경 하시겠습니까?"));
28 33 //w->raise();
29   - int dlgrst = w->exec();
30   - dlgrst = w->result();
31   - if(dlgrst == QDialog::Accepted) {
32   - //Process Init Value;
33   - qDebug() << "Accepted";
  34 + if(m_bAdjustStarted == false){
  35 + UdpHandler* udp = UdpHandler::getInstance();
  36 + int dlgrst = w->exec();
  37 + dlgrst = w->result();
  38 + if(dlgrst == QDialog::Accepted) {
  39 + //Process Init Value;
  40 + qDebug() << "Accepted";
  41 + m_nCurStep = 0;
  42 + m_bAdjustStarted = true;
  43 + m_nSecCnt = 0;
  44 + udp->turnOn(TG_MANUAL_BURNER1);
  45 + udp->turnOn(TG_MANUAL_BURNER2);
  46 + udp->turnOn(TG_MANUAL_BURNER3);
  47 + udp->turnOn(TG_MANUAL_FAN1);
  48 + udp->turnOn(TG_MANUAL_FAN2);
  49 + udp->turnOn(TG_MANUAL_RELAY);
  50 + udp->turnOn(m_arrTestItems[m_nCurStep]);
  51 + m_tmrOneSec->start(1000);
  52 + }
  53 + else qDebug() <<"Rejected";
  54 + }
  55 + else{
  56 +
34 57 }
35   - else qDebug() <<"Rejected";
36 58 }
37 59  
38 60 void AdjustmentWindow::on_backButton_clicked()
39 61 {
  62 + UdpHandler* udp = UdpHandler::getInstance();
  63 + if(m_bAdjustStarted){
  64 + m_tmrOneSec->stop();
  65 + udp->turnOff(TG_MANUAL_BURNER1);
  66 + udp->turnOff(TG_MANUAL_BURNER2);
  67 + udp->turnOff(TG_MANUAL_BURNER3);
  68 + udp->turnOff(TG_MANUAL_FAN1);
  69 + udp->turnOff(TG_MANUAL_FAN2);
  70 + udp->turnOff(TG_MANUAL_RELAY);
  71 + m_bAdjustStarted = false;
  72 + }
40 73 close();
41 74 }
42 75  
  76 +void AdjustmentWindow::testTimerFired()
  77 +{
  78 + int nRestTime = ADJUST_TIME_SEC * MAX_ADJUST_TEST_CNT;
  79 + QString strTemp;
  80 + m_nSecCnt++;
  81 + if((m_nSecCnt%ADJUST_TIME_SEC)==0){
  82 + UdpHandler* udp = UdpHandler::getInstance();
  83 + udp->turnOff(m_arrTestItems[m_nCurStep]);
  84 + m_nCurStep++;
  85 + if(m_nCurStep < MAX_ADJUST_TEST_CNT){
  86 + udp->turnOn(m_nCurStep);
  87 + }
  88 + else{
  89 + //Test Finished
  90 + m_tmrOneSec->stop();
  91 + udp->turnOff(TG_MANUAL_BURNER1);
  92 + udp->turnOff(TG_MANUAL_BURNER2);
  93 + udp->turnOff(TG_MANUAL_BURNER3);
  94 + udp->turnOff(TG_MANUAL_FAN1);
  95 + udp->turnOff(TG_MANUAL_FAN2);
  96 + udp->turnOff(TG_MANUAL_RELAY);
  97 + m_bAdjustStarted = false;
  98 + QDialog* dlg = new NotiPopupDlg(this,tr("테스트를 완료하였습니다."));
  99 + dlg->exec();
  100 + }
  101 + }
  102 + nRestTime = nRestTime - m_nSecCnt;
  103 + strTemp = QString("%1/ %2:%3").arg(m_nCurStep).arg((nRestTime/60),2,10,QLatin1Char('0')).arg((nRestTime%60),2,10,QLatin1Char('0'));
  104 + ui->btnAdjust->setText(strTemp);
  105 +}
  106 +
43 107  
44 108 void AdjustmentWindow::keyPressEvent(QKeyEvent *event){
45 109 switch (event->key())
... ...
app/gui/oven_control/adjustmentwindow.h
... ... @@ -3,6 +3,10 @@
3 3  
4 4 #include <QMainWindow>
5 5 #include <QKeyEvent>
  6 +#include "udphandler.h"
  7 +
  8 +#define MAX_ADJUST_TEST_CNT 20
  9 +#define ADJUST_TIME_SEC 60
6 10  
7 11 namespace Ui {
8 12 class AdjustmentWindow;
... ... @@ -21,12 +25,40 @@ private slots:
21 25  
22 26 void on_backButton_clicked();
23 27  
  28 + void testTimerFired(void);
  29 +
24 30 protected:
25 31 void keyReleaseEvent(QKeyEvent* event);
26 32 void keyPressEvent(QKeyEvent* event);
27 33  
28 34 private:
29 35 Ui::AdjustmentWindow *ui;
  36 + bool m_bAdjustStarted;
  37 + int m_nCurStep;
  38 + int m_nSecCnt;
  39 + QTimer* m_tmrOneSec;
  40 + const target_onoff_t m_arrTestItems[MAX_ADJUST_TEST_CNT] = {
  41 + TG_BUNNER1_MANUAL,
  42 + TG_BUNNER2_MANUAL,
  43 + TG_BUNNER3_MANUAL,
  44 + TG_BUNNER1_FAN,
  45 + TG_BUNNER2_FAN,
  46 + TG_BUNNER3_FAN,
  47 + TG_FAN1_MANUAL,
  48 + TG_FAN2_MANUAL,
  49 + TG_DV,
  50 + TG_CFAN,
  51 + TG_WSV,
  52 + TG_QNV,
  53 + TG_SSV,
  54 + TG_SNV,
  55 + TG_HL,
  56 + TG_DP,
  57 + TG_SSP,
  58 + TG_UNP,
  59 + TG_HDM,
  60 + TG_SGNV
  61 + };
30 62 };
31 63  
32 64 #endif // ADJUSTMENTWINDOW_H
... ...
app/gui/oven_control/notipopupdlg.cpp
... ... @@ -0,0 +1,55 @@
  1 +#include <QKeyEvent>
  2 +#include "notipopupdlg.h"
  3 +#include "ui_notipopupdlg.h"
  4 +
  5 +#include "soundplayer.h"
  6 +
  7 +
  8 +NotiPopupDlg::NotiPopupDlg(QWidget *parent, QString strDesc) :
  9 + QDialog(parent),
  10 + ui(new Ui::NotiPopupDlg)
  11 +{
  12 + ui->setupUi(this);
  13 + this->setAttribute( Qt::WA_DeleteOnClose);
  14 + setWindowFlags(Qt::FramelessWindowHint);
  15 + setAttribute(Qt::WA_NoSystemBackground,false);
  16 + setAttribute(Qt::WA_TranslucentBackground);
  17 + qApp->setActiveWindow(this);
  18 + this->setFocus();
  19 +
  20 + ui->ctrLbDesc->setText(strDesc);
  21 +
  22 + foreach (QPushButton *button, findChildren<QPushButton *>())
  23 + connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  24 +
  25 + ui->ctrBtnOk->setFocus();
  26 +}
  27 +
  28 +NotiPopupDlg::~NotiPopupDlg()
  29 +{
  30 + delete ui;
  31 +}
  32 +
  33 +void NotiPopupDlg::on_ctrBtnOk_clicked()
  34 +{
  35 + accept();
  36 +}
  37 +
  38 +
  39 +void NotiPopupDlg::keyPressEvent(QKeyEvent *event){
  40 +
  41 +}
  42 +
  43 +void NotiPopupDlg::keyReleaseEvent(QKeyEvent *event){
  44 + switch (event->key())
  45 + {
  46 + case 0x01000031: // Push
  47 + {
  48 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  49 + if(btn != NULL){
  50 + btn->click();
  51 + }
  52 + break;
  53 + }
  54 + }
  55 +}
... ...
app/gui/oven_control/notipopupdlg.h
... ... @@ -0,0 +1,29 @@
  1 +#ifndef NOTIPOPUPDLG_H
  2 +#define NOTIPOPUPDLG_H
  3 +
  4 +#include <QDialog>
  5 +
  6 +namespace Ui {
  7 +class NotiPopupDlg;
  8 +}
  9 +
  10 +class NotiPopupDlg : public QDialog
  11 +{
  12 + Q_OBJECT
  13 +
  14 +public:
  15 + explicit NotiPopupDlg(QWidget *parent = 0,QString strDesc="");
  16 + ~NotiPopupDlg();
  17 +
  18 +private slots:
  19 + void on_ctrBtnOk_clicked();
  20 +
  21 +protected:
  22 + void keyPressEvent(QKeyEvent* event);
  23 + void keyReleaseEvent(QKeyEvent* event);
  24 +
  25 +private:
  26 + Ui::NotiPopupDlg *ui;
  27 +};
  28 +
  29 +#endif // NOTIPOPUPDLG_H
... ...
app/gui/oven_control/notipopupdlg.ui
... ... @@ -0,0 +1,113 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<ui version="4.0">
  3 + <class>NotiPopupDlg</class>
  4 + <widget class="QDialog" name="NotiPopupDlg">
  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="windowOpacity">
  14 + <double>1.000000000000000</double>
  15 + </property>
  16 + <property name="styleSheet">
  17 + <string notr="true">#centralWidget { background-image: url(:/images/background/popup/503.png);
  18 +}
  19 +</string>
  20 + </property>
  21 + <property name="modal">
  22 + <bool>true</bool>
  23 + </property>
  24 + <widget class="QWidget" name="centralWidget" native="true">
  25 + <property name="geometry">
  26 + <rect>
  27 + <x>0</x>
  28 + <y>420</y>
  29 + <width>900</width>
  30 + <height>503</height>
  31 + </rect>
  32 + </property>
  33 + <property name="styleSheet">
  34 + <string notr="true"/>
  35 + </property>
  36 + <widget class="QPushButton" name="ctrBtnOk">
  37 + <property name="geometry">
  38 + <rect>
  39 + <x>572</x>
  40 + <y>362</y>
  41 + <width>128</width>
  42 + <height>70</height>
  43 + </rect>
  44 + </property>
  45 + <property name="font">
  46 + <font>
  47 + <weight>75</weight>
  48 + <bold>true</bold>
  49 + <underline>true</underline>
  50 + </font>
  51 + </property>
  52 + <property name="styleSheet">
  53 + <string notr="true">QPushButton{
  54 +border : none;
  55 +color : white;
  56 +}
  57 +QPushButton::pressed, QPushButton::focus{color : yellow}</string>
  58 + </property>
  59 + <property name="text">
  60 + <string>확인</string>
  61 + </property>
  62 + </widget>
  63 + <widget class="QLabel" name="label">
  64 + <property name="geometry">
  65 + <rect>
  66 + <x>415</x>
  67 + <y>99</y>
  68 + <width>61</width>
  69 + <height>51</height>
  70 + </rect>
  71 + </property>
  72 + <property name="text">
  73 + <string/>
  74 + </property>
  75 + <property name="pixmap">
  76 + <pixmap resource="resources.qrc">:/images/symbol/warning.png</pixmap>
  77 + </property>
  78 + </widget>
  79 + <widget class="QLabel" name="ctrLbDesc">
  80 + <property name="geometry">
  81 + <rect>
  82 + <x>0</x>
  83 + <y>150</y>
  84 + <width>900</width>
  85 + <height>201</height>
  86 + </rect>
  87 + </property>
  88 + <property name="font">
  89 + <font>
  90 + <family>나눔고딕</family>
  91 + <pointsize>14</pointsize>
  92 + </font>
  93 + </property>
  94 + <property name="styleSheet">
  95 + <string notr="true">QLabel {
  96 + color : white;
  97 + border : none;
  98 +}</string>
  99 + </property>
  100 + <property name="text">
  101 + <string>TextLabel</string>
  102 + </property>
  103 + <property name="alignment">
  104 + <set>Qt::AlignCenter</set>
  105 + </property>
  106 + </widget>
  107 + </widget>
  108 + </widget>
  109 + <resources>
  110 + <include location="resources.qrc"/>
  111 + </resources>
  112 + <connections/>
  113 +</ui>
... ...
app/gui/oven_control/oven_control.pro
... ... @@ -125,7 +125,8 @@ SOURCES += main.cpp\
125 125 programmedcookpanelbutton.cpp \
126 126 configdemomodedlg.cpp \
127 127 demoicon.cpp \
128   - halfenergyicon.cpp
  128 + halfenergyicon.cpp \
  129 + notipopupdlg.cpp
129 130  
130 131  
131 132 HEADERS += mainwindow.h \
... ... @@ -241,7 +242,8 @@ HEADERS += mainwindow.h \
241 242 programmedcookpanelbutton.h \
242 243 configdemomodedlg.h \
243 244 demoicon.h \
244   - halfenergyicon.h
  245 + halfenergyicon.h \
  246 + notipopupdlg.h
245 247  
246 248 FORMS += mainwindow.ui \
247 249 manualcookwindow.ui \
... ... @@ -320,7 +322,8 @@ FORMS += mainwindow.ui \
320 322 autocookcheckwindow.ui \
321 323 autocookcheckconfigwindow.ui \
322 324 programmedcookpanelbutton.ui \
323   - configdemomodedlg.ui
  325 + configdemomodedlg.ui \
  326 + notipopupdlg.ui
324 327  
325 328 RESOURCES += \
326 329 resources.qrc
... ...