From 71bc74deb31b5686feae15cfaed5fbfba8a38c1e Mon Sep 17 00:00:00 2001 From: victor <taehoon@falinux.com> Date: Mon, 10 Jul 2017 11:54:33 +0900 Subject: [PATCH] =?UTF-8?q?=EC=8A=A4=ED=8C=80=20=ED=86=B5=20=EC=84=B8?= =?UTF-8?q?=EC=B2=99=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/config.cpp | 4 + app/gui/oven_control/configsteamwashdlg.cpp | 193 ++++++++++++++++++++++++++++ app/gui/oven_control/configsteamwashdlg.h | 41 ++++++ app/gui/oven_control/configsteamwashdlg.ui | 186 +++++++++++++++++++++++++++ app/gui/oven_control/oven_control.pro | 9 +- 5 files changed, 430 insertions(+), 3 deletions(-) create mode 100644 app/gui/oven_control/configsteamwashdlg.cpp create mode 100644 app/gui/oven_control/configsteamwashdlg.h create mode 100644 app/gui/oven_control/configsteamwashdlg.ui diff --git a/app/gui/oven_control/config.cpp b/app/gui/oven_control/config.cpp index b0c5b76..44cbd95 100644 --- a/app/gui/oven_control/config.cpp +++ b/app/gui/oven_control/config.cpp @@ -18,6 +18,7 @@ #include "confighalfenergydlg.h" #include "config1digitsetdlg.h" #include "configdutywashdlg.h" +#include "configsteamwashdlg.h" #include "fileprocessor.h" #include "backlight.h" #include "udphandler.h" @@ -536,6 +537,9 @@ void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ case config_demo_mode: dlg = new ConfigDemoModeDlg(parent); break; + case config_steam_wash: + dlg = new ConfigSteamWashDlg(parent); + break; default: dlg=NULL; } diff --git a/app/gui/oven_control/configsteamwashdlg.cpp b/app/gui/oven_control/configsteamwashdlg.cpp new file mode 100644 index 0000000..aa19db5 --- /dev/null +++ b/app/gui/oven_control/configsteamwashdlg.cpp @@ -0,0 +1,193 @@ +#include "configsteamwashdlg.h" +#include "ui_configsteamwashdlg.h" + +#include "udphandler.h" + +ConfigSteamWashDlg::ConfigSteamWashDlg(QWidget *parent) : + QDialog(parent), + ui(new Ui::ConfigSteamWashDlg) +{ + ui->setupUi(this); + + setWindowFlags(Qt::FramelessWindowHint); + setAttribute(Qt::WA_NoSystemBackground); + setAttribute(Qt::WA_TranslucentBackground); + setAttribute(Qt::WA_DeleteOnClose); + setFocus(); + + qApp->setActiveWindow(this); + + UdpHandler *udp = UdpHandler::getInstance(); + connect(udp, SIGNAL(changed()), SLOT(onChanged())); + + updateView(); +} + +ConfigSteamWashDlg::~ConfigSteamWashDlg() +{ + delete ui; +} + +void ConfigSteamWashDlg::updateView() +{ + switch (phase) { + case Idle: + ui->ctrLbBody->setText(tr("시작하시겠습니까?")); + ui->ctrLbBody->show(); + ui->ctrGauge->hide(); + ui->ctrBtnOk->setGeometry(300, 350, 150, 100); + ui->ctrBtnOk->show(); + ui->ctrBtnCancel->show(); + break; + case Starting: + ui->ctrLbBody->hide(); + ui->ctrGauge->hide(); + ui->ctrBtnOk->hide(); + ui->ctrBtnCancel->hide(); + break; + case Started: + { + UdpHandler *udp = UdpHandler::getInstance(); + + oven_control_t control; + udp->fillControl(control); + + switch (control.clean_step_type) + { + case 1: + ui->ctrLbBody->setText(tr("내부 헹굼 진행 중입니다.")); + break; + case 2: + ui->ctrLbBody->setText(tr("스팀 급수 진행 중입니다.")); + break; + case 3: + ui->ctrLbBody->setText(tr("내부 팬 세척 진행 중입니다.")); + break; + case 4: + ui->ctrLbBody->setText(tr("내부 스팀 불림 진행 중입니다.")); + break; + case 5: + ui->ctrLbBody->setText(tr("내부 강 세척 진행 중입니다.")); + break; + case 6: + ui->ctrLbBody->setText(tr("내부 상부 세척 진행 중입니다.")); + break; + case 7: + ui->ctrLbBody->setText(tr("내부 스팀 세척 진행 중입니다.")); + break; + case 8: + ui->ctrLbBody->setText(tr("세척 종료 진행 중입니다.")); + break; + case 9: + ui->ctrLbBody->setText(tr("세제 세척수 만들기 진행 중입니다.")); + break; + case 10: + ui->ctrLbBody->setText(tr("세제 세척수 헹굼 진행 중입니다.")); + break; + case 11: + ui->ctrLbBody->setText(tr("하부 탱크 세척수 만들기 진행 중입니다.")); + break; + } + ui->ctrLbBody->show(); + + ui->ctrGauge->setMaximum(control.clean_total); + ui->ctrGauge->setValue(control.clean_step); + ui->ctrGauge->show(); + + ui->ctrBtnOk->hide(); + ui->ctrBtnCancel->hide(); + break; + } + case Finished: + ui->ctrLbBody->setText(tr("세척이 종료되었습니다")); + ui->ctrLbBody->show(); + ui->ctrGauge->setMaximum(1); + ui->ctrGauge->setValue(1); + ui->ctrGauge->show(); + ui->ctrBtnOk->setGeometry(300, 350, 300, 100); + ui->ctrBtnOk->show(); + ui->ctrBtnCancel->hide(); + } +} + +void ConfigSteamWashDlg::onChanged() +{ + switch (phase) { + case Idle: + return; + case Starting: + if (isStarted()) + phase = Started; + break; + case Started: + if (isFinished()) + phase = Finished; + break; + case Finished: + return; + } + + updateView(); +} + +void ConfigSteamWashDlg::start() +{ + UdpHandler *udp = UdpHandler::getInstance(); + udp->set(TG_OVEN_MODE, 2); + udp->set(TG_CLEAN_TYPE, 6); + udp->turnOn(TG_CLEANING); + + phase = Starting; + + updateView(); +} + +bool ConfigSteamWashDlg::isStarted() +{ + UdpHandler *udp = UdpHandler::getInstance(); + + oven_control_t control; + oven_state_t state; + udp->fillControl(control); + udp->fillData(state); + + return state.cleaning_sate != 0 + && control.clean_total != 0 + && control.clean_step != 0 + && control.clean_step_type != 0; +} + +bool ConfigSteamWashDlg::isFinished() +{ + UdpHandler *udp = UdpHandler::getInstance(); + + oven_state_t state; + udp->fillData(state); + + return state.cleaning_sate == 0; +} + +void ConfigSteamWashDlg::on_ctrBtnOk_clicked() +{ + switch (phase) { + case Idle: + start(); + break; + case Finished: + close(); + break; + default: + return; + } +} + +void ConfigSteamWashDlg::on_ctrBtnCancel_clicked() +{ + switch (phase) { + case Idle: + close(); + break; + default: + return; + } +} diff --git a/app/gui/oven_control/configsteamwashdlg.h b/app/gui/oven_control/configsteamwashdlg.h new file mode 100644 index 0000000..e4fa932 --- /dev/null +++ b/app/gui/oven_control/configsteamwashdlg.h @@ -0,0 +1,41 @@ +#ifndef CONFIGSTEAMWASHDLG_H +#define CONFIGSTEAMWASHDLG_H + +#include <QDialog> +#include <QTimer> + +namespace Ui { +class ConfigSteamWashDlg; +} + +class ConfigSteamWashDlg : public QDialog +{ + Q_OBJECT + + enum Phase { + Idle, Starting, Started, Finished + }; + +public: + explicit ConfigSteamWashDlg(QWidget *parent = 0); + ~ConfigSteamWashDlg(); + +private slots: + void updateView(); + + void onChanged(); + + void start(); + bool isStarted(); + bool isFinished(); + + void on_ctrBtnOk_clicked(); + void on_ctrBtnCancel_clicked(); + +private: + Ui::ConfigSteamWashDlg *ui; + + enum Phase phase = Idle; +}; + +#endif // CONFIGSTEAMWASHDLG_H diff --git a/app/gui/oven_control/configsteamwashdlg.ui b/app/gui/oven_control/configsteamwashdlg.ui new file mode 100644 index 0000000..cac9d4d --- /dev/null +++ b/app/gui/oven_control/configsteamwashdlg.ui @@ -0,0 +1,186 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ConfigSteamWashDlg</class> + <widget class="QDialog" name="ConfigSteamWashDlg"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>900</width> + <height>1600</height> + </rect> + </property> + <property name="windowTitle"> + <string>Dialog</string> + </property> + <property name="styleSheet"> + <string notr="true">#centralWidget { background-image: url(:/images/background/popup/503.png); +} +</string> + </property> + <widget class="QWidget" name="centralWidget" native="true"> + <property name="geometry"> + <rect> + <x>0</x> + <y>430</y> + <width>900</width> + <height>503</height> + </rect> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <widget class="QPushButton" name="ctrBtnOk"> + <property name="geometry"> + <rect> + <x>300</x> + <y>350</y> + <width>150</width> + <height>100</height> + </rect> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + <underline>true</underline> + </font> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { +border: none; +color: white; +} +QPushButton:pressed, QPushButton:focus { +color: yellow; +}</string> + </property> + <property name="text"> + <string>확인</string> + </property> + </widget> + <widget class="QLabel" name="ctrLbTitle"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>900</width> + <height>91</height> + </rect> + </property> + <property name="font"> + <font> + <family>나눔고딕</family> + <pointsize>13</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="styleSheet"> + <string notr="true">QLabel { + color : white; + border : none; +}</string> + </property> + <property name="text"> + <string>증기 발생기 헹굼</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="Line" name="line"> + <property name="geometry"> + <rect> + <x>0</x> + <y>93</y> + <width>900</width> + <height>3</height> + </rect> + </property> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + </widget> + <widget class="QLabel" name="ctrLbBody"> + <property name="geometry"> + <rect> + <x>0</x> + <y>100</y> + <width>900</width> + <height>91</height> + </rect> + </property> + <property name="font"> + <font> + <family>나눔고딕</family> + <pointsize>13</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="styleSheet"> + <string notr="true">QLabel { + color : white; + border : none; +}</string> + </property> + <property name="text"> + <string>시작하시겠습니까?</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + <widget class="WashStepGauge" name="ctrGauge" native="true"> + <property name="geometry"> + <rect> + <x>184</x> + <y>210</y> + <width>532</width> + <height>58</height> + </rect> + </property> + </widget> + <widget class="QPushButton" name="ctrBtnCancel"> + <property name="geometry"> + <rect> + <x>450</x> + <y>350</y> + <width>150</width> + <height>100</height> + </rect> + </property> + <property name="font"> + <font> + <weight>75</weight> + <bold>true</bold> + <underline>true</underline> + </font> + </property> + <property name="styleSheet"> + <string notr="true">QPushButton { +border: none; +color: white; +} +QPushButton:pressed, QPushButton:focus { +color: yellow; +}</string> + </property> + <property name="text"> + <string>취소</string> + </property> + </widget> + </widget> + </widget> + <customwidgets> + <customwidget> + <class>WashStepGauge</class> + <extends>QWidget</extends> + <header>washstepgauge.h</header> + <container>1</container> + </customwidget> + </customwidgets> + <resources/> + <connections/> +</ui> diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index dba1e3a..f1618a6 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -126,7 +126,8 @@ SOURCES += main.cpp\ configdemomodedlg.cpp \ demoicon.cpp \ halfenergyicon.cpp \ - notipopupdlg.cpp + notipopupdlg.cpp \ + configsteamwashdlg.cpp HEADERS += mainwindow.h \ @@ -243,7 +244,8 @@ HEADERS += mainwindow.h \ configdemomodedlg.h \ demoicon.h \ halfenergyicon.h \ - notipopupdlg.h + notipopupdlg.h \ + configsteamwashdlg.h FORMS += mainwindow.ui \ manualcookwindow.ui \ @@ -323,7 +325,8 @@ FORMS += mainwindow.ui \ autocookcheckconfigwindow.ui \ programmedcookpanelbutton.ui \ configdemomodedlg.ui \ - notipopupdlg.ui + notipopupdlg.ui \ + configsteamwashdlg.ui RESOURCES += \ resources.qrc -- 2.1.4