diff --git a/app/gui/oven_control/manualcookfinishpopup.cpp b/app/gui/oven_control/manualcookfinishpopup.cpp new file mode 100644 index 0000000..d60b9af --- /dev/null +++ b/app/gui/oven_control/manualcookfinishpopup.cpp @@ -0,0 +1,115 @@ +#include "manualcookfinishpopup.h" +#include "ui_manualcookfinishpopup.h" + +#include + +#include "soundplayer.h" + +ManualCookFinishPopup::ManualCookFinishPopup(QWidget *parent) : + QWidget(parent), + ui(new Ui::ManualCookFinishPopup) +{ + ui->setupUi(this); + + setAttribute(Qt::WA_DeleteOnClose); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); + + ui->background->setFocus(); +} + +ManualCookFinishPopup::~ManualCookFinishPopup() +{ + delete ui; +} + +void ManualCookFinishPopup::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case 0x01000032: // Turn left + onEncoderLeft(); + break; + case 0x01000031: // Push + pushed = focusWidget(); + break; + case 0x01000030: // Turn right + onEncoderRight(); + break; + } +} + +void ManualCookFinishPopup::keyReleaseEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case 0x01000032: // Turn left + onEncoderLeft(); + break; + case 0x01000031: // Push + if (focusWidget() == pushed) + onEncoderClicked(pushed); + + pushed = NULL; + break; + case 0x01000030: // Turn right + onEncoderRight(); + break; + } +} + +void ManualCookFinishPopup::onEncoderLeft() +{ + QWidget *focused = focusWidget(); + if (focused == ui->background) + ui->okButton->setFocus(); + else + focusPreviousChild(); +} + +void ManualCookFinishPopup::onEncoderRight() +{ + if (focusWidget() == ui->okButton) + ui->background->setFocus(); + else + focusNextChild(); +} + +void ManualCookFinishPopup::onEncoderClicked(QWidget *clicked) +{ + if (clicked == ui->background) + { + close(); + return; + } + + QPushButton *b = qobject_cast(clicked); + if (b) + { + b->click(); + return; + } +} + +void ManualCookFinishPopup::on_closeButton_clicked() +{ + close(); +} + +void ManualCookFinishPopup::on_closeButton_2_clicked() +{ + close(); +} + +void ManualCookFinishPopup::on_warmupButton_clicked() +{ + close(); + + emit keepWarm(); +} + +void ManualCookFinishPopup::on_okButton_clicked() +{ + close(); +} diff --git a/app/gui/oven_control/manualcookfinishpopup.h b/app/gui/oven_control/manualcookfinishpopup.h new file mode 100644 index 0000000..93c094b --- /dev/null +++ b/app/gui/oven_control/manualcookfinishpopup.h @@ -0,0 +1,41 @@ +#ifndef MANUALCOOKFINISHPOPUP_H +#define MANUALCOOKFINISHPOPUP_H + +#include + +namespace Ui { +class ManualCookFinishPopup; +} + +class ManualCookFinishPopup : public QWidget +{ + Q_OBJECT + +public: + explicit ManualCookFinishPopup(QWidget *parent = nullptr); + ~ManualCookFinishPopup(); + +signals: + void keepWarm(); + +protected: + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + +private: + Ui::ManualCookFinishPopup *ui; + + QWidget *pushed = Q_NULLPTR; + + void onEncoderLeft(); + void onEncoderRight(); + void onEncoderClicked(QWidget *clicked); + +private slots: + void on_closeButton_clicked(); + void on_closeButton_2_clicked(); + void on_warmupButton_clicked(); + void on_okButton_clicked(); +}; + +#endif // MANUALCOOKFINISHPOPUP_H diff --git a/app/gui/oven_control/manualcookfinishpopup.ui b/app/gui/oven_control/manualcookfinishpopup.ui new file mode 100644 index 0000000..26537c0 --- /dev/null +++ b/app/gui/oven_control/manualcookfinishpopup.ui @@ -0,0 +1,151 @@ + + + ManualCookFinishPopup + + + + 0 + 0 + 1080 + 1920 + + + + Form + + + #closeButton { border: none; } +#closeButton_2 { border: none; } +#background { background-image: url(:/images/background/popup/373.png); } +#background:focus { border: 4px solid gray; } + +QPushButton { +background-position: center; +background-repeat: no-repeat; +border: none; +} + +QPushButton[style="icon"] { background-image: url(:/images/slider_icon/background.png); } + +QPushButton { color: white; border: none; } +QPushButton:pressed, QPushButton:focus { color: yellow; } + +QLabel { color: white; } + + + + + 0 + 961 + 1080 + 958 + + + + + + + + + + 0 + 511 + 1080 + 447 + + + + Qt::TabFocus + + + + + 650 + 320 + 182 + 84 + + + + + 75 + true + true + + + + + + + 보온 + + + + + + 850 + 320 + 182 + 84 + + + + + 75 + true + true + + + + + + + 확인 + + + + + + 0 + 0 + 1080 + 240 + + + + + 16 + + + + 요리가 끝났습니다 + + + Qt::AlignCenter + + + + + + + 0 + 0 + 1080 + 511 + + + + + + + + + closeButton_2 + background + warmupButton + okButton + closeButton + + + + diff --git a/app/gui/oven_control/manualcookwindow.cpp b/app/gui/oven_control/manualcookwindow.cpp index b55f233..166fb19 100644 --- a/app/gui/oven_control/manualcookwindow.cpp +++ b/app/gui/oven_control/manualcookwindow.cpp @@ -24,6 +24,7 @@ #include "errorpopupdlg.h" #include "manualviewerdlg.h" #include "haccp.h" +#include "manualcookfinishpopup.h" #include @@ -616,6 +617,19 @@ void ManualCookWindow::showInfoText(QString text, QString icon) showInfoTextTimer.start(); } +void ManualCookWindow::startKeepWarm() +{ + if (oven->mode() == Define::CombiMode) + return; + + cookDone = false; + + oven->setTemp(70); + oven->setTime(60*60); + + start(); +} + void ManualCookWindow::onOvenUpdated(Oven *oven) { updateView(); @@ -650,6 +664,12 @@ void ManualCookWindow::onOvenUpdated(Oven *oven) HACCP::done(); emit done(); + + if (oven->mode() != Define::CombiMode) { + ManualCookFinishPopup *p = new ManualCookFinishPopup(this); + p->showFullScreen(); + connect(p, SIGNAL(keepWarm()), SLOT(startKeepWarm())); + } } } diff --git a/app/gui/oven_control/manualcookwindow.h b/app/gui/oven_control/manualcookwindow.h index c35d461..f757e6c 100644 --- a/app/gui/oven_control/manualcookwindow.h +++ b/app/gui/oven_control/manualcookwindow.h @@ -42,6 +42,7 @@ private slots: void showCurrentTemp(); void hideCurrentTemp(); void showInfoText(QString text, QString icon); + void startKeepWarm(); void onOvenUpdated(Oven *oven); diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index fd87cb9..85f5f0b 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -16,6 +16,7 @@ SOURCES += main.cpp\ commicon.cpp \ mainwindow.cpp \ cook.cpp \ + manualcookfinishpopup.cpp \ oven.cpp \ abstractoveninterface.cpp \ clock.cpp \ @@ -156,6 +157,7 @@ SOURCES += main.cpp\ HEADERS += mainwindow.h \ commicon.h \ cook.h \ + manualcookfinishpopup.h \ oven.h \ abstractoveninterface.h \ clock.h \ @@ -294,6 +296,7 @@ HEADERS += mainwindow.h \ waterlevelicon.h FORMS += mainwindow.ui \ + manualcookfinishpopup.ui \ manualcookwindow.ui \ configwindow.ui \ functiontestwindow.ui \