Commit 0ce283850eaeba1c59803c9ba388757ef3dee25f

Authored by 김태훈
1 parent 262c52a2a9
Exists in master and in 2 other branches fhd, fhd-demo

로터리 엔코더 임시 구현

app/gui/oven_control/mainwindow.cpp
... ... @@ -3,6 +3,7 @@
3 3  
4 4 #include <QtDebug>
5 5 #include <QSignalMapper>
  6 +#include <QKeyEvent>
6 7  
7 8 #include "abstractoveninterface.h"
8 9 #include "manualcookwindow.h"
... ... @@ -20,6 +21,8 @@ MainWindow::MainWindow(QWidget *parent) :
20 21 ui(new Ui::MainWindow)
21 22 {
22 23 ui->setupUi(this);
  24 +
  25 + setFocus();
23 26 }
24 27  
25 28 MainWindow::~MainWindow()
... ... @@ -27,6 +30,45 @@ MainWindow::~MainWindow()
27 30 delete ui;
28 31 }
29 32  
  33 +static QPushButton *pushedChild = NULL;
  34 +
  35 +void MainWindow::keyPressEvent(QKeyEvent *event)
  36 +{
  37 + switch (event->key())
  38 + {
  39 + case 0x01000030: // Turn left
  40 + focusPreviousChild();
  41 + break;
  42 + case 0x01000031: // Push
  43 + if (focusWidget() != this)
  44 + pushedChild = static_cast<QPushButton *>(focusWidget());
  45 + break;
  46 + case 0x01000032: // Turn right
  47 + focusNextChild();
  48 + break;
  49 + }
  50 +}
  51 +
  52 +void MainWindow::keyReleaseEvent(QKeyEvent *event)
  53 +{
  54 + switch (event->key())
  55 + {
  56 + case 0x01000030: // Turn left
  57 + focusPreviousChild();
  58 + break;
  59 + case 0x01000031: // Push
  60 + if (focusWidget() == pushedChild)
  61 + pushedChild->click();
  62 +
  63 + setFocus();
  64 + pushedChild = NULL;
  65 + break;
  66 + case 0x01000032: // Turn right
  67 + focusNextChild();
  68 + break;
  69 + }
  70 +}
  71 +
30 72 void MainWindow::showManualCookWindow(Define::Mode mode)
31 73 {
32 74 ManualCookWindow *w = new ManualCookWindow(this, mode);
... ...
app/gui/oven_control/mainwindow.h
... ... @@ -18,6 +18,10 @@ public:
18 18 explicit MainWindow(QWidget *parent = 0);
19 19 ~MainWindow();
20 20  
  21 +protected:
  22 + void keyPressEvent(QKeyEvent *event);
  23 + void keyReleaseEvent(QKeyEvent *event);
  24 +
21 25 private slots:
22 26 void showManualCookWindow(Define::Mode mode);
23 27 void showAutoCookSelectionWindow(Define::CookType type);
... ...
app/gui/oven_control/mainwindow.ui
... ... @@ -117,7 +117,7 @@ font-size: 30px;
117 117 </property>
118 118 <property name="styleSheet">
119 119 <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/config.png); }
120   -QPushButton:pressed { border-image: url(:/images/bottom_bar/config_ov.png); }</string>
  120 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/config_ov.png); }</string>
121 121 </property>
122 122 <property name="text">
123 123 <string/>
... ... @@ -146,7 +146,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/config_ov.png); }&lt;/s
146 146 </property>
147 147 <property name="styleSheet">
148 148 <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); }
149   -QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</string>
  149 +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); }</string>
150 150 </property>
151 151 <property name="text">
152 152 <string/>
... ... @@ -170,7 +170,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }&lt;/str
170 170 </property>
171 171 <property name="styleSheet">
172 172 <string notr="true">QPushButton { background-image: url(:/images/main_button/multi.png); }
173   -QPushButton:pressed { background-image: url(:/images/main_button/multi_ov.png); }</string>
  173 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/multi_ov.png); }</string>
174 174 </property>
175 175 <property name="text">
176 176 <string>다중요리</string>
... ... @@ -196,7 +196,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/multi_ov.png);
196 196 </property>
197 197 <property name="styleSheet">
198 198 <string notr="true">QPushButton { background-image: url(:/images/main_button/custom.png); }
199   -QPushButton:pressed { background-image: url(:/images/main_button/custom_ov.png); }</string>
  199 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/custom_ov.png); }</string>
200 200 </property>
201 201 <property name="text">
202 202 <string>프로그래밍모드</string>
... ... @@ -222,7 +222,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/custom_ov.png);
222 222 </property>
223 223 <property name="styleSheet">
224 224 <string notr="true">QPushButton { background-image: url(:/images/main_button/wash.png); }
225   -QPushButton:pressed { background-image: url(:/images/main_button/wash_ov.png); }</string>
  225 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/main_button/wash_ov.png); }</string>
226 226 </property>
227 227 <property name="text">
228 228 <string>세척모드</string>
... ... @@ -320,7 +320,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/wash_ov.png); }
320 320 </property>
321 321 <property name="styleSheet">
322 322 <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_dryheat.png); }
323   -QPushButton:pressed { background-image: url(:/images/cook_mode/big_dryheat_ov.png); }</string>
  323 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_dryheat_ov.png); }</string>
324 324 </property>
325 325 <property name="text">
326 326 <string>건열</string>
... ... @@ -340,7 +340,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_dryheat_ov.pn
340 340 </property>
341 341 <property name="styleSheet">
342 342 <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_combi.png); }
343   -QPushButton:pressed { background-image: url(:/images/cook_mode/big_combi_ov.png); }</string>
  343 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_combi_ov.png); }</string>
344 344 </property>
345 345 <property name="text">
346 346 <string>콤비</string>
... ... @@ -360,7 +360,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_combi_ov.png)
360 360 </property>
361 361 <property name="styleSheet">
362 362 <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_steam.png); }
363   -QPushButton:pressed { background-image: url(:/images/cook_mode/big_steam_ov.png); }</string>
  363 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_mode/big_steam_ov.png); }</string>
364 364 </property>
365 365 <property name="text">
366 366 <string>스팀</string>
... ... @@ -386,7 +386,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_steam_ov.png)
386 386 </property>
387 387 <property name="styleSheet">
388 388 <string notr="true">QPushButton { background-image: url(:/images/cook_type/meat.png); }
389   -QPushButton:pressed { background-image: url(:/images/cook_type/meat_ov.png); }</string>
  389 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/meat_ov.png); }</string>
390 390 </property>
391 391 <property name="text">
392 392 <string>육류</string>
... ... @@ -412,7 +412,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/meat_ov.png); }&lt;/
412 412 </property>
413 413 <property name="styleSheet">
414 414 <string notr="true">QPushButton { background-image: url(:/images/cook_type/desert.png); }
415   -QPushButton:pressed { background-image: url(:/images/cook_type/desert_ov.png); }</string>
  415 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/desert_ov.png); }</string>
416 416 </property>
417 417 <property name="text">
418 418 <string>디저트류</string>
... ... @@ -438,7 +438,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/desert_ov.png); }
438 438 </property>
439 439 <property name="styleSheet">
440 440 <string notr="true">QPushButton { background-image: url(:/images/cook_type/etc.png); }
441   -QPushButton:pressed { background-image: url(:/images/cook_type/etc_ov.png); }</string>
  441 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/etc_ov.png); }</string>
442 442 </property>
443 443 <property name="text">
444 444 <string>기타요리</string>
... ... @@ -464,7 +464,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/etc_ov.png); }&lt;/s
464 464 </property>
465 465 <property name="styleSheet">
466 466 <string notr="true">QPushButton { background-image: url(:/images/cook_type/vegetable.png); }
467   -QPushButton:pressed { background-image: url(:/images/cook_type/vegetable_ov.png); }</string>
  467 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/vegetable_ov.png); }</string>
468 468 </property>
469 469 <property name="text">
470 470 <string>채소및곡류</string>
... ... @@ -490,7 +490,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/vegetable_ov.png)
490 490 </property>
491 491 <property name="styleSheet">
492 492 <string notr="true">QPushButton { background-image: url(:/images/cook_type/poultry.png); }
493   -QPushButton:pressed { background-image: url(:/images/cook_type/poultry_ov.png); }</string>
  493 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/poultry_ov.png); }</string>
494 494 </property>
495 495 <property name="text">
496 496 <string>가금류</string>
... ... @@ -516,7 +516,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/poultry_ov.png);
516 516 </property>
517 517 <property name="styleSheet">
518 518 <string notr="true">QPushButton { background-image: url(:/images/cook_type/fish.png); }
519   -QPushButton:pressed { background-image: url(:/images/cook_type/fish_ov.png); }</string>
  519 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/fish_ov.png); }</string>
520 520 </property>
521 521 <property name="text">
522 522 <string>생선류</string>
... ... @@ -542,7 +542,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/fish_ov.png); }&lt;/
542 542 </property>
543 543 <property name="styleSheet">
544 544 <string notr="true">QPushButton { background-image: url(:/images/cook_type/bread.png); }
545   -QPushButton:pressed { background-image: url(:/images/cook_type/bread_ov.png); }</string>
  545 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/bread_ov.png); }</string>
546 546 </property>
547 547 <property name="text">
548 548 <string>제과제빵류</string>
... ... @@ -568,7 +568,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/bread_ov.png); }&lt;
568 568 </property>
569 569 <property name="styleSheet">
570 570 <string notr="true">QPushButton { background-image: url(:/images/cook_type/additional.png); }
571   -QPushButton:pressed { background-image: url(:/images/cook_type/additional_ov.png); }</string>
  571 +QPushButton:pressed, QPushButton:focus { background-image: url(:/images/cook_type/additional_ov.png); }</string>
572 572 </property>
573 573 <property name="text">
574 574 <string>부가기능</string>
... ... @@ -689,6 +689,24 @@ QPushButton:pressed { background-image: url(:/images/cook_type/additional_ov.png
689 689 <container>1</container>
690 690 </customwidget>
691 691 </customwidgets>
  692 + <tabstops>
  693 + <tabstop>steamButton</tabstop>
  694 + <tabstop>combiButton</tabstop>
  695 + <tabstop>dryheatButton</tabstop>
  696 + <tabstop>poultryButton</tabstop>
  697 + <tabstop>meatButton</tabstop>
  698 + <tabstop>fishButton</tabstop>
  699 + <tabstop>dessertButton</tabstop>
  700 + <tabstop>grainButton</tabstop>
  701 + <tabstop>breadButton</tabstop>
  702 + <tabstop>etcButton</tabstop>
  703 + <tabstop>primeButton</tabstop>
  704 + <tabstop>multiButton</tabstop>
  705 + <tabstop>programmingButton</tabstop>
  706 + <tabstop>washButton</tabstop>
  707 + <tabstop>configButton</tabstop>
  708 + <tabstop>helpButton</tabstop>
  709 + </tabstops>
692 710 <resources/>
693 711 <connections/>
694 712 </ui>
... ...