Commit 63a45681f34e203e092b342ed67a8d59c0d1b77e

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

엔코더 기능 구현

 - 키보드 적용
app/gui/oven_control/config1digitsetandenablesetdlg.cpp
  1 +#include <QKeyEvent>
1 #include "config1digitsetandenablesetdlg.h" 2 #include "config1digitsetandenablesetdlg.h"
2 #include "ui_config1digitsetandenablesetdlg.h" 3 #include "ui_config1digitsetandenablesetdlg.h"
3 #include "soundplayer.h" 4 #include "soundplayer.h"
@@ -19,6 +20,9 @@ Config1DigitSetAndEnableSetDlg::Config1DigitSetAndEnableSetDlg(QWidget *parent, @@ -19,6 +20,9 @@ Config1DigitSetAndEnableSetDlg::Config1DigitSetAndEnableSetDlg(QWidget *parent,
19 ui->ctrSpBxValue->setValue(val); 20 ui->ctrSpBxValue->setValue(val);
20 21
21 ui->ctrSpBxValue->installEventFilter(this); 22 ui->ctrSpBxValue->installEventFilter(this);
  23 +
  24 + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked()));
  25 + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked()));
22 } 26 }
23 27
24 Config1DigitSetAndEnableSetDlg::~Config1DigitSetAndEnableSetDlg() 28 Config1DigitSetAndEnableSetDlg::~Config1DigitSetAndEnableSetDlg()
@@ -46,6 +50,67 @@ void Config1DigitSetAndEnableSetDlg::on_ctrBtnCancel_clicked() @@ -46,6 +50,67 @@ void Config1DigitSetAndEnableSetDlg::on_ctrBtnCancel_clicked()
46 close(); 50 close();
47 } 51 }
48 52
  53 +void Config1DigitSetAndEnableSetDlg::keyCancel_clicked()
  54 +{
  55 + if(focusWidget() == ui->ctrSpBxValue) ui->ctrSpBxValue->setValue(m_nPrevValue);
  56 + ui->keyboardwidget->focusOutKeyboard();
  57 +}
  58 +
  59 +void Config1DigitSetAndEnableSetDlg::keyEnter_clicked()
  60 +{
  61 + ui->keyboardwidget->focusOutKeyboard();
  62 +}
  63 +
49 int Config1DigitSetAndEnableSetDlg::getValue(){ 64 int Config1DigitSetAndEnableSetDlg::getValue(){
50 return ui->ctrSpBxValue->value(); 65 return ui->ctrSpBxValue->value();
51 } 66 }
  67 +
  68 +
  69 +void Config1DigitSetAndEnableSetDlg::keyPressEvent(QKeyEvent *event){
  70 + int i = 0;
  71 + switch (event->key())
  72 + {
  73 + case 0x01000030: // Turn left
  74 + if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus();
  75 + else focusPreviousChild();
  76 + break;
  77 + case 0x01000031: // Push
  78 +
  79 + break;
  80 + case 0x01000032: // Turn right
  81 + if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus();
  82 + else focusNextChild();
  83 +
  84 + break;
  85 + }
  86 +}
  87 +
  88 +void Config1DigitSetAndEnableSetDlg::keyReleaseEvent(QKeyEvent *event){
  89 + int i = 0;
  90 + switch (event->key())
  91 + {
  92 + case 0x01000030: // Turn left
  93 + if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus();
  94 + else focusPreviousChild();
  95 + break;
  96 + case 0x01000031: // Push
  97 + {
  98 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  99 + if(btn != NULL){
  100 + btn->click();
  101 + }
  102 + else{
  103 + QSpinBox *spbx = qobject_cast<QSpinBox*>(focusWidget());
  104 + if(spbx != NULL) {
  105 + m_nPrevValue = spbx->value();
  106 + ui->keyboardwidget->focusInKeyboard();
  107 + }
  108 + }
  109 + break;
  110 + }
  111 + case 0x01000032: // Turn right
  112 + if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus();
  113 + else focusNextChild();
  114 + break;
  115 + }
  116 +}
app/gui/oven_control/config1digitsetandenablesetdlg.h
@@ -34,9 +34,18 @@ private slots: @@ -34,9 +34,18 @@ private slots:
34 34
35 void on_ctrBtnCancel_clicked(); 35 void on_ctrBtnCancel_clicked();
36 36
  37 +public slots:
  38 + void keyCancel_clicked();
  39 + void keyEnter_clicked();
  40 +
  41 +protected:
  42 + void keyReleaseEvent(QKeyEvent* event);
  43 + void keyPressEvent(QKeyEvent* event);
  44 +
37 private: 45 private:
38 Ui::Config1DigitSetAndEnableSetDlg *ui; 46 Ui::Config1DigitSetAndEnableSetDlg *ui;
39 custom_result m_nResult; 47 custom_result m_nResult;
  48 + int m_nPrevValue;
40 }; 49 };
41 50
42 #endif // CONFIG1DIGITSETANDENABLESETDLG_H 51 #endif // CONFIG1DIGITSETANDENABLESETDLG_H
app/gui/oven_control/config1digitsetandenablesetdlg.ui
@@ -314,6 +314,12 @@ QPushButton::pressed, QPushButton::focus{ @@ -314,6 +314,12 @@ QPushButton::pressed, QPushButton::focus{
314 <container>1</container> 314 <container>1</container>
315 </customwidget> 315 </customwidget>
316 </customwidgets> 316 </customwidgets>
  317 + <tabstops>
  318 + <tabstop>ctrSpBxValue</tabstop>
  319 + <tabstop>ctrBtnOk</tabstop>
  320 + <tabstop>ctrBtnOk_2</tabstop>
  321 + <tabstop>ctrBtnCancel</tabstop>
  322 + </tabstops>
317 <resources/> 323 <resources/>
318 <connections/> 324 <connections/>
319 </ui> 325 </ui>
app/gui/oven_control/config1digitsetdlg.cpp
1 #include <QDebug> 1 #include <QDebug>
  2 +#include <QKeyEvent>
2 #include "config1digitsetdlg.h" 3 #include "config1digitsetdlg.h"
3 #include "ui_config1digitsetdlg.h" 4 #include "ui_config1digitsetdlg.h"
4 #include "soundplayer.h" 5 #include "soundplayer.h"
@@ -16,6 +17,8 @@ Config1DigitSetDlg::Config1DigitSetDlg(QWidget *parent, ConfigType type) : @@ -16,6 +17,8 @@ Config1DigitSetDlg::Config1DigitSetDlg(QWidget *parent, ConfigType type) :
16 ui->setupUi(this); 17 ui->setupUi(this);
17 this->setWindowFlags( Qt::FramelessWindowHint); 18 this->setWindowFlags( Qt::FramelessWindowHint);
18 this->setAttribute( Qt::WA_DeleteOnClose); 19 this->setAttribute( Qt::WA_DeleteOnClose);
  20 + qApp->setActiveWindow(this);
  21 + this->setFocus();
19 22
20 foreach (QPushButton *button, findChildren<QPushButton *>()) 23 foreach (QPushButton *button, findChildren<QPushButton *>())
21 connect(button, &QPushButton::pressed, SoundPlayer::playClick); 24 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
@@ -53,6 +56,9 @@ Config1DigitSetDlg::Config1DigitSetDlg(QWidget *parent, ConfigType type) : @@ -53,6 +56,9 @@ Config1DigitSetDlg::Config1DigitSetDlg(QWidget *parent, ConfigType type) :
53 56
54 ui->ctrSpBxValue->installEventFilter(this); 57 ui->ctrSpBxValue->installEventFilter(this);
55 58
  59 + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked()));
  60 + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked()));
  61 +
56 } 62 }
57 63
58 Config1DigitSetDlg::~Config1DigitSetDlg() 64 Config1DigitSetDlg::~Config1DigitSetDlg()
@@ -83,3 +89,62 @@ bool Config1DigitSetDlg::eventFilter(QObject *object, QEvent *event){ @@ -83,3 +89,62 @@ bool Config1DigitSetDlg::eventFilter(QObject *object, QEvent *event){
83 } 89 }
84 return QWidget::eventFilter(object, event); 90 return QWidget::eventFilter(object, event);
85 } 91 }
  92 +
  93 +void Config1DigitSetDlg::keyPressEvent(QKeyEvent *event){
  94 + int i = 0;
  95 + switch (event->key())
  96 + {
  97 + case 0x01000030: // Turn left
  98 + if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus();
  99 + else focusPreviousChild();
  100 + break;
  101 + case 0x01000031: // Push
  102 +
  103 + break;
  104 + case 0x01000032: // Turn right
  105 + if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus();
  106 + else focusNextChild();
  107 +
  108 + break;
  109 + }
  110 +}
  111 +
  112 +void Config1DigitSetDlg::keyReleaseEvent(QKeyEvent *event){
  113 + int i = 0;
  114 + switch (event->key())
  115 + {
  116 + case 0x01000030: // Turn left
  117 + if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus();
  118 + else focusPreviousChild();
  119 + break;
  120 + case 0x01000031: // Push
  121 + {
  122 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  123 + if(btn != NULL){
  124 + btn->click();
  125 + }
  126 + else{
  127 + QSpinBox *spbx = qobject_cast<QSpinBox*>(focusWidget());
  128 + qDebug() << "grab keyboard";
  129 + if(spbx != NULL) {
  130 + m_nPrevValue = spbx->value();
  131 + ui->keyboardwidget->focusInKeyboard();
  132 + }
  133 + }
  134 + break;
  135 + }
  136 + case 0x01000032: // Turn right
  137 + if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus();
  138 + else focusNextChild();
  139 + break;
  140 + }
  141 +}
  142 +
  143 +void Config1DigitSetDlg::keyCancel_clicked(){
  144 + if(focusWidget() == ui->ctrSpBxValue) ui->ctrSpBxValue->setValue(m_nPrevValue);
  145 + ui->keyboardwidget->focusOutKeyboard();
  146 +}
  147 +
  148 +void Config1DigitSetDlg::keyEnter_clicked(){
  149 + ui->keyboardwidget->focusOutKeyboard();
  150 +}
app/gui/oven_control/config1digitsetdlg.h
@@ -25,9 +25,17 @@ private slots: @@ -25,9 +25,17 @@ private slots:
25 25
26 bool eventFilter(QObject *, QEvent *); 26 bool eventFilter(QObject *, QEvent *);
27 27
  28 + void keyCancel_clicked();
  29 + void keyEnter_clicked();
  30 +
  31 +protected:
  32 + void keyReleaseEvent(QKeyEvent* event);
  33 + void keyPressEvent(QKeyEvent* event);
  34 +
28 private: 35 private:
29 Ui::Config1DigitSetDlg *ui; 36 Ui::Config1DigitSetDlg *ui;
30 ConfigType m_nType; 37 ConfigType m_nType;
  38 + int m_nPrevValue;
31 }; 39 };
32 40
33 #endif // CONFIG1DIGITSETDLG_H 41 #endif // CONFIG1DIGITSETDLG_H
app/gui/oven_control/config1digitsetdlg.ui
@@ -291,6 +291,11 @@ QPushButton::pressed, QPushButton::focus{ @@ -291,6 +291,11 @@ QPushButton::pressed, QPushButton::focus{
291 <container>1</container> 291 <container>1</container>
292 </customwidget> 292 </customwidget>
293 </customwidgets> 293 </customwidgets>
  294 + <tabstops>
  295 + <tabstop>ctrSpBxValue</tabstop>
  296 + <tabstop>ctrBtnOk</tabstop>
  297 + <tabstop>ctrBtnCancel</tabstop>
  298 + </tabstops>
294 <resources/> 299 <resources/>
295 <connections/> 300 <connections/>
296 </ui> 301 </ui>
app/gui/oven_control/configdatetimedlg.cpp
@@ -33,8 +33,8 @@ ConfigDateTimeDlg::ConfigDateTimeDlg(QWidget *parent) : @@ -33,8 +33,8 @@ ConfigDateTimeDlg::ConfigDateTimeDlg(QWidget *parent) :
33 m_bInputState = true; 33 m_bInputState = true;
34 34
35 35
36 - connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(on_keyEnter_clicked()));  
37 - connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(on_keyCancel_clicked())); 36 + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked()));
  37 + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked()));
38 38
39 m_pMapperSpins = new QSignalMapper(this); 39 m_pMapperSpins = new QSignalMapper(this);
40 m_pMapperSpins->setMapping(ui->ctrSpBxYear, ui->ctrSpBxYear); 40 m_pMapperSpins->setMapping(ui->ctrSpBxYear, ui->ctrSpBxYear);
@@ -49,7 +49,7 @@ ConfigDateTimeDlg::ConfigDateTimeDlg(QWidget *parent) : @@ -49,7 +49,7 @@ ConfigDateTimeDlg::ConfigDateTimeDlg(QWidget *parent) :
49 connect(ui->ctrSpBxHour, SIGNAL(focusInEdit()), m_pMapperSpins, SLOT(map())); 49 connect(ui->ctrSpBxHour, SIGNAL(focusInEdit()), m_pMapperSpins, SLOT(map()));
50 connect(ui->ctrSpBxMin, SIGNAL(focusInEdit()), m_pMapperSpins, SLOT(map())); 50 connect(ui->ctrSpBxMin, SIGNAL(focusInEdit()), m_pMapperSpins, SLOT(map()));
51 51
52 - connect(m_pMapperSpins, SIGNAL(mapped(QWidget*)), this, SLOT(on_focusInSpinBox(QWidget*))); 52 + connect(m_pMapperSpins, SIGNAL(mapped(QWidget*)), this, SLOT(focusInSpinBox(QWidget*)));
53 } 53 }
54 54
55 ConfigDateTimeDlg::~ConfigDateTimeDlg() 55 ConfigDateTimeDlg::~ConfigDateTimeDlg()
@@ -128,7 +128,7 @@ void ConfigDateTimeDlg::keyReleaseEvent(QKeyEvent *event){ @@ -128,7 +128,7 @@ void ConfigDateTimeDlg::keyReleaseEvent(QKeyEvent *event){
128 } 128 }
129 } 129 }
130 130
131 -void ConfigDateTimeDlg::on_keyCancel_clicked(){ 131 +void ConfigDateTimeDlg::keyCancel_clicked(){
132 QSpinBox *spbx = qobject_cast<QSpinBox*>(focusWidget()); 132 QSpinBox *spbx = qobject_cast<QSpinBox*>(focusWidget());
133 if(spbx != NULL){ 133 if(spbx != NULL){
134 spbx->setValue(m_nFocusValue); 134 spbx->setValue(m_nFocusValue);
@@ -136,11 +136,11 @@ void ConfigDateTimeDlg::on_keyCancel_clicked(){ @@ -136,11 +136,11 @@ void ConfigDateTimeDlg::on_keyCancel_clicked(){
136 ui->keyboardwidget->focusOutKeyboard(); 136 ui->keyboardwidget->focusOutKeyboard();
137 } 137 }
138 138
139 -void ConfigDateTimeDlg::on_keyEnter_clicked(){ 139 +void ConfigDateTimeDlg::keyEnter_clicked(){
140 ui->keyboardwidget->focusOutKeyboard(); 140 ui->keyboardwidget->focusOutKeyboard();
141 } 141 }
142 142
143 -void ConfigDateTimeDlg::on_focusInSpinBox(QWidget *widget){ 143 +void ConfigDateTimeDlg::focusInSpinBox(QWidget *widget){
144 QSpinBox *spbx = qobject_cast<QSpinBox*>(widget); 144 QSpinBox *spbx = qobject_cast<QSpinBox*>(widget);
145 if(spbx != NULL){ 145 if(spbx != NULL){
146 m_nFocusValue = spbx->value(); 146 m_nFocusValue = spbx->value();
app/gui/oven_control/configdatetimedlg.h
@@ -25,10 +25,10 @@ private slots: @@ -25,10 +25,10 @@ private slots:
25 25
26 void on_ctrBtnCancel_clicked(); 26 void on_ctrBtnCancel_clicked();
27 27
28 - void on_keyCancel_clicked();  
29 - void on_keyEnter_clicked(); 28 + void keyCancel_clicked();
  29 + void keyEnter_clicked();
30 30
31 - void on_focusInSpinBox(QWidget* widget); 31 + void focusInSpinBox(QWidget* widget);
32 32
33 protected: 33 protected:
34 void keyReleaseEvent(QKeyEvent* event); 34 void keyReleaseEvent(QKeyEvent* event);
app/gui/oven_control/configdoormonitoring.cpp
@@ -168,5 +168,21 @@ void ConfigDoorMonitoring::keyPressEvent(QKeyEvent *event){ @@ -168,5 +168,21 @@ void ConfigDoorMonitoring::keyPressEvent(QKeyEvent *event){
168 } 168 }
169 169
170 void ConfigDoorMonitoring::keyReleaseEvent(QKeyEvent *event){ 170 void ConfigDoorMonitoring::keyReleaseEvent(QKeyEvent *event){
171 - 171 + switch (event->key())
  172 + {
  173 + case 0x01000030: // Turn left
  174 + focusPreviousChild();
  175 + break;
  176 + case 0x01000031: // Push
  177 + {
  178 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  179 + if(btn != NULL){
  180 + btn->click();
  181 + }
  182 + break;
  183 + }
  184 + case 0x01000032: // Turn right
  185 + focusNextChild();
  186 + break;
  187 + }
172 } 188 }
app/gui/oven_control/configipdlg.cpp
  1 +#include <QKeyEvent>
1 #include "configipdlg.h" 2 #include "configipdlg.h"
2 #include "ui_configipdlg.h" 3 #include "ui_configipdlg.h"
3 #include "config.h" 4 #include "config.h"
@@ -13,6 +14,8 @@ ConfigIpDlg::ConfigIpDlg(QWidget *parent) : @@ -13,6 +14,8 @@ ConfigIpDlg::ConfigIpDlg(QWidget *parent) :
13 setWindowFlags(Qt::FramelessWindowHint); 14 setWindowFlags(Qt::FramelessWindowHint);
14 setAttribute(Qt::WA_NoSystemBackground); 15 setAttribute(Qt::WA_NoSystemBackground);
15 setAttribute(Qt::WA_TranslucentBackground); 16 setAttribute(Qt::WA_TranslucentBackground);
  17 + qApp->setActiveWindow(this);
  18 + this->setFocus();
16 19
17 foreach (QPushButton *button, findChildren<QPushButton *>()) 20 foreach (QPushButton *button, findChildren<QPushButton *>())
18 connect(button, &QPushButton::pressed, SoundPlayer::playClick); 21 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
@@ -51,6 +54,39 @@ ConfigIpDlg::ConfigIpDlg(QWidget *parent) : @@ -51,6 +54,39 @@ ConfigIpDlg::ConfigIpDlg(QWidget *parent) :
51 ui->ctrNetmask_2->setValue(temp.d8.d8_2); 54 ui->ctrNetmask_2->setValue(temp.d8.d8_2);
52 ui->ctrNetmask_3->setValue(temp.d8.d8_3); 55 ui->ctrNetmask_3->setValue(temp.d8.d8_3);
53 56
  57 + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked()));
  58 + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked()));
  59 +
  60 + m_pSignalMapper = new QSignalMapper(this);
  61 +
  62 + m_pSignalMapper->setMapping(ui->ctrIp_0,ui->ctrIp_0);
  63 + m_pSignalMapper->setMapping(ui->ctrIp_1,ui->ctrIp_1);
  64 + m_pSignalMapper->setMapping(ui->ctrIp_2,ui->ctrIp_2);
  65 + m_pSignalMapper->setMapping(ui->ctrIp_3,ui->ctrIp_3);
  66 + m_pSignalMapper->setMapping(ui->ctrGw_0,ui->ctrGw_0);
  67 + m_pSignalMapper->setMapping(ui->ctrGw_1,ui->ctrGw_1);
  68 + m_pSignalMapper->setMapping(ui->ctrGw_2,ui->ctrGw_2);
  69 + m_pSignalMapper->setMapping(ui->ctrGw_3,ui->ctrGw_3);
  70 + m_pSignalMapper->setMapping(ui->ctrNetmask_0,ui->ctrNetmask_0);
  71 + m_pSignalMapper->setMapping(ui->ctrNetmask_1,ui->ctrNetmask_1);
  72 + m_pSignalMapper->setMapping(ui->ctrNetmask_2,ui->ctrNetmask_2);
  73 + m_pSignalMapper->setMapping(ui->ctrNetmask_3,ui->ctrNetmask_3);
  74 +
  75 + connect(ui->ctrGw_0,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  76 + connect(ui->ctrGw_1,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  77 + connect(ui->ctrGw_2,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  78 + connect(ui->ctrGw_3,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  79 + connect(ui->ctrIp_0,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  80 + connect(ui->ctrIp_1,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  81 + connect(ui->ctrIp_2,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  82 + connect(ui->ctrIp_3,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  83 + connect(ui->ctrNetmask_0,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  84 + connect(ui->ctrNetmask_1,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  85 + connect(ui->ctrNetmask_2,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  86 + connect(ui->ctrNetmask_3,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map()));
  87 +
  88 + connect(m_pSignalMapper, SIGNAL(mapped(QWidget*)), this, SLOT(focusInSpinBox(QWidget*)));
  89 +
54 } 90 }
55 91
56 ConfigIpDlg::~ConfigIpDlg() 92 ConfigIpDlg::~ConfigIpDlg()
@@ -88,3 +124,66 @@ void ConfigIpDlg::on_ctrBtnCancel_clicked() @@ -88,3 +124,66 @@ void ConfigIpDlg::on_ctrBtnCancel_clicked()
88 { 124 {
89 reject(); 125 reject();
90 } 126 }
  127 +
  128 +void ConfigIpDlg::focusInSpinBox(QWidget *widget){
  129 + QSpinBox *spbx = qobject_cast<QSpinBox*>(widget);
  130 + if(spbx != NULL){
  131 + m_nFocusValue = spbx->value();
  132 + }
  133 +}
  134 +
  135 +void ConfigIpDlg::keyPressEvent(QKeyEvent *event){
  136 + switch (event->key())
  137 + {
  138 + case 0x01000030: // Turn left
  139 + if(focusWidget() == ui->ctrIp_0) ui->ctrBtnCancel->setFocus();
  140 + else focusPreviousChild();
  141 + break;
  142 + case 0x01000031: // Push
  143 +
  144 + break;
  145 + case 0x01000032: // Turn right
  146 + if(focusWidget() == ui->ctrBtnCancel) ui->ctrIp_0->setFocus();
  147 + else focusNextChild();
  148 +
  149 + break;
  150 + }
  151 +}
  152 +
  153 +void ConfigIpDlg::keyReleaseEvent(QKeyEvent *event){
  154 + switch (event->key())
  155 + {
  156 + case 0x01000030: // Turn left
  157 + if(focusWidget() == ui->ctrIp_0) ui->ctrBtnCancel->setFocus();
  158 + else focusPreviousChild();
  159 + break;
  160 + case 0x01000031: // Push
  161 + {
  162 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  163 + if(btn != NULL){
  164 + btn->click();
  165 + }
  166 + else{
  167 + QSpinBox *spbx = qobject_cast<QSpinBox*>(focusWidget());
  168 + if(spbx != NULL) ui->keyboardwidget->focusInKeyboard();
  169 + }
  170 + break;
  171 + }
  172 + case 0x01000032: // Turn right
  173 + if(focusWidget() == ui->ctrBtnCancel) ui->ctrIp_0->setFocus();
  174 + else focusNextChild();
  175 + break;
  176 + }
  177 +}
  178 +
  179 +void ConfigIpDlg::keyCancel_clicked(){
  180 + QSpinBox *spbx = qobject_cast<QSpinBox*>(focusWidget());
  181 + if(spbx != NULL){
  182 + spbx->setValue(m_nFocusValue);
  183 + }
  184 + ui->keyboardwidget->focusOutKeyboard();
  185 +}
  186 +
  187 +void ConfigIpDlg::keyEnter_clicked(){
  188 + ui->keyboardwidget->focusOutKeyboard();
  189 +}
app/gui/oven_control/configipdlg.h
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 #define CONFIGIPDLG_H 2 #define CONFIGIPDLG_H
3 3
4 #include <QDialog> 4 #include <QDialog>
  5 +#include <QSignalMapper>
5 6
6 namespace Ui { 7 namespace Ui {
7 class ConfigIpDlg; 8 class ConfigIpDlg;
@@ -20,8 +21,21 @@ private slots: @@ -20,8 +21,21 @@ private slots:
20 21
21 void on_ctrBtnCancel_clicked(); 22 void on_ctrBtnCancel_clicked();
22 23
  24 + void keyCancel_clicked();
  25 + void keyEnter_clicked();
  26 +
  27 + void focusInSpinBox(QWidget* widget);
  28 +
23 private: 29 private:
24 Ui::ConfigIpDlg *ui; 30 Ui::ConfigIpDlg *ui;
  31 +
  32 + QSignalMapper* m_pSignalMapper;
  33 + int m_nFocusValue;
  34 +
  35 +protected:
  36 + void keyReleaseEvent(QKeyEvent* event);
  37 + void keyPressEvent(QKeyEvent* event);
  38 +
25 }; 39 };
26 40
27 #endif // CONFIGIPDLG_H 41 #endif // CONFIGIPDLG_H
app/gui/oven_control/configipdlg.ui
@@ -665,6 +665,22 @@ QPushButton::pressed, QPushButton::focus{ @@ -665,6 +665,22 @@ QPushButton::pressed, QPushButton::focus{
665 <header>formatterspinbox.h</header> 665 <header>formatterspinbox.h</header>
666 </customwidget> 666 </customwidget>
667 </customwidgets> 667 </customwidgets>
  668 + <tabstops>
  669 + <tabstop>ctrIp_0</tabstop>
  670 + <tabstop>ctrIp_1</tabstop>
  671 + <tabstop>ctrIp_2</tabstop>
  672 + <tabstop>ctrIp_3</tabstop>
  673 + <tabstop>ctrGw_0</tabstop>
  674 + <tabstop>ctrGw_1</tabstop>
  675 + <tabstop>ctrGw_2</tabstop>
  676 + <tabstop>ctrGw_3</tabstop>
  677 + <tabstop>ctrNetmask_0</tabstop>
  678 + <tabstop>ctrNetmask_1</tabstop>
  679 + <tabstop>ctrNetmask_2</tabstop>
  680 + <tabstop>ctrNetmask_3</tabstop>
  681 + <tabstop>ctrBtnOk</tabstop>
  682 + <tabstop>ctrBtnCancel</tabstop>
  683 + </tabstops>
668 <resources/> 684 <resources/>
669 <connections/> 685 <connections/>
670 </ui> 686 </ui>
app/gui/oven_control/configwindow.cpp
@@ -361,6 +361,17 @@ void ConfigWindow::on_pushButton_5_clicked() @@ -361,6 +361,17 @@ void ConfigWindow::on_pushButton_5_clicked()
361 void ConfigWindow::onDeleteFavoriteBtnClicked(uint16_t id){ 361 void ConfigWindow::onDeleteFavoriteBtnClicked(uint16_t id){
362 Config* cfg = Config::getInstance(); 362 Config* cfg = Config::getInstance();
363 ConfigFavoriteButton* btn; 363 ConfigFavoriteButton* btn;
  364 + m_vectorTabOrder.clear();
  365 + m_vectorTabOrder.append(this);
  366 + m_vectorTabOrder.append(ui->pushButton);
  367 + m_vectorTabOrder.append(ui->pushButton_8);
  368 + m_vectorTabOrder.append(ui->pushButton_7);
  369 + m_vectorTabOrder.append(ui->pushButton_2);
  370 + m_vectorTabOrder.append(ui->pushButton_4);
  371 + m_vectorTabOrder.append(ui->pushButton_5);
  372 + m_vectorTabOrder.append(ui->pushButton_6);
  373 + m_vectorTabOrder.append(ui->pushButton_3);
  374 +
364 for(int i = 0;i<m_vectorFavorMenuList.count();i++){ 375 for(int i = 0;i<m_vectorFavorMenuList.count();i++){
365 if(m_vectorFavorMenuList[i]->getBtnId() == id){ 376 if(m_vectorFavorMenuList[i]->getBtnId() == id){
366 btn = m_vectorFavorMenuList[i]; 377 btn = m_vectorFavorMenuList[i];
@@ -369,7 +380,15 @@ void ConfigWindow::onDeleteFavoriteBtnClicked(uint16_t id){ @@ -369,7 +380,15 @@ void ConfigWindow::onDeleteFavoriteBtnClicked(uint16_t id){
369 delete btn; 380 delete btn;
370 cfg->removeFavorite((ConfigType)id); 381 cfg->removeFavorite((ConfigType)id);
371 } 382 }
  383 + else{
  384 + m_vectorTabOrder.append(m_vectorFavorMenuList[i]->getBtn());
  385 + m_vectorTabOrder.append(m_vectorFavorMenuList[i]->getDelBtn());
  386 + }
372 } 387 }
  388 +
  389 + m_vectorTabOrder.append(ui->backButton);
  390 + m_vectorTabOrder.append(ui->washButton);
  391 + m_vectorTabOrder.append(ui->helpButton);
373 } 392 }
374 393
375 void ConfigWindow::on_washButton_clicked() 394 void ConfigWindow::on_washButton_clicked()
app/gui/oven_control/engineermenuwindow.cpp
@@ -16,6 +16,7 @@ EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) : @@ -16,6 +16,7 @@ EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) :
16 ui(new Ui::EngineerMenuWindow) 16 ui(new Ui::EngineerMenuWindow)
17 { 17 {
18 ui->setupUi(this); 18 ui->setupUi(this);
  19 + this->setFocus();
19 20
20 ui->clockContainer->setParent(ui->upperStack); 21 ui->clockContainer->setParent(ui->upperStack);
21 setAttribute(Qt::WA_DeleteOnClose); 22 setAttribute(Qt::WA_DeleteOnClose);
app/gui/oven_control/engineermenuwindow.ui
@@ -613,6 +613,16 @@ QPushButton { color: rgb(255, 255, 255);text-align: left;padding-left:30px;}&lt;/st @@ -613,6 +613,16 @@ QPushButton { color: rgb(255, 255, 255);text-align: left;padding-left:30px;}&lt;/st
613 <header>washwarnicon.h</header> 613 <header>washwarnicon.h</header>
614 </customwidget> 614 </customwidget>
615 </customwidgets> 615 </customwidgets>
  616 + <tabstops>
  617 + <tabstop>engAdjustButton</tabstop>
  618 + <tabstop>stdConfigButton</tabstop>
  619 + <tabstop>functionTestButton</tabstop>
  620 + <tabstop>serviceHistoryButton</tabstop>
  621 + <tabstop>realDataButton</tabstop>
  622 + <tabstop>operationTimeButton</tabstop>
  623 + <tabstop>modelTypeConfigButton</tabstop>
  624 + <tabstop>backButton</tabstop>
  625 + </tabstops>
616 <resources/> 626 <resources/>
617 <connections/> 627 <connections/>
618 </ui> 628 </ui>
app/gui/oven_control/keyboardwidget.cpp
@@ -249,7 +249,23 @@ void KeyboardWidget::on_pushButton_40_clicked() @@ -249,7 +249,23 @@ void KeyboardWidget::on_pushButton_40_clicked()
249 } 249 }
250 250
251 void KeyboardWidget::keyPressEvent(QKeyEvent *event){ 251 void KeyboardWidget::keyPressEvent(QKeyEvent *event){
252 - 252 + switch (event->key())
  253 + {
  254 + case 0x01000030: // Turn left
  255 + if(m_nCurTabPos > 0 ) m_nCurTabPos--;
  256 + else m_nCurTabPos = m_vectorTabOrder.size()-1;
  257 + if(m_pCurCheckedBtn !=NULL) m_pCurCheckedBtn->setChecked(false);
  258 + m_pCurCheckedBtn = m_vectorTabOrder[m_nCurTabPos];
  259 + m_pCurCheckedBtn->setChecked(true);
  260 + break;
  261 + case 0x01000032: // Turn right
  262 + if(m_nCurTabPos < (m_vectorTabOrder.size() -1)) m_nCurTabPos++;
  263 + else m_nCurTabPos=0;
  264 + if(m_pCurCheckedBtn !=NULL) m_pCurCheckedBtn->setChecked(false);
  265 + m_pCurCheckedBtn = m_vectorTabOrder[m_nCurTabPos];
  266 + m_pCurCheckedBtn->setChecked(true);
  267 + break;
  268 + }
253 } 269 }
254 270
255 void KeyboardWidget::keyReleaseEvent(QKeyEvent *event){ 271 void KeyboardWidget::keyReleaseEvent(QKeyEvent *event){
app/gui/oven_control/servicepassinputdlg.cpp
@@ -14,13 +14,20 @@ ServicePassInputDlg::ServicePassInputDlg(QWidget *parent) : @@ -14,13 +14,20 @@ ServicePassInputDlg::ServicePassInputDlg(QWidget *parent) :
14 setAttribute(Qt::WA_NoSystemBackground); 14 setAttribute(Qt::WA_NoSystemBackground);
15 setAttribute(Qt::WA_TranslucentBackground); 15 setAttribute(Qt::WA_TranslucentBackground);
16 setAttribute(Qt::WA_DeleteOnClose); 16 setAttribute(Qt::WA_DeleteOnClose);
  17 + qApp->setActiveWindow(this);
  18 + ui->ctrProgressBar->setFocus();
  19 +
17 this->setResult(QDialog::Accepted); 20 this->setResult(QDialog::Accepted);
18 foreach (QPushButton *button, findChildren<QPushButton *>()) 21 foreach (QPushButton *button, findChildren<QPushButton *>())
19 connect(button, &QPushButton::pressed, SoundPlayer::playClick); 22 connect(button, &QPushButton::pressed, SoundPlayer::playClick);
20 ui->ctrProgressBar->setMaxProgress(0,MAX_PASSWORD); 23 ui->ctrProgressBar->setMaxProgress(0,MAX_PASSWORD);
21 m_nCurInputCount = 0; 24 m_nCurInputCount = 0;
22 - this->setFocus();  
23 memset(m_strInputPass, 0x00, MAX_PASSWORD+1); 25 memset(m_strInputPass, 0x00, MAX_PASSWORD+1);
  26 + connect(ui->keyboardwidget,SIGNAL(onBackspaceKeyClicked()), SLOT(backspaceKeyPressEvent()));
  27 + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), SLOT(keyEnter_clicked()));
  28 + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()),SLOT(keyCancel_clicked()));
  29 + connect(ui->keyboardwidget,SIGNAL(onKeyboardClickSignal(QString)),SLOT(keyboardInputEvent(QString)));
  30 + ui->keyboardwidget->focusInKeyboard();
24 } 31 }
25 32
26 ServicePassInputDlg::~ServicePassInputDlg() 33 ServicePassInputDlg::~ServicePassInputDlg()
@@ -48,22 +55,71 @@ void ServicePassInputDlg::on_ctrBtnCancel_clicked() @@ -48,22 +55,71 @@ void ServicePassInputDlg::on_ctrBtnCancel_clicked()
48 reject(); 55 reject();
49 } 56 }
50 57
51 -void ServicePassInputDlg::keyPressEvent(QKeyEvent *event){  
52 - if(event->key() == Qt::Key_Backspace){  
53 - if(m_nCurInputCount>0) m_nCurInputCount--;  
54 - m_strInputPass[m_nCurInputCount] = 0;  
55 - qDebug() <<"back space input" << QString(m_strInputPass);  
56 - ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount);  
57 - } 58 +void ServicePassInputDlg::backspaceKeyPressEvent(){
  59 + if(m_nCurInputCount>0) m_nCurInputCount--;
  60 + m_strInputPass[m_nCurInputCount] = 0;
  61 + qDebug() <<"back space input" << QString(m_strInputPass);
  62 + ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount);
58 } 63 }
59 64
60 -void ServicePassInputDlg::inputMethodEvent(QInputMethodEvent *event){ 65 +void ServicePassInputDlg::keyboardInputEvent(QString strIn){
61 if(m_nCurInputCount < MAX_PASSWORD){ 66 if(m_nCurInputCount < MAX_PASSWORD){
62 - if(!event->commitString().isEmpty()){  
63 - const QChar* in = event->commitString().constData(); 67 + const QChar* in = strIn.constData();
64 m_strInputPass[m_nCurInputCount++] = in[0]; 68 m_strInputPass[m_nCurInputCount++] = in[0];
65 qDebug() <<"input event" << QString(m_strInputPass); 69 qDebug() <<"input event" << QString(m_strInputPass);
66 ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount); 70 ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount);
  71 + }
  72 +}
  73 +
  74 +void ServicePassInputDlg::keyPressEvent(QKeyEvent *event){
  75 + int i = 0;
  76 + switch (event->key())
  77 + {
  78 + case 0x01000030: // Turn left
  79 + if(focusWidget() == ui->ctrProgressBar) ui->ctrBtnCancel->setFocus();
  80 + else focusPreviousChild();
  81 + break;
  82 + case 0x01000031: // Push
  83 +
  84 + break;
  85 + case 0x01000032: // Turn right
  86 + if(focusWidget() == ui->ctrBtnCancel) ui->ctrProgressBar->setFocus();
  87 + else focusNextChild();
  88 +
  89 + break;
  90 + }
  91 +}
  92 +
  93 +void ServicePassInputDlg::keyReleaseEvent(QKeyEvent *event){
  94 + int i = 0;
  95 + switch (event->key())
  96 + {
  97 + case 0x01000030: // Turn left
  98 + if(focusWidget() == ui->ctrProgressBar) ui->ctrBtnCancel->setFocus();
  99 + else focusPreviousChild();
  100 + break;
  101 + case 0x01000031: // Push
  102 + {
  103 + QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
  104 + if(btn != NULL){
  105 + btn->click();
67 } 106 }
  107 + else{
  108 + ui->keyboardwidget->focusInKeyboard();
  109 + }
  110 + break;
  111 + }
  112 + case 0x01000032: // Turn right
  113 + if(focusWidget() == ui->ctrBtnCancel) ui->ctrProgressBar->setFocus();
  114 + else focusNextChild();
  115 + break;
68 } 116 }
69 } 117 }
  118 +
  119 +void ServicePassInputDlg::keyCancel_clicked(){
  120 + ui->ctrBtnCancel->click();
  121 +}
  122 +
  123 +void ServicePassInputDlg::keyEnter_clicked(){
  124 + ui->ctrBtnOk->click();
  125 +}
app/gui/oven_control/servicepassinputdlg.h
@@ -16,8 +16,6 @@ class ServicePassInputDlg : public QDialog @@ -16,8 +16,6 @@ class ServicePassInputDlg : public QDialog
16 { 16 {
17 Q_OBJECT 17 Q_OBJECT
18 18
19 - void keyPressEvent(QKeyEvent *);  
20 - void inputMethodEvent(QInputMethodEvent* event);  
21 19
22 20
23 QChar m_strInputPass[MAX_PASSWORD+1]; 21 QChar m_strInputPass[MAX_PASSWORD+1];
@@ -31,6 +29,16 @@ private slots: @@ -31,6 +29,16 @@ private slots:
31 29
32 void on_ctrBtnCancel_clicked(); 30 void on_ctrBtnCancel_clicked();
33 31
  32 + void keyCancel_clicked();
  33 + void keyEnter_clicked();
  34 + void backspaceKeyPressEvent();
  35 +
  36 + void keyboardInputEvent(QString strIn);
  37 +
  38 +protected:
  39 + void keyPressEvent(QKeyEvent *event);
  40 + void keyReleaseEvent(QKeyEvent *event);
  41 +
34 private: 42 private:
35 Ui::ServicePassInputDlg *ui; 43 Ui::ServicePassInputDlg *ui;
36 int m_nCurInputCount; 44 int m_nCurInputCount;
app/gui/oven_control/servicepassinputdlg.ui
@@ -157,6 +157,12 @@ QPushButton::pressed, QPushButton::focus{ @@ -157,6 +157,12 @@ QPushButton::pressed, QPushButton::focus{
157 <height>150</height> 157 <height>150</height>
158 </size> 158 </size>
159 </property> 159 </property>
  160 + <property name="focusPolicy">
  161 + <enum>Qt::TabFocus</enum>
  162 + </property>
  163 + <property name="styleSheet">
  164 + <string notr="true"/>
  165 + </property>
160 </widget> 166 </widget>
161 </item> 167 </item>
162 </layout> 168 </layout>