Commit 9e1f8d0933fa0b38d3cc0ff8d4da9f682182c07a
1 parent
184bdebb42
Exists in
master
and in
2 other branches
엔코더 구현 대비 선행 수정
Showing
52 changed files
with
1628 additions
and
48 deletions
Show diff stats
app/gui/oven_control/autocooksettingwidget.cpp
@@ -65,6 +65,16 @@ AutoCookSettingWidget::~AutoCookSettingWidget() | @@ -65,6 +65,16 @@ AutoCookSettingWidget::~AutoCookSettingWidget() | ||
65 | delete ui; | 65 | delete ui; |
66 | } | 66 | } |
67 | 67 | ||
68 | +void AutoCookSettingWidget::keyPressEvent(QKeyEvent *event) | ||
69 | +{ | ||
70 | + | ||
71 | +} | ||
72 | + | ||
73 | +void AutoCookSettingWidget::keyReleaseEvent(QKeyEvent *event) | ||
74 | +{ | ||
75 | + | ||
76 | +} | ||
77 | + | ||
68 | void AutoCookSettingWidget::setupUi(Cook cook) | 78 | void AutoCookSettingWidget::setupUi(Cook cook) |
69 | { | 79 | { |
70 | ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); | 80 | ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); |
@@ -132,3 +142,18 @@ void AutoCookSettingWidget::setupUi(Cook cook) | @@ -132,3 +142,18 @@ void AutoCookSettingWidget::setupUi(Cook cook) | ||
132 | } | 142 | } |
133 | } | 143 | } |
134 | } | 144 | } |
145 | + | ||
146 | +void AutoCookSettingWidget::onEncoderLeft() | ||
147 | +{ | ||
148 | + | ||
149 | +} | ||
150 | + | ||
151 | +void AutoCookSettingWidget::onEncoderRight() | ||
152 | +{ | ||
153 | + | ||
154 | +} | ||
155 | + | ||
156 | +void AutoCookSettingWidget::onEncoderClicked(QWidget *clicked) | ||
157 | +{ | ||
158 | + | ||
159 | +} |
app/gui/oven_control/autocooksettingwidget.h
@@ -30,11 +30,21 @@ public: | @@ -30,11 +30,21 @@ public: | ||
30 | explicit AutoCookSettingWidget(AutoCookSetting setting, QWidget *parent = 0); | 30 | explicit AutoCookSettingWidget(AutoCookSetting setting, QWidget *parent = 0); |
31 | ~AutoCookSettingWidget(); | 31 | ~AutoCookSettingWidget(); |
32 | 32 | ||
33 | +protected: | ||
34 | + void keyPressEvent(QKeyEvent *event); | ||
35 | + void keyReleaseEvent(QKeyEvent *event); | ||
36 | + | ||
33 | private: | 37 | private: |
34 | Ui::AutoCookSettingWidget *ui; | 38 | Ui::AutoCookSettingWidget *ui; |
35 | QList<ConfigWidget> configWidgets; | 39 | QList<ConfigWidget> configWidgets; |
36 | 40 | ||
37 | void setupUi(Cook cook); | 41 | void setupUi(Cook cook); |
42 | + | ||
43 | + QWidget *pushed = NULL; | ||
44 | + | ||
45 | + void onEncoderLeft(); | ||
46 | + void onEncoderRight(); | ||
47 | + void onEncoderClicked(QWidget *clicked); | ||
38 | }; | 48 | }; |
39 | 49 | ||
40 | #endif // AUTOCOOKSETTINGWIDGET_H | 50 | #endif // AUTOCOOKSETTINGWIDGET_H |
app/gui/oven_control/autocookwindow.cpp
1 | #include "autocookwindow.h" | 1 | #include "autocookwindow.h" |
2 | #include "ui_autocookwindow.h" | 2 | #include "ui_autocookwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "keepwarmpopup.h" | 6 | #include "keepwarmpopup.h" |
5 | #include "cookhistory.h" | 7 | #include "cookhistory.h" |
6 | #include "confirmpopup.h" | 8 | #include "confirmpopup.h" |
@@ -107,6 +109,41 @@ AutoCookWindow::~AutoCookWindow() | @@ -107,6 +109,41 @@ AutoCookWindow::~AutoCookWindow() | ||
107 | delete ui; | 109 | delete ui; |
108 | } | 110 | } |
109 | 111 | ||
112 | +void AutoCookWindow::keyPressEvent(QKeyEvent *event) | ||
113 | +{ | ||
114 | + switch (event->key()) | ||
115 | + { | ||
116 | + case 0x01000030: // Turn left | ||
117 | + onEncoderLeft(); | ||
118 | + break; | ||
119 | + case 0x01000031: // Push | ||
120 | + pushed = focusWidget(); | ||
121 | + break; | ||
122 | + case 0x01000032: // Turn right | ||
123 | + onEncoderRight(); | ||
124 | + break; | ||
125 | + } | ||
126 | +} | ||
127 | + | ||
128 | +void AutoCookWindow::keyReleaseEvent(QKeyEvent *event) | ||
129 | +{ | ||
130 | + switch (event->key()) | ||
131 | + { | ||
132 | + case 0x01000030: // Turn left | ||
133 | + onEncoderLeft(); | ||
134 | + break; | ||
135 | + case 0x01000031: // Push | ||
136 | + if (focusWidget() == pushed) | ||
137 | + onEncoderClicked(pushed); | ||
138 | + | ||
139 | + pushed = NULL; | ||
140 | + break; | ||
141 | + case 0x01000032: // Turn right | ||
142 | + onEncoderRight(); | ||
143 | + break; | ||
144 | + } | ||
145 | +} | ||
146 | + | ||
110 | void AutoCookWindow::setupUi() | 147 | void AutoCookWindow::setupUi() |
111 | { | 148 | { |
112 | steamModeIcon.load(":/images/cook_mode/small_steam.png"); | 149 | steamModeIcon.load(":/images/cook_mode/small_steam.png"); |
@@ -234,6 +271,21 @@ void AutoCookWindow::setupUi() | @@ -234,6 +271,21 @@ void AutoCookWindow::setupUi() | ||
234 | updateView(); | 271 | updateView(); |
235 | } | 272 | } |
236 | 273 | ||
274 | +void AutoCookWindow::onEncoderLeft() | ||
275 | +{ | ||
276 | + | ||
277 | +} | ||
278 | + | ||
279 | +void AutoCookWindow::onEncoderRight() | ||
280 | +{ | ||
281 | + | ||
282 | +} | ||
283 | + | ||
284 | +void AutoCookWindow::onEncoderClicked(QWidget *clicked) | ||
285 | +{ | ||
286 | + | ||
287 | +} | ||
288 | + | ||
237 | void AutoCookWindow::updateView() | 289 | void AutoCookWindow::updateView() |
238 | { | 290 | { |
239 | Oven *oven = Oven::getInstance(); | 291 | Oven *oven = Oven::getInstance(); |
app/gui/oven_control/autocookwindow.h
@@ -19,6 +19,10 @@ public: | @@ -19,6 +19,10 @@ public: | ||
19 | explicit AutoCookWindow(QWidget *parent, Cook cook); | 19 | explicit AutoCookWindow(QWidget *parent, Cook cook); |
20 | ~AutoCookWindow(); | 20 | ~AutoCookWindow(); |
21 | 21 | ||
22 | +protected: | ||
23 | + void keyPressEvent(QKeyEvent *event); | ||
24 | + void keyReleaseEvent(QKeyEvent *event); | ||
25 | + | ||
22 | private: | 26 | private: |
23 | Ui::AutoCookWindow *ui; | 27 | Ui::AutoCookWindow *ui; |
24 | 28 | ||
@@ -77,6 +81,12 @@ private: | @@ -77,6 +81,12 @@ private: | ||
77 | 81 | ||
78 | void setupUi(); | 82 | void setupUi(); |
79 | 83 | ||
84 | + QWidget *pushed = NULL; | ||
85 | + | ||
86 | + void onEncoderLeft(); | ||
87 | + void onEncoderRight(); | ||
88 | + void onEncoderClicked(QWidget *clicked); | ||
89 | + | ||
80 | private slots: | 90 | private slots: |
81 | void updateView(); | 91 | void updateView(); |
82 | void checkCook(); | 92 | void checkCook(); |
app/gui/oven_control/basicsettingwindow.cpp
@@ -17,3 +17,30 @@ BasicSettingWindow::~BasicSettingWindow() | @@ -17,3 +17,30 @@ BasicSettingWindow::~BasicSettingWindow() | ||
17 | { | 17 | { |
18 | delete ui; | 18 | delete ui; |
19 | } | 19 | } |
20 | + | ||
21 | +void BasicSettingWindow::keyPressEvent(QKeyEvent *event) | ||
22 | +{ | ||
23 | + | ||
24 | +} | ||
25 | + | ||
26 | +void BasicSettingWindow::keyReleaseEvent(QKeyEvent *event) | ||
27 | +{ | ||
28 | + | ||
29 | +} | ||
30 | + | ||
31 | +void BasicSettingWindow::onEncoderLeft() | ||
32 | +{ | ||
33 | + focusPreviousChild(); | ||
34 | +} | ||
35 | + | ||
36 | +void BasicSettingWindow::onEncoderRight() | ||
37 | +{ | ||
38 | + focusNextChild(); | ||
39 | +} | ||
40 | + | ||
41 | +void BasicSettingWindow::onEncoderClicked(QWidget *clicked) | ||
42 | +{ | ||
43 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
44 | + if (b) | ||
45 | + b->click(); | ||
46 | +} |
app/gui/oven_control/basicsettingwindow.h
@@ -15,8 +15,18 @@ public: | @@ -15,8 +15,18 @@ public: | ||
15 | explicit BasicSettingWindow(QWidget *parent = 0); | 15 | explicit BasicSettingWindow(QWidget *parent = 0); |
16 | ~BasicSettingWindow(); | 16 | ~BasicSettingWindow(); |
17 | 17 | ||
18 | +protected: | ||
19 | + void keyPressEvent(QKeyEvent *event); | ||
20 | + void keyReleaseEvent(QKeyEvent *event); | ||
21 | + | ||
18 | private: | 22 | private: |
19 | Ui::BasicSettingWindow *ui; | 23 | Ui::BasicSettingWindow *ui; |
24 | + | ||
25 | + QWidget *pushed = NULL; | ||
26 | + | ||
27 | + void onEncoderLeft(); | ||
28 | + void onEncoderRight(); | ||
29 | + void onEncoderClicked(QWidget *clicked); | ||
20 | }; | 30 | }; |
21 | 31 | ||
22 | #endif // BASICSETTINGWINDOW_H | 32 | #endif // BASICSETTINGWINDOW_H |
app/gui/oven_control/burnertestwindow.cpp
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | #include "ui_burnertestwindow.h" | 2 | #include "ui_burnertestwindow.h" |
3 | 3 | ||
4 | #include <QTimer> | 4 | #include <QTimer> |
5 | +#include <QKeyEvent> | ||
5 | 6 | ||
6 | #include "soundplayer.h" | 7 | #include "soundplayer.h" |
7 | 8 | ||
@@ -42,6 +43,41 @@ BurnerTestWindow::~BurnerTestWindow() | @@ -42,6 +43,41 @@ BurnerTestWindow::~BurnerTestWindow() | ||
42 | delete ui; | 43 | delete ui; |
43 | } | 44 | } |
44 | 45 | ||
46 | +void BurnerTestWindow::keyPressEvent(QKeyEvent *event) | ||
47 | +{ | ||
48 | + switch (event->key()) | ||
49 | + { | ||
50 | + case 0x01000030: // Turn left | ||
51 | + onEncoderLeft(); | ||
52 | + break; | ||
53 | + case 0x01000031: // Push | ||
54 | + pushed = focusWidget(); | ||
55 | + break; | ||
56 | + case 0x01000032: // Turn right | ||
57 | + onEncoderRight(); | ||
58 | + break; | ||
59 | + } | ||
60 | +} | ||
61 | + | ||
62 | +void BurnerTestWindow::keyReleaseEvent(QKeyEvent *event) | ||
63 | +{ | ||
64 | + switch (event->key()) | ||
65 | + { | ||
66 | + case 0x01000030: // Turn left | ||
67 | + onEncoderLeft(); | ||
68 | + break; | ||
69 | + case 0x01000031: // Push | ||
70 | + if (focusWidget() == pushed) | ||
71 | + onEncoderClicked(pushed); | ||
72 | + | ||
73 | + pushed = NULL; | ||
74 | + break; | ||
75 | + case 0x01000032: // Turn right | ||
76 | + onEncoderRight(); | ||
77 | + break; | ||
78 | + } | ||
79 | +} | ||
80 | + | ||
45 | void BurnerTestWindow::onDataChanged() | 81 | void BurnerTestWindow::onDataChanged() |
46 | { | 82 | { |
47 | oven_state_t oven; | 83 | oven_state_t oven; |
@@ -151,6 +187,23 @@ void BurnerTestWindow::on_backButton_clicked() | @@ -151,6 +187,23 @@ void BurnerTestWindow::on_backButton_clicked() | ||
151 | close(); | 187 | close(); |
152 | } | 188 | } |
153 | 189 | ||
190 | +void BurnerTestWindow::onEncoderLeft() | ||
191 | +{ | ||
192 | + focusPreviousChild(); | ||
193 | +} | ||
194 | + | ||
195 | +void BurnerTestWindow::onEncoderRight() | ||
196 | +{ | ||
197 | + focusNextChild(); | ||
198 | +} | ||
199 | + | ||
200 | +void BurnerTestWindow::onEncoderClicked(QWidget *clicked) | ||
201 | +{ | ||
202 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
203 | + if (b) | ||
204 | + b->click(); | ||
205 | +} | ||
206 | + | ||
154 | void BurnerTestWindow::steamOn() | 207 | void BurnerTestWindow::steamOn() |
155 | { | 208 | { |
156 | udp->turnOn(TG_BUNNER3_MANUAL); | 209 | udp->turnOn(TG_BUNNER3_MANUAL); |
app/gui/oven_control/burnertestwindow.h
@@ -18,6 +18,10 @@ public: | @@ -18,6 +18,10 @@ public: | ||
18 | explicit BurnerTestWindow(QWidget *parent = 0); | 18 | explicit BurnerTestWindow(QWidget *parent = 0); |
19 | ~BurnerTestWindow(); | 19 | ~BurnerTestWindow(); |
20 | 20 | ||
21 | +protected: | ||
22 | + void keyPressEvent(QKeyEvent *event); | ||
23 | + void keyReleaseEvent(QKeyEvent *event); | ||
24 | + | ||
21 | private slots: | 25 | private slots: |
22 | void steamOn(); | 26 | void steamOn(); |
23 | void steamOff(); | 27 | void steamOff(); |
@@ -42,6 +46,12 @@ private: | @@ -42,6 +46,12 @@ private: | ||
42 | QTimer steamTimer; | 46 | QTimer steamTimer; |
43 | QTimer upperTimer; | 47 | QTimer upperTimer; |
44 | QTimer lowerTimer; | 48 | QTimer lowerTimer; |
49 | + | ||
50 | + QWidget *pushed = NULL; | ||
51 | + | ||
52 | + void onEncoderLeft(); | ||
53 | + void onEncoderRight(); | ||
54 | + void onEncoderClicked(QWidget *clicked); | ||
45 | }; | 55 | }; |
46 | 56 | ||
47 | #endif // BURNERTESTWINDOW_H | 57 | #endif // BURNERTESTWINDOW_H |
app/gui/oven_control/componenttestwindow.cpp
1 | #include "componenttestwindow.h" | 1 | #include "componenttestwindow.h" |
2 | #include "ui_componenttestwindow.h" | 2 | #include "ui_componenttestwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | 7 | ||
6 | ComponentTestWindow::ComponentTestWindow(QWidget *parent) : | 8 | ComponentTestWindow::ComponentTestWindow(QWidget *parent) : |
@@ -32,6 +34,41 @@ ComponentTestWindow::~ComponentTestWindow() | @@ -32,6 +34,41 @@ ComponentTestWindow::~ComponentTestWindow() | ||
32 | delete ui; | 34 | delete ui; |
33 | } | 35 | } |
34 | 36 | ||
37 | +void ComponentTestWindow::keyPressEvent(QKeyEvent *event) | ||
38 | +{ | ||
39 | + switch (event->key()) | ||
40 | + { | ||
41 | + case 0x01000030: // Turn left | ||
42 | + onEncoderLeft(); | ||
43 | + break; | ||
44 | + case 0x01000031: // Push | ||
45 | + pushed = focusWidget(); | ||
46 | + break; | ||
47 | + case 0x01000032: // Turn right | ||
48 | + onEncoderRight(); | ||
49 | + break; | ||
50 | + } | ||
51 | +} | ||
52 | + | ||
53 | +void ComponentTestWindow::keyReleaseEvent(QKeyEvent *event) | ||
54 | +{ | ||
55 | + switch (event->key()) | ||
56 | + { | ||
57 | + case 0x01000030: // Turn left | ||
58 | + onEncoderLeft(); | ||
59 | + break; | ||
60 | + case 0x01000031: // Push | ||
61 | + if (focusWidget() == pushed) | ||
62 | + onEncoderClicked(pushed); | ||
63 | + | ||
64 | + pushed = NULL; | ||
65 | + break; | ||
66 | + case 0x01000032: // Turn right | ||
67 | + onEncoderRight(); | ||
68 | + break; | ||
69 | + } | ||
70 | +} | ||
71 | + | ||
35 | void ComponentTestWindow::onDataChanged() | 72 | void ComponentTestWindow::onDataChanged() |
36 | { | 73 | { |
37 | if (udp->hl()) | 74 | if (udp->hl()) |
@@ -83,6 +120,23 @@ void ComponentTestWindow::on_backButton_clicked() | @@ -83,6 +120,23 @@ void ComponentTestWindow::on_backButton_clicked() | ||
83 | close(); | 120 | close(); |
84 | } | 121 | } |
85 | 122 | ||
123 | +void ComponentTestWindow::onEncoderLeft() | ||
124 | +{ | ||
125 | + focusPreviousChild(); | ||
126 | +} | ||
127 | + | ||
128 | +void ComponentTestWindow::onEncoderRight() | ||
129 | +{ | ||
130 | + focusNextChild(); | ||
131 | +} | ||
132 | + | ||
133 | +void ComponentTestWindow::onEncoderClicked(QWidget *clicked) | ||
134 | +{ | ||
135 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
136 | + if (b) | ||
137 | + b->click(); | ||
138 | +} | ||
139 | + | ||
86 | void ComponentTestWindow::lampOn() | 140 | void ComponentTestWindow::lampOn() |
87 | { | 141 | { |
88 | udp->turnOn(TG_HL); | 142 | udp->turnOn(TG_HL); |
app/gui/oven_control/componenttestwindow.h
@@ -18,6 +18,10 @@ public: | @@ -18,6 +18,10 @@ public: | ||
18 | explicit ComponentTestWindow(QWidget *parent = 0); | 18 | explicit ComponentTestWindow(QWidget *parent = 0); |
19 | ~ComponentTestWindow(); | 19 | ~ComponentTestWindow(); |
20 | 20 | ||
21 | +protected: | ||
22 | + void keyPressEvent(QKeyEvent *event); | ||
23 | + void keyReleaseEvent(QKeyEvent *event); | ||
24 | + | ||
21 | private slots: | 25 | private slots: |
22 | void lampOn(); | 26 | void lampOn(); |
23 | void lampOff(); | 27 | void lampOff(); |
@@ -36,6 +40,12 @@ private: | @@ -36,6 +40,12 @@ private: | ||
36 | UdpHandler *udp; | 40 | UdpHandler *udp; |
37 | 41 | ||
38 | QTimer damperTimer; | 42 | QTimer damperTimer; |
43 | + | ||
44 | + QWidget *pushed = NULL; | ||
45 | + | ||
46 | + void onEncoderLeft(); | ||
47 | + void onEncoderRight(); | ||
48 | + void onEncoderClicked(QWidget *clicked); | ||
39 | }; | 49 | }; |
40 | 50 | ||
41 | 51 |
app/gui/oven_control/cookpanelbutton.cpp
1 | #include "cookpanelbutton.h" | 1 | #include "cookpanelbutton.h" |
2 | #include "ui_cookpanelbutton.h" | 2 | #include "ui_cookpanelbutton.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | #include "manualcooksettingwidget.h" | 7 | #include "manualcooksettingwidget.h" |
6 | 8 | ||
@@ -81,6 +83,41 @@ void CookPanelButton::setEnabled(bool enabled) | @@ -81,6 +83,41 @@ void CookPanelButton::setEnabled(bool enabled) | ||
81 | ui->deleteButton->setEnabled(enabled); | 83 | ui->deleteButton->setEnabled(enabled); |
82 | } | 84 | } |
83 | 85 | ||
86 | +void CookPanelButton::keyPressEvent(QKeyEvent *event) | ||
87 | +{ | ||
88 | + switch (event->key()) | ||
89 | + { | ||
90 | + case 0x01000030: // Turn left | ||
91 | + onEncoderLeft(); | ||
92 | + break; | ||
93 | + case 0x01000031: // Push | ||
94 | + pushed = focusWidget(); | ||
95 | + break; | ||
96 | + case 0x01000032: // Turn right | ||
97 | + onEncoderRight(); | ||
98 | + break; | ||
99 | + } | ||
100 | +} | ||
101 | + | ||
102 | +void CookPanelButton::keyReleaseEvent(QKeyEvent *event) | ||
103 | +{ | ||
104 | + switch (event->key()) | ||
105 | + { | ||
106 | + case 0x01000030: // Turn left | ||
107 | + onEncoderLeft(); | ||
108 | + break; | ||
109 | + case 0x01000031: // Push | ||
110 | + if (focusWidget() == pushed) | ||
111 | + onEncoderClicked(pushed); | ||
112 | + | ||
113 | + pushed = NULL; | ||
114 | + break; | ||
115 | + case 0x01000032: // Turn right | ||
116 | + onEncoderRight(); | ||
117 | + break; | ||
118 | + } | ||
119 | +} | ||
120 | + | ||
84 | void CookPanelButton::emitLongPressed() | 121 | void CookPanelButton::emitLongPressed() |
85 | { | 122 | { |
86 | emitted = true; | 123 | emitted = true; |
@@ -106,6 +143,21 @@ void CookPanelButton::on_deleteButton_clicked() | @@ -106,6 +143,21 @@ void CookPanelButton::on_deleteButton_clicked() | ||
106 | emit deleteClicked(this); | 143 | emit deleteClicked(this); |
107 | } | 144 | } |
108 | 145 | ||
146 | +void CookPanelButton::onEncoderLeft() | ||
147 | +{ | ||
148 | + | ||
149 | +} | ||
150 | + | ||
151 | +void CookPanelButton::onEncoderRight() | ||
152 | +{ | ||
153 | + | ||
154 | +} | ||
155 | + | ||
156 | +void CookPanelButton::onEncoderClicked(QWidget *clicked) | ||
157 | +{ | ||
158 | + | ||
159 | +} | ||
160 | + | ||
109 | void CookPanelButton::on_pushButton_pressed() | 161 | void CookPanelButton::on_pushButton_pressed() |
110 | { | 162 | { |
111 | longPressedTimer.start(); | 163 | longPressedTimer.start(); |
app/gui/oven_control/cookpanelbutton.h
@@ -42,6 +42,10 @@ public: | @@ -42,6 +42,10 @@ public: | ||
42 | public slots: | 42 | public slots: |
43 | void setEnabled(bool enabled = true); | 43 | void setEnabled(bool enabled = true); |
44 | 44 | ||
45 | +protected: | ||
46 | + void keyPressEvent(QKeyEvent *event); | ||
47 | + void keyReleaseEvent(QKeyEvent *event); | ||
48 | + | ||
45 | private slots: | 49 | private slots: |
46 | void emitLongPressed(); | 50 | void emitLongPressed(); |
47 | 51 | ||
@@ -59,6 +63,12 @@ private: | @@ -59,6 +63,12 @@ private: | ||
59 | QLabel *label; | 63 | QLabel *label; |
60 | bool emitted; | 64 | bool emitted; |
61 | bool longPressEnabled; | 65 | bool longPressEnabled; |
66 | + | ||
67 | + QWidget *pushed = NULL; | ||
68 | + | ||
69 | + void onEncoderLeft(); | ||
70 | + void onEncoderRight(); | ||
71 | + void onEncoderClicked(QWidget *clicked); | ||
62 | }; | 72 | }; |
63 | 73 | ||
64 | #endif // COOKPANELBUTTON_H | 74 | #endif // COOKPANELBUTTON_H |
app/gui/oven_control/electricmodelsettingwindow.cpp
@@ -16,24 +16,24 @@ ElectricModelSettingWindow::ElectricModelSettingWindow(QWidget *parent) : | @@ -16,24 +16,24 @@ ElectricModelSettingWindow::ElectricModelSettingWindow(QWidget *parent) : | ||
16 | foreach (QPushButton *button, findChildren<QPushButton *>()) | 16 | foreach (QPushButton *button, findChildren<QPushButton *>()) |
17 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); | 17 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); |
18 | 18 | ||
19 | - Config* cfg = Config::getInstance(); | ||
20 | - Define::config_item item; | ||
21 | - item = cfg->getConfigValue(Define::config_model); | ||
22 | - selitem = item.d32; | ||
23 | - switch(selitem){ | ||
24 | - case Define::model_electric_10: | ||
25 | - ui->e10Button->setChecked(true); | ||
26 | - break; | ||
27 | - case Define::model_electric_20: | ||
28 | - ui->e20Button->setChecked(true); | ||
29 | - break; | ||
30 | - case Define::model_electric_24: | ||
31 | - ui->e24Button->setChecked(true); | ||
32 | - break; | ||
33 | - case Define::model_electric_40: | ||
34 | - ui->e40Button->setChecked(true); | ||
35 | - break; | ||
36 | - } | 19 | + Config* cfg = Config::getInstance(); |
20 | + Define::config_item item; | ||
21 | + item = cfg->getConfigValue(Define::config_model); | ||
22 | + selitem = item.d32; | ||
23 | + switch(selitem){ | ||
24 | + case Define::model_electric_10: | ||
25 | + ui->e10Button->setChecked(true); | ||
26 | + break; | ||
27 | + case Define::model_electric_20: | ||
28 | + ui->e20Button->setChecked(true); | ||
29 | + break; | ||
30 | + case Define::model_electric_24: | ||
31 | + ui->e24Button->setChecked(true); | ||
32 | + break; | ||
33 | + case Define::model_electric_40: | ||
34 | + ui->e40Button->setChecked(true); | ||
35 | + break; | ||
36 | + } | ||
37 | } | 37 | } |
38 | 38 | ||
39 | ElectricModelSettingWindow::~ElectricModelSettingWindow() | 39 | ElectricModelSettingWindow::~ElectricModelSettingWindow() |
@@ -41,6 +41,41 @@ ElectricModelSettingWindow::~ElectricModelSettingWindow() | @@ -41,6 +41,41 @@ ElectricModelSettingWindow::~ElectricModelSettingWindow() | ||
41 | delete ui; | 41 | delete ui; |
42 | } | 42 | } |
43 | 43 | ||
44 | +void ElectricModelSettingWindow::keyPressEvent(QKeyEvent *event) | ||
45 | +{ | ||
46 | + switch (event->key()) | ||
47 | + { | ||
48 | + case 0x01000030: // Turn left | ||
49 | + onEncoderLeft(); | ||
50 | + break; | ||
51 | + case 0x01000031: // Push | ||
52 | + pushed = focusWidget(); | ||
53 | + break; | ||
54 | + case 0x01000032: // Turn right | ||
55 | + onEncoderRight(); | ||
56 | + break; | ||
57 | + } | ||
58 | +} | ||
59 | + | ||
60 | +void ElectricModelSettingWindow::keyReleaseEvent(QKeyEvent *event) | ||
61 | +{ | ||
62 | + switch (event->key()) | ||
63 | + { | ||
64 | + case 0x01000030: // Turn left | ||
65 | + onEncoderLeft(); | ||
66 | + break; | ||
67 | + case 0x01000031: // Push | ||
68 | + if (focusWidget() == pushed) | ||
69 | + onEncoderClicked(pushed); | ||
70 | + | ||
71 | + pushed = NULL; | ||
72 | + break; | ||
73 | + case 0x01000032: // Turn right | ||
74 | + onEncoderRight(); | ||
75 | + break; | ||
76 | + } | ||
77 | +} | ||
78 | + | ||
44 | void ElectricModelSettingWindow::setModel(Define::model_type model) | 79 | void ElectricModelSettingWindow::setModel(Define::model_type model) |
45 | { | 80 | { |
46 | Define::config_item item; | 81 | Define::config_item item; |
@@ -92,3 +127,20 @@ void ElectricModelSettingWindow::on_backButton_clicked() | @@ -92,3 +127,20 @@ void ElectricModelSettingWindow::on_backButton_clicked() | ||
92 | } | 127 | } |
93 | close(); | 128 | close(); |
94 | } | 129 | } |
130 | + | ||
131 | +void ElectricModelSettingWindow::onEncoderLeft() | ||
132 | +{ | ||
133 | + focusPreviousChild(); | ||
134 | +} | ||
135 | + | ||
136 | +void ElectricModelSettingWindow::onEncoderRight() | ||
137 | +{ | ||
138 | + focusNextChild(); | ||
139 | +} | ||
140 | + | ||
141 | +void ElectricModelSettingWindow::onEncoderClicked(QWidget *clicked) | ||
142 | +{ | ||
143 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
144 | + if (b) | ||
145 | + b->click(); | ||
146 | +} |
app/gui/oven_control/electricmodelsettingwindow.h
@@ -17,6 +17,10 @@ public: | @@ -17,6 +17,10 @@ public: | ||
17 | explicit ElectricModelSettingWindow(QWidget *parent = 0); | 17 | explicit ElectricModelSettingWindow(QWidget *parent = 0); |
18 | ~ElectricModelSettingWindow(); | 18 | ~ElectricModelSettingWindow(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private slots: | 24 | private slots: |
21 | void setModel(Define::model_type model); | 25 | void setModel(Define::model_type model); |
22 | 26 | ||
@@ -30,6 +34,12 @@ private slots: | @@ -30,6 +34,12 @@ private slots: | ||
30 | private: | 34 | private: |
31 | Ui::ElectricModelSettingWindow *ui; | 35 | Ui::ElectricModelSettingWindow *ui; |
32 | int selitem; | 36 | int selitem; |
37 | + | ||
38 | + QWidget *pushed = NULL; | ||
39 | + | ||
40 | + void onEncoderLeft(); | ||
41 | + void onEncoderRight(); | ||
42 | + void onEncoderClicked(QWidget *clicked); | ||
33 | }; | 43 | }; |
34 | 44 | ||
35 | #endif // ELECTRICMODELSETTINGWINDOW_H | 45 | #endif // ELECTRICMODELSETTINGWINDOW_H |
app/gui/oven_control/engineermenuwindow.cpp
@@ -9,6 +9,8 @@ | @@ -9,6 +9,8 @@ | ||
9 | #include "modelsettingwindow.h" | 9 | #include "modelsettingwindow.h" |
10 | #include "soundplayer.h" | 10 | #include "soundplayer.h" |
11 | 11 | ||
12 | +#include <QKeyEvent> | ||
13 | + | ||
12 | EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) : | 14 | EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) : |
13 | QMainWindow(parent), | 15 | QMainWindow(parent), |
14 | ui(new Ui::EngineerMenuWindow) | 16 | ui(new Ui::EngineerMenuWindow) |
@@ -29,6 +31,41 @@ EngineerMenuWindow::~EngineerMenuWindow() | @@ -29,6 +31,41 @@ EngineerMenuWindow::~EngineerMenuWindow() | ||
29 | delete ui; | 31 | delete ui; |
30 | } | 32 | } |
31 | 33 | ||
34 | +void EngineerMenuWindow::keyPressEvent(QKeyEvent *event) | ||
35 | +{ | ||
36 | + switch (event->key()) | ||
37 | + { | ||
38 | + case 0x01000030: // Turn left | ||
39 | + onEncoderLeft(); | ||
40 | + break; | ||
41 | + case 0x01000031: // Push | ||
42 | + pushed = focusWidget(); | ||
43 | + break; | ||
44 | + case 0x01000032: // Turn right | ||
45 | + onEncoderRight(); | ||
46 | + break; | ||
47 | + } | ||
48 | +} | ||
49 | + | ||
50 | +void EngineerMenuWindow::keyReleaseEvent(QKeyEvent *event) | ||
51 | +{ | ||
52 | + switch (event->key()) | ||
53 | + { | ||
54 | + case 0x01000030: // Turn left | ||
55 | + onEncoderLeft(); | ||
56 | + break; | ||
57 | + case 0x01000031: // Push | ||
58 | + if (focusWidget() == pushed) | ||
59 | + onEncoderClicked(pushed); | ||
60 | + | ||
61 | + pushed = NULL; | ||
62 | + break; | ||
63 | + case 0x01000032: // Turn right | ||
64 | + onEncoderRight(); | ||
65 | + break; | ||
66 | + } | ||
67 | +} | ||
68 | + | ||
32 | void EngineerMenuWindow::on_serviceHistoryButton_clicked() | 69 | void EngineerMenuWindow::on_serviceHistoryButton_clicked() |
33 | { | 70 | { |
34 | ServiceHistoryMain *w = new ServiceHistoryMain(this); | 71 | ServiceHistoryMain *w = new ServiceHistoryMain(this); |
@@ -79,3 +116,20 @@ void EngineerMenuWindow::on_modelTypeConfigButton_clicked() | @@ -79,3 +116,20 @@ void EngineerMenuWindow::on_modelTypeConfigButton_clicked() | ||
79 | w->showFullScreen(); | 116 | w->showFullScreen(); |
80 | w->raise(); | 117 | w->raise(); |
81 | } | 118 | } |
119 | + | ||
120 | +void EngineerMenuWindow::onEncoderLeft() | ||
121 | +{ | ||
122 | + focusPreviousChild(); | ||
123 | +} | ||
124 | + | ||
125 | +void EngineerMenuWindow::onEncoderRight() | ||
126 | +{ | ||
127 | + focusNextChild(); | ||
128 | +} | ||
129 | + | ||
130 | +void EngineerMenuWindow::onEncoderClicked(QWidget *clicked) | ||
131 | +{ | ||
132 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
133 | + if (b) | ||
134 | + b->click(); | ||
135 | +} |
app/gui/oven_control/engineermenuwindow.h
@@ -15,6 +15,10 @@ public: | @@ -15,6 +15,10 @@ public: | ||
15 | explicit EngineerMenuWindow(QWidget *parent = 0); | 15 | explicit EngineerMenuWindow(QWidget *parent = 0); |
16 | ~EngineerMenuWindow(); | 16 | ~EngineerMenuWindow(); |
17 | 17 | ||
18 | +protected: | ||
19 | + void keyPressEvent(QKeyEvent *event); | ||
20 | + void keyReleaseEvent(QKeyEvent *event); | ||
21 | + | ||
18 | private slots: | 22 | private slots: |
19 | void on_serviceHistoryButton_clicked(); | 23 | void on_serviceHistoryButton_clicked(); |
20 | 24 | ||
@@ -32,6 +36,12 @@ private slots: | @@ -32,6 +36,12 @@ private slots: | ||
32 | 36 | ||
33 | private: | 37 | private: |
34 | Ui::EngineerMenuWindow *ui; | 38 | Ui::EngineerMenuWindow *ui; |
39 | + | ||
40 | + QWidget *pushed = NULL; | ||
41 | + | ||
42 | + void onEncoderLeft(); | ||
43 | + void onEncoderRight(); | ||
44 | + void onEncoderClicked(QWidget *clicked); | ||
35 | }; | 45 | }; |
36 | 46 | ||
37 | #endif // ENGINEERMENUWINDOW_H | 47 | #endif // ENGINEERMENUWINDOW_H |
app/gui/oven_control/fantestwindow.cpp
1 | #include "fantestwindow.h" | 1 | #include "fantestwindow.h" |
2 | #include "ui_fantestwindow.h" | 2 | #include "ui_fantestwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | 7 | ||
6 | FanTestWindow::FanTestWindow(QWidget *parent) : | 8 | FanTestWindow::FanTestWindow(QWidget *parent) : |
@@ -38,6 +40,41 @@ FanTestWindow::~FanTestWindow() | @@ -38,6 +40,41 @@ FanTestWindow::~FanTestWindow() | ||
38 | delete ui; | 40 | delete ui; |
39 | } | 41 | } |
40 | 42 | ||
43 | +void FanTestWindow::keyPressEvent(QKeyEvent *event) | ||
44 | +{ | ||
45 | + switch (event->key()) | ||
46 | + { | ||
47 | + case 0x01000030: // Turn left | ||
48 | + onEncoderLeft(); | ||
49 | + break; | ||
50 | + case 0x01000031: // Push | ||
51 | + pushed = focusWidget(); | ||
52 | + break; | ||
53 | + case 0x01000032: // Turn right | ||
54 | + onEncoderRight(); | ||
55 | + break; | ||
56 | + } | ||
57 | +} | ||
58 | + | ||
59 | +void FanTestWindow::keyReleaseEvent(QKeyEvent *event) | ||
60 | +{ | ||
61 | + switch (event->key()) | ||
62 | + { | ||
63 | + case 0x01000030: // Turn left | ||
64 | + onEncoderLeft(); | ||
65 | + break; | ||
66 | + case 0x01000031: // Push | ||
67 | + if (focusWidget() == pushed) | ||
68 | + onEncoderClicked(pushed); | ||
69 | + | ||
70 | + pushed = NULL; | ||
71 | + break; | ||
72 | + case 0x01000032: // Turn right | ||
73 | + onEncoderRight(); | ||
74 | + break; | ||
75 | + } | ||
76 | +} | ||
77 | + | ||
41 | void FanTestWindow::onDataChanged() | 78 | void FanTestWindow::onDataChanged() |
42 | { | 79 | { |
43 | if (udp->convection1()) | 80 | if (udp->convection1()) |
@@ -255,6 +292,23 @@ void FanTestWindow::on_backButton_clicked() | @@ -255,6 +292,23 @@ void FanTestWindow::on_backButton_clicked() | ||
255 | deleteLater(); | 292 | deleteLater(); |
256 | } | 293 | } |
257 | 294 | ||
295 | +void FanTestWindow::onEncoderLeft() | ||
296 | +{ | ||
297 | + focusPreviousChild(); | ||
298 | +} | ||
299 | + | ||
300 | +void FanTestWindow::onEncoderRight() | ||
301 | +{ | ||
302 | + focusNextChild(); | ||
303 | +} | ||
304 | + | ||
305 | +void FanTestWindow::onEncoderClicked(QWidget *clicked) | ||
306 | +{ | ||
307 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
308 | + if (b) | ||
309 | + b->click(); | ||
310 | +} | ||
311 | + | ||
258 | void FanTestWindow::setRpm(Fan fan, int rpm) | 312 | void FanTestWindow::setRpm(Fan fan, int rpm) |
259 | { | 313 | { |
260 | switch (fan) | 314 | switch (fan) |
app/gui/oven_control/fantestwindow.h
@@ -20,6 +20,10 @@ public: | @@ -20,6 +20,10 @@ public: | ||
20 | explicit FanTestWindow(QWidget *parent = 0); | 20 | explicit FanTestWindow(QWidget *parent = 0); |
21 | ~FanTestWindow(); | 21 | ~FanTestWindow(); |
22 | 22 | ||
23 | +protected: | ||
24 | + void keyPressEvent(QKeyEvent *event); | ||
25 | + void keyReleaseEvent(QKeyEvent *event); | ||
26 | + | ||
23 | private slots: | 27 | private slots: |
24 | void setRpm(Fan fan, int rpm); | 28 | void setRpm(Fan fan, int rpm); |
25 | void setDirection(Fan fan, Direction direction); | 29 | void setDirection(Fan fan, Direction direction); |
@@ -43,6 +47,12 @@ private: | @@ -43,6 +47,12 @@ private: | ||
43 | Fan currentFan; | 47 | Fan currentFan; |
44 | Direction direction1, direction2; | 48 | Direction direction1, direction2; |
45 | int rpm1, rpm2; | 49 | int rpm1, rpm2; |
50 | + | ||
51 | + QWidget *pushed = NULL; | ||
52 | + | ||
53 | + void onEncoderLeft(); | ||
54 | + void onEncoderRight(); | ||
55 | + void onEncoderClicked(QWidget *clicked); | ||
46 | }; | 56 | }; |
47 | 57 | ||
48 | #endif // FANTESTWINDOW_H | 58 | #endif // FANTESTWINDOW_H |
app/gui/oven_control/favoritenamepopup.cpp
1 | #include "favoritenamepopup.h" | 1 | #include "favoritenamepopup.h" |
2 | #include "ui_favoritenamepopup.h" | 2 | #include "ui_favoritenamepopup.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | #include "primewindow.h" | 7 | #include "primewindow.h" |
6 | #include "mainwindow.h" | 8 | #include "mainwindow.h" |
@@ -35,6 +37,41 @@ FavoriteNamePopup::~FavoriteNamePopup() | @@ -35,6 +37,41 @@ FavoriteNamePopup::~FavoriteNamePopup() | ||
35 | delete ui; | 37 | delete ui; |
36 | } | 38 | } |
37 | 39 | ||
40 | +void FavoriteNamePopup::keyPressEvent(QKeyEvent *event) | ||
41 | +{ | ||
42 | + switch (event->key()) | ||
43 | + { | ||
44 | + case 0x01000030: // Turn left | ||
45 | + onEncoderLeft(); | ||
46 | + break; | ||
47 | + case 0x01000031: // Push | ||
48 | + pushed = focusWidget(); | ||
49 | + break; | ||
50 | + case 0x01000032: // Turn right | ||
51 | + onEncoderRight(); | ||
52 | + break; | ||
53 | + } | ||
54 | +} | ||
55 | + | ||
56 | +void FavoriteNamePopup::keyReleaseEvent(QKeyEvent *event) | ||
57 | +{ | ||
58 | + switch (event->key()) | ||
59 | + { | ||
60 | + case 0x01000030: // Turn left | ||
61 | + onEncoderLeft(); | ||
62 | + break; | ||
63 | + case 0x01000031: // Push | ||
64 | + if (focusWidget() == pushed) | ||
65 | + onEncoderClicked(pushed); | ||
66 | + | ||
67 | + pushed = NULL; | ||
68 | + break; | ||
69 | + case 0x01000032: // Turn right | ||
70 | + onEncoderRight(); | ||
71 | + break; | ||
72 | + } | ||
73 | +} | ||
74 | + | ||
38 | void FavoriteNamePopup::ok() | 75 | void FavoriteNamePopup::ok() |
39 | { | 76 | { |
40 | int id; | 77 | int id; |
@@ -74,3 +111,18 @@ void FavoriteNamePopup::on_cancelButton_clicked() | @@ -74,3 +111,18 @@ void FavoriteNamePopup::on_cancelButton_clicked() | ||
74 | { | 111 | { |
75 | cancel(); | 112 | cancel(); |
76 | } | 113 | } |
114 | + | ||
115 | +void FavoriteNamePopup::onEncoderLeft() | ||
116 | +{ | ||
117 | + | ||
118 | +} | ||
119 | + | ||
120 | +void FavoriteNamePopup::onEncoderRight() | ||
121 | +{ | ||
122 | + | ||
123 | +} | ||
124 | + | ||
125 | +void FavoriteNamePopup::onEncoderClicked(QWidget *clicked) | ||
126 | +{ | ||
127 | + | ||
128 | +} |
app/gui/oven_control/favoritenamepopup.h
@@ -20,6 +20,10 @@ public: | @@ -20,6 +20,10 @@ public: | ||
20 | explicit FavoriteNamePopup(QWidget *parent, AutoCookSetting setting); | 20 | explicit FavoriteNamePopup(QWidget *parent, AutoCookSetting setting); |
21 | ~FavoriteNamePopup(); | 21 | ~FavoriteNamePopup(); |
22 | 22 | ||
23 | +protected: | ||
24 | + void keyPressEvent(QKeyEvent *event); | ||
25 | + void keyReleaseEvent(QKeyEvent *event); | ||
26 | + | ||
23 | private: | 27 | private: |
24 | Ui::FavoriteNamePopup *ui; | 28 | Ui::FavoriteNamePopup *ui; |
25 | 29 | ||
@@ -27,6 +31,12 @@ private: | @@ -27,6 +31,12 @@ private: | ||
27 | ManualCookSetting manualSetting; | 31 | ManualCookSetting manualSetting; |
28 | AutoCookSetting autoSetting; | 32 | AutoCookSetting autoSetting; |
29 | 33 | ||
34 | + QWidget *pushed = NULL; | ||
35 | + | ||
36 | + void onEncoderLeft(); | ||
37 | + void onEncoderRight(); | ||
38 | + void onEncoderClicked(QWidget *clicked); | ||
39 | + | ||
30 | private slots: | 40 | private slots: |
31 | void ok(); | 41 | void ok(); |
32 | void cancel(); | 42 | void cancel(); |
app/gui/oven_control/functiontestwindow.cpp
1 | #include "functiontestwindow.h" | 1 | #include "functiontestwindow.h" |
2 | #include "ui_functiontestwindow.h" | 2 | #include "ui_functiontestwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "burnertestwindow.h" | 6 | #include "burnertestwindow.h" |
5 | #include "componenttestwindow.h" | 7 | #include "componenttestwindow.h" |
6 | #include "valvetestwindow.h" | 8 | #include "valvetestwindow.h" |
@@ -29,6 +31,41 @@ FunctionTestWindow::~FunctionTestWindow() | @@ -29,6 +31,41 @@ FunctionTestWindow::~FunctionTestWindow() | ||
29 | delete ui; | 31 | delete ui; |
30 | } | 32 | } |
31 | 33 | ||
34 | +void FunctionTestWindow::keyPressEvent(QKeyEvent *event) | ||
35 | +{ | ||
36 | + switch (event->key()) | ||
37 | + { | ||
38 | + case 0x01000030: // Turn left | ||
39 | + onEncoderLeft(); | ||
40 | + break; | ||
41 | + case 0x01000031: // Push | ||
42 | + pushed = focusWidget(); | ||
43 | + break; | ||
44 | + case 0x01000032: // Turn right | ||
45 | + onEncoderRight(); | ||
46 | + break; | ||
47 | + } | ||
48 | +} | ||
49 | + | ||
50 | +void FunctionTestWindow::keyReleaseEvent(QKeyEvent *event) | ||
51 | +{ | ||
52 | + switch (event->key()) | ||
53 | + { | ||
54 | + case 0x01000030: // Turn left | ||
55 | + onEncoderLeft(); | ||
56 | + break; | ||
57 | + case 0x01000031: // Push | ||
58 | + if (focusWidget() == pushed) | ||
59 | + onEncoderClicked(pushed); | ||
60 | + | ||
61 | + pushed = NULL; | ||
62 | + break; | ||
63 | + case 0x01000032: // Turn right | ||
64 | + onEncoderRight(); | ||
65 | + break; | ||
66 | + } | ||
67 | +} | ||
68 | + | ||
32 | void FunctionTestWindow::on_burnerTestButton_clicked() | 69 | void FunctionTestWindow::on_burnerTestButton_clicked() |
33 | { | 70 | { |
34 | BurnerTestWindow *w = new BurnerTestWindow(this); | 71 | BurnerTestWindow *w = new BurnerTestWindow(this); |
@@ -62,5 +99,22 @@ void FunctionTestWindow::on_fanTestButton_clicked() | @@ -62,5 +99,22 @@ void FunctionTestWindow::on_fanTestButton_clicked() | ||
62 | void FunctionTestWindow::on_gasTestButton_clicked() | 99 | void FunctionTestWindow::on_gasTestButton_clicked() |
63 | { | 100 | { |
64 | // GasTestWindow *w = new GasTestWindow(this, udp); | 101 | // GasTestWindow *w = new GasTestWindow(this, udp); |
65 | -// w->showFullScreen(); | 102 | + // w->showFullScreen(); |
103 | +} | ||
104 | + | ||
105 | +void FunctionTestWindow::onEncoderLeft() | ||
106 | +{ | ||
107 | + focusPreviousChild(); | ||
108 | +} | ||
109 | + | ||
110 | +void FunctionTestWindow::onEncoderRight() | ||
111 | +{ | ||
112 | + focusNextChild(); | ||
113 | +} | ||
114 | + | ||
115 | +void FunctionTestWindow::onEncoderClicked(QWidget *clicked) | ||
116 | +{ | ||
117 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
118 | + if (b) | ||
119 | + b->click(); | ||
66 | } | 120 | } |
app/gui/oven_control/functiontestwindow.h
@@ -15,6 +15,10 @@ public: | @@ -15,6 +15,10 @@ public: | ||
15 | explicit FunctionTestWindow(QWidget *parent = 0); | 15 | explicit FunctionTestWindow(QWidget *parent = 0); |
16 | ~FunctionTestWindow(); | 16 | ~FunctionTestWindow(); |
17 | 17 | ||
18 | +protected: | ||
19 | + void keyPressEvent(QKeyEvent *event); | ||
20 | + void keyReleaseEvent(QKeyEvent *event); | ||
21 | + | ||
18 | private slots: | 22 | private slots: |
19 | void on_burnerTestButton_clicked(); | 23 | void on_burnerTestButton_clicked(); |
20 | 24 | ||
@@ -30,6 +34,12 @@ private slots: | @@ -30,6 +34,12 @@ private slots: | ||
30 | 34 | ||
31 | private: | 35 | private: |
32 | Ui::FunctionTestWindow *ui; | 36 | Ui::FunctionTestWindow *ui; |
37 | + | ||
38 | + QWidget *pushed = NULL; | ||
39 | + | ||
40 | + void onEncoderLeft(); | ||
41 | + void onEncoderRight(); | ||
42 | + void onEncoderClicked(QWidget *clicked); | ||
33 | }; | 43 | }; |
34 | 44 | ||
35 | #endif // FUNCTIONTESTWINDOW_H | 45 | #endif // FUNCTIONTESTWINDOW_H |
app/gui/oven_control/gasmodelsettingwindow.cpp
@@ -18,35 +18,35 @@ GasModelSettingWindow::GasModelSettingWindow(QWidget *parent) : | @@ -18,35 +18,35 @@ GasModelSettingWindow::GasModelSettingWindow(QWidget *parent) : | ||
18 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); | 18 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); |
19 | 19 | ||
20 | Config* cfg = Config::getInstance(); | 20 | Config* cfg = Config::getInstance(); |
21 | - Define::config_item item; | ||
22 | - item = cfg->getConfigValue(Define::config_model); | ||
23 | - selitem = item.d32; | ||
24 | - switch(item.d32){ | ||
25 | - case Define::model_gas_lng_10: | ||
26 | - ui->lng10Button->setChecked(true); | ||
27 | - break; | ||
28 | - case Define::model_gas_lng_20: | ||
29 | - ui->lng20Button->setChecked(true); | ||
30 | - break; | ||
31 | - case Define::model_gas_lng_24: | ||
32 | - ui->lng24Button->setChecked(true); | ||
33 | - break; | ||
34 | - case Define::model_gas_lng_40: | ||
35 | - ui->lng40Button->setChecked(true); | ||
36 | - break; | ||
37 | - case Define::model_gas_lpg_10: | ||
38 | - ui->lpg10Button->setChecked(true); | ||
39 | - break; | ||
40 | - case Define::model_gas_lpg_20: | ||
41 | - ui->lpg20Button->setChecked(true); | ||
42 | - break; | ||
43 | - case Define::model_gas_lpg_24: | ||
44 | - ui->lpg24Button->setChecked(true); | ||
45 | - break; | ||
46 | - case Define::model_gas_lpg_40: | ||
47 | - ui->lpg40Button->setChecked(true); | ||
48 | - break; | ||
49 | - } | 21 | + Define::config_item item; |
22 | + item = cfg->getConfigValue(Define::config_model); | ||
23 | + selitem = item.d32; | ||
24 | + switch(item.d32){ | ||
25 | + case Define::model_gas_lng_10: | ||
26 | + ui->lng10Button->setChecked(true); | ||
27 | + break; | ||
28 | + case Define::model_gas_lng_20: | ||
29 | + ui->lng20Button->setChecked(true); | ||
30 | + break; | ||
31 | + case Define::model_gas_lng_24: | ||
32 | + ui->lng24Button->setChecked(true); | ||
33 | + break; | ||
34 | + case Define::model_gas_lng_40: | ||
35 | + ui->lng40Button->setChecked(true); | ||
36 | + break; | ||
37 | + case Define::model_gas_lpg_10: | ||
38 | + ui->lpg10Button->setChecked(true); | ||
39 | + break; | ||
40 | + case Define::model_gas_lpg_20: | ||
41 | + ui->lpg20Button->setChecked(true); | ||
42 | + break; | ||
43 | + case Define::model_gas_lpg_24: | ||
44 | + ui->lpg24Button->setChecked(true); | ||
45 | + break; | ||
46 | + case Define::model_gas_lpg_40: | ||
47 | + ui->lpg40Button->setChecked(true); | ||
48 | + break; | ||
49 | + } | ||
50 | } | 50 | } |
51 | 51 | ||
52 | GasModelSettingWindow::~GasModelSettingWindow() | 52 | GasModelSettingWindow::~GasModelSettingWindow() |
@@ -54,6 +54,41 @@ GasModelSettingWindow::~GasModelSettingWindow() | @@ -54,6 +54,41 @@ GasModelSettingWindow::~GasModelSettingWindow() | ||
54 | delete ui; | 54 | delete ui; |
55 | } | 55 | } |
56 | 56 | ||
57 | +void GasModelSettingWindow::keyPressEvent(QKeyEvent *event) | ||
58 | +{ | ||
59 | + switch (event->key()) | ||
60 | + { | ||
61 | + case 0x01000030: // Turn left | ||
62 | + onEncoderLeft(); | ||
63 | + break; | ||
64 | + case 0x01000031: // Push | ||
65 | + pushed = focusWidget(); | ||
66 | + break; | ||
67 | + case 0x01000032: // Turn right | ||
68 | + onEncoderRight(); | ||
69 | + break; | ||
70 | + } | ||
71 | +} | ||
72 | + | ||
73 | +void GasModelSettingWindow::keyReleaseEvent(QKeyEvent *event) | ||
74 | +{ | ||
75 | + switch (event->key()) | ||
76 | + { | ||
77 | + case 0x01000030: // Turn left | ||
78 | + onEncoderLeft(); | ||
79 | + break; | ||
80 | + case 0x01000031: // Push | ||
81 | + if (focusWidget() == pushed) | ||
82 | + onEncoderClicked(pushed); | ||
83 | + | ||
84 | + pushed = NULL; | ||
85 | + break; | ||
86 | + case 0x01000032: // Turn right | ||
87 | + onEncoderRight(); | ||
88 | + break; | ||
89 | + } | ||
90 | +} | ||
91 | + | ||
57 | void GasModelSettingWindow::setModel(Define::model_type model) | 92 | void GasModelSettingWindow::setModel(Define::model_type model) |
58 | { | 93 | { |
59 | Define::config_item item; | 94 | Define::config_item item; |
@@ -129,3 +164,20 @@ void GasModelSettingWindow::on_backButton_clicked() | @@ -129,3 +164,20 @@ void GasModelSettingWindow::on_backButton_clicked() | ||
129 | } | 164 | } |
130 | close(); | 165 | close(); |
131 | } | 166 | } |
167 | + | ||
168 | +void GasModelSettingWindow::onEncoderLeft() | ||
169 | +{ | ||
170 | + focusPreviousChild(); | ||
171 | +} | ||
172 | + | ||
173 | +void GasModelSettingWindow::onEncoderRight() | ||
174 | +{ | ||
175 | + focusNextChild(); | ||
176 | +} | ||
177 | + | ||
178 | +void GasModelSettingWindow::onEncoderClicked(QWidget *clicked) | ||
179 | +{ | ||
180 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
181 | + if (b) | ||
182 | + b->click(); | ||
183 | +} |
app/gui/oven_control/gasmodelsettingwindow.h
@@ -17,6 +17,10 @@ public: | @@ -17,6 +17,10 @@ public: | ||
17 | explicit GasModelSettingWindow(QWidget *parent = 0); | 17 | explicit GasModelSettingWindow(QWidget *parent = 0); |
18 | ~GasModelSettingWindow(); | 18 | ~GasModelSettingWindow(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private slots: | 24 | private slots: |
21 | void setModel(Define::model_type model); | 25 | void setModel(Define::model_type model); |
22 | void on_lpg10Button_clicked(); | 26 | void on_lpg10Button_clicked(); |
@@ -33,6 +37,12 @@ private slots: | @@ -33,6 +37,12 @@ private slots: | ||
33 | private: | 37 | private: |
34 | Ui::GasModelSettingWindow *ui; | 38 | Ui::GasModelSettingWindow *ui; |
35 | uint32_t selitem; | 39 | uint32_t selitem; |
40 | + | ||
41 | + QWidget *pushed = NULL; | ||
42 | + | ||
43 | + void onEncoderLeft(); | ||
44 | + void onEncoderRight(); | ||
45 | + void onEncoderClicked(QWidget *clicked); | ||
36 | }; | 46 | }; |
37 | 47 | ||
38 | #endif // GASMODELSETTINGWINDOW_H | 48 | #endif // GASMODELSETTINGWINDOW_H |
app/gui/oven_control/gastestwindow.cpp
1 | #include "gastestwindow.h" | 1 | #include "gastestwindow.h" |
2 | #include "ui_gastestwindow.h" | 2 | #include "ui_gastestwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | 7 | ||
6 | GasTestWindow::GasTestWindow(QWidget *parent, UdpHandler *udp) : | 8 | GasTestWindow::GasTestWindow(QWidget *parent, UdpHandler *udp) : |
@@ -23,6 +25,41 @@ GasTestWindow::~GasTestWindow() | @@ -23,6 +25,41 @@ GasTestWindow::~GasTestWindow() | ||
23 | delete ui; | 25 | delete ui; |
24 | } | 26 | } |
25 | 27 | ||
28 | +void GasTestWindow::keyPressEvent(QKeyEvent *event) | ||
29 | +{ | ||
30 | + switch (event->key()) | ||
31 | + { | ||
32 | + case 0x01000030: // Turn left | ||
33 | + onEncoderLeft(); | ||
34 | + break; | ||
35 | + case 0x01000031: // Push | ||
36 | + pushed = focusWidget(); | ||
37 | + break; | ||
38 | + case 0x01000032: // Turn right | ||
39 | + onEncoderRight(); | ||
40 | + break; | ||
41 | + } | ||
42 | +} | ||
43 | + | ||
44 | +void GasTestWindow::keyReleaseEvent(QKeyEvent *event) | ||
45 | +{ | ||
46 | + switch (event->key()) | ||
47 | + { | ||
48 | + case 0x01000030: // Turn left | ||
49 | + onEncoderLeft(); | ||
50 | + break; | ||
51 | + case 0x01000031: // Push | ||
52 | + if (focusWidget() == pushed) | ||
53 | + onEncoderClicked(pushed); | ||
54 | + | ||
55 | + pushed = NULL; | ||
56 | + break; | ||
57 | + case 0x01000032: // Turn right | ||
58 | + onEncoderRight(); | ||
59 | + break; | ||
60 | + } | ||
61 | +} | ||
62 | + | ||
26 | void GasTestWindow::onDataChanged() | 63 | void GasTestWindow::onDataChanged() |
27 | { | 64 | { |
28 | 65 | ||
@@ -32,3 +69,20 @@ void GasTestWindow::on_backButton_clicked() | @@ -32,3 +69,20 @@ void GasTestWindow::on_backButton_clicked() | ||
32 | { | 69 | { |
33 | close(); | 70 | close(); |
34 | } | 71 | } |
72 | + | ||
73 | +void GasTestWindow::onEncoderLeft() | ||
74 | +{ | ||
75 | + focusPreviousChild(); | ||
76 | +} | ||
77 | + | ||
78 | +void GasTestWindow::onEncoderRight() | ||
79 | +{ | ||
80 | + focusNextChild(); | ||
81 | +} | ||
82 | + | ||
83 | +void GasTestWindow::onEncoderClicked(QWidget *clicked) | ||
84 | +{ | ||
85 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
86 | + if (b) | ||
87 | + b->click(); | ||
88 | +} |
app/gui/oven_control/gastestwindow.h
@@ -17,6 +17,10 @@ public: | @@ -17,6 +17,10 @@ public: | ||
17 | explicit GasTestWindow(QWidget *parent = 0, UdpHandler *udp = 0); | 17 | explicit GasTestWindow(QWidget *parent = 0, UdpHandler *udp = 0); |
18 | ~GasTestWindow(); | 18 | ~GasTestWindow(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private slots: | 24 | private slots: |
21 | void onDataChanged(); | 25 | void onDataChanged(); |
22 | 26 | ||
@@ -25,6 +29,12 @@ private slots: | @@ -25,6 +29,12 @@ private slots: | ||
25 | private: | 29 | private: |
26 | Ui::GasTestWindow *ui; | 30 | Ui::GasTestWindow *ui; |
27 | UdpHandler *udp; | 31 | UdpHandler *udp; |
32 | + | ||
33 | + QWidget *pushed = NULL; | ||
34 | + | ||
35 | + void onEncoderLeft(); | ||
36 | + void onEncoderRight(); | ||
37 | + void onEncoderClicked(QWidget *clicked); | ||
28 | }; | 38 | }; |
29 | 39 | ||
30 | 40 |
app/gui/oven_control/keepwarmpopup.cpp
1 | #include "keepwarmpopup.h" | 1 | #include "keepwarmpopup.h" |
2 | #include "ui_keepwarmpopup.h" | 2 | #include "ui_keepwarmpopup.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | KeepWarmPopup::KeepWarmPopup(QWidget *parent) : | 6 | KeepWarmPopup::KeepWarmPopup(QWidget *parent) : |
5 | QWidget(parent), | 7 | QWidget(parent), |
6 | ui(new Ui::KeepWarmPopup) | 8 | ui(new Ui::KeepWarmPopup) |
@@ -20,6 +22,56 @@ KeepWarmPopup::~KeepWarmPopup() | @@ -20,6 +22,56 @@ KeepWarmPopup::~KeepWarmPopup() | ||
20 | delete ui; | 22 | delete ui; |
21 | } | 23 | } |
22 | 24 | ||
25 | +void KeepWarmPopup::keyPressEvent(QKeyEvent *event) | ||
26 | +{ | ||
27 | + switch (event->key()) | ||
28 | + { | ||
29 | + case 0x01000030: // Turn left | ||
30 | + onEncoderLeft(); | ||
31 | + break; | ||
32 | + case 0x01000031: // Push | ||
33 | + pushed = focusWidget(); | ||
34 | + break; | ||
35 | + case 0x01000032: // Turn right | ||
36 | + onEncoderRight(); | ||
37 | + break; | ||
38 | + } | ||
39 | +} | ||
40 | + | ||
41 | +void KeepWarmPopup::keyReleaseEvent(QKeyEvent *event) | ||
42 | +{ | ||
43 | + switch (event->key()) | ||
44 | + { | ||
45 | + case 0x01000030: // Turn left | ||
46 | + onEncoderLeft(); | ||
47 | + break; | ||
48 | + case 0x01000031: // Push | ||
49 | + if (focusWidget() == pushed) | ||
50 | + onEncoderClicked(pushed); | ||
51 | + | ||
52 | + pushed = NULL; | ||
53 | + break; | ||
54 | + case 0x01000032: // Turn right | ||
55 | + onEncoderRight(); | ||
56 | + break; | ||
57 | + } | ||
58 | +} | ||
59 | + | ||
60 | +void KeepWarmPopup::onEncoderLeft() | ||
61 | +{ | ||
62 | + | ||
63 | +} | ||
64 | + | ||
65 | +void KeepWarmPopup::onEncoderRight() | ||
66 | +{ | ||
67 | + | ||
68 | +} | ||
69 | + | ||
70 | +void KeepWarmPopup::onEncoderClicked(QWidget *clicked) | ||
71 | +{ | ||
72 | + | ||
73 | +} | ||
74 | + | ||
23 | void KeepWarmPopup::updateView() | 75 | void KeepWarmPopup::updateView() |
24 | { | 76 | { |
25 | int elapsed = startTime.elapsed() / 1000; | 77 | int elapsed = startTime.elapsed() / 1000; |
app/gui/oven_control/keepwarmpopup.h
@@ -17,12 +17,22 @@ public: | @@ -17,12 +17,22 @@ public: | ||
17 | explicit KeepWarmPopup(QWidget *parent = 0); | 17 | explicit KeepWarmPopup(QWidget *parent = 0); |
18 | ~KeepWarmPopup(); | 18 | ~KeepWarmPopup(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private: | 24 | private: |
21 | Ui::KeepWarmPopup *ui; | 25 | Ui::KeepWarmPopup *ui; |
22 | 26 | ||
23 | QTime startTime; | 27 | QTime startTime; |
24 | QTimer updateViewTimer; | 28 | QTimer updateViewTimer; |
25 | 29 | ||
30 | + QWidget *pushed = NULL; | ||
31 | + | ||
32 | + void onEncoderLeft(); | ||
33 | + void onEncoderRight(); | ||
34 | + void onEncoderClicked(QWidget *clicked); | ||
35 | + | ||
26 | 36 | ||
27 | private slots: | 37 | private slots: |
28 | void updateView(); | 38 | void updateView(); |
app/gui/oven_control/manualcooksettingwidget.cpp
1 | #include "manualcooksettingwidget.h" | 1 | #include "manualcooksettingwidget.h" |
2 | #include "ui_manualcooksettingwidget.h" | 2 | #include "ui_manualcooksettingwidget.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "stringer.h" | 6 | #include "stringer.h" |
5 | 7 | ||
6 | ManualCookSettingWidget::ManualCookSettingWidget(ManualCookSetting setting, QWidget *parent) : | 8 | ManualCookSettingWidget::ManualCookSettingWidget(ManualCookSetting setting, QWidget *parent) : |
@@ -110,3 +112,53 @@ void ManualCookSettingWidget::setFan(int level) | @@ -110,3 +112,53 @@ void ManualCookSettingWidget::setFan(int level) | ||
110 | break; | 112 | break; |
111 | } | 113 | } |
112 | } | 114 | } |
115 | + | ||
116 | +void ManualCookSettingWidget::keyPressEvent(QKeyEvent *event) | ||
117 | +{ | ||
118 | + switch (event->key()) | ||
119 | + { | ||
120 | + case 0x01000030: // Turn left | ||
121 | + onEncoderLeft(); | ||
122 | + break; | ||
123 | + case 0x01000031: // Push | ||
124 | + pushed = focusWidget(); | ||
125 | + break; | ||
126 | + case 0x01000032: // Turn right | ||
127 | + onEncoderRight(); | ||
128 | + break; | ||
129 | + } | ||
130 | +} | ||
131 | + | ||
132 | +void ManualCookSettingWidget::keyReleaseEvent(QKeyEvent *event) | ||
133 | +{ | ||
134 | + switch (event->key()) | ||
135 | + { | ||
136 | + case 0x01000030: // Turn left | ||
137 | + onEncoderLeft(); | ||
138 | + break; | ||
139 | + case 0x01000031: // Push | ||
140 | + if (focusWidget() == pushed) | ||
141 | + onEncoderClicked(pushed); | ||
142 | + | ||
143 | + pushed = NULL; | ||
144 | + break; | ||
145 | + case 0x01000032: // Turn right | ||
146 | + onEncoderRight(); | ||
147 | + break; | ||
148 | + } | ||
149 | +} | ||
150 | + | ||
151 | +void ManualCookSettingWidget::onEncoderLeft() | ||
152 | +{ | ||
153 | + | ||
154 | +} | ||
155 | + | ||
156 | +void ManualCookSettingWidget::onEncoderRight() | ||
157 | +{ | ||
158 | + | ||
159 | +} | ||
160 | + | ||
161 | +void ManualCookSettingWidget::onEncoderClicked(QWidget *clicked) | ||
162 | +{ | ||
163 | + | ||
164 | +} |
app/gui/oven_control/manualcooksettingwidget.h
@@ -26,8 +26,18 @@ public: | @@ -26,8 +26,18 @@ public: | ||
26 | void setCoreTemp(int celsius); | 26 | void setCoreTemp(int celsius); |
27 | void setFan(int level); | 27 | void setFan(int level); |
28 | 28 | ||
29 | +protected: | ||
30 | + void keyPressEvent(QKeyEvent *event); | ||
31 | + void keyReleaseEvent(QKeyEvent *event); | ||
32 | + | ||
29 | private: | 33 | private: |
30 | Ui::ManualCookSettingWidget *ui; | 34 | Ui::ManualCookSettingWidget *ui; |
35 | + | ||
36 | + QWidget *pushed = NULL; | ||
37 | + | ||
38 | + void onEncoderLeft(); | ||
39 | + void onEncoderRight(); | ||
40 | + void onEncoderClicked(QWidget *clicked); | ||
31 | }; | 41 | }; |
32 | 42 | ||
33 | #endif // MANUALCOOKSETTINGWIDGET_H | 43 | #endif // MANUALCOOKSETTINGWIDGET_H |
app/gui/oven_control/modelsettingwindow.cpp
1 | #include "modelsettingwindow.h" | 1 | #include "modelsettingwindow.h" |
2 | #include "ui_modelsettingwindow.h" | 2 | #include "ui_modelsettingwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "electricmodelsettingwindow.h" | 6 | #include "electricmodelsettingwindow.h" |
5 | #include "gasmodelsettingwindow.h" | 7 | #include "gasmodelsettingwindow.h" |
6 | #include "soundplayer.h" | 8 | #include "soundplayer.h" |
@@ -23,6 +25,41 @@ ModelSettingWindow::~ModelSettingWindow() | @@ -23,6 +25,41 @@ ModelSettingWindow::~ModelSettingWindow() | ||
23 | delete ui; | 25 | delete ui; |
24 | } | 26 | } |
25 | 27 | ||
28 | +void ModelSettingWindow::keyPressEvent(QKeyEvent *event) | ||
29 | +{ | ||
30 | + switch (event->key()) | ||
31 | + { | ||
32 | + case 0x01000030: // Turn left | ||
33 | + onEncoderLeft(); | ||
34 | + break; | ||
35 | + case 0x01000031: // Push | ||
36 | + pushed = focusWidget(); | ||
37 | + break; | ||
38 | + case 0x01000032: // Turn right | ||
39 | + onEncoderRight(); | ||
40 | + break; | ||
41 | + } | ||
42 | +} | ||
43 | + | ||
44 | +void ModelSettingWindow::keyReleaseEvent(QKeyEvent *event) | ||
45 | +{ | ||
46 | + switch (event->key()) | ||
47 | + { | ||
48 | + case 0x01000030: // Turn left | ||
49 | + onEncoderLeft(); | ||
50 | + break; | ||
51 | + case 0x01000031: // Push | ||
52 | + if (focusWidget() == pushed) | ||
53 | + onEncoderClicked(pushed); | ||
54 | + | ||
55 | + pushed = NULL; | ||
56 | + break; | ||
57 | + case 0x01000032: // Turn right | ||
58 | + onEncoderRight(); | ||
59 | + break; | ||
60 | + } | ||
61 | +} | ||
62 | + | ||
26 | void ModelSettingWindow::on_electricButton_clicked() | 63 | void ModelSettingWindow::on_electricButton_clicked() |
27 | { | 64 | { |
28 | ElectricModelSettingWindow *w = new ElectricModelSettingWindow(this); | 65 | ElectricModelSettingWindow *w = new ElectricModelSettingWindow(this); |
@@ -39,3 +76,20 @@ void ModelSettingWindow::on_backButton_clicked() | @@ -39,3 +76,20 @@ void ModelSettingWindow::on_backButton_clicked() | ||
39 | { | 76 | { |
40 | close(); | 77 | close(); |
41 | } | 78 | } |
79 | + | ||
80 | +void ModelSettingWindow::onEncoderLeft() | ||
81 | +{ | ||
82 | + focusPreviousChild(); | ||
83 | +} | ||
84 | + | ||
85 | +void ModelSettingWindow::onEncoderRight() | ||
86 | +{ | ||
87 | + focusNextChild(); | ||
88 | +} | ||
89 | + | ||
90 | +void ModelSettingWindow::onEncoderClicked(QWidget *clicked) | ||
91 | +{ | ||
92 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
93 | + if (b) | ||
94 | + b->click(); | ||
95 | +} |
app/gui/oven_control/modelsettingwindow.h
@@ -15,6 +15,10 @@ public: | @@ -15,6 +15,10 @@ public: | ||
15 | explicit ModelSettingWindow(QWidget *parent = 0); | 15 | explicit ModelSettingWindow(QWidget *parent = 0); |
16 | ~ModelSettingWindow(); | 16 | ~ModelSettingWindow(); |
17 | 17 | ||
18 | +protected: | ||
19 | + void keyPressEvent(QKeyEvent *event); | ||
20 | + void keyReleaseEvent(QKeyEvent *event); | ||
21 | + | ||
18 | private slots: | 22 | private slots: |
19 | 23 | ||
20 | void on_electricButton_clicked(); | 24 | void on_electricButton_clicked(); |
@@ -25,6 +29,12 @@ private slots: | @@ -25,6 +29,12 @@ private slots: | ||
25 | 29 | ||
26 | private: | 30 | private: |
27 | Ui::ModelSettingWindow *ui; | 31 | Ui::ModelSettingWindow *ui; |
32 | + | ||
33 | + QWidget *pushed = NULL; | ||
34 | + | ||
35 | + void onEncoderLeft(); | ||
36 | + void onEncoderRight(); | ||
37 | + void onEncoderClicked(QWidget *clicked); | ||
28 | }; | 38 | }; |
29 | 39 | ||
30 | #endif // MODELSETTINGWINDOW_H | 40 | #endif // MODELSETTINGWINDOW_H |
app/gui/oven_control/primewindow.cpp
@@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
4 | #include <QtDebug> | 4 | #include <QtDebug> |
5 | #include <QLabel> | 5 | #include <QLabel> |
6 | #include <QPainter> | 6 | #include <QPainter> |
7 | +#include <QKeyEvent> | ||
7 | 8 | ||
8 | #include "manualcooksettingwidget.h" | 9 | #include "manualcooksettingwidget.h" |
9 | #include "cookhistory.h" | 10 | #include "cookhistory.h" |
@@ -82,6 +83,41 @@ void PrimeWindow::focusFavorite(int id) | @@ -82,6 +83,41 @@ void PrimeWindow::focusFavorite(int id) | ||
82 | } | 83 | } |
83 | } | 84 | } |
84 | 85 | ||
86 | +void PrimeWindow::keyPressEvent(QKeyEvent *event) | ||
87 | +{ | ||
88 | + switch (event->key()) | ||
89 | + { | ||
90 | + case 0x01000030: // Turn left | ||
91 | + onEncoderLeft(); | ||
92 | + break; | ||
93 | + case 0x01000031: // Push | ||
94 | + pushed = focusWidget(); | ||
95 | + break; | ||
96 | + case 0x01000032: // Turn right | ||
97 | + onEncoderRight(); | ||
98 | + break; | ||
99 | + } | ||
100 | +} | ||
101 | + | ||
102 | +void PrimeWindow::keyReleaseEvent(QKeyEvent *event) | ||
103 | +{ | ||
104 | + switch (event->key()) | ||
105 | + { | ||
106 | + case 0x01000030: // Turn left | ||
107 | + onEncoderLeft(); | ||
108 | + break; | ||
109 | + case 0x01000031: // Push | ||
110 | + if (focusWidget() == pushed) | ||
111 | + onEncoderClicked(pushed); | ||
112 | + | ||
113 | + pushed = NULL; | ||
114 | + break; | ||
115 | + case 0x01000032: // Turn right | ||
116 | + onEncoderRight(); | ||
117 | + break; | ||
118 | + } | ||
119 | +} | ||
120 | + | ||
85 | void PrimeWindow::on_mostCookedButton_toggled(bool checked) | 121 | void PrimeWindow::on_mostCookedButton_toggled(bool checked) |
86 | { | 122 | { |
87 | if (!checked) | 123 | if (!checked) |
@@ -212,3 +248,20 @@ void PrimeWindow::on_helpButton_clicked() | @@ -212,3 +248,20 @@ void PrimeWindow::on_helpButton_clicked() | ||
212 | { | 248 | { |
213 | 249 | ||
214 | } | 250 | } |
251 | + | ||
252 | +void PrimeWindow::onEncoderLeft() | ||
253 | +{ | ||
254 | + focusPreviousChild(); | ||
255 | +} | ||
256 | + | ||
257 | +void PrimeWindow::onEncoderRight() | ||
258 | +{ | ||
259 | + focusNextChild(); | ||
260 | +} | ||
261 | + | ||
262 | +void PrimeWindow::onEncoderClicked(QWidget *clicked) | ||
263 | +{ | ||
264 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
265 | + if (b) | ||
266 | + b->click(); | ||
267 | +} |
app/gui/oven_control/primewindow.h
@@ -25,6 +25,10 @@ public: | @@ -25,6 +25,10 @@ public: | ||
25 | void listFavorites(); | 25 | void listFavorites(); |
26 | void focusFavorite(int id); | 26 | void focusFavorite(int id); |
27 | 27 | ||
28 | +protected: | ||
29 | + void keyPressEvent(QKeyEvent *event); | ||
30 | + void keyReleaseEvent(QKeyEvent *event); | ||
31 | + | ||
28 | private slots: | 32 | private slots: |
29 | void on_mostCookedButton_toggled(bool checked); | 33 | void on_mostCookedButton_toggled(bool checked); |
30 | void on_recentsButton_toggled(bool checked); | 34 | void on_recentsButton_toggled(bool checked); |
@@ -52,6 +56,12 @@ private: | @@ -52,6 +56,12 @@ private: | ||
52 | 56 | ||
53 | QList<CookPanelButton *> list; | 57 | QList<CookPanelButton *> list; |
54 | CookPanelButton *lastInfoDisplayed; | 58 | CookPanelButton *lastInfoDisplayed; |
59 | + | ||
60 | + QWidget *pushed = NULL; | ||
61 | + | ||
62 | + void onEncoderLeft(); | ||
63 | + void onEncoderRight(); | ||
64 | + void onEncoderClicked(QWidget *clicked); | ||
55 | }; | 65 | }; |
56 | 66 | ||
57 | #endif // PRIMEWINDOW_H | 67 | #endif // PRIMEWINDOW_H |
app/gui/oven_control/programmingautoconfigwindow.cpp
1 | #include "programmingautoconfigwindow.h" | 1 | #include "programmingautoconfigwindow.h" |
2 | #include "ui_programmingautoconfigwindow.h" | 2 | #include "ui_programmingautoconfigwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | #include "stringer.h" | 7 | #include "stringer.h" |
6 | #include "cookprogram.h" | 8 | #include "cookprogram.h" |
@@ -69,6 +71,56 @@ ProgrammingAutoConfigWindow::~ProgrammingAutoConfigWindow() | @@ -69,6 +71,56 @@ ProgrammingAutoConfigWindow::~ProgrammingAutoConfigWindow() | ||
69 | delete ui; | 71 | delete ui; |
70 | } | 72 | } |
71 | 73 | ||
74 | +void ProgrammingAutoConfigWindow::keyPressEvent(QKeyEvent *event) | ||
75 | +{ | ||
76 | + switch (event->key()) | ||
77 | + { | ||
78 | + case 0x01000030: // Turn left | ||
79 | + onEncoderLeft(); | ||
80 | + break; | ||
81 | + case 0x01000031: // Push | ||
82 | + pushed = focusWidget(); | ||
83 | + break; | ||
84 | + case 0x01000032: // Turn right | ||
85 | + onEncoderRight(); | ||
86 | + break; | ||
87 | + } | ||
88 | +} | ||
89 | + | ||
90 | +void ProgrammingAutoConfigWindow::keyReleaseEvent(QKeyEvent *event) | ||
91 | +{ | ||
92 | + switch (event->key()) | ||
93 | + { | ||
94 | + case 0x01000030: // Turn left | ||
95 | + onEncoderLeft(); | ||
96 | + break; | ||
97 | + case 0x01000031: // Push | ||
98 | + if (focusWidget() == pushed) | ||
99 | + onEncoderClicked(pushed); | ||
100 | + | ||
101 | + pushed = NULL; | ||
102 | + break; | ||
103 | + case 0x01000032: // Turn right | ||
104 | + onEncoderRight(); | ||
105 | + break; | ||
106 | + } | ||
107 | +} | ||
108 | + | ||
109 | +void ProgrammingAutoConfigWindow::onEncoderLeft() | ||
110 | +{ | ||
111 | + | ||
112 | +} | ||
113 | + | ||
114 | +void ProgrammingAutoConfigWindow::onEncoderRight() | ||
115 | +{ | ||
116 | + | ||
117 | +} | ||
118 | + | ||
119 | +void ProgrammingAutoConfigWindow::onEncoderClicked(QWidget *clicked) | ||
120 | +{ | ||
121 | + | ||
122 | +} | ||
123 | + | ||
72 | void ProgrammingAutoConfigWindow::setupUi() | 124 | void ProgrammingAutoConfigWindow::setupUi() |
73 | { | 125 | { |
74 | ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); | 126 | ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); |
app/gui/oven_control/programmingautoconfigwindow.h
@@ -21,6 +21,10 @@ public: | @@ -21,6 +21,10 @@ public: | ||
21 | explicit ProgrammingAutoConfigWindow(QWidget *parent, Cook cook); | 21 | explicit ProgrammingAutoConfigWindow(QWidget *parent, Cook cook); |
22 | ~ProgrammingAutoConfigWindow(); | 22 | ~ProgrammingAutoConfigWindow(); |
23 | 23 | ||
24 | +protected: | ||
25 | + void keyPressEvent(QKeyEvent *event); | ||
26 | + void keyReleaseEvent(QKeyEvent *event); | ||
27 | + | ||
24 | private: | 28 | private: |
25 | Ui::ProgrammingAutoConfigWindow *ui; | 29 | Ui::ProgrammingAutoConfigWindow *ui; |
26 | Cook cook; | 30 | Cook cook; |
@@ -35,6 +39,12 @@ private: | @@ -35,6 +39,12 @@ private: | ||
35 | 39 | ||
36 | QList<ConfigWidget> configWidgets; | 40 | QList<ConfigWidget> configWidgets; |
37 | 41 | ||
42 | + QWidget *pushed = NULL; | ||
43 | + | ||
44 | + void onEncoderLeft(); | ||
45 | + void onEncoderRight(); | ||
46 | + void onEncoderClicked(QWidget *clicked); | ||
47 | + | ||
38 | private slots: | 48 | private slots: |
39 | void setupUi(); | 49 | void setupUi(); |
40 | void updateView(); | 50 | void updateView(); |
app/gui/oven_control/programmingautoselectionwindow.cpp
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | #include "ui_programmingautoselectionwindow.h" | 2 | #include "ui_programmingautoselectionwindow.h" |
3 | 3 | ||
4 | #include <QSignalMapper> | 4 | #include <QSignalMapper> |
5 | +#include <QKeyEvent> | ||
5 | 6 | ||
6 | #include "soundplayer.h" | 7 | #include "soundplayer.h" |
7 | #include "programmingautoconfigwindow.h" | 8 | #include "programmingautoconfigwindow.h" |
@@ -63,6 +64,56 @@ ProgrammingAutoSelectionWindow::~ProgrammingAutoSelectionWindow() | @@ -63,6 +64,56 @@ ProgrammingAutoSelectionWindow::~ProgrammingAutoSelectionWindow() | ||
63 | delete ui; | 64 | delete ui; |
64 | } | 65 | } |
65 | 66 | ||
67 | +void ProgrammingAutoSelectionWindow::keyPressEvent(QKeyEvent *event) | ||
68 | +{ | ||
69 | + switch (event->key()) | ||
70 | + { | ||
71 | + case 0x01000030: // Turn left | ||
72 | + onEncoderLeft(); | ||
73 | + break; | ||
74 | + case 0x01000031: // Push | ||
75 | + pushed = focusWidget(); | ||
76 | + break; | ||
77 | + case 0x01000032: // Turn right | ||
78 | + onEncoderRight(); | ||
79 | + break; | ||
80 | + } | ||
81 | +} | ||
82 | + | ||
83 | +void ProgrammingAutoSelectionWindow::keyReleaseEvent(QKeyEvent *event) | ||
84 | +{ | ||
85 | + switch (event->key()) | ||
86 | + { | ||
87 | + case 0x01000030: // Turn left | ||
88 | + onEncoderLeft(); | ||
89 | + break; | ||
90 | + case 0x01000031: // Push | ||
91 | + if (focusWidget() == pushed) | ||
92 | + onEncoderClicked(pushed); | ||
93 | + | ||
94 | + pushed = NULL; | ||
95 | + break; | ||
96 | + case 0x01000032: // Turn right | ||
97 | + onEncoderRight(); | ||
98 | + break; | ||
99 | + } | ||
100 | +} | ||
101 | + | ||
102 | +void ProgrammingAutoSelectionWindow::onEncoderLeft() | ||
103 | +{ | ||
104 | + | ||
105 | +} | ||
106 | + | ||
107 | +void ProgrammingAutoSelectionWindow::onEncoderRight() | ||
108 | +{ | ||
109 | + | ||
110 | +} | ||
111 | + | ||
112 | +void ProgrammingAutoSelectionWindow::onEncoderClicked(QWidget *clicked) | ||
113 | +{ | ||
114 | + | ||
115 | +} | ||
116 | + | ||
66 | void ProgrammingAutoSelectionWindow::onCookSelected(int idx) | 117 | void ProgrammingAutoSelectionWindow::onCookSelected(int idx) |
67 | { | 118 | { |
68 | ProgrammingAutoConfigWindow *w = new ProgrammingAutoConfigWindow(this, book.get(idx)); | 119 | ProgrammingAutoConfigWindow *w = new ProgrammingAutoConfigWindow(this, book.get(idx)); |
app/gui/oven_control/programmingautoselectionwindow.h
@@ -17,11 +17,21 @@ public: | @@ -17,11 +17,21 @@ public: | ||
17 | explicit ProgrammingAutoSelectionWindow(QWidget *parent, Define::CookType type); | 17 | explicit ProgrammingAutoSelectionWindow(QWidget *parent, Define::CookType type); |
18 | ~ProgrammingAutoSelectionWindow(); | 18 | ~ProgrammingAutoSelectionWindow(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private: | 24 | private: |
21 | Ui::ProgrammingAutoSelectionWindow *ui; | 25 | Ui::ProgrammingAutoSelectionWindow *ui; |
22 | Define::CookType type; | 26 | Define::CookType type; |
23 | CookBook book; | 27 | CookBook book; |
24 | 28 | ||
29 | + QWidget *pushed = NULL; | ||
30 | + | ||
31 | + void onEncoderLeft(); | ||
32 | + void onEncoderRight(); | ||
33 | + void onEncoderClicked(QWidget *clicked); | ||
34 | + | ||
25 | private slots: | 35 | private slots: |
26 | void onCookSelected(int idx); | 36 | void onCookSelected(int idx); |
27 | 37 |
app/gui/oven_control/programmingmanualcoretemppopup.cpp
1 | #include "programmingmanualcoretemppopup.h" | 1 | #include "programmingmanualcoretemppopup.h" |
2 | #include "ui_programmingmanualcoretemppopup.h" | 2 | #include "ui_programmingmanualcoretemppopup.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "stringer.h" | 6 | #include "stringer.h" |
5 | #include "soundplayer.h" | 7 | #include "soundplayer.h" |
6 | #include "oven.h" | 8 | #include "oven.h" |
@@ -42,6 +44,41 @@ ProgrammingManualCoreTempPopup::~ProgrammingManualCoreTempPopup() | @@ -42,6 +44,41 @@ ProgrammingManualCoreTempPopup::~ProgrammingManualCoreTempPopup() | ||
42 | delete ui; | 44 | delete ui; |
43 | } | 45 | } |
44 | 46 | ||
47 | +void ProgrammingManualCoreTempPopup::keyPressEvent(QKeyEvent *event) | ||
48 | +{ | ||
49 | + switch (event->key()) | ||
50 | + { | ||
51 | + case 0x01000030: // Turn left | ||
52 | + onEncoderLeft(); | ||
53 | + break; | ||
54 | + case 0x01000031: // Push | ||
55 | + pushed = focusWidget(); | ||
56 | + break; | ||
57 | + case 0x01000032: // Turn right | ||
58 | + onEncoderRight(); | ||
59 | + break; | ||
60 | + } | ||
61 | +} | ||
62 | + | ||
63 | +void ProgrammingManualCoreTempPopup::keyReleaseEvent(QKeyEvent *event) | ||
64 | +{ | ||
65 | + switch (event->key()) | ||
66 | + { | ||
67 | + case 0x01000030: // Turn left | ||
68 | + onEncoderLeft(); | ||
69 | + break; | ||
70 | + case 0x01000031: // Push | ||
71 | + if (focusWidget() == pushed) | ||
72 | + onEncoderClicked(pushed); | ||
73 | + | ||
74 | + pushed = NULL; | ||
75 | + break; | ||
76 | + case 0x01000032: // Turn right | ||
77 | + onEncoderRight(); | ||
78 | + break; | ||
79 | + } | ||
80 | +} | ||
81 | + | ||
45 | void ProgrammingManualCoreTempPopup::updateCoreTempLabel() | 82 | void ProgrammingManualCoreTempPopup::updateCoreTempLabel() |
46 | { | 83 | { |
47 | ui->coreTempLabel->setText(Stringer::temperature(ui->coreTempSlider->sliderPosition(), Stringer::fontSize14)); | 84 | ui->coreTempLabel->setText(Stringer::temperature(ui->coreTempSlider->sliderPosition(), Stringer::fontSize14)); |
@@ -63,3 +100,18 @@ void ProgrammingManualCoreTempPopup::on_applyButton_clicked() | @@ -63,3 +100,18 @@ void ProgrammingManualCoreTempPopup::on_applyButton_clicked() | ||
63 | 100 | ||
64 | close(); | 101 | close(); |
65 | } | 102 | } |
103 | + | ||
104 | +void ProgrammingManualCoreTempPopup::onEncoderLeft() | ||
105 | +{ | ||
106 | + | ||
107 | +} | ||
108 | + | ||
109 | +void ProgrammingManualCoreTempPopup::onEncoderRight() | ||
110 | +{ | ||
111 | + | ||
112 | +} | ||
113 | + | ||
114 | +void ProgrammingManualCoreTempPopup::onEncoderClicked(QWidget *clicked) | ||
115 | +{ | ||
116 | + | ||
117 | +} |
app/gui/oven_control/programmingmanualcoretemppopup.h
@@ -15,6 +15,10 @@ public: | @@ -15,6 +15,10 @@ public: | ||
15 | explicit ProgrammingManualCoreTempPopup(QWidget *parent = 0); | 15 | explicit ProgrammingManualCoreTempPopup(QWidget *parent = 0); |
16 | ~ProgrammingManualCoreTempPopup(); | 16 | ~ProgrammingManualCoreTempPopup(); |
17 | 17 | ||
18 | +protected: | ||
19 | + void keyPressEvent(QKeyEvent *event); | ||
20 | + void keyReleaseEvent(QKeyEvent *event); | ||
21 | + | ||
18 | private slots: | 22 | private slots: |
19 | void updateCoreTempLabel(); | 23 | void updateCoreTempLabel(); |
20 | 24 | ||
@@ -25,6 +29,12 @@ private slots: | @@ -25,6 +29,12 @@ private slots: | ||
25 | private: | 29 | private: |
26 | Ui::ProgrammingManualCoreTempPopup *ui; | 30 | Ui::ProgrammingManualCoreTempPopup *ui; |
27 | 31 | ||
32 | + QWidget *pushed = NULL; | ||
33 | + | ||
34 | + void onEncoderLeft(); | ||
35 | + void onEncoderRight(); | ||
36 | + void onEncoderClicked(QWidget *clicked); | ||
37 | + | ||
28 | signals: | 38 | signals: |
29 | void coreTempEnabled(int); | 39 | void coreTempEnabled(int); |
30 | }; | 40 | }; |
app/gui/oven_control/programmingmanualwindow.cpp
1 | #include "programmingmanualwindow.h" | 1 | #include "programmingmanualwindow.h" |
2 | #include "ui_programmingmanualwindow.h" | 2 | #include "ui_programmingmanualwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "stringer.h" | 6 | #include "stringer.h" |
5 | #include "programmingmanualcoretemppopup.h" | 7 | #include "programmingmanualcoretemppopup.h" |
6 | #include "cookprogram.h" | 8 | #include "cookprogram.h" |
@@ -71,6 +73,41 @@ ProgrammingManualWindow::~ProgrammingManualWindow() | @@ -71,6 +73,41 @@ ProgrammingManualWindow::~ProgrammingManualWindow() | ||
71 | delete ui; | 73 | delete ui; |
72 | } | 74 | } |
73 | 75 | ||
76 | +void ProgrammingManualWindow::keyPressEvent(QKeyEvent *event) | ||
77 | +{ | ||
78 | + switch (event->key()) | ||
79 | + { | ||
80 | + case 0x01000030: // Turn left | ||
81 | + onEncoderLeft(); | ||
82 | + break; | ||
83 | + case 0x01000031: // Push | ||
84 | + pushed = focusWidget(); | ||
85 | + break; | ||
86 | + case 0x01000032: // Turn right | ||
87 | + onEncoderRight(); | ||
88 | + break; | ||
89 | + } | ||
90 | +} | ||
91 | + | ||
92 | +void ProgrammingManualWindow::keyReleaseEvent(QKeyEvent *event) | ||
93 | +{ | ||
94 | + switch (event->key()) | ||
95 | + { | ||
96 | + case 0x01000030: // Turn left | ||
97 | + onEncoderLeft(); | ||
98 | + break; | ||
99 | + case 0x01000031: // Push | ||
100 | + if (focusWidget() == pushed) | ||
101 | + onEncoderClicked(pushed); | ||
102 | + | ||
103 | + pushed = NULL; | ||
104 | + break; | ||
105 | + case 0x01000032: // Turn right | ||
106 | + onEncoderRight(); | ||
107 | + break; | ||
108 | + } | ||
109 | +} | ||
110 | + | ||
74 | int ProgrammingManualWindow::sliderToTime(int value) | 111 | int ProgrammingManualWindow::sliderToTime(int value) |
75 | { | 112 | { |
76 | if (value <= 180) | 113 | if (value <= 180) |
@@ -89,6 +126,21 @@ int ProgrammingManualWindow::timeToSlider(int secs) | @@ -89,6 +126,21 @@ int ProgrammingManualWindow::timeToSlider(int secs) | ||
89 | return 270 + (secs - 360 * 60) / 15 / 60; | 126 | return 270 + (secs - 360 * 60) / 15 / 60; |
90 | } | 127 | } |
91 | 128 | ||
129 | +void ProgrammingManualWindow::onEncoderLeft() | ||
130 | +{ | ||
131 | + | ||
132 | +} | ||
133 | + | ||
134 | +void ProgrammingManualWindow::onEncoderRight() | ||
135 | +{ | ||
136 | + | ||
137 | +} | ||
138 | + | ||
139 | +void ProgrammingManualWindow::onEncoderClicked(QWidget *clicked) | ||
140 | +{ | ||
141 | + | ||
142 | +} | ||
143 | + | ||
92 | void ProgrammingManualWindow::setDefault(Define::Mode mode) | 144 | void ProgrammingManualWindow::setDefault(Define::Mode mode) |
93 | { | 145 | { |
94 | switch (mode) | 146 | switch (mode) |
app/gui/oven_control/programmingmanualwindow.h
@@ -17,6 +17,10 @@ public: | @@ -17,6 +17,10 @@ public: | ||
17 | explicit ProgrammingManualWindow(QWidget *parent, Define::Mode mode); | 17 | explicit ProgrammingManualWindow(QWidget *parent, Define::Mode mode); |
18 | ~ProgrammingManualWindow(); | 18 | ~ProgrammingManualWindow(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private: | 24 | private: |
21 | Ui::ProgrammingManualWindow *ui; | 25 | Ui::ProgrammingManualWindow *ui; |
22 | 26 | ||
@@ -26,6 +30,12 @@ private: | @@ -26,6 +30,12 @@ private: | ||
26 | int sliderToTime(int value); | 30 | int sliderToTime(int value); |
27 | int timeToSlider(int secs); | 31 | int timeToSlider(int secs); |
28 | 32 | ||
33 | + QWidget *pushed = NULL; | ||
34 | + | ||
35 | + void onEncoderLeft(); | ||
36 | + void onEncoderRight(); | ||
37 | + void onEncoderClicked(QWidget *clicked); | ||
38 | + | ||
29 | private slots: | 39 | private slots: |
30 | void setDefault(Define::Mode mode); | 40 | void setDefault(Define::Mode mode); |
31 | void setFan(int level); | 41 | void setFan(int level); |
app/gui/oven_control/programmingnamepopup.cpp
1 | #include "programmingnamepopup.h" | 1 | #include "programmingnamepopup.h" |
2 | #include "ui_programmingnamepopup.h" | 2 | #include "ui_programmingnamepopup.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | 7 | ||
6 | ProgrammingNamePopup::ProgrammingNamePopup(QWidget *parent, CookRecord record) : | 8 | ProgrammingNamePopup::ProgrammingNamePopup(QWidget *parent, CookRecord record) : |
@@ -25,6 +27,41 @@ ProgrammingNamePopup::~ProgrammingNamePopup() | @@ -25,6 +27,41 @@ ProgrammingNamePopup::~ProgrammingNamePopup() | ||
25 | delete ui; | 27 | delete ui; |
26 | } | 28 | } |
27 | 29 | ||
30 | +void ProgrammingNamePopup::keyPressEvent(QKeyEvent *event) | ||
31 | +{ | ||
32 | + switch (event->key()) | ||
33 | + { | ||
34 | + case 0x01000030: // Turn left | ||
35 | + onEncoderLeft(); | ||
36 | + break; | ||
37 | + case 0x01000031: // Push | ||
38 | + pushed = focusWidget(); | ||
39 | + break; | ||
40 | + case 0x01000032: // Turn right | ||
41 | + onEncoderRight(); | ||
42 | + break; | ||
43 | + } | ||
44 | +} | ||
45 | + | ||
46 | +void ProgrammingNamePopup::keyReleaseEvent(QKeyEvent *event) | ||
47 | +{ | ||
48 | + switch (event->key()) | ||
49 | + { | ||
50 | + case 0x01000030: // Turn left | ||
51 | + onEncoderLeft(); | ||
52 | + break; | ||
53 | + case 0x01000031: // Push | ||
54 | + if (focusWidget() == pushed) | ||
55 | + onEncoderClicked(pushed); | ||
56 | + | ||
57 | + pushed = NULL; | ||
58 | + break; | ||
59 | + case 0x01000032: // Turn right | ||
60 | + onEncoderRight(); | ||
61 | + break; | ||
62 | + } | ||
63 | +} | ||
64 | + | ||
28 | void ProgrammingNamePopup::on_okButton_clicked() | 65 | void ProgrammingNamePopup::on_okButton_clicked() |
29 | { | 66 | { |
30 | CookProgram::rename(record, ui->lineEdit->text()); | 67 | CookProgram::rename(record, ui->lineEdit->text()); |
@@ -38,3 +75,18 @@ void ProgrammingNamePopup::on_cancelButton_clicked() | @@ -38,3 +75,18 @@ void ProgrammingNamePopup::on_cancelButton_clicked() | ||
38 | { | 75 | { |
39 | close(); | 76 | close(); |
40 | } | 77 | } |
78 | + | ||
79 | +void ProgrammingNamePopup::onEncoderLeft() | ||
80 | +{ | ||
81 | + | ||
82 | +} | ||
83 | + | ||
84 | +void ProgrammingNamePopup::onEncoderRight() | ||
85 | +{ | ||
86 | + | ||
87 | +} | ||
88 | + | ||
89 | +void ProgrammingNamePopup::onEncoderClicked(QWidget *clicked) | ||
90 | +{ | ||
91 | + | ||
92 | +} |
app/gui/oven_control/programmingnamepopup.h
@@ -17,6 +17,10 @@ public: | @@ -17,6 +17,10 @@ public: | ||
17 | explicit ProgrammingNamePopup(QWidget *parent, CookRecord record); | 17 | explicit ProgrammingNamePopup(QWidget *parent, CookRecord record); |
18 | ~ProgrammingNamePopup(); | 18 | ~ProgrammingNamePopup(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private slots: | 24 | private slots: |
21 | void on_okButton_clicked(); | 25 | void on_okButton_clicked(); |
22 | 26 | ||
@@ -27,6 +31,12 @@ private: | @@ -27,6 +31,12 @@ private: | ||
27 | 31 | ||
28 | CookRecord record; | 32 | CookRecord record; |
29 | 33 | ||
34 | + QWidget *pushed = NULL; | ||
35 | + | ||
36 | + void onEncoderLeft(); | ||
37 | + void onEncoderRight(); | ||
38 | + void onEncoderClicked(QWidget *clicked); | ||
39 | + | ||
30 | signals: | 40 | signals: |
31 | void changed(); | 41 | void changed(); |
32 | }; | 42 | }; |
app/gui/oven_control/programmingselectionwindow.cpp
1 | #include "programmingselectionwindow.h" | 1 | #include "programmingselectionwindow.h" |
2 | #include "ui_programmingselectionwindow.h" | 2 | #include "ui_programmingselectionwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "programmingmanualwindow.h" | 6 | #include "programmingmanualwindow.h" |
5 | #include "programmingautoselectionwindow.h" | 7 | #include "programmingautoselectionwindow.h" |
6 | #include "soundplayer.h" | 8 | #include "soundplayer.h" |
@@ -45,6 +47,58 @@ void ProgrammingSelectionWindow::setCookTypeEnabled(bool enabled) | @@ -45,6 +47,58 @@ void ProgrammingSelectionWindow::setCookTypeEnabled(bool enabled) | ||
45 | ui->etcButton->setEnabled(enabled); | 47 | ui->etcButton->setEnabled(enabled); |
46 | } | 48 | } |
47 | 49 | ||
50 | +void ProgrammingSelectionWindow::keyPressEvent(QKeyEvent *event) | ||
51 | +{ | ||
52 | + switch (event->key()) | ||
53 | + { | ||
54 | + case 0x01000030: // Turn left | ||
55 | + onEncoderLeft(); | ||
56 | + break; | ||
57 | + case 0x01000031: // Push | ||
58 | + pushed = focusWidget(); | ||
59 | + break; | ||
60 | + case 0x01000032: // Turn right | ||
61 | + onEncoderRight(); | ||
62 | + break; | ||
63 | + } | ||
64 | +} | ||
65 | + | ||
66 | +void ProgrammingSelectionWindow::keyReleaseEvent(QKeyEvent *event) | ||
67 | +{ | ||
68 | + switch (event->key()) | ||
69 | + { | ||
70 | + case 0x01000030: // Turn left | ||
71 | + onEncoderLeft(); | ||
72 | + break; | ||
73 | + case 0x01000031: // Push | ||
74 | + if (focusWidget() == pushed) | ||
75 | + onEncoderClicked(pushed); | ||
76 | + | ||
77 | + pushed = NULL; | ||
78 | + break; | ||
79 | + case 0x01000032: // Turn right | ||
80 | + onEncoderRight(); | ||
81 | + break; | ||
82 | + } | ||
83 | +} | ||
84 | + | ||
85 | +void ProgrammingSelectionWindow::onEncoderLeft() | ||
86 | +{ | ||
87 | + focusPreviousChild(); | ||
88 | +} | ||
89 | + | ||
90 | +void ProgrammingSelectionWindow::onEncoderRight() | ||
91 | +{ | ||
92 | + focusNextChild(); | ||
93 | +} | ||
94 | + | ||
95 | +void ProgrammingSelectionWindow::onEncoderClicked(QWidget *clicked) | ||
96 | +{ | ||
97 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
98 | + if (b) | ||
99 | + b->click(); | ||
100 | +} | ||
101 | + | ||
48 | void ProgrammingSelectionWindow::onModeClicked(Define::Mode mode) | 102 | void ProgrammingSelectionWindow::onModeClicked(Define::Mode mode) |
49 | { | 103 | { |
50 | ProgrammingManualWindow *w = new ProgrammingManualWindow(this, mode); | 104 | ProgrammingManualWindow *w = new ProgrammingManualWindow(this, mode); |
app/gui/oven_control/programmingselectionwindow.h
@@ -20,9 +20,19 @@ public: | @@ -20,9 +20,19 @@ public: | ||
20 | void setModeEnabled(bool enabled); | 20 | void setModeEnabled(bool enabled); |
21 | void setCookTypeEnabled(bool enabled); | 21 | void setCookTypeEnabled(bool enabled); |
22 | 22 | ||
23 | +protected: | ||
24 | + void keyPressEvent(QKeyEvent *event); | ||
25 | + void keyReleaseEvent(QKeyEvent *event); | ||
26 | + | ||
23 | private: | 27 | private: |
24 | Ui::ProgrammingSelectionWindow *ui; | 28 | Ui::ProgrammingSelectionWindow *ui; |
25 | 29 | ||
30 | + QWidget *pushed = NULL; | ||
31 | + | ||
32 | + void onEncoderLeft(); | ||
33 | + void onEncoderRight(); | ||
34 | + void onEncoderClicked(QWidget *clicked); | ||
35 | + | ||
26 | signals: | 36 | signals: |
27 | void added(); | 37 | void added(); |
28 | 38 |
app/gui/oven_control/programmingwindow.cpp
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | 3 | ||
4 | #include <QPainter> | 4 | #include <QPainter> |
5 | #include <QtDebug> | 5 | #include <QtDebug> |
6 | +#include <QKeyEvent> | ||
6 | 7 | ||
7 | #include "programmingmanualwindow.h" | 8 | #include "programmingmanualwindow.h" |
8 | #include "programmingselectionwindow.h" | 9 | #include "programmingselectionwindow.h" |
@@ -56,6 +57,41 @@ void ProgrammingWindow::listManual() | @@ -56,6 +57,41 @@ void ProgrammingWindow::listManual() | ||
56 | listButtons(CookProgram::listManual()); | 57 | listButtons(CookProgram::listManual()); |
57 | } | 58 | } |
58 | 59 | ||
60 | +void ProgrammingWindow::keyPressEvent(QKeyEvent *event) | ||
61 | +{ | ||
62 | + switch (event->key()) | ||
63 | + { | ||
64 | + case 0x01000030: // Turn left | ||
65 | + onEncoderLeft(); | ||
66 | + break; | ||
67 | + case 0x01000031: // Push | ||
68 | + pushed = focusWidget(); | ||
69 | + break; | ||
70 | + case 0x01000032: // Turn right | ||
71 | + onEncoderRight(); | ||
72 | + break; | ||
73 | + } | ||
74 | +} | ||
75 | + | ||
76 | +void ProgrammingWindow::keyReleaseEvent(QKeyEvent *event) | ||
77 | +{ | ||
78 | + switch (event->key()) | ||
79 | + { | ||
80 | + case 0x01000030: // Turn left | ||
81 | + onEncoderLeft(); | ||
82 | + break; | ||
83 | + case 0x01000031: // Push | ||
84 | + if (focusWidget() == pushed) | ||
85 | + onEncoderClicked(pushed); | ||
86 | + | ||
87 | + pushed = NULL; | ||
88 | + break; | ||
89 | + case 0x01000032: // Turn right | ||
90 | + onEncoderRight(); | ||
91 | + break; | ||
92 | + } | ||
93 | +} | ||
94 | + | ||
59 | void ProgrammingWindow::setupUi() | 95 | void ProgrammingWindow::setupUi() |
60 | { | 96 | { |
61 | ui->verticalScrollLayout->setAlignment(Qt::AlignTop); | 97 | ui->verticalScrollLayout->setAlignment(Qt::AlignTop); |
@@ -244,3 +280,20 @@ void ProgrammingWindow::on_helpButton_clicked() | @@ -244,3 +280,20 @@ void ProgrammingWindow::on_helpButton_clicked() | ||
244 | { | 280 | { |
245 | 281 | ||
246 | } | 282 | } |
283 | + | ||
284 | +void ProgrammingWindow::onEncoderLeft() | ||
285 | +{ | ||
286 | + focusPreviousChild(); | ||
287 | +} | ||
288 | + | ||
289 | +void ProgrammingWindow::onEncoderRight() | ||
290 | +{ | ||
291 | + focusNextChild(); | ||
292 | +} | ||
293 | + | ||
294 | +void ProgrammingWindow::onEncoderClicked(QWidget *clicked) | ||
295 | +{ | ||
296 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
297 | + if (b) | ||
298 | + b->click(); | ||
299 | +} |
app/gui/oven_control/programmingwindow.h
@@ -20,6 +20,10 @@ public: | @@ -20,6 +20,10 @@ public: | ||
20 | void listAuto(); | 20 | void listAuto(); |
21 | void listManual(); | 21 | void listManual(); |
22 | 22 | ||
23 | +protected: | ||
24 | + void keyPressEvent(QKeyEvent *event); | ||
25 | + void keyReleaseEvent(QKeyEvent *event); | ||
26 | + | ||
23 | private slots: | 27 | private slots: |
24 | void setupUi(); | 28 | void setupUi(); |
25 | void updateView(); | 29 | void updateView(); |
@@ -49,6 +53,12 @@ private: | @@ -49,6 +53,12 @@ private: | ||
49 | 53 | ||
50 | QList<CookPanelButton *> list; | 54 | QList<CookPanelButton *> list; |
51 | CookPanelButton *lastInfoDisplayed; | 55 | CookPanelButton *lastInfoDisplayed; |
56 | + | ||
57 | + QWidget *pushed = NULL; | ||
58 | + | ||
59 | + void onEncoderLeft(); | ||
60 | + void onEncoderRight(); | ||
61 | + void onEncoderClicked(QWidget *clicked); | ||
52 | }; | 62 | }; |
53 | 63 | ||
54 | #endif // PROGRAMMINGWINDOW_H | 64 | #endif // PROGRAMMINGWINDOW_H |
app/gui/oven_control/valvetestwindow.cpp
1 | #include "valvetestwindow.h" | 1 | #include "valvetestwindow.h" |
2 | #include "ui_valvetestwindow.h" | 2 | #include "ui_valvetestwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | 7 | ||
6 | ValveTestWindow::ValveTestWindow(QWidget *parent) : | 8 | ValveTestWindow::ValveTestWindow(QWidget *parent) : |
@@ -29,6 +31,41 @@ ValveTestWindow::~ValveTestWindow() | @@ -29,6 +31,41 @@ ValveTestWindow::~ValveTestWindow() | ||
29 | delete ui; | 31 | delete ui; |
30 | } | 32 | } |
31 | 33 | ||
34 | +void ValveTestWindow::keyPressEvent(QKeyEvent *event) | ||
35 | +{ | ||
36 | + switch (event->key()) | ||
37 | + { | ||
38 | + case 0x01000030: // Turn left | ||
39 | + onEncoderLeft(); | ||
40 | + break; | ||
41 | + case 0x01000031: // Push | ||
42 | + pushed = focusWidget(); | ||
43 | + break; | ||
44 | + case 0x01000032: // Turn right | ||
45 | + onEncoderRight(); | ||
46 | + break; | ||
47 | + } | ||
48 | +} | ||
49 | + | ||
50 | +void ValveTestWindow::keyReleaseEvent(QKeyEvent *event) | ||
51 | +{ | ||
52 | + switch (event->key()) | ||
53 | + { | ||
54 | + case 0x01000030: // Turn left | ||
55 | + onEncoderLeft(); | ||
56 | + break; | ||
57 | + case 0x01000031: // Push | ||
58 | + if (focusWidget() == pushed) | ||
59 | + onEncoderClicked(pushed); | ||
60 | + | ||
61 | + pushed = NULL; | ||
62 | + break; | ||
63 | + case 0x01000032: // Turn right | ||
64 | + onEncoderRight(); | ||
65 | + break; | ||
66 | + } | ||
67 | +} | ||
68 | + | ||
32 | void ValveTestWindow::onDataChanged() | 69 | void ValveTestWindow::onDataChanged() |
33 | { | 70 | { |
34 | if (udp->ssv()) | 71 | if (udp->ssv()) |
@@ -120,6 +157,23 @@ void ValveTestWindow::on_backButton_clicked() | @@ -120,6 +157,23 @@ void ValveTestWindow::on_backButton_clicked() | ||
120 | close(); | 157 | close(); |
121 | } | 158 | } |
122 | 159 | ||
160 | +void ValveTestWindow::onEncoderLeft() | ||
161 | +{ | ||
162 | + focusPreviousChild(); | ||
163 | +} | ||
164 | + | ||
165 | +void ValveTestWindow::onEncoderRight() | ||
166 | +{ | ||
167 | + focusNextChild(); | ||
168 | +} | ||
169 | + | ||
170 | +void ValveTestWindow::onEncoderClicked(QWidget *clicked) | ||
171 | +{ | ||
172 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
173 | + if (b) | ||
174 | + b->click(); | ||
175 | +} | ||
176 | + | ||
123 | void ValveTestWindow::steamValveOpen() | 177 | void ValveTestWindow::steamValveOpen() |
124 | { | 178 | { |
125 | udp->turnOn(TG_SSV); | 179 | udp->turnOn(TG_SSV); |
app/gui/oven_control/valvetestwindow.h
@@ -17,6 +17,10 @@ public: | @@ -17,6 +17,10 @@ public: | ||
17 | explicit ValveTestWindow(QWidget *parent = 0); | 17 | explicit ValveTestWindow(QWidget *parent = 0); |
18 | ~ValveTestWindow(); | 18 | ~ValveTestWindow(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private slots: | 24 | private slots: |
21 | void steamValveOpen(); | 25 | void steamValveOpen(); |
22 | void steamValveClose(); | 26 | void steamValveClose(); |
@@ -43,6 +47,12 @@ private slots: | @@ -43,6 +47,12 @@ private slots: | ||
43 | private: | 47 | private: |
44 | Ui::ValveTestWindow *ui; | 48 | Ui::ValveTestWindow *ui; |
45 | UdpHandler *udp; | 49 | UdpHandler *udp; |
50 | + | ||
51 | + QWidget *pushed = NULL; | ||
52 | + | ||
53 | + void onEncoderLeft(); | ||
54 | + void onEncoderRight(); | ||
55 | + void onEncoderClicked(QWidget *clicked); | ||
46 | }; | 56 | }; |
47 | 57 | ||
48 | #endif // VALVETESTWINDOW_H | 58 | #endif // VALVETESTWINDOW_H |
app/gui/oven_control/washtestwindow.cpp
1 | #include "washtestwindow.h" | 1 | #include "washtestwindow.h" |
2 | #include "ui_washtestwindow.h" | 2 | #include "ui_washtestwindow.h" |
3 | 3 | ||
4 | +#include <QKeyEvent> | ||
5 | + | ||
4 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
5 | 7 | ||
6 | WashTestWindow::WashTestWindow(QWidget *parent) : | 8 | WashTestWindow::WashTestWindow(QWidget *parent) : |
@@ -29,6 +31,41 @@ WashTestWindow::~WashTestWindow() | @@ -29,6 +31,41 @@ WashTestWindow::~WashTestWindow() | ||
29 | delete ui; | 31 | delete ui; |
30 | } | 32 | } |
31 | 33 | ||
34 | +void WashTestWindow::keyPressEvent(QKeyEvent *event) | ||
35 | +{ | ||
36 | + switch (event->key()) | ||
37 | + { | ||
38 | + case 0x01000030: // Turn left | ||
39 | + onEncoderLeft(); | ||
40 | + break; | ||
41 | + case 0x01000031: // Push | ||
42 | + pushed = focusWidget(); | ||
43 | + break; | ||
44 | + case 0x01000032: // Turn right | ||
45 | + onEncoderRight(); | ||
46 | + break; | ||
47 | + } | ||
48 | +} | ||
49 | + | ||
50 | +void WashTestWindow::keyReleaseEvent(QKeyEvent *event) | ||
51 | +{ | ||
52 | + switch (event->key()) | ||
53 | + { | ||
54 | + case 0x01000030: // Turn left | ||
55 | + onEncoderLeft(); | ||
56 | + break; | ||
57 | + case 0x01000031: // Push | ||
58 | + if (focusWidget() == pushed) | ||
59 | + onEncoderClicked(pushed); | ||
60 | + | ||
61 | + pushed = NULL; | ||
62 | + break; | ||
63 | + case 0x01000032: // Turn right | ||
64 | + onEncoderRight(); | ||
65 | + break; | ||
66 | + } | ||
67 | +} | ||
68 | + | ||
32 | void WashTestWindow::onDataChanged() | 69 | void WashTestWindow::onDataChanged() |
33 | { | 70 | { |
34 | if (udp->dp()) | 71 | if (udp->dp()) |
@@ -93,6 +130,23 @@ void WashTestWindow::on_backButton_clicked() | @@ -93,6 +130,23 @@ void WashTestWindow::on_backButton_clicked() | ||
93 | close(); | 130 | close(); |
94 | } | 131 | } |
95 | 132 | ||
133 | +void WashTestWindow::onEncoderLeft() | ||
134 | +{ | ||
135 | + focusPreviousChild(); | ||
136 | +} | ||
137 | + | ||
138 | +void WashTestWindow::onEncoderRight() | ||
139 | +{ | ||
140 | + focusNextChild(); | ||
141 | +} | ||
142 | + | ||
143 | +void WashTestWindow::onEncoderClicked(QWidget *clicked) | ||
144 | +{ | ||
145 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
146 | + if (b) | ||
147 | + b->click(); | ||
148 | +} | ||
149 | + | ||
96 | void WashTestWindow::steamPumpOn() | 150 | void WashTestWindow::steamPumpOn() |
97 | { | 151 | { |
98 | udp->turnOn(TG_DP); | 152 | udp->turnOn(TG_DP); |
app/gui/oven_control/washtestwindow.h
@@ -17,6 +17,10 @@ public: | @@ -17,6 +17,10 @@ public: | ||
17 | explicit WashTestWindow(QWidget *parent = 0); | 17 | explicit WashTestWindow(QWidget *parent = 0); |
18 | ~WashTestWindow(); | 18 | ~WashTestWindow(); |
19 | 19 | ||
20 | +protected: | ||
21 | + void keyPressEvent(QKeyEvent *event); | ||
22 | + void keyReleaseEvent(QKeyEvent *event); | ||
23 | + | ||
20 | private slots: | 24 | private slots: |
21 | void steamPumpOn(); | 25 | void steamPumpOn(); |
22 | void steamPumpOff(); | 26 | void steamPumpOff(); |
@@ -40,6 +44,12 @@ private slots: | @@ -40,6 +44,12 @@ private slots: | ||
40 | private: | 44 | private: |
41 | Ui::WashTestWindow *ui; | 45 | Ui::WashTestWindow *ui; |
42 | UdpHandler *udp; | 46 | UdpHandler *udp; |
47 | + | ||
48 | + QWidget *pushed = NULL; | ||
49 | + | ||
50 | + void onEncoderLeft(); | ||
51 | + void onEncoderRight(); | ||
52 | + void onEncoderClicked(QWidget *clicked); | ||
43 | }; | 53 | }; |
44 | 54 | ||
45 | #endif // WASHTESTWINDOW_H | 55 | #endif // WASHTESTWINDOW_H |