diff --git a/app/gui/oven_control/configbacklightdlg.cpp b/app/gui/oven_control/configbacklightdlg.cpp index 78d3f4a..4597570 100644 --- a/app/gui/oven_control/configbacklightdlg.cpp +++ b/app/gui/oven_control/configbacklightdlg.cpp @@ -19,6 +19,8 @@ ConfigBackLightDlg::ConfigBackLightDlg(QWidget *parent) : 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); @@ -28,6 +30,11 @@ ConfigBackLightDlg::ConfigBackLightDlg(QWidget *parent) : m_nSelBackLight = item.d32; ui->ctrProgressLight->setMaxProgress(0,MAX_LIGHT); ui->ctrProgressLight->setCurrentProgress(m_nSelBackLight); + m_vectorTabOrder.append(this); + m_vectorTabOrder.append(ui->ctrBtnPlus); + m_vectorTabOrder.append(ui->ctrBtnMinus); + m_vectorTabOrder.append(ui->ctrBtnOk); + m_vectorTabOrder.append(ui->ctrBtnCancel); } ConfigBackLightDlg::~ConfigBackLightDlg() @@ -78,3 +85,100 @@ void ConfigBackLightDlg::on_ctrBtnMinus_clicked() Backlight::set(m_nSelBackLight); } + +void ConfigBackLightDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + +void ConfigBackLightDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} diff --git a/app/gui/oven_control/configbacklightdlg.h b/app/gui/oven_control/configbacklightdlg.h index 0fb1791..7aeddf7 100644 --- a/app/gui/oven_control/configbacklightdlg.h +++ b/app/gui/oven_control/configbacklightdlg.h @@ -2,6 +2,8 @@ #define CONFIGBACKLIGHTDLG_H #include +#include +#include namespace Ui { class ConfigBackLightDlg; @@ -26,9 +28,14 @@ private slots: void on_ctrBtnMinus_clicked(); +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::ConfigBackLightDlg *ui; int m_nSelBackLight; + QVector m_vectorTabOrder; }; #endif // CONFIGBACKLIGHTDLG_H diff --git a/app/gui/oven_control/configfavoritebutton.cpp b/app/gui/oven_control/configfavoritebutton.cpp index 39db3ff..854da40 100644 --- a/app/gui/oven_control/configfavoritebutton.cpp +++ b/app/gui/oven_control/configfavoritebutton.cpp @@ -23,6 +23,15 @@ void ConfigFavoriteButton::setText(const QString &text){ ui->pushButton->setText(text); } +QWidget *ConfigFavoriteButton::getBtn() +{ + return ui->pushButton; +} + +QWidget* ConfigFavoriteButton::getDelBtn(){ + return ui->favoriteButton; +} + void ConfigFavoriteButton::on_favoriteButton_clicked() diff --git a/app/gui/oven_control/configfavoritebutton.h b/app/gui/oven_control/configfavoritebutton.h index 5534e30..1ad9d99 100644 --- a/app/gui/oven_control/configfavoritebutton.h +++ b/app/gui/oven_control/configfavoritebutton.h @@ -16,6 +16,9 @@ public: ~ConfigFavoriteButton(); void setText(const QString &text); + QWidget* getBtn(); + QWidget* getDelBtn(); + private: Ui::ConfigFavoriteButton *ui; diff --git a/app/gui/oven_control/configfileprocessdlg.cpp b/app/gui/oven_control/configfileprocessdlg.cpp index c7df83c..618a883 100644 --- a/app/gui/oven_control/configfileprocessdlg.cpp +++ b/app/gui/oven_control/configfileprocessdlg.cpp @@ -14,6 +14,8 @@ ConfigFileProcessDlg::ConfigFileProcessDlg(QWidget *parent, ConfigType type, boo setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_DeleteOnClose); + qApp->setActiveWindow(this); + this->setFocus(); foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); @@ -53,3 +55,42 @@ void ConfigFileProcessDlg::on_ctrBtnCancel_clicked() { deleteLater(); } + + +void ConfigFileProcessDlg::keyPressEvent(QKeyEvent *event){ + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrBtnOk) ui->ctrBtnCancel->setFocus(); + else ui->ctrBtnOk->setFocus(); + break; + case 0x01000031: // Push + break; + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnOk) ui->ctrBtnCancel->setFocus(); + else ui->ctrBtnOk->setFocus(); + break; + } +} + +void ConfigFileProcessDlg::keyReleaseEvent(QKeyEvent *event){ + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrBtnOk) ui->ctrBtnCancel->setFocus(); + else ui->ctrBtnOk->setFocus(); + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnOk) ui->ctrBtnCancel->setFocus(); + else ui->ctrBtnOk->setFocus(); + break; + } +} diff --git a/app/gui/oven_control/configfileprocessdlg.h b/app/gui/oven_control/configfileprocessdlg.h index 27a1110..010ef6f 100644 --- a/app/gui/oven_control/configfileprocessdlg.h +++ b/app/gui/oven_control/configfileprocessdlg.h @@ -2,6 +2,7 @@ #define CONFIGFILEPROCESSDLG_H #include +#include #include "config.h" using namespace Define; @@ -23,6 +24,10 @@ private slots: void on_ctrBtnCancel_clicked(); +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::ConfigFileProcessDlg *ui; ConfigType m_nCfgtype; diff --git a/app/gui/oven_control/configlanguagedlg.cpp b/app/gui/oven_control/configlanguagedlg.cpp index c45a670..9da94b5 100644 --- a/app/gui/oven_control/configlanguagedlg.cpp +++ b/app/gui/oven_control/configlanguagedlg.cpp @@ -10,8 +10,11 @@ ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) : ui(new Ui::ConfigLanguageDlg) { ui->setupUi(this); - this->setWindowFlags( Qt::FramelessWindowHint); + this->setWindowFlags(Qt::FramelessWindowHint); this->setAttribute( Qt::WA_DeleteOnClose); + qApp->setActiveWindow(this); + this->setFocus(); + foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); @@ -38,6 +41,13 @@ ConfigLanguageDlg::ConfigLanguageDlg(QWidget *parent) : connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int))); + m_vectorTabOrder.append(this); + m_vectorTabOrder.append(ui->pushButton_1); + m_vectorTabOrder.append(ui->pushButton_2); + m_vectorTabOrder.append(ui->pushButton_3); + m_vectorTabOrder.append(ui->ctrBtnOk); + m_vectorTabOrder.append(ui->ctrBtnCancel); + reloadUi(); } ConfigLanguageDlg::~ConfigLanguageDlg() @@ -78,3 +88,100 @@ void ConfigLanguageDlg::reloadUi(){ break; } } + +void ConfigLanguageDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + +void ConfigLanguageDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} diff --git a/app/gui/oven_control/configlanguagedlg.h b/app/gui/oven_control/configlanguagedlg.h index f641a04..03659c2 100644 --- a/app/gui/oven_control/configlanguagedlg.h +++ b/app/gui/oven_control/configlanguagedlg.h @@ -3,6 +3,8 @@ #include #include +#include +#include namespace Ui { class ConfigLanguageDlg; @@ -24,10 +26,15 @@ private slots: void onConfigBtnClicked(const int sel); +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::ConfigLanguageDlg *ui; QSignalMapper *m_pSignalMapper; int m_nCurSelLang; + QVector m_vectorTabOrder; }; #endif // CONFIGLANGUAGEDLG_H diff --git a/app/gui/oven_control/configlanguagedlg.ui b/app/gui/oven_control/configlanguagedlg.ui index 211b49b..8149652 100644 --- a/app/gui/oven_control/configlanguagedlg.ui +++ b/app/gui/oven_control/configlanguagedlg.ui @@ -10,6 +10,9 @@ 1600 + + Qt::StrongFocus + false @@ -55,6 +58,9 @@ QLabel{ 450 + + Qt::TabFocus + @@ -252,6 +258,14 @@ QLabel{ + + pushButton_1 + ctrBtnOk + pushButton_2 + ctrBtnCancel + pushButton_3 + centralwidget + diff --git a/app/gui/oven_control/configmastervolumedlg.cpp b/app/gui/oven_control/configmastervolumedlg.cpp index 6701069..4e5b5a4 100644 --- a/app/gui/oven_control/configmastervolumedlg.cpp +++ b/app/gui/oven_control/configmastervolumedlg.cpp @@ -16,6 +16,8 @@ ConfigVolumeDlg::ConfigVolumeDlg(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); @@ -30,6 +32,12 @@ ConfigVolumeDlg::ConfigVolumeDlg(QWidget *parent, ConfigType type) : item = cfg->getConfigValue(m_cfgType); m_nPrevVol = m_nCurVol = item.d32; ui->ctrProgressLight->setMaxProgress(m_nCurVol,MAX_VOL); + + m_vectorTabOrder.append(this); + m_vectorTabOrder.append(ui->ctrBtnMinus); + m_vectorTabOrder.append(ui->ctrBtnPlus); + m_vectorTabOrder.append(ui->ctrBtnOk); + m_vectorTabOrder.append(ui->ctrBtnCancel); } ConfigVolumeDlg::~ConfigVolumeDlg() @@ -74,3 +82,100 @@ void ConfigVolumeDlg::on_ctrBtnPlus_clicked() SoundPlayer::playClick(); } + +void ConfigVolumeDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + +void ConfigVolumeDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} diff --git a/app/gui/oven_control/configmastervolumedlg.h b/app/gui/oven_control/configmastervolumedlg.h index e847d71..fea60d7 100644 --- a/app/gui/oven_control/configmastervolumedlg.h +++ b/app/gui/oven_control/configmastervolumedlg.h @@ -2,6 +2,8 @@ #define CONFIGMASTERVOLUMEDLG_H #include +#include +#include #include "config.h" using namespace Define; @@ -27,11 +29,16 @@ private slots: void on_ctrBtnPlus_clicked(); +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::ConfigMasterVolumeDlg *ui; int m_nCurVol; int m_nPrevVol; ConfigType m_cfgType; + QVector m_vectorTabOrder; }; #endif // CONFIGMASTERVOLUMEDLG_H diff --git a/app/gui/oven_control/configpanelbutton.cpp b/app/gui/oven_control/configpanelbutton.cpp index bffaf1d..ce573f3 100644 --- a/app/gui/oven_control/configpanelbutton.cpp +++ b/app/gui/oven_control/configpanelbutton.cpp @@ -41,6 +41,15 @@ bool ConfigPanelButton::isFavoriteFocused() return (focusWidget() == ui->favoriteButton); } +QWidget *ConfigPanelButton::getFavoriteBtn() +{ + return ui->favoriteButton; +} + +QWidget* ConfigPanelButton::getBtn(){ + return ui->pushButton; +} + void ConfigPanelButton::setText(const QString &text) { if (text_ == text) diff --git a/app/gui/oven_control/configpanelbutton.h b/app/gui/oven_control/configpanelbutton.h index 699abec..9aab401 100644 --- a/app/gui/oven_control/configpanelbutton.h +++ b/app/gui/oven_control/configpanelbutton.h @@ -19,6 +19,8 @@ public: const QString &value() { return value_; } bool isFavoriteFocused(); + QWidget* getFavoriteBtn(); + QWidget* getBtn(); public slots: void setText(const QString &text); diff --git a/app/gui/oven_control/configresttimeformatdlg.cpp b/app/gui/oven_control/configresttimeformatdlg.cpp index c150e77..3bd2033 100644 --- a/app/gui/oven_control/configresttimeformatdlg.cpp +++ b/app/gui/oven_control/configresttimeformatdlg.cpp @@ -16,6 +16,8 @@ configResttimeFormatDlg::configResttimeFormatDlg(QWidget *parent) : 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); @@ -33,6 +35,12 @@ configResttimeFormatDlg::configResttimeFormatDlg(QWidget *parent) : connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map())); connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int))); + + m_vectorTabOrder.append(this); + m_vectorTabOrder.append(ui->pushButton_1); + m_vectorTabOrder.append(ui->pushButton_2); + m_vectorTabOrder.append(ui->ctrBtnOk); + m_vectorTabOrder.append(ui->ctrBtnCancel); } configResttimeFormatDlg::~configResttimeFormatDlg() @@ -71,3 +79,100 @@ void configResttimeFormatDlg::reloadUi(){ } } +void configResttimeFormatDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + +void configResttimeFormatDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + diff --git a/app/gui/oven_control/configresttimeformatdlg.h b/app/gui/oven_control/configresttimeformatdlg.h index c30999f..a18eeb2 100644 --- a/app/gui/oven_control/configresttimeformatdlg.h +++ b/app/gui/oven_control/configresttimeformatdlg.h @@ -3,6 +3,8 @@ #include #include +#include +#include namespace Ui { class configResttimeFormatDlg; @@ -26,10 +28,15 @@ private slots: public slots: void onConfigBtnClicked(const int sel); +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::configResttimeFormatDlg *ui; QSignalMapper *m_pSignalMapper; int m_nCurSel; + QVector m_vectorTabOrder; }; #endif // CONFIGRESTTIMEFORMATDLG_H diff --git a/app/gui/oven_control/configsoundselelectdlg.cpp b/app/gui/oven_control/configsoundselelectdlg.cpp index bc23598..04dbd04 100644 --- a/app/gui/oven_control/configsoundselelectdlg.cpp +++ b/app/gui/oven_control/configsoundselelectdlg.cpp @@ -15,6 +15,8 @@ ConfigSoundSelelectDlg::ConfigSoundSelelectDlg(QWidget *parent, ConfigType cfgty setWindowFlags(Qt::Widget | 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); @@ -72,6 +74,19 @@ ConfigSoundSelelectDlg::ConfigSoundSelelectDlg(QWidget *parent, ConfigType cfgty connect(ui->pushButton_10,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map())); connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int))); + + m_vectorTabOrder.append(ui->pushButton_1); + m_vectorTabOrder.append(ui->pushButton_2); + m_vectorTabOrder.append(ui->pushButton_3); + m_vectorTabOrder.append(ui->pushButton_4); + m_vectorTabOrder.append(ui->pushButton_5); + m_vectorTabOrder.append(ui->pushButton_6); + m_vectorTabOrder.append(ui->pushButton_7); + m_vectorTabOrder.append(ui->pushButton_8); + m_vectorTabOrder.append(ui->pushButton_9); + m_vectorTabOrder.append(ui->pushButton_10); + m_vectorTabOrder.append(ui->ctrBtnOk); + m_vectorTabOrder.append(ui->ctrBtnCancel); } ConfigSoundSelelectDlg::~ConfigSoundSelelectDlg() @@ -133,3 +148,101 @@ void ConfigSoundSelelectDlg::reloadUi(){ void ConfigSoundSelelectDlg::onConfigBtnClicked(const int sel){ m_nCurSel = sel; } + + +void ConfigSoundSelelectDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + +void ConfigSoundSelelectDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} diff --git a/app/gui/oven_control/configsoundselelectdlg.h b/app/gui/oven_control/configsoundselelectdlg.h index 4bbc121..a6b06c4 100644 --- a/app/gui/oven_control/configsoundselelectdlg.h +++ b/app/gui/oven_control/configsoundselelectdlg.h @@ -4,6 +4,8 @@ #include #include #include +#include +#include using namespace Define; @@ -29,11 +31,16 @@ private slots: public slots: void onConfigBtnClicked(const int sel); +protected: + void keyPressEvent(QKeyEvent* event); + void keyReleaseEvent(QKeyEvent* event); + private: Ui::ConfigSoundSelelectDlg *ui; QSignalMapper *m_pSignalMapper; ConfigType m_nCfgType; uint32_t m_nCurSel; + QVector m_vectorTabOrder; }; #endif // CONFIGSOUNDSELELECTDLG_H diff --git a/app/gui/oven_control/configtemptypedlg.cpp b/app/gui/oven_control/configtemptypedlg.cpp index d04eea4..7373c9c 100644 --- a/app/gui/oven_control/configtemptypedlg.cpp +++ b/app/gui/oven_control/configtemptypedlg.cpp @@ -16,6 +16,8 @@ ConfigTempTypeDlg::ConfigTempTypeDlg(QWidget *parent) : 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); @@ -33,6 +35,11 @@ ConfigTempTypeDlg::ConfigTempTypeDlg(QWidget *parent) : connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map())); connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int))); + m_vectorTabOrder.append(this); + m_vectorTabOrder.append(ui->pushButton_1); + m_vectorTabOrder.append(ui->pushButton_2); + m_vectorTabOrder.append(ui->ctrBtnOk); + m_vectorTabOrder.append(ui->ctrBtnCancel); } ConfigTempTypeDlg::~ConfigTempTypeDlg() @@ -71,3 +78,100 @@ void ConfigTempTypeDlg::reloadUi(){ } } +void ConfigTempTypeDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + +void ConfigTempTypeDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + diff --git a/app/gui/oven_control/configtemptypedlg.h b/app/gui/oven_control/configtemptypedlg.h index d16d665..5019c6a 100644 --- a/app/gui/oven_control/configtemptypedlg.h +++ b/app/gui/oven_control/configtemptypedlg.h @@ -3,6 +3,8 @@ #include #include +#include +#include namespace Ui { class ConfigTempTypeDlg; @@ -14,6 +16,10 @@ class ConfigTempTypeDlg : public QDialog void reloadUi(void); +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + public: explicit ConfigTempTypeDlg(QWidget *parent = 0); ~ConfigTempTypeDlg(); @@ -30,6 +36,7 @@ private: Ui::ConfigTempTypeDlg *ui; QSignalMapper *m_pSignalMapper; int m_nCurSel; + QVector m_vectorTabOrder; }; #endif // CONFIGTEMPTYPEDLG_H diff --git a/app/gui/oven_control/configtimeformatdlg.cpp b/app/gui/oven_control/configtimeformatdlg.cpp index 178dd87..3082917 100644 --- a/app/gui/oven_control/configtimeformatdlg.cpp +++ b/app/gui/oven_control/configtimeformatdlg.cpp @@ -16,6 +16,8 @@ ConfigTimeFormatDlg::ConfigTimeFormatDlg(QWidget *parent) : 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); @@ -34,6 +36,12 @@ ConfigTimeFormatDlg::ConfigTimeFormatDlg(QWidget *parent) : connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map())); connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int))); + + m_vectorTabOrder.append(this); + m_vectorTabOrder.append(ui->pushButton_1); + m_vectorTabOrder.append(ui->pushButton_2); + m_vectorTabOrder.append(ui->ctrBtnOk); + m_vectorTabOrder.append(ui->ctrBtnCancel); } ConfigTimeFormatDlg::~ConfigTimeFormatDlg() @@ -73,3 +81,100 @@ void ConfigTimeFormatDlg::reloadUi(){ break; } } + +void ConfigTimeFormatDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} + +void ConfigTimeFormatDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); + } + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; + } + + if(isetFocus(); + } + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); + } + break; + } +} diff --git a/app/gui/oven_control/configtimeformatdlg.h b/app/gui/oven_control/configtimeformatdlg.h index 682d254..6aaa1e9 100644 --- a/app/gui/oven_control/configtimeformatdlg.h +++ b/app/gui/oven_control/configtimeformatdlg.h @@ -3,6 +3,8 @@ #include #include +#include +#include namespace Ui { class ConfigTimeFormatDlg; @@ -27,10 +29,15 @@ private slots: public slots: void onConfigBtnClicked(const int sel); +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::ConfigTimeFormatDlg *ui; QSignalMapper *m_pSignalMapper; int m_nCurSel; + QVector m_vectorTabOrder; }; #endif // CONFIGTIMEFORMATDLG_H diff --git a/app/gui/oven_control/configwindow.cpp b/app/gui/oven_control/configwindow.cpp index 53ecc05..6d1d38b 100644 --- a/app/gui/oven_control/configwindow.cpp +++ b/app/gui/oven_control/configwindow.cpp @@ -60,100 +60,52 @@ void ConfigWindow::on_pushButton_clicked() } void ConfigWindow::prevFocus(){ - if(focusWidget() == ui->helpButton) { - qDebug() << "help"; - ui->washButton->setFocus(); - } - else if(focusWidget() == ui->washButton){ - ui->backButton->setFocus(); - } - else if(focusWidget() == ui->backButton){ - m_vectorMenuList[m_vectorMenuList.size()-1]->setFocus(); - nextFocus(); - nextFocus(); - //prevFocus(); - //focusPreviousChild(); - //qDebug << focusWidget()->wind - } - else if(focusWidget() == ui->scrollArea){ - ui->pushButton_3->setFocus(); - } - else if(focusWidget() == ui->pushButton){ - ui->helpButton->setFocus(); - } - else if(focusWidget() == ui->pushButton_8){ - ui->pushButton->setFocus(); - } - else if(focusWidget() == ui->pushButton_7){ - ui->pushButton_8->setFocus(); - } - else if(focusWidget() == ui->pushButton_2){ - ui->pushButton_7->setFocus(); - } - else if(focusWidget() == ui->pushButton_4){ - ui->pushButton_2->setFocus(); + int i = 0; + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; } - else if(focusWidget() == ui->pushButton_5){ - ui->pushButton_4->setFocus(); + + if(i==0){ + i = m_vectorTabOrder.size()-1; + m_vectorTabOrder[i]->setFocus(); } - else if(focusWidget() == ui->pushButton_6){ - ui->pushButton_5->setFocus(); + else if(i < m_vectorTabOrder.size()) { + i = i - 1; + m_vectorTabOrder[i]->setFocus(); } - else if(focusWidget() == ui->pushButton_3){ - ui->pushButton_6->setFocus(); + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); } - else focusPreviousChild(); } void ConfigWindow::nextFocus(){ - if(focusWidget() == ui->helpButton) { - qDebug() << "help"; - ui->pushButton->setFocus(); - } - else if(focusWidget() == ui->backButton){ - ui->washButton->setFocus(); - } - else if(focusWidget() == ui->washButton){ - ui->helpButton->setFocus(); - } - else if(focusWidget() == ui->pushButton){ - ui->pushButton_8->setFocus(); - } - else if(focusWidget() == ui->pushButton_8){ - ui->pushButton_7->setFocus(); - } - else if(focusWidget() == ui->pushButton_7){ - ui->pushButton_2->setFocus(); - } - else if(focusWidget() == ui->pushButton_2){ - ui->pushButton_4->setFocus(); - } - else if(focusWidget() == ui->pushButton_4){ - ui->pushButton_5->setFocus(); - } - else if(focusWidget() == ui->pushButton_5){ - ui->pushButton_6->setFocus(); + int i = 0; + for(i = 0; i < m_vectorTabOrder.size();i++){ + if(focusWidget() == m_vectorTabOrder[i]) break; } - else if(focusWidget() == ui->pushButton_6){ - ui->pushButton_3->setFocus(); + + if(isetFocus(); } - else if(focusWidget() == ui->pushButton_3){ - ui->scrollArea->setFocus(); + else if(i== (m_vectorTabOrder.size()-1)){ + i=0; + m_vectorTabOrder[i]->setFocus(); } - else if(m_vectorMenuList[m_vectorMenuList.size() -1]->isFavoriteFocused()){ - qDebug() << "last Favorite Focused"; - ui->backButton->setFocus(); + else{ + i=0; + m_vectorTabOrder[i]->setFocus(); } - else focusNextChild(); + return; } void ConfigWindow::keyReleaseEvent(QKeyEvent *event){ switch (event->key()) { case 0x01000030: // Turn left - //focusPreviousChild(); prevFocus(); - qDebug() << "turn left"; + ui->scrollArea->ensureWidgetVisible(m_vectorTabOrder[m_nTabIndex]); break; case 0x01000031: // Push { @@ -166,6 +118,7 @@ void ConfigWindow::keyReleaseEvent(QKeyEvent *event){ } case 0x01000032: // Turn right nextFocus(); + ui->scrollArea->ensureWidgetVisible(focusWidget()); qDebug() << "Turn Right"; break; } @@ -175,8 +128,8 @@ void ConfigWindow::keyPressEvent(QKeyEvent *event){ switch (event->key()) { case 0x01000030: // Turn left - //focusPreviousChild(); prevFocus(); + ui->scrollArea->ensureWidgetVisible(focusWidget()); qDebug() << "turn left"; break; case 0x01000031: // Push @@ -185,6 +138,7 @@ void ConfigWindow::keyPressEvent(QKeyEvent *event){ break; case 0x01000032: // Turn right nextFocus(); + ui->scrollArea->ensureWidgetVisible(focusWidget()); qDebug() << "Turn Right"; break; } @@ -240,6 +194,7 @@ void ConfigWindow::reloadValue(){ void ConfigWindow::onConfigBtnClicked(uint16_t id){ Config *cfg = Config::getInstance(); QDialog* dlg; + QWidget *focusedWidget = focusWidget(); switch(id){ case config_loading_door_monitoring: case config_cooking_door_monitoring: @@ -270,10 +225,9 @@ void ConfigWindow::onConfigBtnClicked(uint16_t id){ default: cfg->execConfigWindow(this,(Define::ConfigType)id); if(m_nCurConfigPos != config_menu_favorite) reloadValue(); - if(id==config_sound_factory_reset) reloadUi(); break; } - + focusedWidget->setFocus(); } @@ -318,6 +272,17 @@ void ConfigWindow::reloadUi(void){ } m_vectorFavorMenuList.clear(); + 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); + if(m_nCurConfigPos != config_menu_favorite){ @@ -330,6 +295,8 @@ void ConfigWindow::reloadUi(void){ pcb->setValue(strtemp); pcb->showFavoriteButton(); pcb->setFavoriteCheck(cfg->isFavorite(m_arrConfigListInfos[m_nCurConfigPos][i])); + m_vectorTabOrder.append(pcb->getFavoriteBtn()); + m_vectorTabOrder.append(pcb->getBtn()); ui->scrollAreaMenuLayout->addWidget(pcb); m_vectorMenuList.append(pcb); connect(pcb ,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t))); @@ -343,12 +310,17 @@ void ConfigWindow::reloadUi(void){ fpcb = new ConfigFavoriteButton(this,idx); strtemp = cfg->getTitleString((ConfigType)idx); fpcb->setText(strtemp); + m_vectorTabOrder.append(fpcb->getBtn()); + m_vectorTabOrder.append(fpcb->getDelBtn()); ui->scrollAreaMenuLayout->addWidget(fpcb); m_vectorFavorMenuList.append(fpcb); connect(fpcb,SIGNAL(clicked(uint16_t)),SLOT(onConfigBtnClicked(uint16_t))); connect(fpcb,SIGNAL(delBtnClicked(uint16_t)),SLOT(onDeleteFavoriteBtnClicked(uint16_t))); } } + m_vectorTabOrder.append(ui->backButton); + m_vectorTabOrder.append(ui->washButton); + m_vectorTabOrder.append(ui->helpButton); ui->scrollAreaMenu->adjustSize(); //Display 전 Contents 사이즈 수정 깜빡임 제거함. diff --git a/app/gui/oven_control/configwindow.h b/app/gui/oven_control/configwindow.h index bb2ce9b..1a6e7c1 100644 --- a/app/gui/oven_control/configwindow.h +++ b/app/gui/oven_control/configwindow.h @@ -32,12 +32,12 @@ class ConfigWindow : public QMainWindow private: const uint16_t m_arrMaxMenuCount[7] ={ - 6,8,9,2,3,0,6 + 6,8,8,2,3,0,6 }; const Define::ConfigType m_arrConfigListInfos[7][20] = { {config_language,config_datetime, config_temptype,config_backlight, config_time_type,config_resttime_format,}, {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}, - {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}, + {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}, {config_set_half_energy,config_set_auto_darkness,}, {config_duty_wash,config_loading_door_monitoring,config_cooking_door_monitoring}, {config_invalid,}, @@ -88,8 +88,9 @@ private: Ui::ConfigWindow *ui; QVector m_vectorMenuList; QVector m_vectorFavorMenuList; + QVector m_vectorTabOrder; CONFIG_MENU_POS m_nCurConfigPos; - + int m_nTabIndex = 0; }; #endif // CONFIGWINDOW_H diff --git a/app/gui/oven_control/fileprocessdlg.cpp b/app/gui/oven_control/fileprocessdlg.cpp index 1eddb6c..b02fd15 100644 --- a/app/gui/oven_control/fileprocessdlg.cpp +++ b/app/gui/oven_control/fileprocessdlg.cpp @@ -209,6 +209,9 @@ FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) : setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_TranslucentBackground); setWindowFlags(Qt::FramelessWindowHint); + qApp->setActiveWindow(this); + this->setFocus(); + ui->ctrBtnCancel->setFocus(); ui->ctrWjProcess->setMinimum(0); ui->ctrWjProcess->setMaximum(100); @@ -706,3 +709,21 @@ void FileProcessDlg::haccpdataDownload(){ ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료")); QTimer::singleShot(1000,this,SLOT(close())); } + +void FileProcessDlg::keyPressEvent(QKeyEvent *event){ + +} + +void FileProcessDlg::keyReleaseEvent(QKeyEvent *event){ + switch (event->key()) + { + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + } +} diff --git a/app/gui/oven_control/fileprocessdlg.h b/app/gui/oven_control/fileprocessdlg.h index 848c5cb..683c961 100644 --- a/app/gui/oven_control/fileprocessdlg.h +++ b/app/gui/oven_control/fileprocessdlg.h @@ -7,6 +7,7 @@ #include #include #include +#include #include "config.h" #include "servicedata.h" #include "historylistwindow.h" @@ -73,6 +74,10 @@ public slots: void onProgressed(int progress,int sec); void onProgressFinished(); +protected: + void keyPressEvent(QKeyEvent* event); + void keyReleaseEvent(QKeyEvent* event); + private: Ui::FileProcessDlg *ui; ConfigType m_nCfgtype; diff --git a/app/gui/oven_control/usbcheckpopupdlg.cpp b/app/gui/oven_control/usbcheckpopupdlg.cpp index 95b9a54..780216c 100644 --- a/app/gui/oven_control/usbcheckpopupdlg.cpp +++ b/app/gui/oven_control/usbcheckpopupdlg.cpp @@ -12,7 +12,9 @@ UsbCheckPopupDlg::UsbCheckPopupDlg(QWidget *parent) : setWindowFlags(Qt::Widget | Qt::FramelessWindowHint); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_TranslucentBackground); - + qApp->setActiveWindow(this); + this->setFocus(); + ui->ctrBtnYes->setFocus(); timer = new QTimer(this); connect(timer,SIGNAL(timeout()),SLOT(usbCheckTimerFired())); @@ -36,3 +38,38 @@ void UsbCheckPopupDlg::usbCheckTimerFired(){ accept(); } } + + +void UsbCheckPopupDlg::keyPressEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + break; + case 0x01000031: // Push + { + break; + } + case 0x01000032: // Turn right + break; + } +} + +void UsbCheckPopupDlg::keyReleaseEvent(QKeyEvent *event){ + int i = 0; + switch (event->key()) + { + case 0x01000030: // Turn left + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + break; + } +} diff --git a/app/gui/oven_control/usbcheckpopupdlg.h b/app/gui/oven_control/usbcheckpopupdlg.h index c023693..eb400ba 100644 --- a/app/gui/oven_control/usbcheckpopupdlg.h +++ b/app/gui/oven_control/usbcheckpopupdlg.h @@ -3,6 +3,7 @@ #include #include +#include namespace Ui { class UsbCheckPopupDlg; @@ -20,6 +21,10 @@ private slots: void on_ctrBtnYes_clicked(); void usbCheckTimerFired(); +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); + private: Ui::UsbCheckPopupDlg *ui; QTimer *timer; diff --git a/app/gui/oven_control/yesnopopupdlg.cpp b/app/gui/oven_control/yesnopopupdlg.cpp index 2cd15fb..de18360 100644 --- a/app/gui/oven_control/yesnopopupdlg.cpp +++ b/app/gui/oven_control/yesnopopupdlg.cpp @@ -10,17 +10,22 @@ YesNoPopupDlg::YesNoPopupDlg(QWidget *parent, QString strDesc) : ui->setupUi(this); this->setAttribute( Qt::WA_DeleteOnClose); setWindowFlags(Qt::FramelessWindowHint); - setAttribute(Qt::WA_NoSystemBackground); + setAttribute(Qt::WA_NoSystemBackground,false); setAttribute(Qt::WA_TranslucentBackground); + qApp->setActiveWindow(this); + this->setFocus(); + //setAttribute(Qt::WA_PaintOnScreen); ui->ctrLbDesc->setText(strDesc); + //this->setAttribute( Qt::WA_DeleteOnClose); foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); + ui->ctrBtnYes->setFocus(); } YesNoPopupDlg::~YesNoPopupDlg() @@ -38,3 +43,42 @@ void YesNoPopupDlg::on_ctrBtnNo_clicked() { this->reject(); } + +void YesNoPopupDlg::keyPressEvent(QKeyEvent *event){ + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrBtnYes) ui->ctrBtnNo->setFocus(); + else ui->ctrBtnYes->setFocus(); + break; + case 0x01000031: // Push + + break; + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnYes) ui->ctrBtnNo->setFocus(); + else ui->ctrBtnYes->setFocus(); + break; + } +} + +void YesNoPopupDlg::keyReleaseEvent(QKeyEvent *event){ + switch (event->key()) + { + case 0x01000030: // Turn left + if(focusWidget() == ui->ctrBtnYes) ui->ctrBtnNo->setFocus(); + else ui->ctrBtnYes->setFocus(); + break; + case 0x01000031: // Push + { + QPushButton *btn = qobject_cast(focusWidget()); + if(btn != NULL){ + btn->click(); + } + break; + } + case 0x01000032: // Turn right + if(focusWidget() == ui->ctrBtnYes) ui->ctrBtnNo->setFocus(); + else ui->ctrBtnYes->setFocus(); + break; + } +} diff --git a/app/gui/oven_control/yesnopopupdlg.h b/app/gui/oven_control/yesnopopupdlg.h index ce92bfc..812b510 100644 --- a/app/gui/oven_control/yesnopopupdlg.h +++ b/app/gui/oven_control/yesnopopupdlg.h @@ -2,6 +2,7 @@ #define YESNOPOPUPDLG_H #include +#include namespace Ui { class YesNoPopupDlg; @@ -20,6 +21,10 @@ private slots: void on_ctrBtnNo_clicked(); +protected: + void keyPressEvent(QKeyEvent* event); + void keyReleaseEvent(QKeyEvent* event); + private: Ui::YesNoPopupDlg *ui; }; diff --git a/app/gui/oven_control/yesnopopupdlg.ui b/app/gui/oven_control/yesnopopupdlg.ui index d5da19e..e5d39ad 100644 --- a/app/gui/oven_control/yesnopopupdlg.ui +++ b/app/gui/oven_control/yesnopopupdlg.ui @@ -54,7 +54,7 @@ border : none; color : white; } -QPushButton::pressed {color : yellow} +QPushButton::pressed, QPushButton::focus{color : yellow} @@ -81,7 +81,7 @@ QPushButton::pressed {color : yellow} border : none; color : white; } -QPushButton::pressed {color : yellow} +QPushButton::pressed, QPushButton::focus{color : yellow} 아니오