From 63a45681f34e203e092b342ed67a8d59c0d1b77e Mon Sep 17 00:00:00 2001 From: byloveletter Date: Thu, 15 Jun 2017 11:40:25 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=94=EC=BD=94=EB=8D=94=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 키보드 적용 --- .../config1digitsetandenablesetdlg.cpp | 65 ++++++++++++++ .../oven_control/config1digitsetandenablesetdlg.h | 9 ++ .../oven_control/config1digitsetandenablesetdlg.ui | 6 ++ app/gui/oven_control/config1digitsetdlg.cpp | 65 ++++++++++++++ app/gui/oven_control/config1digitsetdlg.h | 8 ++ app/gui/oven_control/config1digitsetdlg.ui | 5 ++ app/gui/oven_control/configdatetimedlg.cpp | 12 +-- app/gui/oven_control/configdatetimedlg.h | 6 +- app/gui/oven_control/configdoormonitoring.cpp | 18 +++- app/gui/oven_control/configipdlg.cpp | 99 ++++++++++++++++++++++ app/gui/oven_control/configipdlg.h | 14 +++ app/gui/oven_control/configipdlg.ui | 16 ++++ app/gui/oven_control/configwindow.cpp | 19 +++++ app/gui/oven_control/engineermenuwindow.cpp | 1 + app/gui/oven_control/engineermenuwindow.ui | 10 +++ app/gui/oven_control/keyboardwidget.cpp | 18 +++- app/gui/oven_control/servicepassinputdlg.cpp | 78 ++++++++++++++--- app/gui/oven_control/servicepassinputdlg.h | 12 ++- app/gui/oven_control/servicepassinputdlg.ui | 6 ++ 19 files changed, 443 insertions(+), 24 deletions(-) diff --git a/app/gui/oven_control/config1digitsetandenablesetdlg.cpp b/app/gui/oven_control/config1digitsetandenablesetdlg.cpp index 96e3ff6..667c81a 100644 --- a/app/gui/oven_control/config1digitsetandenablesetdlg.cpp +++ b/app/gui/oven_control/config1digitsetandenablesetdlg.cpp @@ -1,3 +1,4 @@ +#include #include "config1digitsetandenablesetdlg.h" #include "ui_config1digitsetandenablesetdlg.h" #include "soundplayer.h" @@ -19,6 +20,9 @@ Config1DigitSetAndEnableSetDlg::Config1DigitSetAndEnableSetDlg(QWidget *parent, ui->ctrSpBxValue->setValue(val); ui->ctrSpBxValue->installEventFilter(this); + + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked())); + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked())); } Config1DigitSetAndEnableSetDlg::~Config1DigitSetAndEnableSetDlg() @@ -46,6 +50,67 @@ void Config1DigitSetAndEnableSetDlg::on_ctrBtnCancel_clicked() close(); } +void Config1DigitSetAndEnableSetDlg::keyCancel_clicked() +{ + if(focusWidget() == ui->ctrSpBxValue) ui->ctrSpBxValue->setValue(m_nPrevValue); + ui->keyboardwidget->focusOutKeyboard(); +} + +void Config1DigitSetAndEnableSetDlg::keyEnter_clicked() +{ + ui->keyboardwidget->focusOutKeyboard(); +} + int Config1DigitSetAndEnableSetDlg::getValue(){ return ui->ctrSpBxValue->value(); } + + +void Config1DigitSetAndEnableSetDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus(); + else focusPreviousChild(); + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus(); + else focusNextChild(); + + break; + } +} + +void Config1DigitSetAndEnableSetDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus(); + else focusPreviousChild(); + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + else{ + QSpinBox *spbx = qobject_cast(focusWidget()); + if(spbx != NULL) { + m_nPrevValue = spbx->value(); + ui->keyboardwidget->focusInKeyboard(); + } + } + break; + } + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus(); + else focusNextChild(); + break; + } +} diff --git a/app/gui/oven_control/config1digitsetandenablesetdlg.h b/app/gui/oven_control/config1digitsetandenablesetdlg.h index 665bb01..e8fe46b 100644 --- a/app/gui/oven_control/config1digitsetandenablesetdlg.h +++ b/app/gui/oven_control/config1digitsetandenablesetdlg.h @@ -34,9 +34,18 @@ private slots: void on_ctrBtnCancel_clicked(); +public slots: + void keyCancel_clicked(); + void keyEnter_clicked(); + +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::Config1DigitSetAndEnableSetDlg *ui; custom_result m_nResult; + int m_nPrevValue; }; #endif // CONFIG1DIGITSETANDENABLESETDLG_H diff --git a/app/gui/oven_control/config1digitsetandenablesetdlg.ui b/app/gui/oven_control/config1digitsetandenablesetdlg.ui index 48f9bf1..fbfb331 100644 --- a/app/gui/oven_control/config1digitsetandenablesetdlg.ui +++ b/app/gui/oven_control/config1digitsetandenablesetdlg.ui @@ -314,6 +314,12 @@ QPushButton::pressed, QPushButton::focus{ 1 + + ctrSpBxValue + ctrBtnOk + ctrBtnOk_2 + ctrBtnCancel + diff --git a/app/gui/oven_control/config1digitsetdlg.cpp b/app/gui/oven_control/config1digitsetdlg.cpp index f35ad64..b0540cd 100644 --- a/app/gui/oven_control/config1digitsetdlg.cpp +++ b/app/gui/oven_control/config1digitsetdlg.cpp @@ -1,4 +1,5 @@ #include +#include #include "config1digitsetdlg.h" #include "ui_config1digitsetdlg.h" #include "soundplayer.h" @@ -16,6 +17,8 @@ Config1DigitSetDlg::Config1DigitSetDlg(QWidget *parent, ConfigType type) : ui->setupUi(this); this->setWindowFlags( Qt::FramelessWindowHint); this->setAttribute( Qt::WA_DeleteOnClose); + qApp->setActiveWindow(this); + this->setFocus(); foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); @@ -53,6 +56,9 @@ Config1DigitSetDlg::Config1DigitSetDlg(QWidget *parent, ConfigType type) : ui->ctrSpBxValue->installEventFilter(this); + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked())); + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked())); + } Config1DigitSetDlg::~Config1DigitSetDlg() @@ -83,3 +89,62 @@ bool Config1DigitSetDlg::eventFilter(QObject *object, QEvent *event){ } return QWidget::eventFilter(object, event); } + +void Config1DigitSetDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus(); + else focusPreviousChild(); + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus(); + else focusNextChild(); + + break; + } +} + +void Config1DigitSetDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrSpBxValue) ui->ctrBtnCancel->setFocus(); + else focusPreviousChild(); + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + else{ + QSpinBox *spbx = qobject_cast(focusWidget()); + qDebug() << "grab keyboard"; + if(spbx != NULL) { + m_nPrevValue = spbx->value(); + ui->keyboardwidget->focusInKeyboard(); + } + } + break; + } + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnCancel) ui->ctrSpBxValue->setFocus(); + else focusNextChild(); + break; + } +} + +void Config1DigitSetDlg::keyCancel_clicked(){ + if(focusWidget() == ui->ctrSpBxValue) ui->ctrSpBxValue->setValue(m_nPrevValue); + ui->keyboardwidget->focusOutKeyboard(); +} + +void Config1DigitSetDlg::keyEnter_clicked(){ + ui->keyboardwidget->focusOutKeyboard(); +} diff --git a/app/gui/oven_control/config1digitsetdlg.h b/app/gui/oven_control/config1digitsetdlg.h index ca655dd..2d08bd0 100644 --- a/app/gui/oven_control/config1digitsetdlg.h +++ b/app/gui/oven_control/config1digitsetdlg.h @@ -25,9 +25,17 @@ private slots: bool eventFilter(QObject *, QEvent *); + void keyCancel_clicked(); + void keyEnter_clicked(); + +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::Config1DigitSetDlg *ui; ConfigType m_nType; + int m_nPrevValue; }; #endif // CONFIG1DIGITSETDLG_H diff --git a/app/gui/oven_control/config1digitsetdlg.ui b/app/gui/oven_control/config1digitsetdlg.ui index 6016c73..1d76908 100644 --- a/app/gui/oven_control/config1digitsetdlg.ui +++ b/app/gui/oven_control/config1digitsetdlg.ui @@ -291,6 +291,11 @@ QPushButton::pressed, QPushButton::focus{ 1 + + ctrSpBxValue + ctrBtnOk + ctrBtnCancel + diff --git a/app/gui/oven_control/configdatetimedlg.cpp b/app/gui/oven_control/configdatetimedlg.cpp index 5be5813..d457ec7 100644 --- a/app/gui/oven_control/configdatetimedlg.cpp +++ b/app/gui/oven_control/configdatetimedlg.cpp @@ -33,8 +33,8 @@ ConfigDateTimeDlg::ConfigDateTimeDlg(QWidget *parent) : m_bInputState = true; - connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(on_keyEnter_clicked())); - connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(on_keyCancel_clicked())); + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked())); + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked())); m_pMapperSpins = new QSignalMapper(this); m_pMapperSpins->setMapping(ui->ctrSpBxYear, ui->ctrSpBxYear); @@ -49,7 +49,7 @@ ConfigDateTimeDlg::ConfigDateTimeDlg(QWidget *parent) : connect(ui->ctrSpBxHour, SIGNAL(focusInEdit()), m_pMapperSpins, SLOT(map())); connect(ui->ctrSpBxMin, SIGNAL(focusInEdit()), m_pMapperSpins, SLOT(map())); - connect(m_pMapperSpins, SIGNAL(mapped(QWidget*)), this, SLOT(on_focusInSpinBox(QWidget*))); + connect(m_pMapperSpins, SIGNAL(mapped(QWidget*)), this, SLOT(focusInSpinBox(QWidget*))); } ConfigDateTimeDlg::~ConfigDateTimeDlg() @@ -128,7 +128,7 @@ void ConfigDateTimeDlg::keyReleaseEvent(QKeyEvent *event){ } } -void ConfigDateTimeDlg::on_keyCancel_clicked(){ +void ConfigDateTimeDlg::keyCancel_clicked(){ QSpinBox *spbx = qobject_cast(focusWidget()); if(spbx != NULL){ spbx->setValue(m_nFocusValue); @@ -136,11 +136,11 @@ void ConfigDateTimeDlg::on_keyCancel_clicked(){ ui->keyboardwidget->focusOutKeyboard(); } -void ConfigDateTimeDlg::on_keyEnter_clicked(){ +void ConfigDateTimeDlg::keyEnter_clicked(){ ui->keyboardwidget->focusOutKeyboard(); } -void ConfigDateTimeDlg::on_focusInSpinBox(QWidget *widget){ +void ConfigDateTimeDlg::focusInSpinBox(QWidget *widget){ QSpinBox *spbx = qobject_cast(widget); if(spbx != NULL){ m_nFocusValue = spbx->value(); diff --git a/app/gui/oven_control/configdatetimedlg.h b/app/gui/oven_control/configdatetimedlg.h index 0d6f38d..073f328 100644 --- a/app/gui/oven_control/configdatetimedlg.h +++ b/app/gui/oven_control/configdatetimedlg.h @@ -25,10 +25,10 @@ private slots: void on_ctrBtnCancel_clicked(); - void on_keyCancel_clicked(); - void on_keyEnter_clicked(); + void keyCancel_clicked(); + void keyEnter_clicked(); - void on_focusInSpinBox(QWidget* widget); + void focusInSpinBox(QWidget* widget); protected: void keyReleaseEvent(QKeyEvent* event); diff --git a/app/gui/oven_control/configdoormonitoring.cpp b/app/gui/oven_control/configdoormonitoring.cpp index 123750d..f487de1 100644 --- a/app/gui/oven_control/configdoormonitoring.cpp +++ b/app/gui/oven_control/configdoormonitoring.cpp @@ -168,5 +168,21 @@ void ConfigDoorMonitoring::keyPressEvent(QKeyEvent *event){ } void ConfigDoorMonitoring::keyReleaseEvent(QKeyEvent *event){ - + switch (event->key()) + { + case 0x01000030: // Turn left + focusPreviousChild(); + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + focusNextChild(); + break; + } } diff --git a/app/gui/oven_control/configipdlg.cpp b/app/gui/oven_control/configipdlg.cpp index d509b26..06e6abd 100644 --- a/app/gui/oven_control/configipdlg.cpp +++ b/app/gui/oven_control/configipdlg.cpp @@ -1,3 +1,4 @@ +#include #include "configipdlg.h" #include "ui_configipdlg.h" #include "config.h" @@ -13,6 +14,8 @@ ConfigIpDlg::ConfigIpDlg(QWidget *parent) : setWindowFlags(Qt::FramelessWindowHint); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_TranslucentBackground); + qApp->setActiveWindow(this); + this->setFocus(); foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); @@ -51,6 +54,39 @@ ConfigIpDlg::ConfigIpDlg(QWidget *parent) : ui->ctrNetmask_2->setValue(temp.d8.d8_2); ui->ctrNetmask_3->setValue(temp.d8.d8_3); + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), this, SLOT(keyEnter_clicked())); + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()), this, SLOT(keyCancel_clicked())); + + m_pSignalMapper = new QSignalMapper(this); + + m_pSignalMapper->setMapping(ui->ctrIp_0,ui->ctrIp_0); + m_pSignalMapper->setMapping(ui->ctrIp_1,ui->ctrIp_1); + m_pSignalMapper->setMapping(ui->ctrIp_2,ui->ctrIp_2); + m_pSignalMapper->setMapping(ui->ctrIp_3,ui->ctrIp_3); + m_pSignalMapper->setMapping(ui->ctrGw_0,ui->ctrGw_0); + m_pSignalMapper->setMapping(ui->ctrGw_1,ui->ctrGw_1); + m_pSignalMapper->setMapping(ui->ctrGw_2,ui->ctrGw_2); + m_pSignalMapper->setMapping(ui->ctrGw_3,ui->ctrGw_3); + m_pSignalMapper->setMapping(ui->ctrNetmask_0,ui->ctrNetmask_0); + m_pSignalMapper->setMapping(ui->ctrNetmask_1,ui->ctrNetmask_1); + m_pSignalMapper->setMapping(ui->ctrNetmask_2,ui->ctrNetmask_2); + m_pSignalMapper->setMapping(ui->ctrNetmask_3,ui->ctrNetmask_3); + + connect(ui->ctrGw_0,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrGw_1,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrGw_2,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrGw_3,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrIp_0,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrIp_1,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrIp_2,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrIp_3,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrNetmask_0,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrNetmask_1,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrNetmask_2,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + connect(ui->ctrNetmask_3,SIGNAL(focusInEdit()),m_pSignalMapper, SLOT(map())); + + connect(m_pSignalMapper, SIGNAL(mapped(QWidget*)), this, SLOT(focusInSpinBox(QWidget*))); + } ConfigIpDlg::~ConfigIpDlg() @@ -88,3 +124,66 @@ void ConfigIpDlg::on_ctrBtnCancel_clicked() { reject(); } + +void ConfigIpDlg::focusInSpinBox(QWidget *widget){ + QSpinBox *spbx = qobject_cast(widget); + if(spbx != NULL){ + m_nFocusValue = spbx->value(); + } +} + +void ConfigIpDlg::keyPressEvent(QKeyEvent *event){ + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrIp_0) ui->ctrBtnCancel->setFocus(); + else focusPreviousChild(); + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnCancel) ui->ctrIp_0->setFocus(); + else focusNextChild(); + + break; + } +} + +void ConfigIpDlg::keyReleaseEvent(QKeyEvent *event){ + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrIp_0) ui->ctrBtnCancel->setFocus(); + else focusPreviousChild(); + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + else{ + QSpinBox *spbx = qobject_cast(focusWidget()); + if(spbx != NULL) ui->keyboardwidget->focusInKeyboard(); + } + break; + } + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnCancel) ui->ctrIp_0->setFocus(); + else focusNextChild(); + break; + } +} + +void ConfigIpDlg::keyCancel_clicked(){ + QSpinBox *spbx = qobject_cast(focusWidget()); + if(spbx != NULL){ + spbx->setValue(m_nFocusValue); + } + ui->keyboardwidget->focusOutKeyboard(); +} + +void ConfigIpDlg::keyEnter_clicked(){ + ui->keyboardwidget->focusOutKeyboard(); +} diff --git a/app/gui/oven_control/configipdlg.h b/app/gui/oven_control/configipdlg.h index 6e42466..085cce7 100644 --- a/app/gui/oven_control/configipdlg.h +++ b/app/gui/oven_control/configipdlg.h @@ -2,6 +2,7 @@ #define CONFIGIPDLG_H #include +#include namespace Ui { class ConfigIpDlg; @@ -20,8 +21,21 @@ private slots: void on_ctrBtnCancel_clicked(); + void keyCancel_clicked(); + void keyEnter_clicked(); + + void focusInSpinBox(QWidget* widget); + private: Ui::ConfigIpDlg *ui; + + QSignalMapper* m_pSignalMapper; + int m_nFocusValue; + +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + }; #endif // CONFIGIPDLG_H diff --git a/app/gui/oven_control/configipdlg.ui b/app/gui/oven_control/configipdlg.ui index be20566..9b8593e 100644 --- a/app/gui/oven_control/configipdlg.ui +++ b/app/gui/oven_control/configipdlg.ui @@ -665,6 +665,22 @@ QPushButton::pressed, QPushButton::focus{
formatterspinbox.h
+ + ctrIp_0 + ctrIp_1 + ctrIp_2 + ctrIp_3 + ctrGw_0 + ctrGw_1 + ctrGw_2 + ctrGw_3 + ctrNetmask_0 + ctrNetmask_1 + ctrNetmask_2 + ctrNetmask_3 + ctrBtnOk + ctrBtnCancel + diff --git a/app/gui/oven_control/configwindow.cpp b/app/gui/oven_control/configwindow.cpp index 6d1d38b..f005dbf 100644 --- a/app/gui/oven_control/configwindow.cpp +++ b/app/gui/oven_control/configwindow.cpp @@ -361,6 +361,17 @@ void ConfigWindow::on_pushButton_5_clicked() void ConfigWindow::onDeleteFavoriteBtnClicked(uint16_t id){ Config* cfg = Config::getInstance(); ConfigFavoriteButton* btn; + m_vectorTabOrder.clear(); + m_vectorTabOrder.append(this); + m_vectorTabOrder.append(ui->pushButton); + m_vectorTabOrder.append(ui->pushButton_8); + m_vectorTabOrder.append(ui->pushButton_7); + m_vectorTabOrder.append(ui->pushButton_2); + m_vectorTabOrder.append(ui->pushButton_4); + m_vectorTabOrder.append(ui->pushButton_5); + m_vectorTabOrder.append(ui->pushButton_6); + m_vectorTabOrder.append(ui->pushButton_3); + for(int i = 0;igetBtnId() == id){ btn = m_vectorFavorMenuList[i]; @@ -369,7 +380,15 @@ void ConfigWindow::onDeleteFavoriteBtnClicked(uint16_t id){ delete btn; cfg->removeFavorite((ConfigType)id); } + else{ + m_vectorTabOrder.append(m_vectorFavorMenuList[i]->getBtn()); + m_vectorTabOrder.append(m_vectorFavorMenuList[i]->getDelBtn()); + } } + + m_vectorTabOrder.append(ui->backButton); + m_vectorTabOrder.append(ui->washButton); + m_vectorTabOrder.append(ui->helpButton); } void ConfigWindow::on_washButton_clicked() diff --git a/app/gui/oven_control/engineermenuwindow.cpp b/app/gui/oven_control/engineermenuwindow.cpp index 0ac4ae3..bce913a 100644 --- a/app/gui/oven_control/engineermenuwindow.cpp +++ b/app/gui/oven_control/engineermenuwindow.cpp @@ -16,6 +16,7 @@ EngineerMenuWindow::EngineerMenuWindow(QWidget *parent) : ui(new Ui::EngineerMenuWindow) { ui->setupUi(this); + this->setFocus(); ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); diff --git a/app/gui/oven_control/engineermenuwindow.ui b/app/gui/oven_control/engineermenuwindow.ui index 40caccc..71c8053 100644 --- a/app/gui/oven_control/engineermenuwindow.ui +++ b/app/gui/oven_control/engineermenuwindow.ui @@ -613,6 +613,16 @@ QPushButton { color: rgb(255, 255, 255);text-align: left;padding-left:30px;}washwarnicon.h + + engAdjustButton + stdConfigButton + functionTestButton + serviceHistoryButton + realDataButton + operationTimeButton + modelTypeConfigButton + backButton + diff --git a/app/gui/oven_control/keyboardwidget.cpp b/app/gui/oven_control/keyboardwidget.cpp index 2d7dbe1..2d2b736 100644 --- a/app/gui/oven_control/keyboardwidget.cpp +++ b/app/gui/oven_control/keyboardwidget.cpp @@ -249,7 +249,23 @@ void KeyboardWidget::on_pushButton_40_clicked() } void KeyboardWidget::keyPressEvent(QKeyEvent *event){ - + switch (event->key()) + { + case 0x01000030: // Turn left + if(m_nCurTabPos > 0 ) m_nCurTabPos--; + else m_nCurTabPos = m_vectorTabOrder.size()-1; + if(m_pCurCheckedBtn !=NULL) m_pCurCheckedBtn->setChecked(false); + m_pCurCheckedBtn = m_vectorTabOrder[m_nCurTabPos]; + m_pCurCheckedBtn->setChecked(true); + break; + case 0x01000032: // Turn right + if(m_nCurTabPos < (m_vectorTabOrder.size() -1)) m_nCurTabPos++; + else m_nCurTabPos=0; + if(m_pCurCheckedBtn !=NULL) m_pCurCheckedBtn->setChecked(false); + m_pCurCheckedBtn = m_vectorTabOrder[m_nCurTabPos]; + m_pCurCheckedBtn->setChecked(true); + break; + } } void KeyboardWidget::keyReleaseEvent(QKeyEvent *event){ diff --git a/app/gui/oven_control/servicepassinputdlg.cpp b/app/gui/oven_control/servicepassinputdlg.cpp index 663cb19..bd4283a 100644 --- a/app/gui/oven_control/servicepassinputdlg.cpp +++ b/app/gui/oven_control/servicepassinputdlg.cpp @@ -14,13 +14,20 @@ ServicePassInputDlg::ServicePassInputDlg(QWidget *parent) : setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_DeleteOnClose); + qApp->setActiveWindow(this); + ui->ctrProgressBar->setFocus(); + this->setResult(QDialog::Accepted); foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); ui->ctrProgressBar->setMaxProgress(0,MAX_PASSWORD); m_nCurInputCount = 0; - this->setFocus(); memset(m_strInputPass, 0x00, MAX_PASSWORD+1); + connect(ui->keyboardwidget,SIGNAL(onBackspaceKeyClicked()), SLOT(backspaceKeyPressEvent())); + connect(ui->keyboardwidget, SIGNAL(onOkKeyClicked()), SLOT(keyEnter_clicked())); + connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()),SLOT(keyCancel_clicked())); + connect(ui->keyboardwidget,SIGNAL(onKeyboardClickSignal(QString)),SLOT(keyboardInputEvent(QString))); + ui->keyboardwidget->focusInKeyboard(); } ServicePassInputDlg::~ServicePassInputDlg() @@ -48,22 +55,71 @@ void ServicePassInputDlg::on_ctrBtnCancel_clicked() reject(); } -void ServicePassInputDlg::keyPressEvent(QKeyEvent *event){ - if(event->key() == Qt::Key_Backspace){ - if(m_nCurInputCount>0) m_nCurInputCount--; - m_strInputPass[m_nCurInputCount] = 0; - qDebug() <<"back space input" << QString(m_strInputPass); - ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount); - } +void ServicePassInputDlg::backspaceKeyPressEvent(){ + if(m_nCurInputCount>0) m_nCurInputCount--; + m_strInputPass[m_nCurInputCount] = 0; + qDebug() <<"back space input" << QString(m_strInputPass); + ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount); } -void ServicePassInputDlg::inputMethodEvent(QInputMethodEvent *event){ +void ServicePassInputDlg::keyboardInputEvent(QString strIn){ if(m_nCurInputCount < MAX_PASSWORD){ - if(!event->commitString().isEmpty()){ - const QChar* in = event->commitString().constData(); + const QChar* in = strIn.constData(); m_strInputPass[m_nCurInputCount++] = in[0]; qDebug() <<"input event" << QString(m_strInputPass); ui->ctrProgressBar->setCurrentProgress(m_nCurInputCount); + } +} + +void ServicePassInputDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrProgressBar) ui->ctrBtnCancel->setFocus(); + else focusPreviousChild(); + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnCancel) ui->ctrProgressBar->setFocus(); + else focusNextChild(); + + break; + } +} + +void ServicePassInputDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrProgressBar) ui->ctrBtnCancel->setFocus(); + else focusPreviousChild(); + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); } + else{ + ui->keyboardwidget->focusInKeyboard(); + } + break; + } + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnCancel) ui->ctrProgressBar->setFocus(); + else focusNextChild(); + break; } } + +void ServicePassInputDlg::keyCancel_clicked(){ + ui->ctrBtnCancel->click(); +} + +void ServicePassInputDlg::keyEnter_clicked(){ + ui->ctrBtnOk->click(); +} diff --git a/app/gui/oven_control/servicepassinputdlg.h b/app/gui/oven_control/servicepassinputdlg.h index fcc1b95..730d1b3 100644 --- a/app/gui/oven_control/servicepassinputdlg.h +++ b/app/gui/oven_control/servicepassinputdlg.h @@ -16,8 +16,6 @@ class ServicePassInputDlg : public QDialog { Q_OBJECT - void keyPressEvent(QKeyEvent *); - void inputMethodEvent(QInputMethodEvent* event); QChar m_strInputPass[MAX_PASSWORD+1]; @@ -31,6 +29,16 @@ private slots: void on_ctrBtnCancel_clicked(); + void keyCancel_clicked(); + void keyEnter_clicked(); + void backspaceKeyPressEvent(); + + void keyboardInputEvent(QString strIn); + +protected: + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + private: Ui::ServicePassInputDlg *ui; int m_nCurInputCount; diff --git a/app/gui/oven_control/servicepassinputdlg.ui b/app/gui/oven_control/servicepassinputdlg.ui index 01c9f9c..c89ce40 100644 --- a/app/gui/oven_control/servicepassinputdlg.ui +++ b/app/gui/oven_control/servicepassinputdlg.ui @@ -157,6 +157,12 @@ QPushButton::pressed, QPushButton::focus{ 150 + + Qt::TabFocus + + + + -- 2.1.4