Commit a366f320c8d15b5d9a6a61e0df3584686995ca0b
1 parent
069c755078
Exists in
master
and in
2 other branches
자동 요리 후속 공정 동작 개선
- 바삭하게 만들기 동작 시 GUI에 표현 - 습도 0, 온도 +10 한 단계 추가 후 표시 - 자동 요리 단계 표시 위젯 구조 개선
Showing
6 changed files
with
221 additions
and
28 deletions
Show diff stats
app/gui/oven_control/autocookwindow.cpp
@@ -46,8 +46,6 @@ AutoCookWindow::~AutoCookWindow() | @@ -46,8 +46,6 @@ AutoCookWindow::~AutoCookWindow() | ||
46 | 46 | ||
47 | void AutoCookWindow::setupUi() | 47 | void AutoCookWindow::setupUi() |
48 | { | 48 | { |
49 | - bulletPixmap.load(":/images/symbol/step_bullet.png"); | ||
50 | - selectedBulletPixmap.load(":/images/symbol/selected_step_bullet.png"); | ||
51 | steamModeIcon.load(":/images/cook_mode/small_steam.png"); | 49 | steamModeIcon.load(":/images/cook_mode/small_steam.png"); |
52 | dryModeIcon.load(":/images/cook_mode/small_dryheat.png"); | 50 | dryModeIcon.load(":/images/cook_mode/small_dryheat.png"); |
53 | combiModeIcon.load(":/images/cook_mode/small_combi.png"); | 51 | combiModeIcon.load(":/images/cook_mode/small_combi.png"); |
@@ -55,15 +53,7 @@ void AutoCookWindow::setupUi() | @@ -55,15 +53,7 @@ void AutoCookWindow::setupUi() | ||
55 | ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); | 53 | ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); |
56 | ui->selectCookButton->setText(cook.name); | 54 | ui->selectCookButton->setText(cook.name); |
57 | 55 | ||
58 | - int offsetX = (900 - (cook.steps.size() * 19 * 2 - 19)) / 2; | ||
59 | - int offsetY = 1150; | ||
60 | - for (int idx = 0; idx < cook.steps.size(); idx++) | ||
61 | - { | ||
62 | - QLabel *bullet = new QLabel(this); | ||
63 | - bullet->setPixmap(bulletPixmap); | ||
64 | - bullet->setGeometry(offsetX + 19 * 2 * idx, offsetY, 19, 19); | ||
65 | - bullets.append(bullet); | ||
66 | - } | 56 | + ui->stepIndicator->setMaximum(cook.steps.size() - 1); |
67 | 57 | ||
68 | ui->cookStepAnimation->start(300); | 58 | ui->cookStepAnimation->start(300); |
69 | 59 | ||
@@ -333,15 +323,7 @@ void AutoCookWindow::updateView() | @@ -333,15 +323,7 @@ void AutoCookWindow::updateView() | ||
333 | if (selectedStepIndex != lastViewStepIndex) | 323 | if (selectedStepIndex != lastViewStepIndex) |
334 | { | 324 | { |
335 | lastViewStepIndex = selectedStepIndex; | 325 | lastViewStepIndex = selectedStepIndex; |
336 | - | ||
337 | - for (int idx = 0; idx < bullets.length(); idx++) | ||
338 | - { | ||
339 | - QLabel *bullet = bullets.at(idx); | ||
340 | - if (idx == selectedStepIndex) | ||
341 | - bullet->setPixmap(selectedBulletPixmap); | ||
342 | - else | ||
343 | - bullet->setPixmap(bulletPixmap); | ||
344 | - } | 326 | + ui->stepIndicator->setCurrentIndex(selectedStepIndex); |
345 | } | 327 | } |
346 | 328 | ||
347 | CookStep showingStep = autocook.cook.steps[selectedStepIndex]; | 329 | CookStep showingStep = autocook.cook.steps[selectedStepIndex]; |
@@ -566,8 +548,20 @@ void AutoCookWindow::startProcess(int process) | @@ -566,8 +548,20 @@ void AutoCookWindow::startProcess(int process) | ||
566 | 548 | ||
567 | CookStep &step = autocook.cook.steps[autocook.cook.steps.size() - 1]; | 549 | CookStep &step = autocook.cook.steps[autocook.cook.steps.size() - 1]; |
568 | 550 | ||
551 | + CookStep newStep = step; | ||
552 | + newStep.type = Define::MakeCrispy; | ||
553 | + newStep.humidity = 0; | ||
554 | + newStep.temp += 10; | ||
555 | + newStep.time = 0; | ||
556 | + newStep.humidification = 0; | ||
557 | + newStep.dehumidification = 0; | ||
558 | + autocook.cook.steps.append(newStep); | ||
559 | + autocook.currentStepIndex = autocook.cook.steps.size() - 1; | ||
560 | + ui->stepIndicator->setMaximum(autocook.cook.steps.size() - 1); | ||
561 | + returnToCurrentStep(); | ||
562 | + | ||
569 | Oven *oven = Oven::getInstance(); | 563 | Oven *oven = Oven::getInstance(); |
570 | - oven->setHumidity(step.humidity); | 564 | + oven->setHumidity(0); |
571 | oven->setTemp(step.temp + 10); | 565 | oven->setTemp(step.temp + 10); |
572 | oven->startCooking(); | 566 | oven->startCooking(); |
573 | 567 | ||
@@ -601,6 +595,7 @@ void AutoCookWindow::checkProcess() | @@ -601,6 +595,7 @@ void AutoCookWindow::checkProcess() | ||
601 | { | 595 | { |
602 | oven->stopCooking(); | 596 | oven->stopCooking(); |
603 | checkProcessTimer.stop(); | 597 | checkProcessTimer.stop(); |
598 | + processSelected = false; | ||
604 | } | 599 | } |
605 | break; | 600 | break; |
606 | } | 601 | } |
@@ -683,7 +678,7 @@ void AutoCookWindow::on_showPrevStepButton_clicked() | @@ -683,7 +678,7 @@ void AutoCookWindow::on_showPrevStepButton_clicked() | ||
683 | 678 | ||
684 | void AutoCookWindow::on_showNextStepButton_clicked() | 679 | void AutoCookWindow::on_showNextStepButton_clicked() |
685 | { | 680 | { |
686 | - if (selectedStepIndex + 1 < cook.steps.size()) | 681 | + if (selectedStepIndex + 1 < autocook.cook.steps.size()) |
687 | { | 682 | { |
688 | selectedStepIndex++; | 683 | selectedStepIndex++; |
689 | updateView(); | 684 | updateView(); |
app/gui/oven_control/autocookwindow.h
@@ -27,10 +27,6 @@ private: | @@ -27,10 +27,6 @@ private: | ||
27 | 27 | ||
28 | QTimer checkCookTimer; | 28 | QTimer checkCookTimer; |
29 | 29 | ||
30 | - QPixmap bulletPixmap; | ||
31 | - QPixmap selectedBulletPixmap; | ||
32 | - QList<QLabel *> bullets; | ||
33 | - | ||
34 | QPixmap steamModeIcon; | 30 | QPixmap steamModeIcon; |
35 | QPixmap dryModeIcon; | 31 | QPixmap dryModeIcon; |
36 | QPixmap combiModeIcon; | 32 | QPixmap combiModeIcon; |
app/gui/oven_control/autocookwindow.ui
@@ -1304,6 +1304,16 @@ QPushButton:pressed { border-image: url(:/images/button/152_ov.png); }</string> | @@ -1304,6 +1304,16 @@ QPushButton:pressed { border-image: url(:/images/button/152_ov.png); }</string> | ||
1304 | </property> | 1304 | </property> |
1305 | </widget> | 1305 | </widget> |
1306 | </widget> | 1306 | </widget> |
1307 | + <widget class="BulletIndicator" name="stepIndicator" native="true"> | ||
1308 | + <property name="geometry"> | ||
1309 | + <rect> | ||
1310 | + <x>100</x> | ||
1311 | + <y>1130</y> | ||
1312 | + <width>700</width> | ||
1313 | + <height>50</height> | ||
1314 | + </rect> | ||
1315 | + </property> | ||
1316 | + </widget> | ||
1307 | <zorder>openDoorAnimation</zorder> | 1317 | <zorder>openDoorAnimation</zorder> |
1308 | <zorder>closeDoorAnimation</zorder> | 1318 | <zorder>closeDoorAnimation</zorder> |
1309 | <zorder>upperStack</zorder> | 1319 | <zorder>upperStack</zorder> |
@@ -1336,10 +1346,17 @@ QPushButton:pressed { border-image: url(:/images/button/152_ov.png); }</string> | @@ -1336,10 +1346,17 @@ QPushButton:pressed { border-image: url(:/images/button/152_ov.png); }</string> | ||
1336 | <zorder>openDoorArrow</zorder> | 1346 | <zorder>openDoorArrow</zorder> |
1337 | <zorder>heatGaugeButton</zorder> | 1347 | <zorder>heatGaugeButton</zorder> |
1338 | <zorder>processContainer</zorder> | 1348 | <zorder>processContainer</zorder> |
1349 | + <zorder>stepIndicator</zorder> | ||
1339 | </widget> | 1350 | </widget> |
1340 | </widget> | 1351 | </widget> |
1341 | <customwidgets> | 1352 | <customwidgets> |
1342 | <customwidget> | 1353 | <customwidget> |
1354 | + <class>BulletIndicator</class> | ||
1355 | + <extends>QWidget</extends> | ||
1356 | + <header>bulletindicator.h</header> | ||
1357 | + <container>1</container> | ||
1358 | + </customwidget> | ||
1359 | + <customwidget> | ||
1343 | <class>Clock</class> | 1360 | <class>Clock</class> |
1344 | <extends>QWidget</extends> | 1361 | <extends>QWidget</extends> |
1345 | <header>clock.h</header> | 1362 | <header>clock.h</header> |
app/gui/oven_control/bulletindicator.cpp
@@ -0,0 +1,142 @@ | @@ -0,0 +1,142 @@ | ||
1 | +#include "bulletindicator.h" | ||
2 | + | ||
3 | +BulletIndicator::BulletIndicator(QWidget *parent) : QWidget(parent) | ||
4 | +{ | ||
5 | + max = 1; | ||
6 | + cur = 0; | ||
7 | + bulletPixmap.load(":/images/symbol/step_bullet.png"); | ||
8 | + currentBulletPixmap.load(":/images/symbol/selected_step_bullet.png"); | ||
9 | + padding = qMin(bulletPixmap.width(), currentBulletPixmap.width()); | ||
10 | + | ||
11 | + QRect defaultGeometry; | ||
12 | + defaultGeometry.setSize(bulletPixmap.size()); | ||
13 | + | ||
14 | + QLabel *bullet; | ||
15 | + | ||
16 | + bullet = new QLabel(this); | ||
17 | + bullet->setPixmap(currentBulletPixmap); | ||
18 | + bullet->setGeometry(defaultGeometry); | ||
19 | + bullets.append(bullet); | ||
20 | + | ||
21 | + bullet = new QLabel(this); | ||
22 | + bullet->setPixmap(bulletPixmap); | ||
23 | + bullet->setGeometry(defaultGeometry); | ||
24 | + bullets.append(bullet); | ||
25 | + | ||
26 | + updatePosition(); | ||
27 | +} | ||
28 | + | ||
29 | +void BulletIndicator::setBulletPixmap(QPixmap &pixmap) | ||
30 | +{ | ||
31 | + bulletPixmap = pixmap; | ||
32 | + | ||
33 | + for (int i = 0; i <= max; i++) | ||
34 | + if (i != cur) | ||
35 | + bullets.at(i)->setPixmap(pixmap); | ||
36 | + | ||
37 | + padding = qMin(pixmap.width(), padding); | ||
38 | + | ||
39 | + updatePosition(); | ||
40 | +} | ||
41 | + | ||
42 | +void BulletIndicator::setCurrentBulletPixmap(QPixmap &pixmap) | ||
43 | +{ | ||
44 | + currentBulletPixmap = pixmap; | ||
45 | + | ||
46 | + bullets.at(cur)->setPixmap(pixmap); | ||
47 | + | ||
48 | + padding = qMin(pixmap.width(), padding); | ||
49 | + | ||
50 | + updatePosition(); | ||
51 | +} | ||
52 | + | ||
53 | +void BulletIndicator::setCurrentIndex(int index) | ||
54 | +{ | ||
55 | + if (index == cur || index < 0 || index > max) | ||
56 | + return; | ||
57 | + | ||
58 | + bullets.at(cur)->setPixmap(bulletPixmap); | ||
59 | + bullets.at(index)->setPixmap(currentBulletPixmap); | ||
60 | + | ||
61 | + cur = index; | ||
62 | + | ||
63 | + updatePosition(); | ||
64 | +} | ||
65 | + | ||
66 | +void BulletIndicator::setMaximum(int maximum) | ||
67 | +{ | ||
68 | + if (maximum == max || maximum < 1) | ||
69 | + return; | ||
70 | + | ||
71 | + if (bullets.size() <= maximum) | ||
72 | + { | ||
73 | + QRect defaultGeometry; | ||
74 | + defaultGeometry.setSize(bulletPixmap.size()); | ||
75 | + for (int i = bullets.size(); i <= maximum; i++) | ||
76 | + { | ||
77 | + QLabel *l = new QLabel(this); | ||
78 | + l->setPixmap(bulletPixmap); | ||
79 | + l->setGeometry(defaultGeometry); | ||
80 | + bullets.append(l); | ||
81 | + } | ||
82 | + } | ||
83 | + | ||
84 | + if (maximum > max) | ||
85 | + { | ||
86 | + for (int i = max + 1; i <= maximum; i++) | ||
87 | + { | ||
88 | + QLabel *l = bullets.at(i); | ||
89 | + if (l->isHidden()) | ||
90 | + l->show(); | ||
91 | + } | ||
92 | + } | ||
93 | + else if (maximum < max) | ||
94 | + { | ||
95 | + for (int i = maximum + 1; i <= max; i++) | ||
96 | + { | ||
97 | + QLabel *l = bullets.at(i); | ||
98 | + if (l->isVisible()) | ||
99 | + l->hide(); | ||
100 | + } | ||
101 | + } | ||
102 | + | ||
103 | + max = maximum; | ||
104 | + | ||
105 | + if (maximum < cur) | ||
106 | + setCurrentIndex(maximum); | ||
107 | + else | ||
108 | + updatePosition(); | ||
109 | +} | ||
110 | + | ||
111 | +void BulletIndicator::resizeEvent(QResizeEvent *event) | ||
112 | +{ | ||
113 | + QWidget::resizeEvent(event); | ||
114 | + | ||
115 | + updatePosition(); | ||
116 | +} | ||
117 | + | ||
118 | +void BulletIndicator::updatePosition() | ||
119 | +{ | ||
120 | + int bulletWidth = bulletPixmap.width(); | ||
121 | + int bulletHeight = bulletPixmap.height(); | ||
122 | + int currentBulletWidth = currentBulletPixmap.width(); | ||
123 | + int currentBulletHeight = currentBulletPixmap.height(); | ||
124 | + | ||
125 | + int x = (width() - ((bulletWidth + padding) * max + currentBulletWidth)) / 2; | ||
126 | + int bulletY = (height() - bulletHeight) / 2; | ||
127 | + int currentBulletY = (height() - currentBulletHeight) / 2; | ||
128 | + | ||
129 | + for (int i = 0; i <= max; i++) | ||
130 | + { | ||
131 | + if (i == cur) | ||
132 | + { | ||
133 | + bullets.at(i)->setGeometry(x, currentBulletY, currentBulletWidth, currentBulletHeight); | ||
134 | + x += currentBulletWidth + padding; | ||
135 | + } | ||
136 | + else | ||
137 | + { | ||
138 | + bullets.at(i)->setGeometry(x, bulletY, bulletWidth, bulletHeight); | ||
139 | + x += bulletWidth + padding; | ||
140 | + } | ||
141 | + } | ||
142 | +} |
app/gui/oven_control/bulletindicator.h
@@ -0,0 +1,41 @@ | @@ -0,0 +1,41 @@ | ||
1 | +#ifndef BULLETINDICATOR_H | ||
2 | +#define BULLETINDICATOR_H | ||
3 | + | ||
4 | +#include <QWidget> | ||
5 | +#include <QLabel> | ||
6 | + | ||
7 | +class BulletIndicator : public QWidget | ||
8 | +{ | ||
9 | + Q_OBJECT | ||
10 | +public: | ||
11 | + explicit BulletIndicator(QWidget *parent = 0); | ||
12 | + | ||
13 | + void setBulletPixmap(QPixmap &pixmap); | ||
14 | + void setCurrentBulletPixmap(QPixmap &pixmap); | ||
15 | + | ||
16 | + int maximum() { return max; } | ||
17 | + int currentIndex() { return cur; } | ||
18 | + | ||
19 | +signals: | ||
20 | + | ||
21 | +public slots: | ||
22 | + void setCurrentIndex(int index); | ||
23 | + void setMaximum(int maximum); | ||
24 | + | ||
25 | +protected: | ||
26 | + void resizeEvent(QResizeEvent *event); | ||
27 | + | ||
28 | +private: | ||
29 | + int max; | ||
30 | + int cur; | ||
31 | + | ||
32 | + int padding; | ||
33 | + QPixmap bulletPixmap; | ||
34 | + QPixmap currentBulletPixmap; | ||
35 | + | ||
36 | + QList<QLabel *> bullets; | ||
37 | + | ||
38 | + void updatePosition(); | ||
39 | +}; | ||
40 | + | ||
41 | +#endif // BULLETINDICATOR_H |
app/gui/oven_control/oven_control.pro
@@ -60,7 +60,8 @@ SOURCES += main.cpp\ | @@ -60,7 +60,8 @@ SOURCES += main.cpp\ | ||
60 | operationtimeparts.cpp \ | 60 | operationtimeparts.cpp \ |
61 | realtimemain.cpp \ | 61 | realtimemain.cpp \ |
62 | realtimepartswindow.cpp \ | 62 | realtimepartswindow.cpp \ |
63 | - realtimesensorwindow.cpp | 63 | + realtimesensorwindow.cpp \ |
64 | + bulletindicator.cpp | ||
64 | 65 | ||
65 | HEADERS += mainwindow.h \ | 66 | HEADERS += mainwindow.h \ |
66 | cook.h \ | 67 | cook.h \ |
@@ -109,7 +110,8 @@ HEADERS += mainwindow.h \ | @@ -109,7 +110,8 @@ HEADERS += mainwindow.h \ | ||
109 | operationtimeparts.h \ | 110 | operationtimeparts.h \ |
110 | realtimemain.h \ | 111 | realtimemain.h \ |
111 | realtimepartswindow.h \ | 112 | realtimepartswindow.h \ |
112 | - realtimesensorwindow.h | 113 | + realtimesensorwindow.h \ |
114 | + bulletindicator.h | ||
113 | 115 | ||
114 | FORMS += mainwindow.ui \ | 116 | FORMS += mainwindow.ui \ |
115 | manualcookwindow.ui \ | 117 | manualcookwindow.ui \ |