Commit 6fb8aa9a86fe5424040ef8713408cfb72b2c4fb4
1 parent
d56284d940
Exists in
fhd
수동 요리 종료 시 보온 여부 설정 팝업 생성 (스팀, 건열 모드 한정)
Showing
6 changed files
with
331 additions
and
0 deletions
Show diff stats
app/gui/oven_control/manualcookfinishpopup.cpp
@@ -0,0 +1,115 @@ | @@ -0,0 +1,115 @@ | ||
1 | +#include "manualcookfinishpopup.h" | ||
2 | +#include "ui_manualcookfinishpopup.h" | ||
3 | + | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
6 | +#include "soundplayer.h" | ||
7 | + | ||
8 | +ManualCookFinishPopup::ManualCookFinishPopup(QWidget *parent) : | ||
9 | + QWidget(parent), | ||
10 | + ui(new Ui::ManualCookFinishPopup) | ||
11 | +{ | ||
12 | + ui->setupUi(this); | ||
13 | + | ||
14 | + setAttribute(Qt::WA_DeleteOnClose); | ||
15 | + | ||
16 | + foreach (QPushButton *button, findChildren<QPushButton *>()) | ||
17 | + connect(button, &QPushButton::pressed, SoundPlayer::playClick); | ||
18 | + | ||
19 | + ui->background->setFocus(); | ||
20 | +} | ||
21 | + | ||
22 | +ManualCookFinishPopup::~ManualCookFinishPopup() | ||
23 | +{ | ||
24 | + delete ui; | ||
25 | +} | ||
26 | + | ||
27 | +void ManualCookFinishPopup::keyPressEvent(QKeyEvent *event) | ||
28 | +{ | ||
29 | + switch (event->key()) | ||
30 | + { | ||
31 | + case 0x01000032: // Turn left | ||
32 | + onEncoderLeft(); | ||
33 | + break; | ||
34 | + case 0x01000031: // Push | ||
35 | + pushed = focusWidget(); | ||
36 | + break; | ||
37 | + case 0x01000030: // Turn right | ||
38 | + onEncoderRight(); | ||
39 | + break; | ||
40 | + } | ||
41 | +} | ||
42 | + | ||
43 | +void ManualCookFinishPopup::keyReleaseEvent(QKeyEvent *event) | ||
44 | +{ | ||
45 | + switch (event->key()) | ||
46 | + { | ||
47 | + case 0x01000032: // Turn left | ||
48 | + onEncoderLeft(); | ||
49 | + break; | ||
50 | + case 0x01000031: // Push | ||
51 | + if (focusWidget() == pushed) | ||
52 | + onEncoderClicked(pushed); | ||
53 | + | ||
54 | + pushed = NULL; | ||
55 | + break; | ||
56 | + case 0x01000030: // Turn right | ||
57 | + onEncoderRight(); | ||
58 | + break; | ||
59 | + } | ||
60 | +} | ||
61 | + | ||
62 | +void ManualCookFinishPopup::onEncoderLeft() | ||
63 | +{ | ||
64 | + QWidget *focused = focusWidget(); | ||
65 | + if (focused == ui->background) | ||
66 | + ui->okButton->setFocus(); | ||
67 | + else | ||
68 | + focusPreviousChild(); | ||
69 | +} | ||
70 | + | ||
71 | +void ManualCookFinishPopup::onEncoderRight() | ||
72 | +{ | ||
73 | + if (focusWidget() == ui->okButton) | ||
74 | + ui->background->setFocus(); | ||
75 | + else | ||
76 | + focusNextChild(); | ||
77 | +} | ||
78 | + | ||
79 | +void ManualCookFinishPopup::onEncoderClicked(QWidget *clicked) | ||
80 | +{ | ||
81 | + if (clicked == ui->background) | ||
82 | + { | ||
83 | + close(); | ||
84 | + return; | ||
85 | + } | ||
86 | + | ||
87 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
88 | + if (b) | ||
89 | + { | ||
90 | + b->click(); | ||
91 | + return; | ||
92 | + } | ||
93 | +} | ||
94 | + | ||
95 | +void ManualCookFinishPopup::on_closeButton_clicked() | ||
96 | +{ | ||
97 | + close(); | ||
98 | +} | ||
99 | + | ||
100 | +void ManualCookFinishPopup::on_closeButton_2_clicked() | ||
101 | +{ | ||
102 | + close(); | ||
103 | +} | ||
104 | + | ||
105 | +void ManualCookFinishPopup::on_warmupButton_clicked() | ||
106 | +{ | ||
107 | + close(); | ||
108 | + | ||
109 | + emit keepWarm(); | ||
110 | +} | ||
111 | + | ||
112 | +void ManualCookFinishPopup::on_okButton_clicked() | ||
113 | +{ | ||
114 | + close(); | ||
115 | +} |
app/gui/oven_control/manualcookfinishpopup.h
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +#ifndef MANUALCOOKFINISHPOPUP_H | ||
2 | +#define MANUALCOOKFINISHPOPUP_H | ||
3 | + | ||
4 | +#include <QWidget> | ||
5 | + | ||
6 | +namespace Ui { | ||
7 | +class ManualCookFinishPopup; | ||
8 | +} | ||
9 | + | ||
10 | +class ManualCookFinishPopup : public QWidget | ||
11 | +{ | ||
12 | + Q_OBJECT | ||
13 | + | ||
14 | +public: | ||
15 | + explicit ManualCookFinishPopup(QWidget *parent = nullptr); | ||
16 | + ~ManualCookFinishPopup(); | ||
17 | + | ||
18 | +signals: | ||
19 | + void keepWarm(); | ||
20 | + | ||
21 | +protected: | ||
22 | + void keyPressEvent(QKeyEvent *event); | ||
23 | + void keyReleaseEvent(QKeyEvent *event); | ||
24 | + | ||
25 | +private: | ||
26 | + Ui::ManualCookFinishPopup *ui; | ||
27 | + | ||
28 | + QWidget *pushed = Q_NULLPTR; | ||
29 | + | ||
30 | + void onEncoderLeft(); | ||
31 | + void onEncoderRight(); | ||
32 | + void onEncoderClicked(QWidget *clicked); | ||
33 | + | ||
34 | +private slots: | ||
35 | + void on_closeButton_clicked(); | ||
36 | + void on_closeButton_2_clicked(); | ||
37 | + void on_warmupButton_clicked(); | ||
38 | + void on_okButton_clicked(); | ||
39 | +}; | ||
40 | + | ||
41 | +#endif // MANUALCOOKFINISHPOPUP_H |
app/gui/oven_control/manualcookfinishpopup.ui
@@ -0,0 +1,151 @@ | @@ -0,0 +1,151 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<ui version="4.0"> | ||
3 | + <class>ManualCookFinishPopup</class> | ||
4 | + <widget class="QWidget" name="ManualCookFinishPopup"> | ||
5 | + <property name="geometry"> | ||
6 | + <rect> | ||
7 | + <x>0</x> | ||
8 | + <y>0</y> | ||
9 | + <width>1080</width> | ||
10 | + <height>1920</height> | ||
11 | + </rect> | ||
12 | + </property> | ||
13 | + <property name="windowTitle"> | ||
14 | + <string>Form</string> | ||
15 | + </property> | ||
16 | + <property name="styleSheet"> | ||
17 | + <string notr="true">#closeButton { border: none; } | ||
18 | +#closeButton_2 { border: none; } | ||
19 | +#background { background-image: url(:/images/background/popup/373.png); } | ||
20 | +#background:focus { border: 4px solid gray; } | ||
21 | + | ||
22 | +QPushButton { | ||
23 | +background-position: center; | ||
24 | +background-repeat: no-repeat; | ||
25 | +border: none; | ||
26 | +} | ||
27 | + | ||
28 | +QPushButton[style="icon"] { background-image: url(:/images/slider_icon/background.png); } | ||
29 | + | ||
30 | +QPushButton { color: white; border: none; } | ||
31 | +QPushButton:pressed, QPushButton:focus { color: yellow; } | ||
32 | + | ||
33 | +QLabel { color: white; }</string> | ||
34 | + </property> | ||
35 | + <widget class="QPushButton" name="closeButton_2"> | ||
36 | + <property name="geometry"> | ||
37 | + <rect> | ||
38 | + <x>0</x> | ||
39 | + <y>961</y> | ||
40 | + <width>1080</width> | ||
41 | + <height>958</height> | ||
42 | + </rect> | ||
43 | + </property> | ||
44 | + <property name="text"> | ||
45 | + <string/> | ||
46 | + </property> | ||
47 | + </widget> | ||
48 | + <widget class="QWidget" name="background" native="true"> | ||
49 | + <property name="geometry"> | ||
50 | + <rect> | ||
51 | + <x>0</x> | ||
52 | + <y>511</y> | ||
53 | + <width>1080</width> | ||
54 | + <height>447</height> | ||
55 | + </rect> | ||
56 | + </property> | ||
57 | + <property name="focusPolicy"> | ||
58 | + <enum>Qt::TabFocus</enum> | ||
59 | + </property> | ||
60 | + <widget class="QPushButton" name="warmupButton"> | ||
61 | + <property name="geometry"> | ||
62 | + <rect> | ||
63 | + <x>650</x> | ||
64 | + <y>320</y> | ||
65 | + <width>182</width> | ||
66 | + <height>84</height> | ||
67 | + </rect> | ||
68 | + </property> | ||
69 | + <property name="font"> | ||
70 | + <font> | ||
71 | + <weight>75</weight> | ||
72 | + <bold>true</bold> | ||
73 | + <underline>true</underline> | ||
74 | + </font> | ||
75 | + </property> | ||
76 | + <property name="styleSheet"> | ||
77 | + <string notr="true"/> | ||
78 | + </property> | ||
79 | + <property name="text"> | ||
80 | + <string>보온</string> | ||
81 | + </property> | ||
82 | + </widget> | ||
83 | + <widget class="QPushButton" name="okButton"> | ||
84 | + <property name="geometry"> | ||
85 | + <rect> | ||
86 | + <x>850</x> | ||
87 | + <y>320</y> | ||
88 | + <width>182</width> | ||
89 | + <height>84</height> | ||
90 | + </rect> | ||
91 | + </property> | ||
92 | + <property name="font"> | ||
93 | + <font> | ||
94 | + <weight>75</weight> | ||
95 | + <bold>true</bold> | ||
96 | + <underline>true</underline> | ||
97 | + </font> | ||
98 | + </property> | ||
99 | + <property name="styleSheet"> | ||
100 | + <string notr="true"/> | ||
101 | + </property> | ||
102 | + <property name="text"> | ||
103 | + <string>확인</string> | ||
104 | + </property> | ||
105 | + </widget> | ||
106 | + <widget class="QLabel" name="text"> | ||
107 | + <property name="geometry"> | ||
108 | + <rect> | ||
109 | + <x>0</x> | ||
110 | + <y>0</y> | ||
111 | + <width>1080</width> | ||
112 | + <height>240</height> | ||
113 | + </rect> | ||
114 | + </property> | ||
115 | + <property name="font"> | ||
116 | + <font> | ||
117 | + <pointsize>16</pointsize> | ||
118 | + </font> | ||
119 | + </property> | ||
120 | + <property name="text"> | ||
121 | + <string>요리가 끝났습니다</string> | ||
122 | + </property> | ||
123 | + <property name="alignment"> | ||
124 | + <set>Qt::AlignCenter</set> | ||
125 | + </property> | ||
126 | + </widget> | ||
127 | + </widget> | ||
128 | + <widget class="QPushButton" name="closeButton"> | ||
129 | + <property name="geometry"> | ||
130 | + <rect> | ||
131 | + <x>0</x> | ||
132 | + <y>0</y> | ||
133 | + <width>1080</width> | ||
134 | + <height>511</height> | ||
135 | + </rect> | ||
136 | + </property> | ||
137 | + <property name="text"> | ||
138 | + <string/> | ||
139 | + </property> | ||
140 | + </widget> | ||
141 | + </widget> | ||
142 | + <tabstops> | ||
143 | + <tabstop>closeButton_2</tabstop> | ||
144 | + <tabstop>background</tabstop> | ||
145 | + <tabstop>warmupButton</tabstop> | ||
146 | + <tabstop>okButton</tabstop> | ||
147 | + <tabstop>closeButton</tabstop> | ||
148 | + </tabstops> | ||
149 | + <resources/> | ||
150 | + <connections/> | ||
151 | +</ui> |
app/gui/oven_control/manualcookwindow.cpp
@@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
24 | #include "errorpopupdlg.h" | 24 | #include "errorpopupdlg.h" |
25 | #include "manualviewerdlg.h" | 25 | #include "manualviewerdlg.h" |
26 | #include "haccp.h" | 26 | #include "haccp.h" |
27 | +#include "manualcookfinishpopup.h" | ||
27 | 28 | ||
28 | #include <QTime> | 29 | #include <QTime> |
29 | 30 | ||
@@ -616,6 +617,19 @@ void ManualCookWindow::showInfoText(QString text, QString icon) | @@ -616,6 +617,19 @@ void ManualCookWindow::showInfoText(QString text, QString icon) | ||
616 | showInfoTextTimer.start(); | 617 | showInfoTextTimer.start(); |
617 | } | 618 | } |
618 | 619 | ||
620 | +void ManualCookWindow::startKeepWarm() | ||
621 | +{ | ||
622 | + if (oven->mode() == Define::CombiMode) | ||
623 | + return; | ||
624 | + | ||
625 | + cookDone = false; | ||
626 | + | ||
627 | + oven->setTemp(70); | ||
628 | + oven->setTime(60*60); | ||
629 | + | ||
630 | + start(); | ||
631 | +} | ||
632 | + | ||
619 | void ManualCookWindow::onOvenUpdated(Oven *oven) | 633 | void ManualCookWindow::onOvenUpdated(Oven *oven) |
620 | { | 634 | { |
621 | updateView(); | 635 | updateView(); |
@@ -650,6 +664,12 @@ void ManualCookWindow::onOvenUpdated(Oven *oven) | @@ -650,6 +664,12 @@ void ManualCookWindow::onOvenUpdated(Oven *oven) | ||
650 | HACCP::done(); | 664 | HACCP::done(); |
651 | 665 | ||
652 | emit done(); | 666 | emit done(); |
667 | + | ||
668 | + if (oven->mode() != Define::CombiMode) { | ||
669 | + ManualCookFinishPopup *p = new ManualCookFinishPopup(this); | ||
670 | + p->showFullScreen(); | ||
671 | + connect(p, SIGNAL(keepWarm()), SLOT(startKeepWarm())); | ||
672 | + } | ||
653 | } | 673 | } |
654 | } | 674 | } |
655 | 675 |
app/gui/oven_control/manualcookwindow.h
@@ -42,6 +42,7 @@ private slots: | @@ -42,6 +42,7 @@ private slots: | ||
42 | void showCurrentTemp(); | 42 | void showCurrentTemp(); |
43 | void hideCurrentTemp(); | 43 | void hideCurrentTemp(); |
44 | void showInfoText(QString text, QString icon); | 44 | void showInfoText(QString text, QString icon); |
45 | + void startKeepWarm(); | ||
45 | 46 | ||
46 | void onOvenUpdated(Oven *oven); | 47 | void onOvenUpdated(Oven *oven); |
47 | 48 |
app/gui/oven_control/oven_control.pro
@@ -16,6 +16,7 @@ SOURCES += main.cpp\ | @@ -16,6 +16,7 @@ SOURCES += main.cpp\ | ||
16 | commicon.cpp \ | 16 | commicon.cpp \ |
17 | mainwindow.cpp \ | 17 | mainwindow.cpp \ |
18 | cook.cpp \ | 18 | cook.cpp \ |
19 | + manualcookfinishpopup.cpp \ | ||
19 | oven.cpp \ | 20 | oven.cpp \ |
20 | abstractoveninterface.cpp \ | 21 | abstractoveninterface.cpp \ |
21 | clock.cpp \ | 22 | clock.cpp \ |
@@ -156,6 +157,7 @@ SOURCES += main.cpp\ | @@ -156,6 +157,7 @@ SOURCES += main.cpp\ | ||
156 | HEADERS += mainwindow.h \ | 157 | HEADERS += mainwindow.h \ |
157 | commicon.h \ | 158 | commicon.h \ |
158 | cook.h \ | 159 | cook.h \ |
160 | + manualcookfinishpopup.h \ | ||
159 | oven.h \ | 161 | oven.h \ |
160 | abstractoveninterface.h \ | 162 | abstractoveninterface.h \ |
161 | clock.h \ | 163 | clock.h \ |
@@ -294,6 +296,7 @@ HEADERS += mainwindow.h \ | @@ -294,6 +296,7 @@ HEADERS += mainwindow.h \ | ||
294 | waterlevelicon.h | 296 | waterlevelicon.h |
295 | 297 | ||
296 | FORMS += mainwindow.ui \ | 298 | FORMS += mainwindow.ui \ |
299 | + manualcookfinishpopup.ui \ | ||
297 | manualcookwindow.ui \ | 300 | manualcookwindow.ui \ |
298 | configwindow.ui \ | 301 | configwindow.ui \ |
299 | functiontestwindow.ui \ | 302 | functiontestwindow.ui \ |