Commit 51175dd1aa7c3b44e66c4391deb4e645cbb11b22
1 parent
6139c8c790
Exists in
master
and in
2 other branches
엔코더 구현
- 프로그래밍 모드
Showing
16 changed files
with
578 additions
and
103 deletions
Show diff stats
app/gui/oven_control/cookpanelbutton.cpp
... | ... | @@ -81,6 +81,11 @@ QPushButton *CookPanelButton::bar() |
81 | 81 | return ui->pushButton; |
82 | 82 | } |
83 | 83 | |
84 | +QPushButton *CookPanelButton::infoButton() | |
85 | +{ | |
86 | + return ui->showInfoButton; | |
87 | +} | |
88 | + | |
84 | 89 | QPushButton *CookPanelButton::deleteButton() |
85 | 90 | { |
86 | 91 | return ui->deleteButton; |
... | ... | @@ -93,40 +98,45 @@ void CookPanelButton::setEnabled(bool enabled) |
93 | 98 | ui->deleteButton->setEnabled(enabled); |
94 | 99 | } |
95 | 100 | |
96 | -//void CookPanelButton::keyPressEvent(QKeyEvent *event) | |
97 | -//{ | |
98 | -// switch (event->key()) | |
99 | -// { | |
100 | -// case 0x01000030: // Turn left | |
101 | -// onEncoderLeft(); | |
102 | -// break; | |
103 | -// case 0x01000031: // Push | |
104 | -// pushed = focusWidget(); | |
105 | -// break; | |
106 | -// case 0x01000032: // Turn right | |
107 | -// onEncoderRight(); | |
108 | -// break; | |
109 | -// } | |
110 | -//} | |
111 | - | |
112 | -//void CookPanelButton::keyReleaseEvent(QKeyEvent *event) | |
113 | -//{ | |
114 | -// switch (event->key()) | |
115 | -// { | |
116 | -// case 0x01000030: // Turn left | |
117 | -// onEncoderLeft(); | |
118 | -// break; | |
119 | -// case 0x01000031: // Push | |
120 | -// if (focusWidget() == pushed) | |
121 | -// onEncoderClicked(pushed); | |
122 | - | |
123 | -// pushed = NULL; | |
124 | -// break; | |
125 | -// case 0x01000032: // Turn right | |
126 | -// onEncoderRight(); | |
127 | -// break; | |
128 | -// } | |
129 | -//} | |
101 | +void CookPanelButton::keyPressEvent(QKeyEvent *event) | |
102 | +{ | |
103 | + switch (event->key()) | |
104 | + { | |
105 | + case 0x01000030: // Turn left | |
106 | + event->ignore(); | |
107 | + break; | |
108 | + case 0x01000031: // Push | |
109 | + pushed = focusWidget(); | |
110 | + if (pushed == ui->pushButton) | |
111 | + on_pushButton_pressed(); | |
112 | + break; | |
113 | + case 0x01000032: // Turn right | |
114 | + event->ignore(); | |
115 | + break; | |
116 | + } | |
117 | +} | |
118 | + | |
119 | +void CookPanelButton::keyReleaseEvent(QKeyEvent *event) | |
120 | +{ | |
121 | + switch (event->key()) | |
122 | + { | |
123 | + case 0x01000030: // Turn left | |
124 | + event->ignore(); | |
125 | + break; | |
126 | + case 0x01000031: // Push | |
127 | + if (pushed == ui->pushButton) | |
128 | + on_pushButton_released(); | |
129 | + | |
130 | + if (focusWidget() == pushed) | |
131 | + onEncoderClicked(pushed); | |
132 | + | |
133 | + pushed = NULL; | |
134 | + break; | |
135 | + case 0x01000032: // Turn right | |
136 | + event->ignore(); | |
137 | + break; | |
138 | + } | |
139 | +} | |
130 | 140 | |
131 | 141 | void CookPanelButton::emitLongPressed() |
132 | 142 | { |
... | ... | @@ -165,7 +175,9 @@ void CookPanelButton::onEncoderRight() |
165 | 175 | |
166 | 176 | void CookPanelButton::onEncoderClicked(QWidget *clicked) |
167 | 177 | { |
168 | - | |
178 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | |
179 | + if (b) | |
180 | + b->click(); | |
169 | 181 | } |
170 | 182 | |
171 | 183 | void CookPanelButton::on_pushButton_pressed() | ... | ... |
app/gui/oven_control/cookpanelbutton.h
... | ... | @@ -39,6 +39,7 @@ public: |
39 | 39 | void setLongPressEnabled(bool enabled); |
40 | 40 | |
41 | 41 | QPushButton *bar(); |
42 | + QPushButton *infoButton(); | |
42 | 43 | QPushButton *deleteButton(); |
43 | 44 | |
44 | 45 | CookRecord record; |
... | ... | @@ -47,8 +48,8 @@ public slots: |
47 | 48 | void setEnabled(bool enabled = true); |
48 | 49 | |
49 | 50 | protected: |
50 | -// void keyPressEvent(QKeyEvent *event); | |
51 | -// void keyReleaseEvent(QKeyEvent *event); | |
51 | + void keyPressEvent(QKeyEvent *event); | |
52 | + void keyReleaseEvent(QKeyEvent *event); | |
52 | 53 | |
53 | 54 | private slots: |
54 | 55 | void emitLongPressed(); | ... | ... |
app/gui/oven_control/programmingautoconfigwindow.cpp
... | ... | @@ -62,8 +62,19 @@ ProgrammingAutoConfigWindow::ProgrammingAutoConfigWindow(QWidget *parent, Cook c |
62 | 62 | |
63 | 63 | setupUi(); |
64 | 64 | |
65 | + afterThreeSecsTimer.setSingleShot(true); | |
66 | + afterThreeSecsTimer.setInterval(3000); | |
67 | + connect(&afterThreeSecsTimer, SIGNAL(timeout()), SLOT(afterThreeSecs())); | |
68 | + | |
65 | 69 | foreach (QPushButton *button, findChildren<QPushButton *>()) |
66 | 70 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); |
71 | + | |
72 | + foreach (QWidget *w, findChildren<QWidget *>()) | |
73 | + w->installEventFilter(this); | |
74 | + | |
75 | + installEventFilter(this); | |
76 | + | |
77 | + setFocus(); | |
67 | 78 | } |
68 | 79 | |
69 | 80 | ProgrammingAutoConfigWindow::~ProgrammingAutoConfigWindow() |
... | ... | @@ -71,6 +82,24 @@ ProgrammingAutoConfigWindow::~ProgrammingAutoConfigWindow() |
71 | 82 | delete ui; |
72 | 83 | } |
73 | 84 | |
85 | +bool ProgrammingAutoConfigWindow::eventFilter(QObject */*watched*/, QEvent *event) | |
86 | +{ | |
87 | + switch (event->type()) | |
88 | + { | |
89 | + case QEvent::KeyPress: | |
90 | + case QEvent::KeyRelease: | |
91 | + case QEvent::MouseButtonPress: | |
92 | + case QEvent::MouseButtonRelease: | |
93 | + case QEvent::MouseMove: | |
94 | + afterThreeSecsTimer.start(); | |
95 | + break; | |
96 | + default: | |
97 | + break; | |
98 | + } | |
99 | + | |
100 | + return false; | |
101 | +} | |
102 | + | |
74 | 103 | void ProgrammingAutoConfigWindow::keyPressEvent(QKeyEvent *event) |
75 | 104 | { |
76 | 105 | switch (event->key()) |
... | ... | @@ -108,17 +137,42 @@ void ProgrammingAutoConfigWindow::keyReleaseEvent(QKeyEvent *event) |
108 | 137 | |
109 | 138 | void ProgrammingAutoConfigWindow::onEncoderLeft() |
110 | 139 | { |
111 | - | |
140 | + focusPreviousChild(); | |
112 | 141 | } |
113 | 142 | |
114 | 143 | void ProgrammingAutoConfigWindow::onEncoderRight() |
115 | 144 | { |
116 | - | |
145 | + focusNextChild(); | |
117 | 146 | } |
118 | 147 | |
119 | 148 | void ProgrammingAutoConfigWindow::onEncoderClicked(QWidget *clicked) |
120 | 149 | { |
150 | + if (clicked == NULL) | |
151 | + return; | |
121 | 152 | |
153 | + if (clicked->inherits("QPushButton")) | |
154 | + { | |
155 | + QPushButton *pb = qobject_cast<QPushButton *>(clicked); | |
156 | + if (pb) | |
157 | + pb->click(); | |
158 | + } | |
159 | + else if (clicked->inherits("Slider")) | |
160 | + { | |
161 | + Slider *slider = qobject_cast<Slider *>(clicked); | |
162 | + if (slider) | |
163 | + { | |
164 | + if (slider == ui->configSlider_1) | |
165 | + ui->configButton_1->setFocus(); | |
166 | + else if (slider == ui->configSlider_2) | |
167 | + ui->configButton_2->setFocus(); | |
168 | + else if (slider == ui->configSlider_3) | |
169 | + ui->configButton_3->setFocus(); | |
170 | + else if (slider == ui->configSlider_4) | |
171 | + ui->configButton_4->setFocus(); | |
172 | + else if (slider == ui->configSlider_5) | |
173 | + ui->configButton_5->setFocus(); | |
174 | + } | |
175 | + } | |
122 | 176 | } |
123 | 177 | |
124 | 178 | void ProgrammingAutoConfigWindow::setupUi() |
... | ... | @@ -144,7 +198,7 @@ void ProgrammingAutoConfigWindow::setupUi() |
144 | 198 | cw.button->setStyleSheet( |
145 | 199 | "QPushButton { image: url(" |
146 | 200 | + Define::icon(config.type) |
147 | - + ") } QPushButton::pressed { image: url(" | |
201 | + + ") } QPushButton::pressed, QPushButton:focus { image: url(" | |
148 | 202 | + Define::iconOverlay(config.type) |
149 | 203 | + ") }"); |
150 | 204 | |
... | ... | @@ -220,6 +274,24 @@ void ProgrammingAutoConfigWindow::updateConfig() |
220 | 274 | updateView(); |
221 | 275 | } |
222 | 276 | |
277 | +void ProgrammingAutoConfigWindow::afterThreeSecs() | |
278 | +{ | |
279 | + Slider *slider = qobject_cast<Slider *>(focusWidget()); | |
280 | + if (slider) | |
281 | + { | |
282 | + if (slider == ui->configSlider_1) | |
283 | + ui->configButton_1->setFocus(); | |
284 | + else if (slider == ui->configSlider_2) | |
285 | + ui->configButton_2->setFocus(); | |
286 | + else if (slider == ui->configSlider_3) | |
287 | + ui->configButton_3->setFocus(); | |
288 | + else if (slider == ui->configSlider_4) | |
289 | + ui->configButton_4->setFocus(); | |
290 | + else if (slider == ui->configSlider_5) | |
291 | + ui->configButton_5->setFocus(); | |
292 | + } | |
293 | +} | |
294 | + | |
223 | 295 | void ProgrammingAutoConfigWindow::on_backButton_clicked() |
224 | 296 | { |
225 | 297 | close(); |
... | ... | @@ -257,3 +329,28 @@ void ProgrammingAutoConfigWindow::on_okButton_clicked() |
257 | 329 | emit added(); |
258 | 330 | close(); |
259 | 331 | } |
332 | + | |
333 | +void ProgrammingAutoConfigWindow::on_configButton_1_clicked() | |
334 | +{ | |
335 | + ui->configSlider_1->setFocus(); | |
336 | +} | |
337 | + | |
338 | +void ProgrammingAutoConfigWindow::on_configButton_2_clicked() | |
339 | +{ | |
340 | + ui->configSlider_2->setFocus(); | |
341 | +} | |
342 | + | |
343 | +void ProgrammingAutoConfigWindow::on_configButton_3_clicked() | |
344 | +{ | |
345 | + ui->configSlider_3->setFocus(); | |
346 | +} | |
347 | + | |
348 | +void ProgrammingAutoConfigWindow::on_configButton_4_clicked() | |
349 | +{ | |
350 | + ui->configSlider_4->setFocus(); | |
351 | +} | |
352 | + | |
353 | +void ProgrammingAutoConfigWindow::on_configButton_5_clicked() | |
354 | +{ | |
355 | + ui->configSlider_5->setFocus(); | |
356 | +} | ... | ... |
app/gui/oven_control/programmingautoconfigwindow.h
... | ... | @@ -21,6 +21,8 @@ public: |
21 | 21 | explicit ProgrammingAutoConfigWindow(QWidget *parent, Cook cook); |
22 | 22 | ~ProgrammingAutoConfigWindow(); |
23 | 23 | |
24 | + bool eventFilter(QObject *watched, QEvent *event); | |
25 | + | |
24 | 26 | protected: |
25 | 27 | void keyPressEvent(QKeyEvent *event); |
26 | 28 | void keyReleaseEvent(QKeyEvent *event); |
... | ... | @@ -45,10 +47,13 @@ private: |
45 | 47 | void onEncoderRight(); |
46 | 48 | void onEncoderClicked(QWidget *clicked); |
47 | 49 | |
50 | + QTimer afterThreeSecsTimer; | |
51 | + | |
48 | 52 | private slots: |
49 | 53 | void setupUi(); |
50 | 54 | void updateView(); |
51 | 55 | void updateConfig(); |
56 | + void afterThreeSecs(); | |
52 | 57 | |
53 | 58 | void on_backButton_clicked(); |
54 | 59 | |
... | ... | @@ -58,6 +63,16 @@ private slots: |
58 | 63 | |
59 | 64 | void on_okButton_clicked(); |
60 | 65 | |
66 | + void on_configButton_1_clicked(); | |
67 | + | |
68 | + void on_configButton_2_clicked(); | |
69 | + | |
70 | + void on_configButton_3_clicked(); | |
71 | + | |
72 | + void on_configButton_4_clicked(); | |
73 | + | |
74 | + void on_configButton_5_clicked(); | |
75 | + | |
61 | 76 | signals: |
62 | 77 | void added(); |
63 | 78 | }; | ... | ... |
app/gui/oven_control/programmingautoconfigwindow.ui
... | ... | @@ -1308,6 +1308,9 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/c |
1308 | 1308 | <height>140</height> |
1309 | 1309 | </rect> |
1310 | 1310 | </property> |
1311 | + <property name="focusPolicy"> | |
1312 | + <enum>Qt::ClickFocus</enum> | |
1313 | + </property> | |
1311 | 1314 | </widget> |
1312 | 1315 | <widget class="Slider" name="configSlider_3" native="true"> |
1313 | 1316 | <property name="geometry"> |
... | ... | @@ -1318,6 +1321,9 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/c |
1318 | 1321 | <height>140</height> |
1319 | 1322 | </rect> |
1320 | 1323 | </property> |
1324 | + <property name="focusPolicy"> | |
1325 | + <enum>Qt::ClickFocus</enum> | |
1326 | + </property> | |
1321 | 1327 | </widget> |
1322 | 1328 | <widget class="Slider" name="configSlider_2" native="true"> |
1323 | 1329 | <property name="geometry"> |
... | ... | @@ -1328,6 +1334,9 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/c |
1328 | 1334 | <height>140</height> |
1329 | 1335 | </rect> |
1330 | 1336 | </property> |
1337 | + <property name="focusPolicy"> | |
1338 | + <enum>Qt::ClickFocus</enum> | |
1339 | + </property> | |
1331 | 1340 | </widget> |
1332 | 1341 | <widget class="Slider" name="configSlider_5" native="true"> |
1333 | 1342 | <property name="geometry"> |
... | ... | @@ -1338,6 +1347,9 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/c |
1338 | 1347 | <height>140</height> |
1339 | 1348 | </rect> |
1340 | 1349 | </property> |
1350 | + <property name="focusPolicy"> | |
1351 | + <enum>Qt::ClickFocus</enum> | |
1352 | + </property> | |
1341 | 1353 | </widget> |
1342 | 1354 | <widget class="Slider" name="configSlider_1" native="true"> |
1343 | 1355 | <property name="geometry"> |
... | ... | @@ -1348,6 +1360,9 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/c |
1348 | 1360 | <height>140</height> |
1349 | 1361 | </rect> |
1350 | 1362 | </property> |
1363 | + <property name="focusPolicy"> | |
1364 | + <enum>Qt::ClickFocus</enum> | |
1365 | + </property> | |
1351 | 1366 | </widget> |
1352 | 1367 | </widget> |
1353 | 1368 | </widget> |
... | ... | @@ -1370,6 +1385,19 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/c |
1370 | 1385 | <container>1</container> |
1371 | 1386 | </customwidget> |
1372 | 1387 | </customwidgets> |
1388 | + <tabstops> | |
1389 | + <tabstop>selectCookButton</tabstop> | |
1390 | + <tabstop>pushButton_4</tabstop> | |
1391 | + <tabstop>configButton_1</tabstop> | |
1392 | + <tabstop>configButton_2</tabstop> | |
1393 | + <tabstop>configButton_3</tabstop> | |
1394 | + <tabstop>configButton_4</tabstop> | |
1395 | + <tabstop>configButton_5</tabstop> | |
1396 | + <tabstop>backButton</tabstop> | |
1397 | + <tabstop>configButton</tabstop> | |
1398 | + <tabstop>helpButton</tabstop> | |
1399 | + <tabstop>okButton</tabstop> | |
1400 | + </tabstops> | |
1373 | 1401 | <resources> |
1374 | 1402 | <include location="resources.qrc"/> |
1375 | 1403 | </resources> | ... | ... |
app/gui/oven_control/programmingautoselectionwindow.cpp
... | ... | @@ -36,10 +36,11 @@ ProgrammingAutoSelectionWindow::ProgrammingAutoSelectionWindow(QWidget *parent, |
36 | 36 | QPushButton {\ |
37 | 37 | border-image: url(:/images/button/288.png);\ |
38 | 38 | }\ |
39 | -QPushButton:pressed {\ | |
39 | +QPushButton:pressed, QPushButton:focus {\ | |
40 | 40 | border-image: url(:/images/button/288_ov.png);\ |
41 | 41 | }"); |
42 | 42 | |
43 | + QWidget *last = this; | |
43 | 44 | for (int idx = 0; idx < book.list.size(); idx++) |
44 | 45 | { |
45 | 46 | int x = 12 + (idx % 3) * 294; |
... | ... | @@ -53,10 +54,21 @@ QPushButton:pressed {\ |
53 | 54 | |
54 | 55 | sm->setMapping(pb, idx); |
55 | 56 | connect(pb, SIGNAL(clicked()), sm, SLOT(map())); |
57 | + | |
58 | + setTabOrder(last, pb); | |
59 | + | |
60 | + last = pb; | |
56 | 61 | } |
57 | 62 | |
63 | + setTabOrder(last, ui->backButton); | |
64 | + setTabOrder(ui->backButton, ui->configButton); | |
65 | + setTabOrder(ui->configButton, ui->helpButton); | |
66 | + setTabOrder(ui->helpButton, ui->okButton); | |
67 | + | |
58 | 68 | foreach (QPushButton *button, findChildren<QPushButton *>()) |
59 | 69 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); |
70 | + | |
71 | + setFocus(); | |
60 | 72 | } |
61 | 73 | |
62 | 74 | ProgrammingAutoSelectionWindow::~ProgrammingAutoSelectionWindow() |
... | ... | @@ -101,17 +113,19 @@ void ProgrammingAutoSelectionWindow::keyReleaseEvent(QKeyEvent *event) |
101 | 113 | |
102 | 114 | void ProgrammingAutoSelectionWindow::onEncoderLeft() |
103 | 115 | { |
104 | - | |
116 | + focusPreviousChild(); | |
105 | 117 | } |
106 | 118 | |
107 | 119 | void ProgrammingAutoSelectionWindow::onEncoderRight() |
108 | 120 | { |
109 | - | |
121 | + focusNextChild(); | |
110 | 122 | } |
111 | 123 | |
112 | 124 | void ProgrammingAutoSelectionWindow::onEncoderClicked(QWidget *clicked) |
113 | 125 | { |
114 | - | |
126 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | |
127 | + if (b) | |
128 | + b->click(); | |
115 | 129 | } |
116 | 130 | |
117 | 131 | void ProgrammingAutoSelectionWindow::onCookSelected(int idx) | ... | ... |
app/gui/oven_control/programmingmanualcoretemppopup.cpp
... | ... | @@ -35,8 +35,19 @@ ProgrammingManualCoreTempPopup::ProgrammingManualCoreTempPopup(QWidget *parent) |
35 | 35 | |
36 | 36 | updateCoreTempLabel(); |
37 | 37 | |
38 | + afterThreeSecsTimer.setSingleShot(true); | |
39 | + afterThreeSecsTimer.setInterval(3000); | |
40 | + connect(&afterThreeSecsTimer, SIGNAL(timeout()), SLOT(afterThreeSecs())); | |
41 | + | |
38 | 42 | foreach (QPushButton *button, findChildren<QPushButton *>()) |
39 | 43 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); |
44 | + | |
45 | + foreach (QWidget *w, findChildren<QWidget *>()) | |
46 | + w->installEventFilter(this); | |
47 | + | |
48 | + installEventFilter(this); | |
49 | + | |
50 | + ui->background->setFocus(); | |
40 | 51 | } |
41 | 52 | |
42 | 53 | ProgrammingManualCoreTempPopup::~ProgrammingManualCoreTempPopup() |
... | ... | @@ -44,6 +55,24 @@ ProgrammingManualCoreTempPopup::~ProgrammingManualCoreTempPopup() |
44 | 55 | delete ui; |
45 | 56 | } |
46 | 57 | |
58 | +bool ProgrammingManualCoreTempPopup::eventFilter(QObject */*watched*/, QEvent *event) | |
59 | +{ | |
60 | + switch (event->type()) | |
61 | + { | |
62 | + case QEvent::KeyPress: | |
63 | + case QEvent::KeyRelease: | |
64 | + case QEvent::MouseButtonPress: | |
65 | + case QEvent::MouseButtonRelease: | |
66 | + case QEvent::MouseMove: | |
67 | + afterThreeSecsTimer.start(); | |
68 | + break; | |
69 | + default: | |
70 | + break; | |
71 | + } | |
72 | + | |
73 | + return false; | |
74 | +} | |
75 | + | |
47 | 76 | void ProgrammingManualCoreTempPopup::keyPressEvent(QKeyEvent *event) |
48 | 77 | { |
49 | 78 | switch (event->key()) |
... | ... | @@ -84,9 +113,19 @@ void ProgrammingManualCoreTempPopup::updateCoreTempLabel() |
84 | 113 | ui->coreTempLabel->setText(Stringer::temperature(ui->coreTempSlider->sliderPosition(), Stringer::fontSize14)); |
85 | 114 | } |
86 | 115 | |
87 | -void ProgrammingManualCoreTempPopup::on_coreTempButton_clicked() | |
116 | +void ProgrammingManualCoreTempPopup::afterThreeSecs() | |
88 | 117 | { |
118 | + Slider *slider = qobject_cast<Slider *>(focusWidget()); | |
119 | + if (slider) | |
120 | + { | |
121 | + if (slider == ui->coreTempSlider) | |
122 | + ui->coreTempButton->setFocus(); | |
123 | + } | |
124 | +} | |
89 | 125 | |
126 | +void ProgrammingManualCoreTempPopup::on_coreTempButton_clicked() | |
127 | +{ | |
128 | + ui->coreTempSlider->setFocus(); | |
90 | 129 | } |
91 | 130 | |
92 | 131 | void ProgrammingManualCoreTempPopup::on_cancelButton_clicked() |
... | ... | @@ -96,22 +135,47 @@ void ProgrammingManualCoreTempPopup::on_cancelButton_clicked() |
96 | 135 | |
97 | 136 | void ProgrammingManualCoreTempPopup::on_applyButton_clicked() |
98 | 137 | { |
99 | - emit coreTempEnabled(ui->coreTempSlider->value()); | |
138 | + emit coreTempEnabled(ui->coreTempSlider->sliderPosition()); | |
100 | 139 | |
101 | 140 | close(); |
102 | 141 | } |
103 | 142 | |
104 | 143 | void ProgrammingManualCoreTempPopup::onEncoderLeft() |
105 | 144 | { |
106 | - | |
145 | + QWidget *focused = focusWidget(); | |
146 | + if (focused == ui->background) | |
147 | + ui->applyButton->setFocus(); | |
148 | + else | |
149 | + focusPreviousChild(); | |
107 | 150 | } |
108 | 151 | |
109 | 152 | void ProgrammingManualCoreTempPopup::onEncoderRight() |
110 | 153 | { |
111 | - | |
154 | + QWidget *focused = focusWidget(); | |
155 | + if (focused == ui->applyButton) | |
156 | + ui->background->setFocus(); | |
157 | + else | |
158 | + focusNextChild(); | |
112 | 159 | } |
113 | 160 | |
114 | 161 | void ProgrammingManualCoreTempPopup::onEncoderClicked(QWidget *clicked) |
115 | 162 | { |
116 | - | |
163 | + QWidget *focused = clicked; | |
164 | + if (focused == ui->background) | |
165 | + close(); | |
166 | + else if (focused->inherits("QPushButton")) | |
167 | + { | |
168 | + QPushButton *pb = qobject_cast<QPushButton *>(focused); | |
169 | + if (pb) | |
170 | + pb->click(); | |
171 | + } | |
172 | + else if (focused->inherits("Slider")) | |
173 | + { | |
174 | + Slider *slider = qobject_cast<Slider *>(focused); | |
175 | + if (slider) | |
176 | + { | |
177 | + if (slider == ui->coreTempSlider) | |
178 | + ui->coreTempButton->setFocus(); | |
179 | + } | |
180 | + } | |
117 | 181 | } | ... | ... |
app/gui/oven_control/programmingmanualcoretemppopup.h
... | ... | @@ -2,6 +2,7 @@ |
2 | 2 | #define PROGRAMMINGMANUALCORETEMPPOPUP_H |
3 | 3 | |
4 | 4 | #include <QWidget> |
5 | +#include <QTimer> | |
5 | 6 | |
6 | 7 | namespace Ui { |
7 | 8 | class ProgrammingManualCoreTempPopup; |
... | ... | @@ -15,12 +16,15 @@ public: |
15 | 16 | explicit ProgrammingManualCoreTempPopup(QWidget *parent = 0); |
16 | 17 | ~ProgrammingManualCoreTempPopup(); |
17 | 18 | |
19 | + bool eventFilter(QObject *watched, QEvent *event); | |
20 | + | |
18 | 21 | protected: |
19 | 22 | void keyPressEvent(QKeyEvent *event); |
20 | 23 | void keyReleaseEvent(QKeyEvent *event); |
21 | 24 | |
22 | 25 | private slots: |
23 | 26 | void updateCoreTempLabel(); |
27 | + void afterThreeSecs(); | |
24 | 28 | |
25 | 29 | void on_coreTempButton_clicked(); |
26 | 30 | void on_cancelButton_clicked(); |
... | ... | @@ -35,6 +39,8 @@ private: |
35 | 39 | void onEncoderRight(); |
36 | 40 | void onEncoderClicked(QWidget *clicked); |
37 | 41 | |
42 | + QTimer afterThreeSecsTimer; | |
43 | + | |
38 | 44 | signals: |
39 | 45 | void coreTempEnabled(int); |
40 | 46 | }; | ... | ... |
app/gui/oven_control/programmingmanualcoretemppopup.ui
... | ... | @@ -13,9 +13,15 @@ |
13 | 13 | <property name="styleSheet"> |
14 | 14 | <string notr="true">#background { |
15 | 15 | background-image: url(:/images/background/manual_core.png); |
16 | +background-origin: border; | |
16 | 17 | margin-top: -720px; |
17 | 18 | } |
18 | 19 | |
20 | +#background:focus { | |
21 | +border: 4px solid gray; | |
22 | +border-top: 724px solid gray; | |
23 | +} | |
24 | + | |
19 | 25 | QPushButton[style="icon"] { |
20 | 26 | background-image: url(:/images/slider_icon/background.png); |
21 | 27 | background-repeat: no-repeat; |
... | ... | @@ -118,6 +124,9 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/manual_b |
118 | 124 | <height>730</height> |
119 | 125 | </rect> |
120 | 126 | </property> |
127 | + <property name="focusPolicy"> | |
128 | + <enum>Qt::TabFocus</enum> | |
129 | + </property> | |
121 | 130 | </widget> |
122 | 131 | <widget class="QLabel" name="coreTempLabel"> |
123 | 132 | <property name="enabled"> |
... | ... | @@ -208,6 +217,12 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/manual_b |
208 | 217 | <container>1</container> |
209 | 218 | </customwidget> |
210 | 219 | </customwidgets> |
220 | + <tabstops> | |
221 | + <tabstop>background</tabstop> | |
222 | + <tabstop>coreTempButton</tabstop> | |
223 | + <tabstop>cancelButton</tabstop> | |
224 | + <tabstop>applyButton</tabstop> | |
225 | + </tabstops> | |
211 | 226 | <resources/> |
212 | 227 | <connections/> |
213 | 228 | </ui> | ... | ... |
app/gui/oven_control/programmingmanualwindow.cpp
... | ... | @@ -66,6 +66,19 @@ ProgrammingManualWindow::ProgrammingManualWindow(QWidget *parent, Define::Mode m |
66 | 66 | |
67 | 67 | foreach (QPushButton *button, findChildren<QPushButton *>()) |
68 | 68 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); |
69 | + | |
70 | + setFocus(); | |
71 | + | |
72 | + afterThreeSecsTimer.setSingleShot(true); | |
73 | + afterThreeSecsTimer.setInterval(3000); | |
74 | + connect(&afterThreeSecsTimer, SIGNAL(timeout()), SLOT(afterThreeSecs())); | |
75 | + | |
76 | + foreach (QWidget *w, findChildren<QWidget *>()) | |
77 | + w->installEventFilter(this); | |
78 | + | |
79 | + installEventFilter(this); | |
80 | + | |
81 | + afterThreeSecsTimer.start(); | |
69 | 82 | } |
70 | 83 | |
71 | 84 | ProgrammingManualWindow::~ProgrammingManualWindow() |
... | ... | @@ -73,6 +86,24 @@ ProgrammingManualWindow::~ProgrammingManualWindow() |
73 | 86 | delete ui; |
74 | 87 | } |
75 | 88 | |
89 | +bool ProgrammingManualWindow::eventFilter(QObject */*watched*/, QEvent *event) | |
90 | +{ | |
91 | + switch (event->type()) | |
92 | + { | |
93 | + case QEvent::KeyPress: | |
94 | + case QEvent::KeyRelease: | |
95 | + case QEvent::MouseButtonPress: | |
96 | + case QEvent::MouseButtonRelease: | |
97 | + case QEvent::MouseMove: | |
98 | + afterThreeSecsTimer.start(); | |
99 | + break; | |
100 | + default: | |
101 | + break; | |
102 | + } | |
103 | + | |
104 | + return false; | |
105 | +} | |
106 | + | |
76 | 107 | void ProgrammingManualWindow::keyPressEvent(QKeyEvent *event) |
77 | 108 | { |
78 | 109 | switch (event->key()) |
... | ... | @@ -128,17 +159,92 @@ int ProgrammingManualWindow::timeToSlider(int secs) |
128 | 159 | |
129 | 160 | void ProgrammingManualWindow::onEncoderLeft() |
130 | 161 | { |
162 | + focusPreviousChild(); | |
131 | 163 | |
164 | + QWidget *focused = focusWidget(); | |
165 | + if (focused == ui->steamButton) | |
166 | + { | |
167 | + if (ui->steamButton->isChecked()) | |
168 | + focusPreviousChild(); | |
169 | + } | |
170 | + else if (focused == ui->combiButton) | |
171 | + { | |
172 | + if (ui->combiButton->isChecked()) | |
173 | + focusPreviousChild(); | |
174 | + } | |
175 | + else if (focused == ui->dryheatButton) | |
176 | + { | |
177 | + if (ui->dryheatButton->isChecked()) | |
178 | + focusPreviousChild(); | |
179 | + } | |
132 | 180 | } |
133 | 181 | |
134 | 182 | void ProgrammingManualWindow::onEncoderRight() |
135 | 183 | { |
136 | - | |
184 | + QWidget *focused = focusWidget(); | |
185 | + if (focused == NULL || focused == this) | |
186 | + { | |
187 | + if (ui->steamButton->isChecked() || ui->dryheatButton->isChecked()) | |
188 | + ui->tempButton->setFocus(); | |
189 | + else if (ui->combiButton->isChecked()) | |
190 | + ui->humidityButton->setFocus(); | |
191 | + } | |
192 | + else | |
193 | + { | |
194 | + focusNextChild(); | |
195 | + | |
196 | + focused = focusWidget(); | |
197 | + if (focused == ui->steamButton) | |
198 | + { | |
199 | + if (ui->steamButton->isChecked()) | |
200 | + focusNextChild(); | |
201 | + } | |
202 | + else if (focused == ui->combiButton) | |
203 | + { | |
204 | + if (ui->combiButton->isChecked()) | |
205 | + focusNextChild(); | |
206 | + } | |
207 | + else if (focused == ui->dryheatButton) | |
208 | + { | |
209 | + if (ui->dryheatButton->isChecked()) | |
210 | + focusNextChild(); | |
211 | + } | |
212 | + } | |
137 | 213 | } |
138 | 214 | |
139 | 215 | void ProgrammingManualWindow::onEncoderClicked(QWidget *clicked) |
140 | 216 | { |
217 | + if (clicked == NULL) | |
218 | + return; | |
141 | 219 | |
220 | + if (clicked->inherits("QPushButton")) | |
221 | + { | |
222 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | |
223 | + if (b) | |
224 | + { | |
225 | + b->click(); | |
226 | + | |
227 | + if (b == ui->steamButton || b == ui->dryheatButton) | |
228 | + ui->tempButton->setFocus(); | |
229 | + else if (b == ui->combiButton) | |
230 | + ui->humidityButton->setFocus(); | |
231 | + } | |
232 | + } | |
233 | + else if (clicked->inherits("Slider")) | |
234 | + { | |
235 | + Slider *slider = qobject_cast<Slider *>(clicked); | |
236 | + if (slider) | |
237 | + { | |
238 | + if (slider == ui->humiditySlider) | |
239 | + ui->humidityButton->setFocus(); | |
240 | + else if (slider == ui->tempSlider) | |
241 | + ui->tempButton->setFocus(); | |
242 | + else if (slider == ui->timeSlider) | |
243 | + ui->timeButton->setFocus(); | |
244 | + else if (slider == ui->interTempSlider) | |
245 | + ui->interTempButton->setFocus(); | |
246 | + } | |
247 | + } | |
142 | 248 | } |
143 | 249 | |
144 | 250 | void ProgrammingManualWindow::setDefault(Define::Mode mode) |
... | ... | @@ -147,6 +253,8 @@ void ProgrammingManualWindow::setDefault(Define::Mode mode) |
147 | 253 | { |
148 | 254 | case Define::SteamMode: |
149 | 255 | ui->steamButton->setChecked(true); |
256 | + ui->combiButton->setChecked(false); | |
257 | + ui->dryheatButton->setChecked(false); | |
150 | 258 | ui->humiditySlider->setEnabled(false); |
151 | 259 | ui->humiditySlider->setValue(100); |
152 | 260 | ui->tempSlider->setRange(30, 130); |
... | ... | @@ -161,7 +269,9 @@ void ProgrammingManualWindow::setDefault(Define::Mode mode) |
161 | 269 | this->mode = mode; |
162 | 270 | break; |
163 | 271 | case Define::CombiMode: |
272 | + ui->steamButton->setChecked(false); | |
164 | 273 | ui->combiButton->setChecked(true); |
274 | + ui->dryheatButton->setChecked(false); | |
165 | 275 | ui->humiditySlider->setEnabled(true); |
166 | 276 | ui->humiditySlider->setValue(50); |
167 | 277 | ui->tempSlider->setRange(30, 300); |
... | ... | @@ -176,6 +286,8 @@ void ProgrammingManualWindow::setDefault(Define::Mode mode) |
176 | 286 | this->mode = mode; |
177 | 287 | break; |
178 | 288 | case Define::DryMode: |
289 | + ui->steamButton->setChecked(false); | |
290 | + ui->combiButton->setChecked(false); | |
179 | 291 | ui->dryheatButton->setChecked(true); |
180 | 292 | ui->humiditySlider->setEnabled(false); |
181 | 293 | ui->humiditySlider->setValue(0); |
... | ... | @@ -219,22 +331,7 @@ void ProgrammingManualWindow::updateTimeLabel() |
219 | 331 | |
220 | 332 | void ProgrammingManualWindow::updateCoreTempButton() |
221 | 333 | { |
222 | - if (ui->interTempSlider->isEnabled()) | |
223 | - ui->interTempButton->setStyleSheet("\ | |
224 | -QPushButton {\ | |
225 | - image: url(:/images/slider_icon/core_temp_enabled.png);\ | |
226 | -}\ | |
227 | -QPushButton:pressed {\ | |
228 | - image: url(:/images/slider_icon/core_temp_ov.png);\ | |
229 | -}"); | |
230 | - else | |
231 | - ui->interTempButton->setStyleSheet("\ | |
232 | -QPushButton {\ | |
233 | - image: url(:/images/slider_icon/core_temp.png);\ | |
234 | -}\ | |
235 | -QPushButton:pressed {\ | |
236 | - image: url(:/images/slider_icon/core_temp_ov.png);\ | |
237 | -}"); | |
334 | + ui->interTempButton->setChecked(ui->interTempSlider->isEnabled()); | |
238 | 335 | } |
239 | 336 | |
240 | 337 | void ProgrammingManualWindow::updateCoreTempLabel() |
... | ... | @@ -276,6 +373,24 @@ void ProgrammingManualWindow::updateFanButton() |
276 | 373 | } |
277 | 374 | } |
278 | 375 | |
376 | +void ProgrammingManualWindow::afterThreeSecs() | |
377 | +{ | |
378 | + Slider *slider = qobject_cast<Slider *>(focusWidget()); | |
379 | + if (slider) | |
380 | + { | |
381 | + if (slider == ui->humiditySlider) | |
382 | + ui->humidityButton->setFocus(); | |
383 | + else if (slider == ui->tempSlider) | |
384 | + ui->tempButton->setFocus(); | |
385 | + else if (slider == ui->timeSlider) | |
386 | + ui->timeButton->setFocus(); | |
387 | + else if (slider == ui->interTempSlider) | |
388 | + ui->interTempButton->setFocus(); | |
389 | + | |
390 | + afterThreeSecsTimer.start(); | |
391 | + } | |
392 | +} | |
393 | + | |
279 | 394 | void ProgrammingManualWindow::onCoreTempEnabled(int celsius) |
280 | 395 | { |
281 | 396 | ui->interTempSlider->setEnabled(true); |
... | ... | @@ -300,6 +415,21 @@ void ProgrammingManualWindow::on_dryheatButton_clicked() |
300 | 415 | setDefault(Define::DryMode); |
301 | 416 | } |
302 | 417 | |
418 | +void ProgrammingManualWindow::on_humidityButton_clicked() | |
419 | +{ | |
420 | + ui->humiditySlider->setFocus(); | |
421 | +} | |
422 | + | |
423 | +void ProgrammingManualWindow::on_tempButton_clicked() | |
424 | +{ | |
425 | + ui->tempSlider->setFocus(); | |
426 | +} | |
427 | + | |
428 | +void ProgrammingManualWindow::on_timeButton_clicked() | |
429 | +{ | |
430 | + ui->timeSlider->setFocus(); | |
431 | +} | |
432 | + | |
303 | 433 | void ProgrammingManualWindow::on_interTempButton_clicked() |
304 | 434 | { |
305 | 435 | if (ui->interTempSlider->isEnabled()) |
... | ... | @@ -313,6 +443,8 @@ void ProgrammingManualWindow::on_interTempButton_clicked() |
313 | 443 | { |
314 | 444 | ProgrammingManualCoreTempPopup *p = new ProgrammingManualCoreTempPopup(this); |
315 | 445 | connect(p, SIGNAL(coreTempEnabled(int)), SLOT(onCoreTempEnabled(int))); |
446 | + connect(p, SIGNAL(destroyed(QObject*)), SLOT(updateCoreTempButton())); | |
447 | + connect(p, SIGNAL(destroyed(QObject*)), ui->interTempButton, SLOT(setFocus())); | |
316 | 448 | p->showFullScreen(); |
317 | 449 | } |
318 | 450 | } | ... | ... |
app/gui/oven_control/programmingmanualwindow.h
... | ... | @@ -17,6 +17,8 @@ public: |
17 | 17 | explicit ProgrammingManualWindow(QWidget *parent, Define::Mode mode); |
18 | 18 | ~ProgrammingManualWindow(); |
19 | 19 | |
20 | + bool eventFilter(QObject *watched, QEvent *event); | |
21 | + | |
20 | 22 | protected: |
21 | 23 | void keyPressEvent(QKeyEvent *event); |
22 | 24 | void keyReleaseEvent(QKeyEvent *event); |
... | ... | @@ -36,6 +38,8 @@ private: |
36 | 38 | void onEncoderRight(); |
37 | 39 | void onEncoderClicked(QWidget *clicked); |
38 | 40 | |
41 | + QTimer afterThreeSecsTimer; | |
42 | + | |
39 | 43 | private slots: |
40 | 44 | void setDefault(Define::Mode mode); |
41 | 45 | void setFan(int level); |
... | ... | @@ -45,6 +49,7 @@ private slots: |
45 | 49 | void updateCoreTempButton(); |
46 | 50 | void updateCoreTempLabel(); |
47 | 51 | void updateFanButton(); |
52 | + void afterThreeSecs(); | |
48 | 53 | |
49 | 54 | void onCoreTempEnabled(int celsius); |
50 | 55 | |
... | ... | @@ -58,6 +63,12 @@ private slots: |
58 | 63 | void on_helpButton_clicked(); |
59 | 64 | void on_okButton_clicked(); |
60 | 65 | |
66 | + void on_humidityButton_clicked(); | |
67 | + | |
68 | + void on_tempButton_clicked(); | |
69 | + | |
70 | + void on_timeButton_clicked(); | |
71 | + | |
61 | 72 | signals: |
62 | 73 | void added(); |
63 | 74 | }; | ... | ... |
app/gui/oven_control/programmingmanualwindow.ui
... | ... | @@ -207,9 +207,6 @@ QPushButton:checked { background-image: url(:/images/cook_mode/big_dryheat.png); |
207 | 207 | <property name="checkable"> |
208 | 208 | <bool>true</bool> |
209 | 209 | </property> |
210 | - <property name="autoExclusive"> | |
211 | - <bool>true</bool> | |
212 | - </property> | |
213 | 210 | <property name="style" stdset="0"> |
214 | 211 | <string notr="true">mode</string> |
215 | 212 | </property> |
... | ... | @@ -596,9 +593,6 @@ QPushButton:checked { background-image: url(:/images/cook_mode/big_steam.png); } |
596 | 593 | <property name="checkable"> |
597 | 594 | <bool>true</bool> |
598 | 595 | </property> |
599 | - <property name="autoExclusive"> | |
600 | - <bool>true</bool> | |
601 | - </property> | |
602 | 596 | <property name="style" stdset="0"> |
603 | 597 | <string notr="true">mode</string> |
604 | 598 | </property> |
... | ... | @@ -757,8 +751,12 @@ QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/humidit |
757 | 751 | </property> |
758 | 752 | <property name="styleSheet"> |
759 | 753 | <string notr="true">QPushButton { image: url(:/images/slider_icon/core_temp.png); } |
754 | +QPushButton:checked { image: url(:/images/slider_icon/core_temp_enabled.png); } | |
760 | 755 | QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/core_temp_ov.png); }</string> |
761 | 756 | </property> |
757 | + <property name="checkable"> | |
758 | + <bool>true</bool> | |
759 | + </property> | |
762 | 760 | <property name="style" stdset="0"> |
763 | 761 | <string notr="true">icon</string> |
764 | 762 | </property> |
... | ... | @@ -783,9 +781,6 @@ QPushButton:checked { background-image: url(:/images/cook_mode/big_combi.png); } |
783 | 781 | <property name="checkable"> |
784 | 782 | <bool>true</bool> |
785 | 783 | </property> |
786 | - <property name="autoExclusive"> | |
787 | - <bool>true</bool> | |
788 | - </property> | |
789 | 784 | <property name="style" stdset="0"> |
790 | 785 | <string notr="true">mode</string> |
791 | 786 | </property> |
... | ... | @@ -871,41 +866,53 @@ QPushButton:checked { background-image: url(:/images/cook_mode/big_combi.png); } |
871 | 866 | <property name="geometry"> |
872 | 867 | <rect> |
873 | 868 | <x>185</x> |
874 | - <y>875</y> | |
869 | + <y>915</y> | |
875 | 870 | <width>666</width> |
876 | - <height>140</height> | |
871 | + <height>60</height> | |
877 | 872 | </rect> |
878 | 873 | </property> |
874 | + <property name="focusPolicy"> | |
875 | + <enum>Qt::ClickFocus</enum> | |
876 | + </property> | |
879 | 877 | </widget> |
880 | 878 | <widget class="Slider" name="interTempSlider" native="true"> |
881 | 879 | <property name="geometry"> |
882 | 880 | <rect> |
883 | 881 | <x>185</x> |
884 | - <y>1175</y> | |
882 | + <y>1215</y> | |
885 | 883 | <width>666</width> |
886 | - <height>140</height> | |
884 | + <height>60</height> | |
887 | 885 | </rect> |
888 | 886 | </property> |
887 | + <property name="focusPolicy"> | |
888 | + <enum>Qt::ClickFocus</enum> | |
889 | + </property> | |
889 | 890 | </widget> |
890 | 891 | <widget class="Slider" name="timeSlider" native="true"> |
891 | 892 | <property name="geometry"> |
892 | 893 | <rect> |
893 | 894 | <x>185</x> |
894 | - <y>1025</y> | |
895 | + <y>1065</y> | |
895 | 896 | <width>666</width> |
896 | - <height>140</height> | |
897 | + <height>60</height> | |
897 | 898 | </rect> |
898 | 899 | </property> |
900 | + <property name="focusPolicy"> | |
901 | + <enum>Qt::ClickFocus</enum> | |
902 | + </property> | |
899 | 903 | </widget> |
900 | 904 | <widget class="Slider" name="humiditySlider" native="true"> |
901 | 905 | <property name="geometry"> |
902 | 906 | <rect> |
903 | 907 | <x>185</x> |
904 | - <y>725</y> | |
908 | + <y>765</y> | |
905 | 909 | <width>666</width> |
906 | - <height>140</height> | |
910 | + <height>60</height> | |
907 | 911 | </rect> |
908 | 912 | </property> |
913 | + <property name="focusPolicy"> | |
914 | + <enum>Qt::ClickFocus</enum> | |
915 | + </property> | |
909 | 916 | </widget> |
910 | 917 | </widget> |
911 | 918 | </widget> |
... | ... | @@ -933,6 +940,20 @@ QPushButton:checked { background-image: url(:/images/cook_mode/big_combi.png); } |
933 | 940 | <container>1</container> |
934 | 941 | </customwidget> |
935 | 942 | </customwidgets> |
943 | + <tabstops> | |
944 | + <tabstop>steamButton</tabstop> | |
945 | + <tabstop>combiButton</tabstop> | |
946 | + <tabstop>dryheatButton</tabstop> | |
947 | + <tabstop>humidityButton</tabstop> | |
948 | + <tabstop>tempButton</tabstop> | |
949 | + <tabstop>timeButton</tabstop> | |
950 | + <tabstop>interTempButton</tabstop> | |
951 | + <tabstop>fanButton</tabstop> | |
952 | + <tabstop>backButton</tabstop> | |
953 | + <tabstop>configButton</tabstop> | |
954 | + <tabstop>helpButton</tabstop> | |
955 | + <tabstop>okButton</tabstop> | |
956 | + </tabstops> | |
936 | 957 | <resources> |
937 | 958 | <include location="resources.qrc"/> |
938 | 959 | </resources> | ... | ... |
app/gui/oven_control/programmingselectionwindow.cpp
... | ... | @@ -101,6 +101,8 @@ void ProgrammingSelectionWindow::onEncoderClicked(QWidget *clicked) |
101 | 101 | |
102 | 102 | void ProgrammingSelectionWindow::onModeClicked(Define::Mode mode) |
103 | 103 | { |
104 | + setFocus(); | |
105 | + | |
104 | 106 | ProgrammingManualWindow *w = new ProgrammingManualWindow(this, mode); |
105 | 107 | connect(w, SIGNAL(added()), SIGNAL(added())); |
106 | 108 | connect(w, SIGNAL(added()), SLOT(hide())); |
... | ... | @@ -112,6 +114,8 @@ void ProgrammingSelectionWindow::onModeClicked(Define::Mode mode) |
112 | 114 | |
113 | 115 | void ProgrammingSelectionWindow::onCookTypeClicked(Define::CookType type) |
114 | 116 | { |
117 | + setFocus(); | |
118 | + | |
115 | 119 | ProgrammingAutoSelectionWindow *w = new ProgrammingAutoSelectionWindow(this, type); |
116 | 120 | connect(w, SIGNAL(added()), SIGNAL(added())); |
117 | 121 | connect(w, SIGNAL(added()), SLOT(hide())); | ... | ... |
app/gui/oven_control/programmingselectionwindow.ui
... | ... | @@ -161,6 +161,9 @@ QPushButton:disabled { background-image: url(:/images/cook_type/fish_hide.png); |
161 | 161 | <verstretch>0</verstretch> |
162 | 162 | </sizepolicy> |
163 | 163 | </property> |
164 | + <property name="focusPolicy"> | |
165 | + <enum>Qt::NoFocus</enum> | |
166 | + </property> | |
164 | 167 | <property name="styleSheet"> |
165 | 168 | <string notr="true">QPushButton { background-image: url(:/images/main_button/multi.png); } |
166 | 169 | QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/multi_ov.png); } |
... | ... | @@ -445,6 +448,9 @@ QPushButton:disabled { background-image: url(:/images/cook_type/etc_hide.png); } |
445 | 448 | <verstretch>0</verstretch> |
446 | 449 | </sizepolicy> |
447 | 450 | </property> |
451 | + <property name="focusPolicy"> | |
452 | + <enum>Qt::NoFocus</enum> | |
453 | + </property> | |
448 | 454 | <property name="styleSheet"> |
449 | 455 | <string notr="true">QPushButton { background-image: url(:/images/main_button/wash.png); } |
450 | 456 | QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/wash_ov.png); } |
... | ... | @@ -475,6 +481,9 @@ QPushButton:disabled { background-image: url(:/images/main_button/wash_hide.png) |
475 | 481 | <verstretch>0</verstretch> |
476 | 482 | </sizepolicy> |
477 | 483 | </property> |
484 | + <property name="focusPolicy"> | |
485 | + <enum>Qt::NoFocus</enum> | |
486 | + </property> | |
478 | 487 | <property name="styleSheet"> |
479 | 488 | <string notr="true">QPushButton { background-image: url(:/images/main_button/custom.png); } |
480 | 489 | QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/custom_ov.png); } |
... | ... | @@ -724,11 +733,13 @@ QPushButton:disabled { background-image: url(:/images/cook_type/bread_hide.png); |
724 | 733 | <tabstop>breadButton</tabstop> |
725 | 734 | <tabstop>etcButton</tabstop> |
726 | 735 | <tabstop>primeButton</tabstop> |
727 | - <tabstop>multiButton</tabstop> | |
728 | - <tabstop>programmingButton</tabstop> | |
729 | - <tabstop>washButton</tabstop> | |
736 | + <tabstop>backButton</tabstop> | |
730 | 737 | <tabstop>configButton</tabstop> |
731 | 738 | <tabstop>helpButton</tabstop> |
739 | + <tabstop>okButton</tabstop> | |
740 | + <tabstop>washButton</tabstop> | |
741 | + <tabstop>multiButton</tabstop> | |
742 | + <tabstop>programmingButton</tabstop> | |
732 | 743 | </tabstops> |
733 | 744 | <resources/> |
734 | 745 | <connections/> | ... | ... |
app/gui/oven_control/programmingwindow.cpp
... | ... | @@ -25,6 +25,8 @@ ProgrammingWindow::ProgrammingWindow(QWidget *parent) : |
25 | 25 | |
26 | 26 | foreach (QPushButton *button, findChildren<QPushButton *>()) |
27 | 27 | connect(button, &QPushButton::pressed, SoundPlayer::playClick); |
28 | + | |
29 | + setFocus(); | |
28 | 30 | } |
29 | 31 | |
30 | 32 | ProgrammingWindow::~ProgrammingWindow() |
... | ... | @@ -42,6 +44,9 @@ void ProgrammingWindow::listAuto() |
42 | 44 | ui->autoButton->blockSignals(false); |
43 | 45 | } |
44 | 46 | |
47 | + if (ui->manualButton->isChecked()) | |
48 | + ui->manualButton->setChecked(false); | |
49 | + | |
45 | 50 | listButtons(CookProgram::listAuto()); |
46 | 51 | } |
47 | 52 | |
... | ... | @@ -54,6 +59,9 @@ void ProgrammingWindow::listManual() |
54 | 59 | ui->manualButton->blockSignals(false); |
55 | 60 | } |
56 | 61 | |
62 | + if (ui->autoButton->isChecked()) | |
63 | + ui->autoButton->setChecked(false); | |
64 | + | |
57 | 65 | listButtons(CookProgram::listManual()); |
58 | 66 | } |
59 | 67 | |
... | ... | @@ -134,8 +142,23 @@ void ProgrammingWindow::listButtons(QList<CookRecord> record) |
134 | 142 | |
135 | 143 | ui->addButton->show(); |
136 | 144 | |
145 | + setTabOrder(this, ui->autoButton); | |
146 | + setTabOrder(ui->autoButton, ui->manualButton); | |
147 | + setTabOrder(ui->manualButton, ui->addButton); | |
148 | + | |
149 | + QWidget *last = ui->addButton; | |
137 | 150 | foreach (CookRecord r, record) |
138 | - newButton(r); | |
151 | + { | |
152 | + CookPanelButton *b = newButton(r); | |
153 | + setTabOrder(last, b->bar()); | |
154 | + setTabOrder(b->bar(), b->infoButton()); | |
155 | + setTabOrder(b->infoButton(), b->deleteButton()); | |
156 | + last = b->deleteButton(); | |
157 | + } | |
158 | + | |
159 | + setTabOrder(last, ui->backButton); | |
160 | + setTabOrder(ui->backButton, ui->saveButton); | |
161 | + setTabOrder(ui->saveButton, ui->helpButton); | |
139 | 162 | |
140 | 163 | ui->scrollAreaWidgetContents->adjustSize(); |
141 | 164 | } |
... | ... | @@ -243,18 +266,32 @@ void ProgrammingWindow::on_addButton_clicked() |
243 | 266 | |
244 | 267 | void ProgrammingWindow::on_autoButton_toggled(bool checked) |
245 | 268 | { |
246 | - if (!checked) | |
247 | - return; | |
248 | - | |
249 | - listAuto(); | |
269 | + if (checked) | |
270 | + listAuto(); | |
271 | + else | |
272 | + { | |
273 | + if (!ui->manualButton->isChecked()) | |
274 | + { | |
275 | + ui->autoButton->blockSignals(true); | |
276 | + ui->autoButton->setChecked(true); | |
277 | + ui->autoButton->blockSignals(false); | |
278 | + } | |
279 | + } | |
250 | 280 | } |
251 | 281 | |
252 | 282 | void ProgrammingWindow::on_manualButton_toggled(bool checked) |
253 | 283 | { |
254 | - if (!checked) | |
255 | - return; | |
256 | - | |
257 | - listManual(); | |
284 | + if (checked) | |
285 | + listManual(); | |
286 | + else | |
287 | + { | |
288 | + if (!ui->autoButton->isChecked()) | |
289 | + { | |
290 | + ui->manualButton->blockSignals(true); | |
291 | + ui->manualButton->setChecked(true); | |
292 | + ui->manualButton->blockSignals(false); | |
293 | + } | |
294 | + } | |
258 | 295 | } |
259 | 296 | |
260 | 297 | void ProgrammingWindow::on_backButton_clicked() |
... | ... | @@ -284,11 +321,13 @@ void ProgrammingWindow::on_helpButton_clicked() |
284 | 321 | void ProgrammingWindow::onEncoderLeft() |
285 | 322 | { |
286 | 323 | focusPreviousChild(); |
324 | + ui->scrollArea->ensureWidgetVisible(focusWidget()); | |
287 | 325 | } |
288 | 326 | |
289 | 327 | void ProgrammingWindow::onEncoderRight() |
290 | 328 | { |
291 | 329 | focusNextChild(); |
330 | + ui->scrollArea->ensureWidgetVisible(focusWidget()); | |
292 | 331 | } |
293 | 332 | |
294 | 333 | void ProgrammingWindow::onEncoderClicked(QWidget *clicked) | ... | ... |
app/gui/oven_control/programmingwindow.ui
... | ... | @@ -187,11 +187,8 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/etc/main |
187 | 187 | <property name="checkable"> |
188 | 188 | <bool>true</bool> |
189 | 189 | </property> |
190 | - <property name="autoExclusive"> | |
191 | - <bool>true</bool> | |
192 | - </property> | |
193 | 190 | <property name="style" stdset="0"> |
194 | - <string>mode</string> | |
191 | + <string notr="true">mode</string> | |
195 | 192 | </property> |
196 | 193 | </widget> |
197 | 194 | </item> |
... | ... | @@ -213,11 +210,8 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/etc/main |
213 | 210 | <property name="checkable"> |
214 | 211 | <bool>true</bool> |
215 | 212 | </property> |
216 | - <property name="autoExclusive"> | |
217 | - <bool>true</bool> | |
218 | - </property> | |
219 | 213 | <property name="style" stdset="0"> |
220 | - <string>mode</string> | |
214 | + <string notr="true">mode</string> | |
221 | 215 | </property> |
222 | 216 | </widget> |
223 | 217 | </item> |
... | ... | @@ -232,6 +226,9 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/etc/main |
232 | 226 | <height>803</height> |
233 | 227 | </rect> |
234 | 228 | </property> |
229 | + <property name="focusPolicy"> | |
230 | + <enum>Qt::NoFocus</enum> | |
231 | + </property> | |
235 | 232 | <property name="widgetResizable"> |
236 | 233 | <bool>true</bool> |
237 | 234 | </property> |
... | ... | @@ -295,6 +292,14 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/etc/bar_ |
295 | 292 | <header>washwarnicon.h</header> |
296 | 293 | </customwidget> |
297 | 294 | </customwidgets> |
295 | + <tabstops> | |
296 | + <tabstop>autoButton</tabstop> | |
297 | + <tabstop>manualButton</tabstop> | |
298 | + <tabstop>addButton</tabstop> | |
299 | + <tabstop>backButton</tabstop> | |
300 | + <tabstop>saveButton</tabstop> | |
301 | + <tabstop>helpButton</tabstop> | |
302 | + </tabstops> | |
298 | 303 | <resources/> |
299 | 304 | <connections/> |
300 | 305 | </ui> | ... | ... |