From e3205cf8390b19cf158f490ca125bd243fd1d0b7 Mon Sep 17 00:00:00 2001 From: byloveletter Date: Mon, 19 Jun 2017 17:22:05 +0900 Subject: [PATCH] =?UTF-8?q?=EA=B3=A0=EA=B0=9D=EC=82=AC=20=EC=9A=94?= =?UTF-8?q?=EA=B5=AC=20=EC=82=AC=ED=95=AD=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 데모모드 복구 - 데모모드 상황시 설정 진입시 비밀번호 요구 --- app/gui/oven_control/config.cpp | 4 + app/gui/oven_control/configdemomodedlg.cpp | 178 +++++++++++++++++++++ app/gui/oven_control/configdemomodedlg.h | 41 +++++ app/gui/oven_control/configdemomodedlg.ui | 222 +++++++++++++++++++++++++++ app/gui/oven_control/configwindow.cpp | 38 ++++- app/gui/oven_control/configwindow.h | 6 +- app/gui/oven_control/errorpopupdlg.cpp | 1 + app/gui/oven_control/oven_control.pro | 4 + app/gui/oven_control/servicepassinputdlg.cpp | 12 +- app/gui/oven_control/servicepassinputdlg.h | 11 +- 10 files changed, 509 insertions(+), 8 deletions(-) create mode 100644 app/gui/oven_control/configdemomodedlg.cpp create mode 100644 app/gui/oven_control/configdemomodedlg.h create mode 100644 app/gui/oven_control/configdemomodedlg.ui diff --git a/app/gui/oven_control/config.cpp b/app/gui/oven_control/config.cpp index b4ed9c9..e83af7c 100644 --- a/app/gui/oven_control/config.cpp +++ b/app/gui/oven_control/config.cpp @@ -23,6 +23,7 @@ #include "udphandler.h" #include "system.h" #include "unistd.h" +#include "configdemomodedlg.h" using namespace Define; using namespace System; @@ -493,6 +494,9 @@ void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){ case config_duty_wash: dlg = new ConfigDutyWashDlg(parent); break; + case config_demo_mode: + dlg = new ConfigDemoModeDlg(parent); + break; default: dlg=NULL; } diff --git a/app/gui/oven_control/configdemomodedlg.cpp b/app/gui/oven_control/configdemomodedlg.cpp new file mode 100644 index 0000000..cd63a01 --- /dev/null +++ b/app/gui/oven_control/configdemomodedlg.cpp @@ -0,0 +1,178 @@ +#include "configdemomodedlg.h" +#include "ui_configdemomodedlg.h" +#include "config.h" +#include "soundplayer.h" + +using namespace Define; + +ConfigDemoModeDlg::ConfigDemoModeDlg(QWidget *parent) : + QDialog(parent), + ui(new Ui::ConfigDemoModeDlg) +{ + Config* cfg = Config::getInstance(); + config_item item; + item = cfg->getConfigValue(config_demo_mode); + m_nCurSel = item.d32; + 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); + + ui->pushButton_1->setText(QCoreApplication::translate("Config",on_off_menu[0])); + ui->pushButton_2->setText(QCoreApplication::translate("Config", on_off_menu[1])); + + reloadUi(); + + m_pSignalMapper = new QSignalMapper(this); + m_pSignalMapper->setMapping(ui->pushButton_1,0); + m_pSignalMapper->setMapping(ui->pushButton_2,1); + + connect(ui->pushButton_1,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map())); + 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); +} + +ConfigDemoModeDlg::~ConfigDemoModeDlg() +{ + delete ui; +} + +void ConfigDemoModeDlg::on_ctrBtnOk_clicked() +{ + Config* cfg = Config::getInstance(); + config_item item; + item.d32 = m_nCurSel; + cfg->setConfigValue(config_demo_mode,item); + accept(); +} + +void ConfigDemoModeDlg::on_ctrBtnCancel_clicked() +{ + reject(); +} + +void ConfigDemoModeDlg::onConfigBtnClicked(const int sel){ + m_nCurSel = sel; +} + +void ConfigDemoModeDlg::reloadUi(){ + switch(m_nCurSel){ + case 0: + ui->pushButton_1->setChecked(true); + break; + case 1: + ui->pushButton_2->setChecked(true); + break; + default: + break; + } +} + +void ConfigDemoModeDlg::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 ConfigDemoModeDlg::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/configdemomodedlg.h b/app/gui/oven_control/configdemomodedlg.h new file mode 100644 index 0000000..b464018 --- /dev/null +++ b/app/gui/oven_control/configdemomodedlg.h @@ -0,0 +1,41 @@ +#ifndef CONFIGDEMOMODEDLG_H +#define CONFIGDEMOMODEDLG_H + +#include +#include +#include +#include + +namespace Ui { +class ConfigDemoModeDlg; +} + +class ConfigDemoModeDlg : public QDialog +{ + Q_OBJECT + + void reloadUi(void); + +public: + explicit ConfigDemoModeDlg(QWidget *parent = 0); + ~ConfigDemoModeDlg(); + +private slots: + void on_ctrBtnOk_clicked(); + + void on_ctrBtnCancel_clicked(); + + void onConfigBtnClicked(const int sel); + +private: + Ui::ConfigDemoModeDlg *ui; + QSignalMapper *m_pSignalMapper; + int m_nCurSel; + QVector m_vectorTabOrder; + +protected: + void keyReleaseEvent(QKeyEvent* event); + void keyPressEvent(QKeyEvent* event); +}; + +#endif // CONFIGDEMOMODEDLG_H diff --git a/app/gui/oven_control/configdemomodedlg.ui b/app/gui/oven_control/configdemomodedlg.ui new file mode 100644 index 0000000..8232204 --- /dev/null +++ b/app/gui/oven_control/configdemomodedlg.ui @@ -0,0 +1,222 @@ + + + ConfigDemoModeDlg + + + + 0 + 0 + 900 + 1600 + + + + false + + + #centralwidget{ + background-image : url(:/images/background/popup/503.png); +} + +QPushButton{ + border-color : transparent; + background-color : transparent; + color : white; +} + +QPushButton::focus{ + color : yellow; +} + +QPushButton::pressed{ + color : green; +} + +QPushButton::checked{ + color : red; +} + +QLabel{ + color : white; +} + + + + + 0 + 450 + 900 + 362 + + + + + 900 + 0 + + + + + + + + 18 + 75 + true + + + + + + + 시연모드 + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + + + + + + + 0 + 0 + + + + + 나눔고딕 + 16 + + + + PushButton + + + true + + + true + + + true + + + true + + + + + + + Qt::Horizontal + + + + + + + + 0 + 0 + + + + + 나눔고딕 + 16 + + + + PushButton + + + true + + + true + + + true + + + + + + + Qt::Horizontal + + + + + + + + + + + + 0 + 0 + + + + + 나눔고딕 + 10 + 75 + true + true + + + + 취소 + + + true + + + + + + + + 0 + 0 + + + + + 나눔고딕 + 10 + 75 + true + true + + + + 확인 + + + true + + + + + + + + + + + diff --git a/app/gui/oven_control/configwindow.cpp b/app/gui/oven_control/configwindow.cpp index f005dbf..c30046f 100644 --- a/app/gui/oven_control/configwindow.cpp +++ b/app/gui/oven_control/configwindow.cpp @@ -14,6 +14,7 @@ #include "washwindow.h" #include "mainwindow.h" #include "configdoormonitoring.h" +#include "servicepassinputdlg.h" ConfigWindow::ConfigWindow(QWidget *parent) : QMainWindow(parent), @@ -25,12 +26,16 @@ ConfigWindow::ConfigWindow(QWidget *parent) : ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); + Config* cfg = Config::getInstance(); + + ui->scrollAreaMenuLayout->setAlignment(Qt::AlignTop); foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); - Config* cfg = Config::getInstance(); + config_item item; + QSetIterator itr = cfg->getConstBeginFavorite(); while(itr.hasNext()) itr.next(); @@ -44,8 +49,38 @@ ConfigWindow::ConfigWindow(QWidget *parent) : reloadUi(); + + item = cfg->getConfigValue(config_demo_mode); + if(item.d32!=0){ + QDialog* dlg = new ServicePassInputDlg(this, DEMO_SERVICE_PASS_MODE); + dlg->setModal(true); + dlg->showFullScreen(); + dlg->raise(); + connect(dlg, SIGNAL(rejected()), SLOT(close())); + } } +void ConfigWindow::onLoadedWindow(){ + QDialog* dlg = new ServicePassInputDlg(this); + dlg->exec(); + this->show(); +} + +void ConfigWindow::showFullScreen(){ + Config* cfg = Config::getInstance(); + config_item item = cfg->getConfigValue(config_demo_mode); + if(item.d32){ + //QMainWindow::showFullScreen(); +// QDialog* dlg = new ServicePassInputDlg(this->parentWidget()); +// dlg->exec(); + QMainWindow::showFullScreen(); + } + else{ + QMainWindow::showFullScreen(); + } +} + + ConfigWindow::~ConfigWindow() { delete ui; @@ -419,3 +454,4 @@ void ConfigWindow::on_helpButton_clicked() { } + diff --git a/app/gui/oven_control/configwindow.h b/app/gui/oven_control/configwindow.h index 7659a87..16a4fdc 100644 --- a/app/gui/oven_control/configwindow.h +++ b/app/gui/oven_control/configwindow.h @@ -32,7 +32,7 @@ class ConfigWindow : public QMainWindow private: const uint16_t m_arrMaxMenuCount[7] ={ - 6,8,8,2,3,0,5 + 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,}, @@ -41,7 +41,7 @@ private: {config_set_half_energy,config_set_auto_darkness,}, {config_duty_wash,config_loading_door_monitoring,config_cooking_door_monitoring}, {config_invalid,}, - {config_software_info,config_hotline_chef,config_hotline_service,config_steam_wash,config_enter_engineer_mode} + {config_software_info,config_hotline_chef,config_hotline_service,config_steam_wash,config_demo_mode,config_enter_engineer_mode} }; void nextFocus(); @@ -79,6 +79,8 @@ public slots: void onConfigBtnClicked(uint16_t id); void onConfigCheckBtnClicked(uint16_t id, bool checked); void onDeleteFavoriteBtnClicked(uint16_t id); + void onLoadedWindow(void); + void showFullScreen(); protected: void keyReleaseEvent(QKeyEvent* event); diff --git a/app/gui/oven_control/errorpopupdlg.cpp b/app/gui/oven_control/errorpopupdlg.cpp index fe4e6fc..ebc7edb 100644 --- a/app/gui/oven_control/errorpopupdlg.cpp +++ b/app/gui/oven_control/errorpopupdlg.cpp @@ -30,6 +30,7 @@ ErrorPopupDlg::~ErrorPopupDlg() void ErrorPopupDlg::on_ctrlOkBtn_clicked() { //emit closedPopup(m_pParent); + qApp->setActiveWindow(m_pParent); this->hide(); close(); } diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index 0c17355..b8f9da9 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -123,6 +123,8 @@ SOURCES += main.cpp\ autocookcheckwindow.cpp \ autocookcheckconfigwindow.cpp \ programmedcookpanelbutton.cpp + configdemomodedlg.cpp + HEADERS += mainwindow.h \ cook.h \ @@ -235,6 +237,7 @@ HEADERS += mainwindow.h \ autocookcheckwindow.h \ autocookcheckconfigwindow.h \ programmedcookpanelbutton.h + configdemomodedlg.h FORMS += mainwindow.ui \ manualcookwindow.ui \ @@ -313,6 +316,7 @@ FORMS += mainwindow.ui \ autocookcheckwindow.ui \ autocookcheckconfigwindow.ui \ programmedcookpanelbutton.ui + configdemomodedlg.ui RESOURCES += \ resources.qrc diff --git a/app/gui/oven_control/servicepassinputdlg.cpp b/app/gui/oven_control/servicepassinputdlg.cpp index bd4283a..fa47722 100644 --- a/app/gui/oven_control/servicepassinputdlg.cpp +++ b/app/gui/oven_control/servicepassinputdlg.cpp @@ -5,7 +5,7 @@ #include "soundplayer.h" -ServicePassInputDlg::ServicePassInputDlg(QWidget *parent) : +ServicePassInputDlg::ServicePassInputDlg(QWidget *parent, service_pass_type mode) : QDialog(parent), ui(new Ui::ServicePassInputDlg) { @@ -28,6 +28,7 @@ ServicePassInputDlg::ServicePassInputDlg(QWidget *parent) : connect(ui->keyboardwidget, SIGNAL(onCancelKeyClicked()),SLOT(keyCancel_clicked())); connect(ui->keyboardwidget,SIGNAL(onKeyboardClickSignal(QString)),SLOT(keyboardInputEvent(QString))); ui->keyboardwidget->focusInKeyboard(); + m_nMode = mode; } ServicePassInputDlg::~ServicePassInputDlg() @@ -37,14 +38,19 @@ ServicePassInputDlg::~ServicePassInputDlg() void ServicePassInputDlg::on_ctrBtnOk_clicked() { - if( QString(m_strInputPass) == QString(PASS_WORD)){ + + if( QString(m_strInputPass) == QString(NORMAL_PASS_WORD) && m_nMode == NORMAL_SERVICE_PASS_MODE){ qDebug() << this->parentWidget() <parent(); EngineerMenuWindow *w = new EngineerMenuWindow(this->parentWidget()); connect(w,SIGNAL(destroyed(QObject*)),this,SLOT(close())); w->setWindowModality(Qt::WindowModal); - w->show(); + w->showFullScreen(); + w->raise(); this->hide(); } + else if(QString(m_strInputPass) == QString(DEMO_PASS_WORD) && m_nMode == DEMO_SERVICE_PASS_MODE){ + accept(); + } else { reject(); } diff --git a/app/gui/oven_control/servicepassinputdlg.h b/app/gui/oven_control/servicepassinputdlg.h index 730d1b3..1a81192 100644 --- a/app/gui/oven_control/servicepassinputdlg.h +++ b/app/gui/oven_control/servicepassinputdlg.h @@ -5,13 +5,19 @@ #include -#define PASS_WORD "00000000" +#define NORMAL_PASS_WORD "00000000" +#define DEMO_PASS_WORD "11111111" #define MAX_PASSWORD 8 namespace Ui { class ServicePassInputDlg; } +enum service_pass_type{ + NORMAL_SERVICE_PASS_MODE = 0, + DEMO_SERVICE_PASS_MODE=1 +}; + class ServicePassInputDlg : public QDialog { Q_OBJECT @@ -21,7 +27,7 @@ class ServicePassInputDlg : public QDialog QChar m_strInputPass[MAX_PASSWORD+1]; public: - explicit ServicePassInputDlg(QWidget *parent = 0); + explicit ServicePassInputDlg(QWidget *parent = 0, service_pass_type mode = NORMAL_SERVICE_PASS_MODE ); ~ServicePassInputDlg(); private slots: @@ -42,6 +48,7 @@ protected: private: Ui::ServicePassInputDlg *ui; int m_nCurInputCount; + service_pass_type m_nMode; }; #endif // SERVICEPASSINPUTDLG_H -- 2.1.4