Commit 80c5eb48bc4f8b21fcb56ed8e8cf8c8974611dcf
1 parent
ec04831f57
Exists in
master
and in
2 other branches
configwindow 엔코더 1차 적용
- 자동 방법 사용
Showing
7 changed files
with
186 additions
and
6 deletions
Show diff stats
app/gui/oven_control/configpanelbutton.cpp
| @@ -4,6 +4,7 @@ | @@ -4,6 +4,7 @@ | ||
| 4 | #include <QPixmap> | 4 | #include <QPixmap> |
| 5 | #include <QPainter> | 5 | #include <QPainter> |
| 6 | #include <QDebug> | 6 | #include <QDebug> |
| 7 | +#include <QFocusEvent> | ||
| 7 | 8 | ||
| 8 | #include "soundplayer.h" | 9 | #include "soundplayer.h" |
| 9 | 10 | ||
| @@ -35,6 +36,11 @@ ConfigPanelButton::~ConfigPanelButton() | @@ -35,6 +36,11 @@ ConfigPanelButton::~ConfigPanelButton() | ||
| 35 | delete ui; | 36 | delete ui; |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 39 | +bool ConfigPanelButton::isFavoriteFocused() | ||
| 40 | +{ | ||
| 41 | + return (focusWidget() == ui->favoriteButton); | ||
| 42 | +} | ||
| 43 | + | ||
| 38 | void ConfigPanelButton::setText(const QString &text) | 44 | void ConfigPanelButton::setText(const QString &text) |
| 39 | { | 45 | { |
| 40 | if (text_ == text) | 46 | if (text_ == text) |
| @@ -107,6 +113,19 @@ void ConfigPanelButton::setFavoriteCheck(bool checked){ | @@ -107,6 +113,19 @@ void ConfigPanelButton::setFavoriteCheck(bool checked){ | ||
| 107 | ui->favoriteButton->setChecked(checked); | 113 | ui->favoriteButton->setChecked(checked); |
| 108 | } | 114 | } |
| 109 | 115 | ||
| 116 | +void ConfigPanelButton::focusInEvent(QFocusEvent *event) | ||
| 117 | +{ | ||
| 118 | + switch (event->reason()) | ||
| 119 | + { | ||
| 120 | + case Qt::TabFocusReason: | ||
| 121 | + ui->pushButton->setFocus(); | ||
| 122 | + break; | ||
| 123 | + case Qt::BacktabFocusReason: | ||
| 124 | + ui->favoriteButton->setFocus(); | ||
| 125 | + break; | ||
| 126 | + } | ||
| 127 | +} | ||
| 128 | + | ||
| 110 | void ConfigPanelButton::on_favoriteButton_clicked(bool checked) | 129 | void ConfigPanelButton::on_favoriteButton_clicked(bool checked) |
| 111 | { | 130 | { |
| 112 | emit checkButtonClicked(btnid,checked); | 131 | emit checkButtonClicked(btnid,checked); |
app/gui/oven_control/configpanelbutton.h
| @@ -18,6 +18,8 @@ public: | @@ -18,6 +18,8 @@ public: | ||
| 18 | const QString &text() { return text_; } | 18 | const QString &text() { return text_; } |
| 19 | const QString &value() { return value_; } | 19 | const QString &value() { return value_; } |
| 20 | 20 | ||
| 21 | + bool isFavoriteFocused(); | ||
| 22 | + | ||
| 21 | public slots: | 23 | public slots: |
| 22 | void setText(const QString &text); | 24 | void setText(const QString &text); |
| 23 | void setValue(const QString &value); | 25 | void setValue(const QString &value); |
| @@ -26,6 +28,9 @@ public slots: | @@ -26,6 +28,9 @@ public slots: | ||
| 26 | bool isFavoriteChecked(); | 28 | bool isFavoriteChecked(); |
| 27 | void setFavoriteCheck(bool checked); | 29 | void setFavoriteCheck(bool checked); |
| 28 | 30 | ||
| 31 | +protected: | ||
| 32 | + void focusInEvent(QFocusEvent *event); | ||
| 33 | + | ||
| 29 | private: | 34 | private: |
| 30 | Ui::ConfigPanelButton *ui; | 35 | Ui::ConfigPanelButton *ui; |
| 31 | 36 |
app/gui/oven_control/configpanelbutton.ui
| @@ -81,11 +81,11 @@ QPushButton:focus { background-image: url(:/images/config/pannel_ov.png); }</str | @@ -81,11 +81,11 @@ QPushButton:focus { background-image: url(:/images/config/pannel_ov.png); }</str | ||
| 81 | </rect> | 81 | </rect> |
| 82 | </property> | 82 | </property> |
| 83 | <property name="focusPolicy"> | 83 | <property name="focusPolicy"> |
| 84 | - <enum>Qt::NoFocus</enum> | 84 | + <enum>Qt::TabFocus</enum> |
| 85 | </property> | 85 | </property> |
| 86 | <property name="styleSheet"> | 86 | <property name="styleSheet"> |
| 87 | <string notr="true">QPushButton { background-image: url(:/images/config/088_fava_02.png); } | 87 | <string notr="true">QPushButton { background-image: url(:/images/config/088_fava_02.png); } |
| 88 | -QPushButton:checked { background-image: url(:/images/config/088_fava_01.png); }</string> | 88 | +QPushButton:checked, QPushButton:focus { background-image: url(:/images/config/088_fava_01.png); }</string> |
| 89 | </property> | 89 | </property> |
| 90 | <property name="text"> | 90 | <property name="text"> |
| 91 | <string/> | 91 | <string/> |
app/gui/oven_control/configwindow.cpp
| @@ -59,6 +59,137 @@ void ConfigWindow::on_pushButton_clicked() | @@ -59,6 +59,137 @@ void ConfigWindow::on_pushButton_clicked() | ||
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | +void ConfigWindow::prevFocus(){ | ||
| 63 | + if(focusWidget() == ui->helpButton) { | ||
| 64 | + qDebug() << "help"; | ||
| 65 | + ui->washButton->setFocus(); | ||
| 66 | + } | ||
| 67 | + else if(focusWidget() == ui->washButton){ | ||
| 68 | + ui->backButton->setFocus(); | ||
| 69 | + } | ||
| 70 | + else if(focusWidget() == ui->backButton){ | ||
| 71 | + m_vectorMenuList[m_vectorMenuList.size()-1]->setFocus(); | ||
| 72 | + nextFocus(); | ||
| 73 | + nextFocus(); | ||
| 74 | + //prevFocus(); | ||
| 75 | + //focusPreviousChild(); | ||
| 76 | + //qDebug << focusWidget()->wind | ||
| 77 | + } | ||
| 78 | + else if(focusWidget() == ui->scrollArea){ | ||
| 79 | + ui->pushButton_3->setFocus(); | ||
| 80 | + } | ||
| 81 | + else if(focusWidget() == ui->pushButton){ | ||
| 82 | + ui->helpButton->setFocus(); | ||
| 83 | + } | ||
| 84 | + else if(focusWidget() == ui->pushButton_8){ | ||
| 85 | + ui->pushButton->setFocus(); | ||
| 86 | + } | ||
| 87 | + else if(focusWidget() == ui->pushButton_7){ | ||
| 88 | + ui->pushButton_8->setFocus(); | ||
| 89 | + } | ||
| 90 | + else if(focusWidget() == ui->pushButton_2){ | ||
| 91 | + ui->pushButton_7->setFocus(); | ||
| 92 | + } | ||
| 93 | + else if(focusWidget() == ui->pushButton_4){ | ||
| 94 | + ui->pushButton_2->setFocus(); | ||
| 95 | + } | ||
| 96 | + else if(focusWidget() == ui->pushButton_5){ | ||
| 97 | + ui->pushButton_4->setFocus(); | ||
| 98 | + } | ||
| 99 | + else if(focusWidget() == ui->pushButton_6){ | ||
| 100 | + ui->pushButton_5->setFocus(); | ||
| 101 | + } | ||
| 102 | + else if(focusWidget() == ui->pushButton_3){ | ||
| 103 | + ui->pushButton_6->setFocus(); | ||
| 104 | + } | ||
| 105 | + else focusPreviousChild(); | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +void ConfigWindow::nextFocus(){ | ||
| 109 | + if(focusWidget() == ui->helpButton) { | ||
| 110 | + qDebug() << "help"; | ||
| 111 | + ui->pushButton->setFocus(); | ||
| 112 | + } | ||
| 113 | + else if(focusWidget() == ui->backButton){ | ||
| 114 | + ui->washButton->setFocus(); | ||
| 115 | + } | ||
| 116 | + else if(focusWidget() == ui->washButton){ | ||
| 117 | + ui->helpButton->setFocus(); | ||
| 118 | + } | ||
| 119 | + else if(focusWidget() == ui->pushButton){ | ||
| 120 | + ui->pushButton_8->setFocus(); | ||
| 121 | + } | ||
| 122 | + else if(focusWidget() == ui->pushButton_8){ | ||
| 123 | + ui->pushButton_7->setFocus(); | ||
| 124 | + } | ||
| 125 | + else if(focusWidget() == ui->pushButton_7){ | ||
| 126 | + ui->pushButton_2->setFocus(); | ||
| 127 | + } | ||
| 128 | + else if(focusWidget() == ui->pushButton_2){ | ||
| 129 | + ui->pushButton_4->setFocus(); | ||
| 130 | + } | ||
| 131 | + else if(focusWidget() == ui->pushButton_4){ | ||
| 132 | + ui->pushButton_5->setFocus(); | ||
| 133 | + } | ||
| 134 | + else if(focusWidget() == ui->pushButton_5){ | ||
| 135 | + ui->pushButton_6->setFocus(); | ||
| 136 | + } | ||
| 137 | + else if(focusWidget() == ui->pushButton_6){ | ||
| 138 | + ui->pushButton_3->setFocus(); | ||
| 139 | + } | ||
| 140 | + else if(focusWidget() == ui->pushButton_3){ | ||
| 141 | + ui->scrollArea->setFocus(); | ||
| 142 | + } | ||
| 143 | + else if(m_vectorMenuList[m_vectorMenuList.size() -1]->isFavoriteFocused()){ | ||
| 144 | + qDebug() << "last Favorite Focused"; | ||
| 145 | + ui->backButton->setFocus(); | ||
| 146 | + } | ||
| 147 | + else focusNextChild(); | ||
| 148 | +} | ||
| 149 | + | ||
| 150 | +void ConfigWindow::keyReleaseEvent(QKeyEvent *event){ | ||
| 151 | + switch (event->key()) | ||
| 152 | + { | ||
| 153 | + case 0x01000030: // Turn left | ||
| 154 | + //focusPreviousChild(); | ||
| 155 | + prevFocus(); | ||
| 156 | + qDebug() << "turn left"; | ||
| 157 | + break; | ||
| 158 | + case 0x01000031: // Push | ||
| 159 | + { | ||
| 160 | + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget()); | ||
| 161 | + if(btn != NULL){ | ||
| 162 | + btn->click(); | ||
| 163 | + } | ||
| 164 | + qDebug() << "pushed "; | ||
| 165 | + break; | ||
| 166 | + } | ||
| 167 | + case 0x01000032: // Turn right | ||
| 168 | + nextFocus(); | ||
| 169 | + qDebug() << "Turn Right"; | ||
| 170 | + break; | ||
| 171 | + } | ||
| 172 | +} | ||
| 173 | + | ||
| 174 | +void ConfigWindow::keyPressEvent(QKeyEvent *event){ | ||
| 175 | + switch (event->key()) | ||
| 176 | + { | ||
| 177 | + case 0x01000030: // Turn left | ||
| 178 | + //focusPreviousChild(); | ||
| 179 | + prevFocus(); | ||
| 180 | + qDebug() << "turn left"; | ||
| 181 | + break; | ||
| 182 | + case 0x01000031: // Push | ||
| 183 | + | ||
| 184 | + qDebug() << "pushed "; | ||
| 185 | + break; | ||
| 186 | + case 0x01000032: // Turn right | ||
| 187 | + nextFocus(); | ||
| 188 | + qDebug() << "Turn Right"; | ||
| 189 | + break; | ||
| 190 | + } | ||
| 191 | +} | ||
| 192 | + | ||
| 62 | void ConfigWindow::on_backButton_clicked() | 193 | void ConfigWindow::on_backButton_clicked() |
| 63 | { | 194 | { |
| 64 | Config* cfg = Config::getInstance(); | 195 | Config* cfg = Config::getInstance(); |
| @@ -187,6 +318,8 @@ void ConfigWindow::reloadUi(void){ | @@ -187,6 +318,8 @@ void ConfigWindow::reloadUi(void){ | ||
| 187 | } | 318 | } |
| 188 | m_vectorFavorMenuList.clear(); | 319 | m_vectorFavorMenuList.clear(); |
| 189 | 320 | ||
| 321 | + | ||
| 322 | + | ||
| 190 | if(m_nCurConfigPos != config_menu_favorite){ | 323 | if(m_nCurConfigPos != config_menu_favorite){ |
| 191 | for(i=0 ; i < m_arrMaxMenuCount[m_nCurConfigPos] ;i++){ | 324 | for(i=0 ; i < m_arrMaxMenuCount[m_nCurConfigPos] ;i++){ |
| 192 | pcb = new ConfigPanelButton(this,m_arrConfigListInfos[m_nCurConfigPos][i]); | 325 | pcb = new ConfigPanelButton(this,m_arrConfigListInfos[m_nCurConfigPos][i]); |
app/gui/oven_control/configwindow.h
| @@ -44,6 +44,9 @@ private: | @@ -44,6 +44,9 @@ private: | ||
| 44 | {config_software_info,config_hotline_chef,config_hotline_service,config_steam_wash,config_demo_mode,config_enter_engineer_mode} | 44 | {config_software_info,config_hotline_chef,config_hotline_service,config_steam_wash,config_demo_mode,config_enter_engineer_mode} |
| 45 | }; | 45 | }; |
| 46 | 46 | ||
| 47 | + void nextFocus(); | ||
| 48 | + void prevFocus(); | ||
| 49 | + | ||
| 47 | public: | 50 | public: |
| 48 | explicit ConfigWindow(QWidget *parent = 0); | 51 | explicit ConfigWindow(QWidget *parent = 0); |
| 49 | ~ConfigWindow(); | 52 | ~ConfigWindow(); |
| @@ -77,11 +80,16 @@ public slots: | @@ -77,11 +80,16 @@ public slots: | ||
| 77 | void onConfigCheckBtnClicked(uint16_t id, bool checked); | 80 | void onConfigCheckBtnClicked(uint16_t id, bool checked); |
| 78 | void onDeleteFavoriteBtnClicked(uint16_t id); | 81 | void onDeleteFavoriteBtnClicked(uint16_t id); |
| 79 | 82 | ||
| 83 | +protected: | ||
| 84 | + void keyReleaseEvent(QKeyEvent* event); | ||
| 85 | + void keyPressEvent(QKeyEvent* event); | ||
| 86 | + | ||
| 80 | private: | 87 | private: |
| 81 | Ui::ConfigWindow *ui; | 88 | Ui::ConfigWindow *ui; |
| 82 | QVector<ConfigPanelButton *> m_vectorMenuList; | 89 | QVector<ConfigPanelButton *> m_vectorMenuList; |
| 83 | QVector<ConfigFavoriteButton*> m_vectorFavorMenuList; | 90 | QVector<ConfigFavoriteButton*> m_vectorFavorMenuList; |
| 84 | CONFIG_MENU_POS m_nCurConfigPos; | 91 | CONFIG_MENU_POS m_nCurConfigPos; |
| 92 | + | ||
| 85 | }; | 93 | }; |
| 86 | 94 | ||
| 87 | #endif // CONFIGWINDOW_H | 95 | #endif // CONFIGWINDOW_H |
app/gui/oven_control/configwindow.ui
| @@ -441,7 +441,7 @@ QPushButton:pressed, QPushButton:focus ,QPushButton:checked{ background-image: u | @@ -441,7 +441,7 @@ QPushButton:pressed, QPushButton:focus ,QPushButton:checked{ background-image: u | ||
| 441 | </property> | 441 | </property> |
| 442 | <property name="styleSheet"> | 442 | <property name="styleSheet"> |
| 443 | <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/back.png); } | 443 | <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/back.png); } |
| 444 | -QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); }</string> | 444 | +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/back_ov.png); }</string> |
| 445 | </property> | 445 | </property> |
| 446 | <property name="text"> | 446 | <property name="text"> |
| 447 | <string/> | 447 | <string/> |
| @@ -458,7 +458,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); }</str | @@ -458,7 +458,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); }</str | ||
| 458 | </property> | 458 | </property> |
| 459 | <property name="styleSheet"> | 459 | <property name="styleSheet"> |
| 460 | <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/wash.png); } | 460 | <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/wash.png); } |
| 461 | -QPushButton:pressed { border-image: url(:/images/bottom_bar/wash_ov.png); }</string> | 461 | +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/wash_ov.png); }</string> |
| 462 | </property> | 462 | </property> |
| 463 | <property name="text"> | 463 | <property name="text"> |
| 464 | <string/> | 464 | <string/> |
| @@ -475,7 +475,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/wash_ov.png); }</str | @@ -475,7 +475,7 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/wash_ov.png); }</str | ||
| 475 | </property> | 475 | </property> |
| 476 | <property name="styleSheet"> | 476 | <property name="styleSheet"> |
| 477 | <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); } | 477 | <string notr="true">QPushButton { border-image: url(:/images/bottom_bar/help.png); } |
| 478 | -QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</string> | 478 | +QPushButton:pressed , QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); }</string> |
| 479 | </property> | 479 | </property> |
| 480 | <property name="text"> | 480 | <property name="text"> |
| 481 | <string/> | 481 | <string/> |
| @@ -491,6 +491,9 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</str | @@ -491,6 +491,9 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</str | ||
| 491 | <height>600</height> | 491 | <height>600</height> |
| 492 | </rect> | 492 | </rect> |
| 493 | </property> | 493 | </property> |
| 494 | + <property name="focusPolicy"> | ||
| 495 | + <enum>Qt::TabFocus</enum> | ||
| 496 | + </property> | ||
| 494 | <property name="styleSheet"> | 497 | <property name="styleSheet"> |
| 495 | <string notr="true">background-color : transparent;</string> | 498 | <string notr="true">background-color : transparent;</string> |
| 496 | </property> | 499 | </property> |
| @@ -558,6 +561,19 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</str | @@ -558,6 +561,19 @@ QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); }</str | ||
| 558 | <header>washwarnicon.h</header> | 561 | <header>washwarnicon.h</header> |
| 559 | </customwidget> | 562 | </customwidget> |
| 560 | </customwidgets> | 563 | </customwidgets> |
| 564 | + <tabstops> | ||
| 565 | + <tabstop>pushButton</tabstop> | ||
| 566 | + <tabstop>backButton</tabstop> | ||
| 567 | + <tabstop>pushButton_8</tabstop> | ||
| 568 | + <tabstop>washButton</tabstop> | ||
| 569 | + <tabstop>pushButton_7</tabstop> | ||
| 570 | + <tabstop>helpButton</tabstop> | ||
| 571 | + <tabstop>pushButton_2</tabstop> | ||
| 572 | + <tabstop>pushButton_4</tabstop> | ||
| 573 | + <tabstop>pushButton_5</tabstop> | ||
| 574 | + <tabstop>pushButton_6</tabstop> | ||
| 575 | + <tabstop>pushButton_3</tabstop> | ||
| 576 | + </tabstops> | ||
| 561 | <resources/> | 577 | <resources/> |
| 562 | <connections/> | 578 | <connections/> |
| 563 | </ui> | 579 | </ui> |
app/gui/oven_control/electricmodelsettingwindow.cpp
| @@ -34,7 +34,6 @@ ElectricModelSettingWindow::ElectricModelSettingWindow(QWidget *parent) : | @@ -34,7 +34,6 @@ ElectricModelSettingWindow::ElectricModelSettingWindow(QWidget *parent) : | ||
| 34 | ui->e40Button->setChecked(true); | 34 | ui->e40Button->setChecked(true); |
| 35 | break; | 35 | break; |
| 36 | } | 36 | } |
| 37 | - | ||
| 38 | } | 37 | } |
| 39 | 38 | ||
| 40 | ElectricModelSettingWindow::~ElectricModelSettingWindow() | 39 | ElectricModelSettingWindow::~ElectricModelSettingWindow() |