Commit 0ce283850eaeba1c59803c9ba388757ef3dee25f
1 parent
262c52a2a9
Exists in
master
and in
2 other branches
로터리 엔코더 임시 구현
Showing
3 changed files
with
80 additions
and
16 deletions
Show diff stats
app/gui/oven_control/mainwindow.cpp
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | 3 | ||
| 4 | #include <QtDebug> | 4 | #include <QtDebug> |
| 5 | #include <QSignalMapper> | 5 | #include <QSignalMapper> |
| 6 | +#include <QKeyEvent> | ||
| 6 | 7 | ||
| 7 | #include "abstractoveninterface.h" | 8 | #include "abstractoveninterface.h" |
| 8 | #include "manualcookwindow.h" | 9 | #include "manualcookwindow.h" |
| @@ -20,6 +21,8 @@ MainWindow::MainWindow(QWidget *parent) : | @@ -20,6 +21,8 @@ MainWindow::MainWindow(QWidget *parent) : | ||
| 20 | ui(new Ui::MainWindow) | 21 | ui(new Ui::MainWindow) |
| 21 | { | 22 | { |
| 22 | ui->setupUi(this); | 23 | ui->setupUi(this); |
| 24 | + | ||
| 25 | + setFocus(); | ||
| 23 | } | 26 | } |
| 24 | 27 | ||
| 25 | MainWindow::~MainWindow() | 28 | MainWindow::~MainWindow() |
| @@ -27,6 +30,45 @@ MainWindow::~MainWindow() | @@ -27,6 +30,45 @@ MainWindow::~MainWindow() | ||
| 27 | delete ui; | 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 | void MainWindow::showManualCookWindow(Define::Mode mode) | 72 | void MainWindow::showManualCookWindow(Define::Mode mode) |
| 31 | { | 73 | { |
| 32 | ManualCookWindow *w = new ManualCookWindow(this, mode); | 74 | ManualCookWindow *w = new ManualCookWindow(this, mode); |
app/gui/oven_control/mainwindow.h
| @@ -18,6 +18,10 @@ public: | @@ -18,6 +18,10 @@ public: | ||
| 18 | explicit MainWindow(QWidget *parent = 0); | 18 | explicit MainWindow(QWidget *parent = 0); |
| 19 | ~MainWindow(); | 19 | ~MainWindow(); |
| 20 | 20 | ||
| 21 | +protected: | ||
| 22 | + void keyPressEvent(QKeyEvent *event); | ||
| 23 | + void keyReleaseEvent(QKeyEvent *event); | ||
| 24 | + | ||
| 21 | private slots: | 25 | private slots: |
| 22 | void showManualCookWindow(Define::Mode mode); | 26 | void showManualCookWindow(Define::Mode mode); |
| 23 | void showAutoCookSelectionWindow(Define::CookType type); | 27 | void showAutoCookSelectionWindow(Define::CookType type); |
app/gui/oven_control/mainwindow.ui
| @@ -117,7 +117,7 @@ font-size: 30px; | @@ -117,7 +117,7 @@ font-size: 30px; | ||
| 117 | </property> | 117 | </property> |
| 118 | <property name="styleSheet"> | 118 | <property name="styleSheet"> |
| 119 | <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/config.png); } | 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 | </property> | 121 | </property> |
| 122 | <property name="text"> | 122 | <property name="text"> |
| 123 | <string/> | 123 | <string/> |
| @@ -146,7 +146,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/config_ov.png); }</s | @@ -146,7 +146,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/config_ov.png); }</s | ||
| 146 | </property> | 146 | </property> |
| 147 | <property name="styleSheet"> | 147 | <property name="styleSheet"> |
| 148 | <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); } | 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 | </property> | 150 | </property> |
| 151 | <property name="text"> | 151 | <property name="text"> |
| 152 | <string/> | 152 | <string/> |
| @@ -170,7 +170,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</str | @@ -170,7 +170,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</str | ||
| 170 | </property> | 170 | </property> |
| 171 | <property name="styleSheet"> | 171 | <property name="styleSheet"> |
| 172 | <string notr="true">QPushButton { background-image: url(:/images/main_button/multi.png); } | 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 | </property> | 174 | </property> |
| 175 | <property name="text"> | 175 | <property name="text"> |
| 176 | <string>다중요리</string> | 176 | <string>다중요리</string> |
| @@ -196,7 +196,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/multi_ov.png); | @@ -196,7 +196,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/multi_ov.png); | ||
| 196 | </property> | 196 | </property> |
| 197 | <property name="styleSheet"> | 197 | <property name="styleSheet"> |
| 198 | <string notr="true">QPushButton { background-image: url(:/images/main_button/custom.png); } | 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 | </property> | 200 | </property> |
| 201 | <property name="text"> | 201 | <property name="text"> |
| 202 | <string>프로그래밍모드</string> | 202 | <string>프로그래밍모드</string> |
| @@ -222,7 +222,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/custom_ov.png); | @@ -222,7 +222,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/custom_ov.png); | ||
| 222 | </property> | 222 | </property> |
| 223 | <property name="styleSheet"> | 223 | <property name="styleSheet"> |
| 224 | <string notr="true">QPushButton { background-image: url(:/images/main_button/wash.png); } | 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 | </property> | 226 | </property> |
| 227 | <property name="text"> | 227 | <property name="text"> |
| 228 | <string>세척모드</string> | 228 | <string>세척모드</string> |
| @@ -320,7 +320,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/wash_ov.png); } | @@ -320,7 +320,7 @@ QPushButton:pressed { background-image: url(:/images/main_button/wash_ov.png); } | ||
| 320 | </property> | 320 | </property> |
| 321 | <property name="styleSheet"> | 321 | <property name="styleSheet"> |
| 322 | <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_dryheat.png); } | 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 | </property> | 324 | </property> |
| 325 | <property name="text"> | 325 | <property name="text"> |
| 326 | <string>건열</string> | 326 | <string>건열</string> |
| @@ -340,7 +340,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_dryheat_ov.pn | @@ -340,7 +340,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_dryheat_ov.pn | ||
| 340 | </property> | 340 | </property> |
| 341 | <property name="styleSheet"> | 341 | <property name="styleSheet"> |
| 342 | <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_combi.png); } | 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 | </property> | 344 | </property> |
| 345 | <property name="text"> | 345 | <property name="text"> |
| 346 | <string>콤비</string> | 346 | <string>콤비</string> |
| @@ -360,7 +360,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_combi_ov.png) | @@ -360,7 +360,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_combi_ov.png) | ||
| 360 | </property> | 360 | </property> |
| 361 | <property name="styleSheet"> | 361 | <property name="styleSheet"> |
| 362 | <string notr="true">QPushButton { background-image: url(:/images/cook_mode/big_steam.png); } | 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 | </property> | 364 | </property> |
| 365 | <property name="text"> | 365 | <property name="text"> |
| 366 | <string>스팀</string> | 366 | <string>스팀</string> |
| @@ -386,7 +386,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_steam_ov.png) | @@ -386,7 +386,7 @@ QPushButton:pressed { background-image: url(:/images/cook_mode/big_steam_ov.png) | ||
| 386 | </property> | 386 | </property> |
| 387 | <property name="styleSheet"> | 387 | <property name="styleSheet"> |
| 388 | <string notr="true">QPushButton { background-image: url(:/images/cook_type/meat.png); } | 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 | </property> | 390 | </property> |
| 391 | <property name="text"> | 391 | <property name="text"> |
| 392 | <string>육류</string> | 392 | <string>육류</string> |
| @@ -412,7 +412,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/meat_ov.png); }</ | @@ -412,7 +412,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/meat_ov.png); }</ | ||
| 412 | </property> | 412 | </property> |
| 413 | <property name="styleSheet"> | 413 | <property name="styleSheet"> |
| 414 | <string notr="true">QPushButton { background-image: url(:/images/cook_type/desert.png); } | 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 | </property> | 416 | </property> |
| 417 | <property name="text"> | 417 | <property name="text"> |
| 418 | <string>디저트류</string> | 418 | <string>디저트류</string> |
| @@ -438,7 +438,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/desert_ov.png); } | @@ -438,7 +438,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/desert_ov.png); } | ||
| 438 | </property> | 438 | </property> |
| 439 | <property name="styleSheet"> | 439 | <property name="styleSheet"> |
| 440 | <string notr="true">QPushButton { background-image: url(:/images/cook_type/etc.png); } | 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 | </property> | 442 | </property> |
| 443 | <property name="text"> | 443 | <property name="text"> |
| 444 | <string>기타요리</string> | 444 | <string>기타요리</string> |
| @@ -464,7 +464,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/etc_ov.png); }</s | @@ -464,7 +464,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/etc_ov.png); }</s | ||
| 464 | </property> | 464 | </property> |
| 465 | <property name="styleSheet"> | 465 | <property name="styleSheet"> |
| 466 | <string notr="true">QPushButton { background-image: url(:/images/cook_type/vegetable.png); } | 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 | </property> | 468 | </property> |
| 469 | <property name="text"> | 469 | <property name="text"> |
| 470 | <string>채소및곡류</string> | 470 | <string>채소및곡류</string> |
| @@ -490,7 +490,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/vegetable_ov.png) | @@ -490,7 +490,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/vegetable_ov.png) | ||
| 490 | </property> | 490 | </property> |
| 491 | <property name="styleSheet"> | 491 | <property name="styleSheet"> |
| 492 | <string notr="true">QPushButton { background-image: url(:/images/cook_type/poultry.png); } | 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 | </property> | 494 | </property> |
| 495 | <property name="text"> | 495 | <property name="text"> |
| 496 | <string>가금류</string> | 496 | <string>가금류</string> |
| @@ -516,7 +516,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/poultry_ov.png); | @@ -516,7 +516,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/poultry_ov.png); | ||
| 516 | </property> | 516 | </property> |
| 517 | <property name="styleSheet"> | 517 | <property name="styleSheet"> |
| 518 | <string notr="true">QPushButton { background-image: url(:/images/cook_type/fish.png); } | 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 | </property> | 520 | </property> |
| 521 | <property name="text"> | 521 | <property name="text"> |
| 522 | <string>생선류</string> | 522 | <string>생선류</string> |
| @@ -542,7 +542,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/fish_ov.png); }</ | @@ -542,7 +542,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/fish_ov.png); }</ | ||
| 542 | </property> | 542 | </property> |
| 543 | <property name="styleSheet"> | 543 | <property name="styleSheet"> |
| 544 | <string notr="true">QPushButton { background-image: url(:/images/cook_type/bread.png); } | 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 | </property> | 546 | </property> |
| 547 | <property name="text"> | 547 | <property name="text"> |
| 548 | <string>제과제빵류</string> | 548 | <string>제과제빵류</string> |
| @@ -568,7 +568,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/bread_ov.png); }< | @@ -568,7 +568,7 @@ QPushButton:pressed { background-image: url(:/images/cook_type/bread_ov.png); }< | ||
| 568 | </property> | 568 | </property> |
| 569 | <property name="styleSheet"> | 569 | <property name="styleSheet"> |
| 570 | <string notr="true">QPushButton { background-image: url(:/images/cook_type/additional.png); } | 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 | </property> | 572 | </property> |
| 573 | <property name="text"> | 573 | <property name="text"> |
| 574 | <string>부가기능</string> | 574 | <string>부가기능</string> |
| @@ -689,6 +689,24 @@ QPushButton:pressed { background-image: url(:/images/cook_type/additional_ov.png | @@ -689,6 +689,24 @@ QPushButton:pressed { background-image: url(:/images/cook_type/additional_ov.png | ||
| 689 | <container>1</container> | 689 | <container>1</container> |
| 690 | </customwidget> | 690 | </customwidget> |
| 691 | </customwidgets> | 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 | <resources/> | 710 | <resources/> |
| 693 | <connections/> | 711 | <connections/> |
| 694 | </ui> | 712 | </ui> |