Commit 40f5d047f8a7f59138448914b37e51a5f249c122

Authored by 고영탁
1 parent 80c5eb48bc
Exists in master and in 2 other branches fhd, fhd-demo

엔코더 작업 진행 중

 - 설정, 음향관리, 시스템관리 엔코더 적용
 - 키보드 사용 설정은 제외
app/gui/oven_control/configbacklightdlg.cpp
... ... @@ -19,6 +19,8 @@ ConfigBackLightDlg::ConfigBackLightDlg(QWidget *parent) :
19 19 ui->setupUi(this);
20 20 this->setWindowFlags( Qt::FramelessWindowHint);
21 21 this->setAttribute( Qt::WA_DeleteOnClose);
  22 + qApp->setActiveWindow(this);
  23 + this->setFocus();
22 24  
23 25 foreach (QPushButton *button, findChildren<QPushButton *>())
24 26 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
... ... @@ -28,6 +30,11 @@ ConfigBackLightDlg::ConfigBackLightDlg(QWidget *parent) :
28 30 m_nSelBackLight = item.d32;
29 31 ui->ctrProgressLight->setMaxProgress(0,MAX_LIGHT);
30 32 ui->ctrProgressLight->setCurrentProgress(m_nSelBackLight);
  33 + m_vectorTabOrder.append(this);
  34 + m_vectorTabOrder.append(ui->ctrBtnPlus);
  35 + m_vectorTabOrder.append(ui->ctrBtnMinus);
  36 + m_vectorTabOrder.append(ui->ctrBtnOk);
  37 + m_vectorTabOrder.append(ui->ctrBtnCancel);
31 38 }
32 39  
33 40 ConfigBackLightDlg::~ConfigBackLightDlg()
... ... @@ -78,3 +85,100 @@ void ConfigBackLightDlg::on_ctrBtnMinus_clicked()
78 85  
79 86 Backlight::set(m_nSelBackLight);
80 87 }
  88 +
  89 +void ConfigBackLightDlg::keyPressEvent(QKeyEvent *event){
  90 + int i = 0;
  91 + switch (event->key())
  92 + {
  93 + case 0x01000030: // Turn left
  94 + for(i = 0; i < m_vectorTabOrder.size();i++){
  95 + if(focusWidget() == m_vectorTabOrder[i]) break;
  96 + }
  97 +
  98 + if(i==0){
  99 + i = m_vectorTabOrder.size()-1;
  100 + m_vectorTabOrder[i]->setFocus();
  101 + }
  102 + else if(i < m_vectorTabOrder.size()) {
  103 + i = i - 1;
  104 + m_vectorTabOrder[i]->setFocus();
  105 + }
  106 + else{
  107 + i=0;
  108 + m_vectorTabOrder[i]->setFocus();
  109 + }
  110 + break;
  111 + case 0x01000031: // Push
  112 +
  113 + break;
  114 + case 0x01000032: // Turn right
  115 + for(i = 0; i < m_vectorTabOrder.size();i++){
  116 + if(focusWidget() == m_vectorTabOrder[i]) break;
  117 + }
  118 +
  119 + if(i<m_vectorTabOrder.size()-1){
  120 + i+=1;
  121 + m_vectorTabOrder[i]->setFocus();
  122 + }
  123 + else if(i== (m_vectorTabOrder.size()-1)){
  124 + i=0;
  125 + m_vectorTabOrder[i]->setFocus();
  126 + }
  127 + else{
  128 + i=0;
  129 + m_vectorTabOrder[i]->setFocus();
  130 + }
  131 + break;
  132 + }
  133 +}
  134 +
  135 +void ConfigBackLightDlg::keyReleaseEvent(QKeyEvent *event){
  136 + int i = 0;
  137 + switch (event->key())
  138 + {
  139 + case 0x01000030: // Turn left
  140 + for(i = 0; i < m_vectorTabOrder.size();i++){
  141 + if(focusWidget() == m_vectorTabOrder[i]) break;
  142 + }
  143 +
  144 + if(i==0){
  145 + i = m_vectorTabOrder.size()-1;
  146 + m_vectorTabOrder[i]->setFocus();
  147 + }
  148 + else if(i < m_vectorTabOrder.size()) {
  149 + i = i - 1;
  150 + m_vectorTabOrder[i]->setFocus();
  151 + }
  152 + else{
  153 + i=0;
  154 + m_vectorTabOrder[i]->setFocus();
  155 + }
  156 + break;
  157 + case 0x01000031: // Push
  158 + {
  159 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  160 + if(btn != NULL){
  161 + btn->click();
  162 + }
  163 + break;
  164 + }
  165 + case 0x01000032: // Turn right
  166 + for(i = 0; i < m_vectorTabOrder.size();i++){
  167 + if(focusWidget() == m_vectorTabOrder[i]) break;
  168 + }
  169 +
  170 + if(i<m_vectorTabOrder.size()-1){
  171 + i+=1;
  172 + m_vectorTabOrder[i]->setFocus();
  173 + }
  174 + else if(i== (m_vectorTabOrder.size()-1)){
  175 + i=0;
  176 + m_vectorTabOrder[i]->setFocus();
  177 + }
  178 + else{
  179 + i=0;
  180 + m_vectorTabOrder[i]->setFocus();
  181 + }
  182 + break;
  183 + }
  184 +}
... ...
app/gui/oven_control/configbacklightdlg.h
... ... @@ -2,6 +2,8 @@
2 2 #define CONFIGBACKLIGHTDLG_H
3 3  
4 4 #include <QDialog>
  5 +#include <QKeyEvent>
  6 +#include <QVector>
5 7  
6 8 namespace Ui {
7 9 class ConfigBackLightDlg;
... ... @@ -26,9 +28,14 @@ private slots:
26 28  
27 29 void on_ctrBtnMinus_clicked();
28 30  
  31 +protected:
  32 + void keyReleaseEvent(QKeyEvent* event);
  33 + void keyPressEvent(QKeyEvent* event);
  34 +
29 35 private:
30 36 Ui::ConfigBackLightDlg *ui;
31 37 int m_nSelBackLight;
  38 + QVector<QWidget*> m_vectorTabOrder;
32 39 };
33 40  
34 41 #endif // CONFIGBACKLIGHTDLG_H
... ...
app/gui/oven_control/configfavoritebutton.cpp
... ... @@ -23,6 +23,15 @@ void ConfigFavoriteButton::setText(const QString &amp;text){
23 23 ui->pushButton->setText(text);
24 24 }
25 25  
  26 +QWidget *ConfigFavoriteButton::getBtn()
  27 +{
  28 + return ui->pushButton;
  29 +}
  30 +
  31 +QWidget* ConfigFavoriteButton::getDelBtn(){
  32 + return ui->favoriteButton;
  33 +}
  34 +
26 35  
27 36  
28 37 void ConfigFavoriteButton::on_favoriteButton_clicked()
... ...
app/gui/oven_control/configfavoritebutton.h
... ... @@ -16,6 +16,9 @@ public:
16 16 ~ConfigFavoriteButton();
17 17 void setText(const QString &text);
18 18  
  19 + QWidget* getBtn();
  20 + QWidget* getDelBtn();
  21 +
19 22  
20 23 private:
21 24 Ui::ConfigFavoriteButton *ui;
... ...
app/gui/oven_control/configfileprocessdlg.cpp
... ... @@ -14,6 +14,8 @@ ConfigFileProcessDlg::ConfigFileProcessDlg(QWidget *parent, ConfigType type, boo
14 14 setAttribute(Qt::WA_NoSystemBackground);
15 15 setAttribute(Qt::WA_TranslucentBackground);
16 16 setAttribute(Qt::WA_DeleteOnClose);
  17 + qApp->setActiveWindow(this);
  18 + this->setFocus();
17 19  
18 20 foreach (QPushButton *button, findChildren<QPushButton *>())
19 21 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
... ... @@ -53,3 +55,42 @@ void ConfigFileProcessDlg::on_ctrBtnCancel_clicked()
53 55 {
54 56 deleteLater();
55 57 }
  58 +
  59 +
  60 +void ConfigFileProcessDlg::keyPressEvent(QKeyEvent *event){
  61 + switch (event->key())
  62 + {
  63 + case 0x01000030: // Turn left
  64 + if(focusWidget() == ui->ctrBtnOk) ui->ctrBtnCancel->setFocus();
  65 + else ui->ctrBtnOk->setFocus();
  66 + break;
  67 + case 0x01000031: // Push
  68 + break;
  69 + case 0x01000032: // Turn right
  70 + if(focusWidget() == ui->ctrBtnOk) ui->ctrBtnCancel->setFocus();
  71 + else ui->ctrBtnOk->setFocus();
  72 + break;
  73 + }
  74 +}
  75 +
  76 +void ConfigFileProcessDlg::keyReleaseEvent(QKeyEvent *event){
  77 + switch (event->key())
  78 + {
  79 + case 0x01000030: // Turn left
  80 + if(focusWidget() == ui->ctrBtnOk) ui->ctrBtnCancel->setFocus();
  81 + else ui->ctrBtnOk->setFocus();
  82 + break;
  83 + case 0x01000031: // Push
  84 + {
  85 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  86 + if(btn != NULL){
  87 + btn->click();
  88 + }
  89 + break;
  90 + }
  91 + case 0x01000032: // Turn right
  92 + if(focusWidget() == ui->ctrBtnOk) ui->ctrBtnCancel->setFocus();
  93 + else ui->ctrBtnOk->setFocus();
  94 + break;
  95 + }
  96 +}
... ...
app/gui/oven_control/configfileprocessdlg.h
... ... @@ -2,6 +2,7 @@
2 2 #define CONFIGFILEPROCESSDLG_H
3 3  
4 4 #include <QDialog>
  5 +#include <QKeyEvent>
5 6 #include "config.h"
6 7  
7 8 using namespace Define;
... ... @@ -23,6 +24,10 @@ private slots:
23 24  
24 25 void on_ctrBtnCancel_clicked();
25 26  
  27 +protected:
  28 + void keyReleaseEvent(QKeyEvent* event);
  29 + void keyPressEvent(QKeyEvent* event);
  30 +
26 31 private:
27 32 Ui::ConfigFileProcessDlg *ui;
28 33 ConfigType m_nCfgtype;
... ...
app/gui/oven_control/configlanguagedlg.cpp
... ... @@ -10,8 +10,11 @@ ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) :
10 10 ui(new Ui::ConfigLanguageDlg)
11 11 {
12 12 ui->setupUi(this);
13   - this->setWindowFlags( Qt::FramelessWindowHint);
  13 + this->setWindowFlags(Qt::FramelessWindowHint);
14 14 this->setAttribute( Qt::WA_DeleteOnClose);
  15 + qApp->setActiveWindow(this);
  16 + this->setFocus();
  17 +
15 18  
16 19 foreach (QPushButton *button, findChildren<QPushButton *>())
17 20 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
... ... @@ -38,6 +41,13 @@ ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) :
38 41  
39 42 connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int)));
40 43  
  44 + m_vectorTabOrder.append(this);
  45 + m_vectorTabOrder.append(ui->pushButton_1);
  46 + m_vectorTabOrder.append(ui->pushButton_2);
  47 + m_vectorTabOrder.append(ui->pushButton_3);
  48 + m_vectorTabOrder.append(ui->ctrBtnOk);
  49 + m_vectorTabOrder.append(ui->ctrBtnCancel);
  50 + reloadUi();
41 51 }
42 52  
43 53 ConfigLanguageDlg::~ConfigLanguageDlg()
... ... @@ -78,3 +88,100 @@ void ConfigLanguageDlg::reloadUi(){
78 88 break;
79 89 }
80 90 }
  91 +
  92 +void ConfigLanguageDlg::keyPressEvent(QKeyEvent *event){
  93 + int i = 0;
  94 + switch (event->key())
  95 + {
  96 + case 0x01000030: // Turn left
  97 + for(i = 0; i < m_vectorTabOrder.size();i++){
  98 + if(focusWidget() == m_vectorTabOrder[i]) break;
  99 + }
  100 +
  101 + if(i==0){
  102 + i = m_vectorTabOrder.size()-1;
  103 + m_vectorTabOrder[i]->setFocus();
  104 + }
  105 + else if(i < m_vectorTabOrder.size()) {
  106 + i = i - 1;
  107 + m_vectorTabOrder[i]->setFocus();
  108 + }
  109 + else{
  110 + i=0;
  111 + m_vectorTabOrder[i]->setFocus();
  112 + }
  113 + break;
  114 + case 0x01000031: // Push
  115 +
  116 + break;
  117 + case 0x01000032: // Turn right
  118 + for(i = 0; i < m_vectorTabOrder.size();i++){
  119 + if(focusWidget() == m_vectorTabOrder[i]) break;
  120 + }
  121 +
  122 + if(i<m_vectorTabOrder.size()-1){
  123 + i+=1;
  124 + m_vectorTabOrder[i]->setFocus();
  125 + }
  126 + else if(i== (m_vectorTabOrder.size()-1)){
  127 + i=0;
  128 + m_vectorTabOrder[i]->setFocus();
  129 + }
  130 + else{
  131 + i=0;
  132 + m_vectorTabOrder[i]->setFocus();
  133 + }
  134 + break;
  135 + }
  136 +}
  137 +
  138 +void ConfigLanguageDlg::keyReleaseEvent(QKeyEvent *event){
  139 + int i = 0;
  140 + switch (event->key())
  141 + {
  142 + case 0x01000030: // Turn left
  143 + for(i = 0; i < m_vectorTabOrder.size();i++){
  144 + if(focusWidget() == m_vectorTabOrder[i]) break;
  145 + }
  146 +
  147 + if(i==0){
  148 + i = m_vectorTabOrder.size()-1;
  149 + m_vectorTabOrder[i]->setFocus();
  150 + }
  151 + else if(i < m_vectorTabOrder.size()) {
  152 + i = i - 1;
  153 + m_vectorTabOrder[i]->setFocus();
  154 + }
  155 + else{
  156 + i=0;
  157 + m_vectorTabOrder[i]->setFocus();
  158 + }
  159 + break;
  160 + case 0x01000031: // Push
  161 + {
  162 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  163 + if(btn != NULL){
  164 + btn->click();
  165 + }
  166 + break;
  167 + }
  168 + case 0x01000032: // Turn right
  169 + for(i = 0; i < m_vectorTabOrder.size();i++){
  170 + if(focusWidget() == m_vectorTabOrder[i]) break;
  171 + }
  172 +
  173 + if(i<m_vectorTabOrder.size()-1){
  174 + i+=1;
  175 + m_vectorTabOrder[i]->setFocus();
  176 + }
  177 + else if(i== (m_vectorTabOrder.size()-1)){
  178 + i=0;
  179 + m_vectorTabOrder[i]->setFocus();
  180 + }
  181 + else{
  182 + i=0;
  183 + m_vectorTabOrder[i]->setFocus();
  184 + }
  185 + break;
  186 + }
  187 +}
... ...
app/gui/oven_control/configlanguagedlg.h
... ... @@ -3,6 +3,8 @@
3 3  
4 4 #include <QDialog>
5 5 #include <QSignalMapper>
  6 +#include <QKeyEvent>
  7 +#include <QVector>
6 8  
7 9 namespace Ui {
8 10 class ConfigLanguageDlg;
... ... @@ -24,10 +26,15 @@ private slots:
24 26  
25 27 void onConfigBtnClicked(const int sel);
26 28  
  29 +protected:
  30 + void keyReleaseEvent(QKeyEvent* event);
  31 + void keyPressEvent(QKeyEvent* event);
  32 +
27 33 private:
28 34 Ui::ConfigLanguageDlg *ui;
29 35 QSignalMapper *m_pSignalMapper;
30 36 int m_nCurSelLang;
  37 + QVector<QWidget*> m_vectorTabOrder;
31 38 };
32 39  
33 40 #endif // CONFIGLANGUAGEDLG_H
... ...
app/gui/oven_control/configlanguagedlg.ui
... ... @@ -10,6 +10,9 @@
10 10 <height>1600</height>
11 11 </rect>
12 12 </property>
  13 + <property name="focusPolicy">
  14 + <enum>Qt::StrongFocus</enum>
  15 + </property>
13 16 <property name="autoFillBackground">
14 17 <bool>false</bool>
15 18 </property>
... ... @@ -55,6 +58,9 @@ QLabel{
55 58 <height>450</height>
56 59 </size>
57 60 </property>
  61 + <property name="focusPolicy">
  62 + <enum>Qt::TabFocus</enum>
  63 + </property>
58 64 <layout class="QVBoxLayout" name="verticalLayout_3" stretch="92,0,264,88">
59 65 <item>
60 66 <widget class="QLabel" name="label">
... ... @@ -252,6 +258,14 @@ QLabel{
252 258 </layout>
253 259 </widget>
254 260 </widget>
  261 + <tabstops>
  262 + <tabstop>pushButton_1</tabstop>
  263 + <tabstop>ctrBtnOk</tabstop>
  264 + <tabstop>pushButton_2</tabstop>
  265 + <tabstop>ctrBtnCancel</tabstop>
  266 + <tabstop>pushButton_3</tabstop>
  267 + <tabstop>centralwidget</tabstop>
  268 + </tabstops>
255 269 <resources/>
256 270 <connections/>
257 271 </ui>
... ...
app/gui/oven_control/configmastervolumedlg.cpp
... ... @@ -16,6 +16,8 @@ ConfigVolumeDlg::ConfigVolumeDlg(QWidget *parent, ConfigType type) :
16 16 ui->setupUi(this);
17 17 this->setWindowFlags( Qt::FramelessWindowHint);
18 18 this->setAttribute( Qt::WA_DeleteOnClose);
  19 + qApp->setActiveWindow(this);
  20 + this->setFocus();
19 21  
20 22 foreach (QPushButton *button, findChildren<QPushButton *>())
21 23 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
... ... @@ -30,6 +32,12 @@ ConfigVolumeDlg::ConfigVolumeDlg(QWidget *parent, ConfigType type) :
30 32 item = cfg->getConfigValue(m_cfgType);
31 33 m_nPrevVol = m_nCurVol = item.d32;
32 34 ui->ctrProgressLight->setMaxProgress(m_nCurVol,MAX_VOL);
  35 +
  36 + m_vectorTabOrder.append(this);
  37 + m_vectorTabOrder.append(ui->ctrBtnMinus);
  38 + m_vectorTabOrder.append(ui->ctrBtnPlus);
  39 + m_vectorTabOrder.append(ui->ctrBtnOk);
  40 + m_vectorTabOrder.append(ui->ctrBtnCancel);
33 41 }
34 42  
35 43 ConfigVolumeDlg::~ConfigVolumeDlg()
... ... @@ -74,3 +82,100 @@ void ConfigVolumeDlg::on_ctrBtnPlus_clicked()
74 82  
75 83 SoundPlayer::playClick();
76 84 }
  85 +
  86 +void ConfigVolumeDlg::keyPressEvent(QKeyEvent *event){
  87 + int i = 0;
  88 + switch (event->key())
  89 + {
  90 + case 0x01000030: // Turn left
  91 + for(i = 0; i < m_vectorTabOrder.size();i++){
  92 + if(focusWidget() == m_vectorTabOrder[i]) break;
  93 + }
  94 +
  95 + if(i==0){
  96 + i = m_vectorTabOrder.size()-1;
  97 + m_vectorTabOrder[i]->setFocus();
  98 + }
  99 + else if(i < m_vectorTabOrder.size()) {
  100 + i = i - 1;
  101 + m_vectorTabOrder[i]->setFocus();
  102 + }
  103 + else{
  104 + i=0;
  105 + m_vectorTabOrder[i]->setFocus();
  106 + }
  107 + break;
  108 + case 0x01000031: // Push
  109 +
  110 + break;
  111 + case 0x01000032: // Turn right
  112 + for(i = 0; i < m_vectorTabOrder.size();i++){
  113 + if(focusWidget() == m_vectorTabOrder[i]) break;
  114 + }
  115 +
  116 + if(i<m_vectorTabOrder.size()-1){
  117 + i+=1;
  118 + m_vectorTabOrder[i]->setFocus();
  119 + }
  120 + else if(i== (m_vectorTabOrder.size()-1)){
  121 + i=0;
  122 + m_vectorTabOrder[i]->setFocus();
  123 + }
  124 + else{
  125 + i=0;
  126 + m_vectorTabOrder[i]->setFocus();
  127 + }
  128 + break;
  129 + }
  130 +}
  131 +
  132 +void ConfigVolumeDlg::keyReleaseEvent(QKeyEvent *event){
  133 + int i = 0;
  134 + switch (event->key())
  135 + {
  136 + case 0x01000030: // Turn left
  137 + for(i = 0; i < m_vectorTabOrder.size();i++){
  138 + if(focusWidget() == m_vectorTabOrder[i]) break;
  139 + }
  140 +
  141 + if(i==0){
  142 + i = m_vectorTabOrder.size()-1;
  143 + m_vectorTabOrder[i]->setFocus();
  144 + }
  145 + else if(i < m_vectorTabOrder.size()) {
  146 + i = i - 1;
  147 + m_vectorTabOrder[i]->setFocus();
  148 + }
  149 + else{
  150 + i=0;
  151 + m_vectorTabOrder[i]->setFocus();
  152 + }
  153 + break;
  154 + case 0x01000031: // Push
  155 + {
  156 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  157 + if(btn != NULL){
  158 + btn->click();
  159 + }
  160 + break;
  161 + }
  162 + case 0x01000032: // Turn right
  163 + for(i = 0; i < m_vectorTabOrder.size();i++){
  164 + if(focusWidget() == m_vectorTabOrder[i]) break;
  165 + }
  166 +
  167 + if(i<m_vectorTabOrder.size()-1){
  168 + i+=1;
  169 + m_vectorTabOrder[i]->setFocus();
  170 + }
  171 + else if(i== (m_vectorTabOrder.size()-1)){
  172 + i=0;
  173 + m_vectorTabOrder[i]->setFocus();
  174 + }
  175 + else{
  176 + i=0;
  177 + m_vectorTabOrder[i]->setFocus();
  178 + }
  179 + break;
  180 + }
  181 +}
... ...
app/gui/oven_control/configmastervolumedlg.h
... ... @@ -2,6 +2,8 @@
2 2 #define CONFIGMASTERVOLUMEDLG_H
3 3  
4 4 #include <QDialog>
  5 +#include <QKeyEvent>
  6 +#include <QVector>
5 7 #include "config.h"
6 8  
7 9 using namespace Define;
... ... @@ -27,11 +29,16 @@ private slots:
27 29  
28 30 void on_ctrBtnPlus_clicked();
29 31  
  32 +protected:
  33 + void keyReleaseEvent(QKeyEvent* event);
  34 + void keyPressEvent(QKeyEvent* event);
  35 +
30 36 private:
31 37 Ui::ConfigMasterVolumeDlg *ui;
32 38 int m_nCurVol;
33 39 int m_nPrevVol;
34 40 ConfigType m_cfgType;
  41 + QVector<QWidget*> m_vectorTabOrder;
35 42 };
36 43  
37 44 #endif // CONFIGMASTERVOLUMEDLG_H
... ...
app/gui/oven_control/configpanelbutton.cpp
... ... @@ -41,6 +41,15 @@ bool ConfigPanelButton::isFavoriteFocused()
41 41 return (focusWidget() == ui->favoriteButton);
42 42 }
43 43  
  44 +QWidget *ConfigPanelButton::getFavoriteBtn()
  45 +{
  46 + return ui->favoriteButton;
  47 +}
  48 +
  49 +QWidget* ConfigPanelButton::getBtn(){
  50 + return ui->pushButton;
  51 +}
  52 +
44 53 void ConfigPanelButton::setText(const QString &text)
45 54 {
46 55 if (text_ == text)
... ...
app/gui/oven_control/configpanelbutton.h
... ... @@ -19,6 +19,8 @@ public:
19 19 const QString &value() { return value_; }
20 20  
21 21 bool isFavoriteFocused();
  22 + QWidget* getFavoriteBtn();
  23 + QWidget* getBtn();
22 24  
23 25 public slots:
24 26 void setText(const QString &text);
... ...
app/gui/oven_control/configresttimeformatdlg.cpp
... ... @@ -16,6 +16,8 @@ configResttimeFormatDlg::configResttimeFormatDlg(QWidget *parent) :
16 16 ui->setupUi(this);
17 17 this->setWindowFlags( Qt::FramelessWindowHint);
18 18 this->setAttribute( Qt::WA_DeleteOnClose);
  19 + qApp->setActiveWindow(this);
  20 + this->setFocus();
19 21  
20 22 foreach (QPushButton *button, findChildren<QPushButton *>())
21 23 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
... ... @@ -33,6 +35,12 @@ configResttimeFormatDlg::configResttimeFormatDlg(QWidget *parent) :
33 35 connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
34 36  
35 37 connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int)));
  38 +
  39 + m_vectorTabOrder.append(this);
  40 + m_vectorTabOrder.append(ui->pushButton_1);
  41 + m_vectorTabOrder.append(ui->pushButton_2);
  42 + m_vectorTabOrder.append(ui->ctrBtnOk);
  43 + m_vectorTabOrder.append(ui->ctrBtnCancel);
36 44 }
37 45  
38 46 configResttimeFormatDlg::~configResttimeFormatDlg()
... ... @@ -71,3 +79,100 @@ void configResttimeFormatDlg::reloadUi(){
71 79 }
72 80 }
73 81  
  82 +void configResttimeFormatDlg::keyPressEvent(QKeyEvent *event){
  83 + int i = 0;
  84 + switch (event->key())
  85 + {
  86 + case 0x01000030: // Turn left
  87 + for(i = 0; i < m_vectorTabOrder.size();i++){
  88 + if(focusWidget() == m_vectorTabOrder[i]) break;
  89 + }
  90 +
  91 + if(i==0){
  92 + i = m_vectorTabOrder.size()-1;
  93 + m_vectorTabOrder[i]->setFocus();
  94 + }
  95 + else if(i < m_vectorTabOrder.size()) {
  96 + i = i - 1;
  97 + m_vectorTabOrder[i]->setFocus();
  98 + }
  99 + else{
  100 + i=0;
  101 + m_vectorTabOrder[i]->setFocus();
  102 + }
  103 + break;
  104 + case 0x01000031: // Push
  105 +
  106 + break;
  107 + case 0x01000032: // Turn right
  108 + for(i = 0; i < m_vectorTabOrder.size();i++){
  109 + if(focusWidget() == m_vectorTabOrder[i]) break;
  110 + }
  111 +
  112 + if(i<m_vectorTabOrder.size()-1){
  113 + i+=1;
  114 + m_vectorTabOrder[i]->setFocus();
  115 + }
  116 + else if(i== (m_vectorTabOrder.size()-1)){
  117 + i=0;
  118 + m_vectorTabOrder[i]->setFocus();
  119 + }
  120 + else{
  121 + i=0;
  122 + m_vectorTabOrder[i]->setFocus();
  123 + }
  124 + break;
  125 + }
  126 +}
  127 +
  128 +void configResttimeFormatDlg::keyReleaseEvent(QKeyEvent *event){
  129 + int i = 0;
  130 + switch (event->key())
  131 + {
  132 + case 0x01000030: // Turn left
  133 + for(i = 0; i < m_vectorTabOrder.size();i++){
  134 + if(focusWidget() == m_vectorTabOrder[i]) break;
  135 + }
  136 +
  137 + if(i==0){
  138 + i = m_vectorTabOrder.size()-1;
  139 + m_vectorTabOrder[i]->setFocus();
  140 + }
  141 + else if(i < m_vectorTabOrder.size()) {
  142 + i = i - 1;
  143 + m_vectorTabOrder[i]->setFocus();
  144 + }
  145 + else{
  146 + i=0;
  147 + m_vectorTabOrder[i]->setFocus();
  148 + }
  149 + break;
  150 + case 0x01000031: // Push
  151 + {
  152 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  153 + if(btn != NULL){
  154 + btn->click();
  155 + }
  156 + break;
  157 + }
  158 + case 0x01000032: // Turn right
  159 + for(i = 0; i < m_vectorTabOrder.size();i++){
  160 + if(focusWidget() == m_vectorTabOrder[i]) break;
  161 + }
  162 +
  163 + if(i<m_vectorTabOrder.size()-1){
  164 + i+=1;
  165 + m_vectorTabOrder[i]->setFocus();
  166 + }
  167 + else if(i== (m_vectorTabOrder.size()-1)){
  168 + i=0;
  169 + m_vectorTabOrder[i]->setFocus();
  170 + }
  171 + else{
  172 + i=0;
  173 + m_vectorTabOrder[i]->setFocus();
  174 + }
  175 + break;
  176 + }
  177 +}
  178 +
... ...
app/gui/oven_control/configresttimeformatdlg.h
... ... @@ -3,6 +3,8 @@
3 3  
4 4 #include <QDialog>
5 5 #include <QSignalMapper>
  6 +#include <QKeyEvent>
  7 +#include <QVector>
6 8  
7 9 namespace Ui {
8 10 class configResttimeFormatDlg;
... ... @@ -26,10 +28,15 @@ private slots:
26 28 public slots:
27 29 void onConfigBtnClicked(const int sel);
28 30  
  31 +protected:
  32 + void keyReleaseEvent(QKeyEvent* event);
  33 + void keyPressEvent(QKeyEvent* event);
  34 +
29 35 private:
30 36 Ui::configResttimeFormatDlg *ui;
31 37 QSignalMapper *m_pSignalMapper;
32 38 int m_nCurSel;
  39 + QVector<QWidget*> m_vectorTabOrder;
33 40 };
34 41  
35 42 #endif // CONFIGRESTTIMEFORMATDLG_H
... ...
app/gui/oven_control/configsoundselelectdlg.cpp
... ... @@ -15,6 +15,8 @@ ConfigSoundSelelectDlg::ConfigSoundSelelectDlg(QWidget *parent, ConfigType cfgty
15 15 setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
16 16 setAttribute(Qt::WA_NoSystemBackground);
17 17 setAttribute(Qt::WA_TranslucentBackground);
  18 + qApp->setActiveWindow(this);
  19 + this->setFocus();
18 20  
19 21 foreach (QPushButton *button, findChildren<QPushButton *>())
20 22 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
... ... @@ -72,6 +74,19 @@ ConfigSoundSelelectDlg::ConfigSoundSelelectDlg(QWidget *parent, ConfigType cfgty
72 74 connect(ui->pushButton_10,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
73 75  
74 76 connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int)));
  77 +
  78 + m_vectorTabOrder.append(ui->pushButton_1);
  79 + m_vectorTabOrder.append(ui->pushButton_2);
  80 + m_vectorTabOrder.append(ui->pushButton_3);
  81 + m_vectorTabOrder.append(ui->pushButton_4);
  82 + m_vectorTabOrder.append(ui->pushButton_5);
  83 + m_vectorTabOrder.append(ui->pushButton_6);
  84 + m_vectorTabOrder.append(ui->pushButton_7);
  85 + m_vectorTabOrder.append(ui->pushButton_8);
  86 + m_vectorTabOrder.append(ui->pushButton_9);
  87 + m_vectorTabOrder.append(ui->pushButton_10);
  88 + m_vectorTabOrder.append(ui->ctrBtnOk);
  89 + m_vectorTabOrder.append(ui->ctrBtnCancel);
75 90 }
76 91  
77 92 ConfigSoundSelelectDlg::~ConfigSoundSelelectDlg()
... ... @@ -133,3 +148,101 @@ void ConfigSoundSelelectDlg::reloadUi(){
133 148 void ConfigSoundSelelectDlg::onConfigBtnClicked(const int sel){
134 149 m_nCurSel = sel;
135 150 }
  151 +
  152 +
  153 +void ConfigSoundSelelectDlg::keyPressEvent(QKeyEvent *event){
  154 + int i = 0;
  155 + switch (event->key())
  156 + {
  157 + case 0x01000030: // Turn left
  158 + for(i = 0; i < m_vectorTabOrder.size();i++){
  159 + if(focusWidget() == m_vectorTabOrder[i]) break;
  160 + }
  161 +
  162 + if(i==0){
  163 + i = m_vectorTabOrder.size()-1;
  164 + m_vectorTabOrder[i]->setFocus();
  165 + }
  166 + else if(i < m_vectorTabOrder.size()) {
  167 + i = i - 1;
  168 + m_vectorTabOrder[i]->setFocus();
  169 + }
  170 + else{
  171 + i=0;
  172 + m_vectorTabOrder[i]->setFocus();
  173 + }
  174 + break;
  175 + case 0x01000031: // Push
  176 +
  177 + break;
  178 + case 0x01000032: // Turn right
  179 + for(i = 0; i < m_vectorTabOrder.size();i++){
  180 + if(focusWidget() == m_vectorTabOrder[i]) break;
  181 + }
  182 +
  183 + if(i<m_vectorTabOrder.size()-1){
  184 + i+=1;
  185 + m_vectorTabOrder[i]->setFocus();
  186 + }
  187 + else if(i== (m_vectorTabOrder.size()-1)){
  188 + i=0;
  189 + m_vectorTabOrder[i]->setFocus();
  190 + }
  191 + else{
  192 + i=0;
  193 + m_vectorTabOrder[i]->setFocus();
  194 + }
  195 + break;
  196 + }
  197 +}
  198 +
  199 +void ConfigSoundSelelectDlg::keyReleaseEvent(QKeyEvent *event){
  200 + int i = 0;
  201 + switch (event->key())
  202 + {
  203 + case 0x01000030: // Turn left
  204 + for(i = 0; i < m_vectorTabOrder.size();i++){
  205 + if(focusWidget() == m_vectorTabOrder[i]) break;
  206 + }
  207 +
  208 + if(i==0){
  209 + i = m_vectorTabOrder.size()-1;
  210 + m_vectorTabOrder[i]->setFocus();
  211 + }
  212 + else if(i < m_vectorTabOrder.size()) {
  213 + i = i - 1;
  214 + m_vectorTabOrder[i]->setFocus();
  215 + }
  216 + else{
  217 + i=0;
  218 + m_vectorTabOrder[i]->setFocus();
  219 + }
  220 + break;
  221 + case 0x01000031: // Push
  222 + {
  223 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  224 + if(btn != NULL){
  225 + btn->click();
  226 + }
  227 + break;
  228 + }
  229 + case 0x01000032: // Turn right
  230 + for(i = 0; i < m_vectorTabOrder.size();i++){
  231 + if(focusWidget() == m_vectorTabOrder[i]) break;
  232 + }
  233 +
  234 + if(i<m_vectorTabOrder.size()-1){
  235 + i+=1;
  236 + m_vectorTabOrder[i]->setFocus();
  237 + }
  238 + else if(i== (m_vectorTabOrder.size()-1)){
  239 + i=0;
  240 + m_vectorTabOrder[i]->setFocus();
  241 + }
  242 + else{
  243 + i=0;
  244 + m_vectorTabOrder[i]->setFocus();
  245 + }
  246 + break;
  247 + }
  248 +}
... ...
app/gui/oven_control/configsoundselelectdlg.h
... ... @@ -4,6 +4,8 @@
4 4 #include <QDialog>
5 5 #include <QSignalMapper>
6 6 #include <config.h>
  7 +#include <QKeyEvent>
  8 +#include <QVector>
7 9  
8 10 using namespace Define;
9 11  
... ... @@ -29,11 +31,16 @@ private slots:
29 31 public slots:
30 32 void onConfigBtnClicked(const int sel);
31 33  
  34 +protected:
  35 + void keyPressEvent(QKeyEvent* event);
  36 + void keyReleaseEvent(QKeyEvent* event);
  37 +
32 38 private:
33 39 Ui::ConfigSoundSelelectDlg *ui;
34 40 QSignalMapper *m_pSignalMapper;
35 41 ConfigType m_nCfgType;
36 42 uint32_t m_nCurSel;
  43 + QVector<QWidget*> m_vectorTabOrder;
37 44 };
38 45  
39 46 #endif // CONFIGSOUNDSELELECTDLG_H
... ...
app/gui/oven_control/configtemptypedlg.cpp
... ... @@ -16,6 +16,8 @@ ConfigTempTypeDlg::ConfigTempTypeDlg(QWidget *parent) :
16 16 ui->setupUi(this);
17 17 this->setWindowFlags( Qt::FramelessWindowHint);
18 18 this->setAttribute( Qt::WA_DeleteOnClose);
  19 + qApp->setActiveWindow(this);
  20 + this->setFocus();
19 21  
20 22 foreach (QPushButton *button, findChildren<QPushButton *>())
21 23 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
... ... @@ -33,6 +35,11 @@ ConfigTempTypeDlg::ConfigTempTypeDlg(QWidget *parent) :
33 35 connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
34 36  
35 37 connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int)));
  38 + m_vectorTabOrder.append(this);
  39 + m_vectorTabOrder.append(ui->pushButton_1);
  40 + m_vectorTabOrder.append(ui->pushButton_2);
  41 + m_vectorTabOrder.append(ui->ctrBtnOk);
  42 + m_vectorTabOrder.append(ui->ctrBtnCancel);
36 43 }
37 44  
38 45 ConfigTempTypeDlg::~ConfigTempTypeDlg()
... ... @@ -71,3 +78,100 @@ void ConfigTempTypeDlg::reloadUi(){
71 78 }
72 79 }
73 80  
  81 +void ConfigTempTypeDlg::keyPressEvent(QKeyEvent *event){
  82 + int i = 0;
  83 + switch (event->key())
  84 + {
  85 + case 0x01000030: // Turn left
  86 + for(i = 0; i < m_vectorTabOrder.size();i++){
  87 + if(focusWidget() == m_vectorTabOrder[i]) break;
  88 + }
  89 +
  90 + if(i==0){
  91 + i = m_vectorTabOrder.size()-1;
  92 + m_vectorTabOrder[i]->setFocus();
  93 + }
  94 + else if(i < m_vectorTabOrder.size()) {
  95 + i = i - 1;
  96 + m_vectorTabOrder[i]->setFocus();
  97 + }
  98 + else{
  99 + i=0;
  100 + m_vectorTabOrder[i]->setFocus();
  101 + }
  102 + break;
  103 + case 0x01000031: // Push
  104 +
  105 + break;
  106 + case 0x01000032: // Turn right
  107 + for(i = 0; i < m_vectorTabOrder.size();i++){
  108 + if(focusWidget() == m_vectorTabOrder[i]) break;
  109 + }
  110 +
  111 + if(i<m_vectorTabOrder.size()-1){
  112 + i+=1;
  113 + m_vectorTabOrder[i]->setFocus();
  114 + }
  115 + else if(i== (m_vectorTabOrder.size()-1)){
  116 + i=0;
  117 + m_vectorTabOrder[i]->setFocus();
  118 + }
  119 + else{
  120 + i=0;
  121 + m_vectorTabOrder[i]->setFocus();
  122 + }
  123 + break;
  124 + }
  125 +}
  126 +
  127 +void ConfigTempTypeDlg::keyReleaseEvent(QKeyEvent *event){
  128 + int i = 0;
  129 + switch (event->key())
  130 + {
  131 + case 0x01000030: // Turn left
  132 + for(i = 0; i < m_vectorTabOrder.size();i++){
  133 + if(focusWidget() == m_vectorTabOrder[i]) break;
  134 + }
  135 +
  136 + if(i==0){
  137 + i = m_vectorTabOrder.size()-1;
  138 + m_vectorTabOrder[i]->setFocus();
  139 + }
  140 + else if(i < m_vectorTabOrder.size()) {
  141 + i = i - 1;
  142 + m_vectorTabOrder[i]->setFocus();
  143 + }
  144 + else{
  145 + i=0;
  146 + m_vectorTabOrder[i]->setFocus();
  147 + }
  148 + break;
  149 + case 0x01000031: // Push
  150 + {
  151 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  152 + if(btn != NULL){
  153 + btn->click();
  154 + }
  155 + break;
  156 + }
  157 + case 0x01000032: // Turn right
  158 + for(i = 0; i < m_vectorTabOrder.size();i++){
  159 + if(focusWidget() == m_vectorTabOrder[i]) break;
  160 + }
  161 +
  162 + if(i<m_vectorTabOrder.size()-1){
  163 + i+=1;
  164 + m_vectorTabOrder[i]->setFocus();
  165 + }
  166 + else if(i== (m_vectorTabOrder.size()-1)){
  167 + i=0;
  168 + m_vectorTabOrder[i]->setFocus();
  169 + }
  170 + else{
  171 + i=0;
  172 + m_vectorTabOrder[i]->setFocus();
  173 + }
  174 + break;
  175 + }
  176 +}
  177 +
... ...
app/gui/oven_control/configtemptypedlg.h
... ... @@ -3,6 +3,8 @@
3 3  
4 4 #include <QDialog>
5 5 #include <QSignalMapper>
  6 +#include <QVector>
  7 +#include <QKeyEvent>
6 8  
7 9 namespace Ui {
8 10 class ConfigTempTypeDlg;
... ... @@ -14,6 +16,10 @@ class ConfigTempTypeDlg : public QDialog
14 16  
15 17 void reloadUi(void);
16 18  
  19 +protected:
  20 + void keyReleaseEvent(QKeyEvent* event);
  21 + void keyPressEvent(QKeyEvent* event);
  22 +
17 23 public:
18 24 explicit ConfigTempTypeDlg(QWidget *parent = 0);
19 25 ~ConfigTempTypeDlg();
... ... @@ -30,6 +36,7 @@ private:
30 36 Ui::ConfigTempTypeDlg *ui;
31 37 QSignalMapper *m_pSignalMapper;
32 38 int m_nCurSel;
  39 + QVector<QWidget*> m_vectorTabOrder;
33 40 };
34 41  
35 42 #endif // CONFIGTEMPTYPEDLG_H
... ...
app/gui/oven_control/configtimeformatdlg.cpp
... ... @@ -16,6 +16,8 @@ ConfigTimeFormatDlg::ConfigTimeFormatDlg(QWidget *parent) :
16 16 ui->setupUi(this);
17 17 this->setWindowFlags( Qt::FramelessWindowHint);
18 18 this->setAttribute( Qt::WA_DeleteOnClose);
  19 + qApp->setActiveWindow(this);
  20 + this->setFocus();
19 21  
20 22 foreach (QPushButton *button, findChildren<QPushButton *>())
21 23 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
... ... @@ -34,6 +36,12 @@ ConfigTimeFormatDlg::ConfigTimeFormatDlg(QWidget *parent) :
34 36 connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
35 37  
36 38 connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int)));
  39 +
  40 + m_vectorTabOrder.append(this);
  41 + m_vectorTabOrder.append(ui->pushButton_1);
  42 + m_vectorTabOrder.append(ui->pushButton_2);
  43 + m_vectorTabOrder.append(ui->ctrBtnOk);
  44 + m_vectorTabOrder.append(ui->ctrBtnCancel);
37 45 }
38 46  
39 47 ConfigTimeFormatDlg::~ConfigTimeFormatDlg()
... ... @@ -73,3 +81,100 @@ void ConfigTimeFormatDlg::reloadUi(){
73 81 break;
74 82 }
75 83 }
  84 +
  85 +void ConfigTimeFormatDlg::keyPressEvent(QKeyEvent *event){
  86 + int i = 0;
  87 + switch (event->key())
  88 + {
  89 + case 0x01000030: // Turn left
  90 + for(i = 0; i < m_vectorTabOrder.size();i++){
  91 + if(focusWidget() == m_vectorTabOrder[i]) break;
  92 + }
  93 +
  94 + if(i==0){
  95 + i = m_vectorTabOrder.size()-1;
  96 + m_vectorTabOrder[i]->setFocus();
  97 + }
  98 + else if(i < m_vectorTabOrder.size()) {
  99 + i = i - 1;
  100 + m_vectorTabOrder[i]->setFocus();
  101 + }
  102 + else{
  103 + i=0;
  104 + m_vectorTabOrder[i]->setFocus();
  105 + }
  106 + break;
  107 + case 0x01000031: // Push
  108 +
  109 + break;
  110 + case 0x01000032: // Turn right
  111 + for(i = 0; i < m_vectorTabOrder.size();i++){
  112 + if(focusWidget() == m_vectorTabOrder[i]) break;
  113 + }
  114 +
  115 + if(i<m_vectorTabOrder.size()-1){
  116 + i+=1;
  117 + m_vectorTabOrder[i]->setFocus();
  118 + }
  119 + else if(i== (m_vectorTabOrder.size()-1)){
  120 + i=0;
  121 + m_vectorTabOrder[i]->setFocus();
  122 + }
  123 + else{
  124 + i=0;
  125 + m_vectorTabOrder[i]->setFocus();
  126 + }
  127 + break;
  128 + }
  129 +}
  130 +
  131 +void ConfigTimeFormatDlg::keyReleaseEvent(QKeyEvent *event){
  132 + int i = 0;
  133 + switch (event->key())
  134 + {
  135 + case 0x01000030: // Turn left
  136 + for(i = 0; i < m_vectorTabOrder.size();i++){
  137 + if(focusWidget() == m_vectorTabOrder[i]) break;
  138 + }
  139 +
  140 + if(i==0){
  141 + i = m_vectorTabOrder.size()-1;
  142 + m_vectorTabOrder[i]->setFocus();
  143 + }
  144 + else if(i < m_vectorTabOrder.size()) {
  145 + i = i - 1;
  146 + m_vectorTabOrder[i]->setFocus();
  147 + }
  148 + else{
  149 + i=0;
  150 + m_vectorTabOrder[i]->setFocus();
  151 + }
  152 + break;
  153 + case 0x01000031: // Push
  154 + {
  155 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  156 + if(btn != NULL){
  157 + btn->click();
  158 + }
  159 + break;
  160 + }
  161 + case 0x01000032: // Turn right
  162 + for(i = 0; i < m_vectorTabOrder.size();i++){
  163 + if(focusWidget() == m_vectorTabOrder[i]) break;
  164 + }
  165 +
  166 + if(i<m_vectorTabOrder.size()-1){
  167 + i+=1;
  168 + m_vectorTabOrder[i]->setFocus();
  169 + }
  170 + else if(i== (m_vectorTabOrder.size()-1)){
  171 + i=0;
  172 + m_vectorTabOrder[i]->setFocus();
  173 + }
  174 + else{
  175 + i=0;
  176 + m_vectorTabOrder[i]->setFocus();
  177 + }
  178 + break;
  179 + }
  180 +}
... ...
app/gui/oven_control/configtimeformatdlg.h
... ... @@ -3,6 +3,8 @@
3 3  
4 4 #include <QDialog>
5 5 #include <QSignalMapper>
  6 +#include <QKeyEvent>
  7 +#include <QVector>
6 8  
7 9 namespace Ui {
8 10 class ConfigTimeFormatDlg;
... ... @@ -27,10 +29,15 @@ private slots:
27 29 public slots:
28 30 void onConfigBtnClicked(const int sel);
29 31  
  32 +protected:
  33 + void keyReleaseEvent(QKeyEvent* event);
  34 + void keyPressEvent(QKeyEvent* event);
  35 +
30 36 private:
31 37 Ui::ConfigTimeFormatDlg *ui;
32 38 QSignalMapper *m_pSignalMapper;
33 39 int m_nCurSel;
  40 + QVector<QWidget*> m_vectorTabOrder;
34 41 };
35 42  
36 43 #endif // CONFIGTIMEFORMATDLG_H
... ...
app/gui/oven_control/configwindow.cpp
... ... @@ -60,100 +60,52 @@ void ConfigWindow::on_pushButton_clicked()
60 60 }
61 61  
62 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();
  63 + int i = 0;
  64 + for(i = 0; i < m_vectorTabOrder.size();i++){
  65 + if(focusWidget() == m_vectorTabOrder[i]) break;
95 66 }
96   - else if(focusWidget() == ui->pushButton_5){
97   - ui->pushButton_4->setFocus();
  67 +
  68 + if(i==0){
  69 + i = m_vectorTabOrder.size()-1;
  70 + m_vectorTabOrder[i]->setFocus();
98 71 }
99   - else if(focusWidget() == ui->pushButton_6){
100   - ui->pushButton_5->setFocus();
  72 + else if(i < m_vectorTabOrder.size()) {
  73 + i = i - 1;
  74 + m_vectorTabOrder[i]->setFocus();
101 75 }
102   - else if(focusWidget() == ui->pushButton_3){
103   - ui->pushButton_6->setFocus();
  76 + else{
  77 + i=0;
  78 + m_vectorTabOrder[i]->setFocus();
104 79 }
105   - else focusPreviousChild();
106 80 }
107 81  
108 82 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();
  83 + int i = 0;
  84 + for(i = 0; i < m_vectorTabOrder.size();i++){
  85 + if(focusWidget() == m_vectorTabOrder[i]) break;
136 86 }
137   - else if(focusWidget() == ui->pushButton_6){
138   - ui->pushButton_3->setFocus();
  87 +
  88 + if(i<m_vectorTabOrder.size()-1){
  89 + i+=1;
  90 + m_vectorTabOrder[i]->setFocus();
139 91 }
140   - else if(focusWidget() == ui->pushButton_3){
141   - ui->scrollArea->setFocus();
  92 + else if(i== (m_vectorTabOrder.size()-1)){
  93 + i=0;
  94 + m_vectorTabOrder[i]->setFocus();
142 95 }
143   - else if(m_vectorMenuList[m_vectorMenuList.size() -1]->isFavoriteFocused()){
144   - qDebug() << "last Favorite Focused";
145   - ui->backButton->setFocus();
  96 + else{
  97 + i=0;
  98 + m_vectorTabOrder[i]->setFocus();
146 99 }
147   - else focusNextChild();
  100 + return;
148 101 }
149 102  
150 103 void ConfigWindow::keyReleaseEvent(QKeyEvent *event){
151 104 switch (event->key())
152 105 {
153 106 case 0x01000030: // Turn left
154   - //focusPreviousChild();
155 107 prevFocus();
156   - qDebug() << "turn left";
  108 + ui->scrollArea->ensureWidgetVisible(m_vectorTabOrder[m_nTabIndex]);
157 109 break;
158 110 case 0x01000031: // Push
159 111 {
... ... @@ -166,6 +118,7 @@ void ConfigWindow::keyReleaseEvent(QKeyEvent *event){
166 118 }
167 119 case 0x01000032: // Turn right
168 120 nextFocus();
  121 + ui->scrollArea->ensureWidgetVisible(focusWidget());
169 122 qDebug() << "Turn Right";
170 123 break;
171 124 }
... ... @@ -175,8 +128,8 @@ void ConfigWindow::keyPressEvent(QKeyEvent *event){
175 128 switch (event->key())
176 129 {
177 130 case 0x01000030: // Turn left
178   - //focusPreviousChild();
179 131 prevFocus();
  132 + ui->scrollArea->ensureWidgetVisible(focusWidget());
180 133 qDebug() << "turn left";
181 134 break;
182 135 case 0x01000031: // Push
... ... @@ -185,6 +138,7 @@ void ConfigWindow::keyPressEvent(QKeyEvent *event){
185 138 break;
186 139 case 0x01000032: // Turn right
187 140 nextFocus();
  141 + ui->scrollArea->ensureWidgetVisible(focusWidget());
188 142 qDebug() << "Turn Right";
189 143 break;
190 144 }
... ... @@ -240,6 +194,7 @@ void ConfigWindow::reloadValue(){
240 194 void ConfigWindow::onConfigBtnClicked(uint16_t id){
241 195 Config *cfg = Config::getInstance();
242 196 QDialog* dlg;
  197 + QWidget *focusedWidget = focusWidget();
243 198 switch(id){
244 199 case config_loading_door_monitoring:
245 200 case config_cooking_door_monitoring:
... ... @@ -270,10 +225,9 @@ void ConfigWindow::onConfigBtnClicked(uint16_t id){
270 225 default:
271 226 cfg->execConfigWindow(this,(Define::ConfigType)id);
272 227 if(m_nCurConfigPos != config_menu_favorite) reloadValue();
273   - if(id==config_sound_factory_reset) reloadUi();
274 228 break;
275 229 }
276   -
  230 + focusedWidget->setFocus();
277 231 }
278 232  
279 233  
... ... @@ -318,6 +272,17 @@ void ConfigWindow::reloadUi(void){
318 272 }
319 273 m_vectorFavorMenuList.clear();
320 274  
  275 + m_vectorTabOrder.clear();
  276 + m_vectorTabOrder.append(this);
  277 + m_vectorTabOrder.append(ui->pushButton);
  278 + m_vectorTabOrder.append(ui->pushButton_8);
  279 + m_vectorTabOrder.append(ui->pushButton_7);
  280 + m_vectorTabOrder.append(ui->pushButton_2);
  281 + m_vectorTabOrder.append(ui->pushButton_4);
  282 + m_vectorTabOrder.append(ui->pushButton_5);
  283 + m_vectorTabOrder.append(ui->pushButton_6);
  284 + m_vectorTabOrder.append(ui->pushButton_3);
  285 +
321 286  
322 287  
323 288 if(m_nCurConfigPos != config_menu_favorite){
... ... @@ -330,6 +295,8 @@ void ConfigWindow::reloadUi(void){
330 295 pcb->setValue(strtemp);
331 296 pcb->showFavoriteButton();
332 297 pcb->setFavoriteCheck(cfg->isFavorite(m_arrConfigListInfos[m_nCurConfigPos][i]));
  298 + m_vectorTabOrder.append(pcb->getFavoriteBtn());
  299 + m_vectorTabOrder.append(pcb->getBtn());
333 300 ui->scrollAreaMenuLayout->addWidget(pcb);
334 301 m_vectorMenuList.append(pcb);
335 302 connect(pcb ,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t)));
... ... @@ -343,12 +310,17 @@ void ConfigWindow::reloadUi(void){
343 310 fpcb = new ConfigFavoriteButton(this,idx);
344 311 strtemp = cfg->getTitleString((ConfigType)idx);
345 312 fpcb->setText(strtemp);
  313 + m_vectorTabOrder.append(fpcb->getBtn());
  314 + m_vectorTabOrder.append(fpcb->getDelBtn());
346 315 ui->scrollAreaMenuLayout->addWidget(fpcb);
347 316 m_vectorFavorMenuList.append(fpcb);
348 317 connect(fpcb,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t)));
349 318 connect(fpcb,SIGNAL(delBtnClicked(uint16_t)),SLOT(onDeleteFavoriteBtnClicked(uint16_t)));
350 319 }
351 320 }
  321 + m_vectorTabOrder.append(ui->backButton);
  322 + m_vectorTabOrder.append(ui->washButton);
  323 + m_vectorTabOrder.append(ui->helpButton);
352 324  
353 325 ui->scrollAreaMenu->adjustSize(); //Display 전 Contents 사이즈 수정 깜빡임 제거함.
354 326  
... ...
app/gui/oven_control/configwindow.h
... ... @@ -32,12 +32,12 @@ class ConfigWindow : public QMainWindow
32 32  
33 33 private:
34 34 const uint16_t m_arrMaxMenuCount[7] ={
35   - 6,8,9,2,3,0,6
  35 + 6,8,8,2,3,0,6
36 36 };
37 37 const Define::ConfigType m_arrConfigListInfos[7][20] = {
38 38 {config_language,config_datetime, config_temptype,config_backlight, config_time_type,config_resttime_format,},
39 39 {config_marster_vol,config_keypad_sound1,config_keypad_sound2,config_request_loadexec,config_programstep_finish,config_cooktime_finish,config_stoperror_distinguish,config_sound_factory_reset},
40   - {config_haccp_data_download,config_info_data_download,config_service_data_download,config_program_download,config_program_upload ,config_program_initialize,config_ip,config_set_download,config_set_upload},
  40 + {config_info_data_download,config_service_data_download,config_program_download,config_program_upload ,config_program_initialize,config_ip,config_set_download,config_set_upload},
41 41 {config_set_half_energy,config_set_auto_darkness,},
42 42 {config_duty_wash,config_loading_door_monitoring,config_cooking_door_monitoring},
43 43 {config_invalid,},
... ... @@ -88,8 +88,9 @@ private:
88 88 Ui::ConfigWindow *ui;
89 89 QVector<ConfigPanelButton *> m_vectorMenuList;
90 90 QVector<ConfigFavoriteButton*> m_vectorFavorMenuList;
  91 + QVector<QWidget*> m_vectorTabOrder;
91 92 CONFIG_MENU_POS m_nCurConfigPos;
92   -
  93 + int m_nTabIndex = 0;
93 94 };
94 95  
95 96 #endif // CONFIGWINDOW_H
... ...
app/gui/oven_control/fileprocessdlg.cpp
... ... @@ -209,6 +209,9 @@ FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) :
209 209 setAttribute(Qt::WA_DeleteOnClose);
210 210 setAttribute(Qt::WA_TranslucentBackground);
211 211 setWindowFlags(Qt::FramelessWindowHint);
  212 + qApp->setActiveWindow(this);
  213 + this->setFocus();
  214 + ui->ctrBtnCancel->setFocus();
212 215  
213 216 ui->ctrWjProcess->setMinimum(0);
214 217 ui->ctrWjProcess->setMaximum(100);
... ... @@ -706,3 +709,21 @@ void FileProcessDlg::haccpdataDownload(){
706 709 ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
707 710 QTimer::singleShot(1000,this,SLOT(close()));
708 711 }
  712 +
  713 +void FileProcessDlg::keyPressEvent(QKeyEvent *event){
  714 +
  715 +}
  716 +
  717 +void FileProcessDlg::keyReleaseEvent(QKeyEvent *event){
  718 + switch (event->key())
  719 + {
  720 + case 0x01000031: // Push
  721 + {
  722 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  723 + if(btn != NULL){
  724 + btn->click();
  725 + }
  726 + break;
  727 + }
  728 + }
  729 +}
... ...
app/gui/oven_control/fileprocessdlg.h
... ... @@ -7,6 +7,7 @@
7 7 #include <QThread>
8 8 #include <QList>
9 9 #include <QMutex>
  10 +#include <QKeyEvent>
10 11 #include "config.h"
11 12 #include "servicedata.h"
12 13 #include "historylistwindow.h"
... ... @@ -73,6 +74,10 @@ public slots:
73 74 void onProgressed(int progress,int sec);
74 75 void onProgressFinished();
75 76  
  77 +protected:
  78 + void keyPressEvent(QKeyEvent* event);
  79 + void keyReleaseEvent(QKeyEvent* event);
  80 +
76 81 private:
77 82 Ui::FileProcessDlg *ui;
78 83 ConfigType m_nCfgtype;
... ...
app/gui/oven_control/usbcheckpopupdlg.cpp
... ... @@ -12,7 +12,9 @@ UsbCheckPopupDlg::UsbCheckPopupDlg(QWidget *parent) :
12 12 setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
13 13 setAttribute(Qt::WA_NoSystemBackground);
14 14 setAttribute(Qt::WA_TranslucentBackground);
15   -
  15 + qApp->setActiveWindow(this);
  16 + this->setFocus();
  17 + ui->ctrBtnYes->setFocus();
16 18  
17 19 timer = new QTimer(this);
18 20 connect(timer,SIGNAL(timeout()),SLOT(usbCheckTimerFired()));
... ... @@ -36,3 +38,38 @@ void UsbCheckPopupDlg::usbCheckTimerFired(){
36 38 accept();
37 39 }
38 40 }
  41 +
  42 +
  43 +void UsbCheckPopupDlg::keyPressEvent(QKeyEvent *event){
  44 + int i = 0;
  45 + switch (event->key())
  46 + {
  47 + case 0x01000030: // Turn left
  48 + break;
  49 + case 0x01000031: // Push
  50 + {
  51 + break;
  52 + }
  53 + case 0x01000032: // Turn right
  54 + break;
  55 + }
  56 +}
  57 +
  58 +void UsbCheckPopupDlg::keyReleaseEvent(QKeyEvent *event){
  59 + int i = 0;
  60 + switch (event->key())
  61 + {
  62 + case 0x01000030: // Turn left
  63 + break;
  64 + case 0x01000031: // Push
  65 + {
  66 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  67 + if(btn != NULL){
  68 + btn->click();
  69 + }
  70 + break;
  71 + }
  72 + case 0x01000032: // Turn right
  73 + break;
  74 + }
  75 +}
... ...
app/gui/oven_control/usbcheckpopupdlg.h
... ... @@ -3,6 +3,7 @@
3 3  
4 4 #include <QDialog>
5 5 #include <QTimer>
  6 +#include <QKeyEvent>
6 7  
7 8 namespace Ui {
8 9 class UsbCheckPopupDlg;
... ... @@ -20,6 +21,10 @@ private slots:
20 21 void on_ctrBtnYes_clicked();
21 22 void usbCheckTimerFired();
22 23  
  24 +protected:
  25 + void keyReleaseEvent(QKeyEvent* event);
  26 + void keyPressEvent(QKeyEvent* event);
  27 +
23 28 private:
24 29 Ui::UsbCheckPopupDlg *ui;
25 30 QTimer *timer;
... ...
app/gui/oven_control/yesnopopupdlg.cpp
... ... @@ -10,17 +10,22 @@ YesNoPopupDlg::YesNoPopupDlg(QWidget *parent, QString strDesc) :
10 10 ui->setupUi(this);
11 11 this->setAttribute( Qt::WA_DeleteOnClose);
12 12 setWindowFlags(Qt::FramelessWindowHint);
13   - setAttribute(Qt::WA_NoSystemBackground);
  13 + setAttribute(Qt::WA_NoSystemBackground,false);
14 14 setAttribute(Qt::WA_TranslucentBackground);
  15 + qApp->setActiveWindow(this);
  16 + this->setFocus();
  17 +
15 18 //setAttribute(Qt::WA_PaintOnScreen);
16 19  
17 20  
18 21  
19 22 ui->ctrLbDesc->setText(strDesc);
20 23  
  24 +
21 25 //this->setAttribute( Qt::WA_DeleteOnClose);
22 26 foreach (QPushButton *button, findChildren<QPushButton *>())
23 27 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
  28 + ui->ctrBtnYes->setFocus();
24 29 }
25 30  
26 31 YesNoPopupDlg::~YesNoPopupDlg()
... ... @@ -38,3 +43,42 @@ void YesNoPopupDlg::on_ctrBtnNo_clicked()
38 43 {
39 44 this->reject();
40 45 }
  46 +
  47 +void YesNoPopupDlg::keyPressEvent(QKeyEvent *event){
  48 + switch (event->key())
  49 + {
  50 + case 0x01000030: // Turn left
  51 + if(focusWidget() == ui->ctrBtnYes) ui->ctrBtnNo->setFocus();
  52 + else ui->ctrBtnYes->setFocus();
  53 + break;
  54 + case 0x01000031: // Push
  55 +
  56 + break;
  57 + case 0x01000032: // Turn right
  58 + if(focusWidget() == ui->ctrBtnYes) ui->ctrBtnNo->setFocus();
  59 + else ui->ctrBtnYes->setFocus();
  60 + break;
  61 + }
  62 +}
  63 +
  64 +void YesNoPopupDlg::keyReleaseEvent(QKeyEvent *event){
  65 + switch (event->key())
  66 + {
  67 + case 0x01000030: // Turn left
  68 + if(focusWidget() == ui->ctrBtnYes) ui->ctrBtnNo->setFocus();
  69 + else ui->ctrBtnYes->setFocus();
  70 + break;
  71 + case 0x01000031: // Push
  72 + {
  73 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  74 + if(btn != NULL){
  75 + btn->click();
  76 + }
  77 + break;
  78 + }
  79 + case 0x01000032: // Turn right
  80 + if(focusWidget() == ui->ctrBtnYes) ui->ctrBtnNo->setFocus();
  81 + else ui->ctrBtnYes->setFocus();
  82 + break;
  83 + }
  84 +}
... ...
app/gui/oven_control/yesnopopupdlg.h
... ... @@ -2,6 +2,7 @@
2 2 #define YESNOPOPUPDLG_H
3 3  
4 4 #include <QDialog>
  5 +#include <QKeyEvent>
5 6  
6 7 namespace Ui {
7 8 class YesNoPopupDlg;
... ... @@ -20,6 +21,10 @@ private slots:
20 21  
21 22 void on_ctrBtnNo_clicked();
22 23  
  24 +protected:
  25 + void keyPressEvent(QKeyEvent* event);
  26 + void keyReleaseEvent(QKeyEvent* event);
  27 +
23 28 private:
24 29 Ui::YesNoPopupDlg *ui;
25 30 };
... ...
app/gui/oven_control/yesnopopupdlg.ui
... ... @@ -54,7 +54,7 @@
54 54 border : none;
55 55 color : white;
56 56 }
57   -QPushButton::pressed {color : yellow}</string>
  57 +QPushButton::pressed, QPushButton::focus{color : yellow}</string>
58 58 </property>
59 59 <property name="text">
60 60 <string>예</string>
... ... @@ -81,7 +81,7 @@ QPushButton::pressed {color : yellow}&lt;/string&gt;
81 81 border : none;
82 82 color : white;
83 83 }
84   -QPushButton::pressed {color : yellow}</string>
  84 +QPushButton::pressed, QPushButton::focus{color : yellow}</string>
85 85 </property>
86 86 <property name="text">
87 87 <string>아니오</string>
... ...