diff --git a/app/gui/oven_control/autocookcheckconfigwindow.cpp b/app/gui/oven_control/autocookcheckconfigwindow.cpp new file mode 100644 index 0000000..c6c3757 --- /dev/null +++ b/app/gui/oven_control/autocookcheckconfigwindow.cpp @@ -0,0 +1,238 @@ +#include "autocookcheckconfigwindow.h" +#include "ui_autocookcheckconfigwindow.h" + +#include + +#include "soundplayer.h" +#include "stringer.h" + +AutoCookCheckConfigWindow::AutoCookCheckConfigWindow(QWidget *parent, Cook cook) : + QMainWindow(parent), + ui(new Ui::AutoCookCheckConfigWindow), + cook(cook) +{ + ui->setupUi(this); + + if (!this->cook.isLoaded()) + this->cook.load(); + + configWidgets.append( + ConfigWidget { + ui->configButton_1, + ui->configMinLabel_1, + ui->configMaxLabel_1, + ui->configCurrentLabel_1, + ui->configSlider_1 + }); + configWidgets.append( + ConfigWidget { + ui->configButton_2, + ui->configMinLabel_2, + ui->configMaxLabel_2, + ui->configCurrentLabel_2, + ui->configSlider_2 + }); + configWidgets.append( + ConfigWidget { + ui->configButton_3, + ui->configMinLabel_3, + ui->configMaxLabel_3, + ui->configCurrentLabel_3, + ui->configSlider_3 + }); + configWidgets.append( + ConfigWidget { + ui->configButton_4, + ui->configMinLabel_4, + ui->configMaxLabel_4, + ui->configCurrentLabel_4, + ui->configSlider_4 + }); + configWidgets.append( + ConfigWidget { + ui->configButton_5, + ui->configMinLabel_5, + ui->configMaxLabel_5, + ui->configCurrentLabel_5, + ui->configSlider_5 + }); + + setupUi(); + + afterThreeSecsTimer.setSingleShot(true); + afterThreeSecsTimer.setInterval(3000); + afterThreeSecsTimer.start(); + connect(&afterThreeSecsTimer, SIGNAL(timeout()), SLOT(afterThreeSecs())); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); + + foreach (QWidget *w, findChildren()) + w->installEventFilter(this); + + setFocus(); +} + +AutoCookCheckConfigWindow::~AutoCookCheckConfigWindow() +{ + delete ui; +} + +bool AutoCookCheckConfigWindow::eventFilter(QObject */*watched*/, QEvent *event) +{ + switch (event->type()) + { + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + afterThreeSecsTimer.start(); + break; + default: + break; + } + + return false; +} + +void AutoCookCheckConfigWindow::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case 0x01000030: // Turn left + onEncoderLeft(); + break; + case 0x01000031: // Push + pushed = focusWidget(); + break; + case 0x01000032: // Turn right + onEncoderRight(); + break; + } +} + +void AutoCookCheckConfigWindow::keyReleaseEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case 0x01000030: // Turn left + onEncoderLeft(); + break; + case 0x01000031: // Push + if (focusWidget() == pushed) + onEncoderClicked(pushed); + + pushed = NULL; + break; + case 0x01000032: // Turn right + onEncoderRight(); + break; + } +} + +void AutoCookCheckConfigWindow::setupUi() +{ + ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); + ui->selectCookButton->setText(cook.name); + + for (int idx = 0; idx < 5; idx++) + { + ConfigWidget cw = configWidgets.at(idx); + + CookConfig config = cook.configs[idx]; + if (config.type == Define::ConfigNotUsed) + { + cw.button->hide(); + cw.minimum->hide(); + cw.maximum->hide(); + cw.current->hide(); + cw.slider->hide(); + } + else + { + ConfigWidget cw = configWidgets.at(idx); + cw.button->show(); + cw.minimum->show(); + cw.maximum->show(); + cw.current->show(); + cw.slider->show(); + + cw.button->setStyleSheet( + "QPushButton { image: url(" + + Define::icon(config.type) + + ") } QPushButton:pressed, QPushButton:focus { image: url(" + + Define::iconOverlay(config.type) + + ") }"); + + cw.minimum->setText(Define::minimum(config.type)); + cw.maximum->setText(Define::maximum(config.type)); + + switch (config.type) + { + case Define::Time: + cw.slider->setSubPixmap(":/images/slider/sub_white.png"); + break; + case Define::BurnDegree: + cw.slider->setSubPixmap(":/images/slider/sub_yellow.png"); + break; + case Define::Brightness: + cw.slider->setSubPixmap(":/images/slider/sub_red.png"); + break; + default: + cw.slider->setSubPixmap(":/images/slider/sub_blue.png"); + break; + } + + cw.slider->blockSignals(true); + cw.slider->setMinimum(1); + cw.slider->setMaximum(config.maximum); + cw.slider->setValue(config.current); + cw.slider->blockSignals(false); + cw.slider->bigTickInterval = 1; + + switch (config.type) + { + case Define::Time: + cw.current->setText(Stringer::remainingTime(cook.time() * 1000, Stringer::fontSize14)); + break; + case Define::BurnDegree: + cw.current->setText(Stringer::temperature(cook.coreTemp(), Stringer::fontSize14)); + break; + default: + cw.current->setText(QString().sprintf( + "%d" + "/%d", + config.current, config.maximum)); + break; + } + } + } +} + +void AutoCookCheckConfigWindow::onEncoderLeft() +{ + focusPreviousChild(); +} + +void AutoCookCheckConfigWindow::onEncoderRight() +{ + focusNextChild(); +} + +void AutoCookCheckConfigWindow::onEncoderClicked(QWidget *clicked) +{ + QPushButton *pb = qobject_cast(clicked); + if (pb) + pb->click(); +} + +void AutoCookCheckConfigWindow::afterThreeSecs() +{ + close(); +} + +void AutoCookCheckConfigWindow::on_backButton_clicked() +{ + close(); +} diff --git a/app/gui/oven_control/autocookcheckconfigwindow.h b/app/gui/oven_control/autocookcheckconfigwindow.h new file mode 100644 index 0000000..1558765 --- /dev/null +++ b/app/gui/oven_control/autocookcheckconfigwindow.h @@ -0,0 +1,58 @@ +#ifndef AUTOCOOKCHECKCONFIGWINDOW_H +#define AUTOCOOKCHECKCONFIGWINDOW_H + +#include +#include +#include +#include + +#include "cook.h" +#include "slider.h" + +namespace Ui { +class AutoCookCheckConfigWindow; +} + +class AutoCookCheckConfigWindow : public QMainWindow +{ + Q_OBJECT + + struct ConfigWidget { + QPushButton *button; + QLabel *minimum; + QLabel *maximum; + QLabel *current; + Slider *slider; + }; + +public: + explicit AutoCookCheckConfigWindow(QWidget *parent, Cook cook); + ~AutoCookCheckConfigWindow(); + + bool eventFilter(QObject *watched, QEvent *event); + +protected: + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + +private: + Ui::AutoCookCheckConfigWindow *ui; + QList configWidgets; + Cook cook; + + void setupUi(); + + QTimer afterThreeSecsTimer; + + QWidget *pushed = NULL; + + void onEncoderLeft(); + void onEncoderRight(); + void onEncoderClicked(QWidget *clicked); + +private slots: + void afterThreeSecs(); + void on_backButton_clicked(); +}; + +#endif // AUTOCOOKCHECKCONFIGWINDOW_H diff --git a/app/gui/oven_control/autocookcheckconfigwindow.ui b/app/gui/oven_control/autocookcheckconfigwindow.ui new file mode 100644 index 0000000..9a603e1 --- /dev/null +++ b/app/gui/oven_control/autocookcheckconfigwindow.ui @@ -0,0 +1,1336 @@ + + + AutoCookCheckConfigWindow + + + + 0 + 0 + 900 + 1600 + + + + MainWindow + + + #centralwidget { background-image: url(:/images/background/auto.png); } +#bottomBar { background-image: url(:/images/bottom_bar/background.png); } + +QSlider::groove { +background-image: url(:/images/slider/groove.png); +background-repeat: no-repeat; +background-position: center; +} + +QSlider::sub-page { +background-repeat: no-repeat; +background-position: left center; +margin: 0px 5px; +} + +QSlider[sliderColor="red"]::sub-page { +background-image: url(:/images/slider/sub_red.png); +} + +QSlider[sliderColor="yellow"]::sub-page { +background-image: url(:/images/slider/sub_yellow.png); +} + +QSlider[sliderColor="white"]::sub-page { +background-image: url(:/images/slider/sub_white.png); +} + +QSlider[sliderColor="blue"]::sub-page { +background-image: url(:/images/slider/sub_blue.png); +} + +QSlider[sliderColor="green"]::sub-page { +background-image: url(:/images/slider/sub_green.png); +} + +QSlider::handle { +background-image: url(:/images/slider/handle_big.png); +background-repeat: no-repeat; +background-position: center; +width: 23px; +height: 33px; +} + +QPushButton[style="icon"] { +background-image: url(:/images/slider_icon/background.png); +background-repeat: no-repeat; +background-position: center; +border: none; +} + + + + + false + + + + 27 + 1115 + 140 + 140 + + + + + + + icon + + + + + false + + + + 185 + 645 + 666 + 60 + + + + Qt::ClickFocus + + + + + true + + + + 185 + 780 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 0 + 430 + 250 + 150 + + + + + + + :/images/images/auto/005_auto_icon_01_ov.png + + + Qt::AlignCenter + + + + + true + + + + 185 + 1130 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + true + + + + 700 + 950 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 0 + 0 + 900 + 426 + + + + + #clockContainer { background-image: url(:/images/clock/background.png); } + + + + + 272 + 36 + 356 + 355 + + + + + + + 800 + 320 + 80 + 84 + + + + + + + + + true + + + + 199 + 1200 + 641 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 스팀 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + true + + + + 700 + 1130 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + false + + + + 27 + 1285 + 140 + 140 + + + + + + + icon + + + + + false + + + + 27 + 935 + 140 + 140 + + + + + + + icon + + + + + + 0 + 1450 + 900 + 150 + + + + + + 401 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/back.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/back_ov.png); } + + + + + + + + + true + + + + 189 + 1370 + 651 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 스팀 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + false + + + + 185 + 975 + 666 + 60 + + + + Qt::ClickFocus + + + + + false + + + + 27 + 605 + 140 + 140 + + + + + + + icon + + + + + false + + + + 185 + 805 + 666 + 60 + + + + Qt::ClickFocus + + + + + true + + + + 185 + 1300 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + true + + + + 199 + 690 + 641 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 스팀 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 584 + 480 + 288 + 70 + + + + + Roboto + 10 + 75 + true + + + + Qt::NoFocus + + + QPushButton { +border-image: url(:/images/button/288.png); +} +QPushButton::pressed, QPushButton:focus { +border-image: url(:/images/button/288_ov.png); +} + + + + + + + + true + + + + 700 + 780 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + false + + + + 185 + 1325 + 666 + 60 + + + + Qt::ClickFocus + + + + + true + + + + 185 + 950 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + true + + + + 700 + 1300 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + false + + + + 27 + 765 + 140 + 140 + + + + + + + icon + + + + + true + + + + 199 + 1020 + 641 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 스팀 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + true + + + + 700 + 620 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + false + + + + 185 + 1155 + 666 + 60 + + + + Qt::ClickFocus + + + + + true + + + + 199 + 850 + 641 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 스팀 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + true + + + + 185 + 620 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Clock + QWidget +
clock.h
+ 1 +
+ + WashWarnIcon + QLabel +
washwarnicon.h
+
+ + Slider + QWidget +
slider.h
+ 1 +
+
+ + backButton + configButton_5 + configButton_4 + configButton_3 + configButton_1 + configButton_2 + + + + + +
diff --git a/app/gui/oven_control/autocookcheckwindow.cpp b/app/gui/oven_control/autocookcheckwindow.cpp new file mode 100644 index 0000000..a23f92a --- /dev/null +++ b/app/gui/oven_control/autocookcheckwindow.cpp @@ -0,0 +1,357 @@ +#include "autocookcheckwindow.h" +#include "ui_autocookcheckwindow.h" + +#include + +#include "mainwindow.h" +#include "configwindow.h" +#include "washwindow.h" +#include "confirmpopup.h" +#include "favoritenamepopup.h" +#include "stringer.h" +#include "soundplayer.h" + +AutoCookCheckWindow::AutoCookCheckWindow(QWidget *parent, Cook cook) : + QMainWindow(parent), + ui(new Ui::AutoCookCheckWindow), + cook(cook) +{ + ui->setupUi(this); + + ui->clockContainer->setParent(ui->upperStack); + setAttribute(Qt::WA_DeleteOnClose); + + if (!this->cook.isLoaded()) + this->cook.load(); + + setupUi(); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); + + foreach (QWidget *w, findChildren()) + w->installEventFilter(this); + + afterThreeSecsTimer.setSingleShot(true); + afterThreeSecsTimer.setInterval(3000); + afterThreeSecsTimer.start(); + connect(&afterThreeSecsTimer, SIGNAL(timeout()), SLOT(afterThreeSecs())); + + setFocus(); +} + +AutoCookCheckWindow::~AutoCookCheckWindow() +{ + delete ui; +} + +bool AutoCookCheckWindow::eventFilter(QObject */*watched*/, QEvent *event) +{ + switch (event->type()) + { + case QEvent::KeyPress: + case QEvent::KeyRelease: + case QEvent::MouseButtonPress: + case QEvent::MouseButtonRelease: + case QEvent::MouseMove: + afterThreeSecsTimer.start(); + break; + default: + break; + } + + return false; +} + +void AutoCookCheckWindow::keyPressEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case 0x01000030: // Turn left + onEncoderLeft(); + break; + case 0x01000031: // Push + pushed = focusWidget(); + break; + case 0x01000032: // Turn right + onEncoderRight(); + break; + } +} + +void AutoCookCheckWindow::keyReleaseEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case 0x01000030: // Turn left + onEncoderLeft(); + break; + case 0x01000031: // Push + if (focusWidget() == pushed) + onEncoderClicked(pushed); + + pushed = NULL; + break; + case 0x01000032: // Turn right + onEncoderRight(); + break; + } +} + +void AutoCookCheckWindow::setupUi() +{ + steamModeIcon.load(":/images/cook_mode/small_steam.png"); + dryModeIcon.load(":/images/cook_mode/small_dryheat.png"); + combiModeIcon.load(":/images/cook_mode/small_combi.png"); + + ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); + ui->selectCookButton->setText(cook.name); + + int msecs = 0; + for (int i = 0; i < cook.steps.size(); i++) + msecs += cook.steps[i].time * 1000; + + ui->timeLabel->setText(Stringer::remainingTime(msecs)); + + if (cook.isCoreTempValid()) + ui->interTempLabel->setText(Stringer::temperature(cook.coreTemp())); + else + { + ui->interTempIcon->hide(); + ui->interTempLabel->hide(); + } + + ui->stepIndicator->setMaximum(cook.steps.size() - 1); + + ui->cookStepAnimation->start(300); + + ui->humidityGauge->setMinimum(0); + ui->humidityGauge->setMaximum(100); + ui->humidityGauge->setValue(0); + + ui->heatGauge->setMinimum(30); + ui->heatGauge->setMaximum(300); + ui->heatGauge->setValue(30); + + ui->doorStepLabel->hide(); + + selectedStepIndex = 0; + lastViewCookMode = Define::InvalidMode; + lastViewCookType = Define::Invalid; + lastViewDoorType = Define::Invalid; + + updateView(); +} + +void AutoCookCheckWindow::onEncoderLeft() +{ + focusPreviousChild(); +} + +void AutoCookCheckWindow::onEncoderRight() +{ + focusNextChild(); +} + +void AutoCookCheckWindow::onEncoderClicked(QWidget *clicked) +{ + QPushButton *b = qobject_cast(clicked); + if (b) + b->click(); +} + +void AutoCookCheckWindow::updateView() +{ + ui->stepIndicator->setCurrentIndex(selectedStepIndex); + + CookStep showingStep = cook.steps[selectedStepIndex]; + if (Define::classify(showingStep.type) == Define::DoorClass) + { + ui->cookStepIcon->hide(); + ui->cookStepLabel->hide(); + ui->cookModeIcon->hide(); + ui->humidityGauge->hide(); + ui->humidityLabel->hide(); + ui->heatGauge->hide(); + ui->heatLabel->hide(); + ui->doorStepLabel->show(); + ui->cookStepAnimation->show(); + + if (showingStep.type != lastViewDoorType) + { + lastViewDoorType = showingStep.type; + + ui->doorStepLabel->setText(Define::name(showingStep.type)); + ui->cookStepAnimation->clear(); + switch (showingStep.type) + { + case Define::PutThermometer: + ui->doorStepLabel->setText(tr("중심 온도계 삽입")); + ui->cookStepAnimation->load(":/images/animation/thermometer_01.png"); + ui->cookStepAnimation->load(":/images/animation/thermometer_02.png"); + ui->cookStepAnimation->setGeometry((900-210)/2, 800, 210, 307); + ui->cookStepAnimation->start(300); + break; + case Define::Load: + ui->doorStepLabel->setText(tr("식재료 적재")); + ui->cookStepAnimation->load(":/images/animation/load_01.png"); + ui->cookStepAnimation->load(":/images/animation/load_02.png"); + ui->cookStepAnimation->load(":/images/animation/load_03.png"); + ui->cookStepAnimation->load(":/images/animation/load_04.png"); + ui->cookStepAnimation->load(":/images/animation/load_03.png"); + ui->cookStepAnimation->load(":/images/animation/load_02.png"); + ui->cookStepAnimation->load(":/images/animation/load_01.png"); + ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307); + ui->cookStepAnimation->start(300); + break; + case Define::Cut: + ui->doorStepLabel->setText(tr("자르기")); + ui->cookStepAnimation->load(":/images/animation/cut_01.png"); + ui->cookStepAnimation->load(":/images/animation/cut_02.png"); + ui->cookStepAnimation->load(":/images/animation/cut_03.png"); + ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307); + ui->cookStepAnimation->start(300); + break; + case Define::Pour: + ui->doorStepLabel->setText(tr("물 붓기")); + ui->cookStepAnimation->load(":/images/animation/pour_01.png"); + ui->cookStepAnimation->load(":/images/animation/pour_02.png"); + ui->cookStepAnimation->load(":/images/animation/pour_03.png"); + ui->cookStepAnimation->load(":/images/animation/pour_04.png"); + ui->cookStepAnimation->setGeometry((900-264)/2, 800, 264, 307); + ui->cookStepAnimation->start(300); + break; + default: + ui->doorStepLabel->hide(); + ui->cookStepAnimation->hide(); + } + } + } + else + { + ui->doorStepLabel->hide(); + ui->cookStepAnimation->hide(); + ui->cookStepIcon->show(); + ui->cookStepLabel->show(); + ui->cookModeIcon->show(); + ui->humidityGauge->show(); + ui->humidityLabel->show(); + ui->heatGauge->show(); + ui->heatLabel->show(); + + if (showingStep.type != lastViewCookType) + { + lastViewCookType = showingStep.type; + + ui->cookStepIcon->setPixmap(Define::icon(showingStep.type)); + ui->cookStepLabel->setText(Define::name(showingStep.type)); + } + + if (showingStep.mode != lastViewCookMode) + { + lastViewCookMode = showingStep.mode; + + switch (showingStep.mode) + { + case Define::SteamMode: + ui->cookModeIcon->setPixmap(steamModeIcon); + break; + case Define::CombiMode: + ui->cookModeIcon->setPixmap(combiModeIcon); + break; + case Define::DryMode: + ui->cookModeIcon->setPixmap(dryModeIcon); + break; + case Define::InvalidClass: + ui->cookModeIcon->hide(); + break; + } + } + + ui->humidityLabel->setText(QString("%1%").arg(showingStep.humidity)); + ui->humidityGauge->setValue(showingStep.humidity); + + ui->heatLabel->setText(Stringer::temperature(showingStep.temp)); + ui->heatGauge->setValue(showingStep.temp); + } +} + +void AutoCookCheckWindow::addFavorite() +{ + AutoCookSetting s; + s.type = cook.type; + s.root = cook.root; + for (int i = 0; i < 5; i++) + s.configs[i] = cook.configs[i].current; + + FavoriteNamePopup *p = new FavoriteNamePopup(this, s); + p->showFullScreen(); +} + +void AutoCookCheckWindow::afterThreeSecs() +{ + emit back(); + close(); +} + +void AutoCookCheckWindow::on_selectCookButton_clicked() +{ + +} + +void AutoCookCheckWindow::on_showPrevStepButton_clicked() +{ + if (selectedStepIndex > 0) + { + selectedStepIndex--; + updateView(); + } +} + +void AutoCookCheckWindow::on_showNextStepButton_clicked() +{ + if (selectedStepIndex + 1 < cook.steps.size()) + { + selectedStepIndex++; + updateView(); + } +} + +void AutoCookCheckWindow::on_backButton_clicked() +{ + emit back(); + close(); +} + +void AutoCookCheckWindow::on_configButton_clicked() +{ + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + +void AutoCookCheckWindow::on_favoritesButton_clicked() +{ + ConfirmPopup *p = new ConfirmPopup(this, tr("즐겨찾기 항목에 추가하시겠습니까?")); + p->showFullScreen(); + + connect(p, SIGNAL(accepted()), SLOT(addFavorite())); +} + +void AutoCookCheckWindow::on_washButton_clicked() +{ + WashWindow *w = new WashWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + +void AutoCookCheckWindow::on_helpButton_clicked() +{ + +} diff --git a/app/gui/oven_control/autocookcheckwindow.h b/app/gui/oven_control/autocookcheckwindow.h new file mode 100644 index 0000000..aae636a --- /dev/null +++ b/app/gui/oven_control/autocookcheckwindow.h @@ -0,0 +1,69 @@ +#ifndef AUTOCOOKCHECKWINDOW_H +#define AUTOCOOKCHECKWINDOW_H + +#include + +#include "cook.h" + +namespace Ui { +class AutoCookCheckWindow; +} + +class AutoCookCheckWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit AutoCookCheckWindow(QWidget *parent, Cook cook); + ~AutoCookCheckWindow(); + + bool eventFilter(QObject *watched, QEvent *event); + +protected: + void keyPressEvent(QKeyEvent *event); + void keyReleaseEvent(QKeyEvent *event); + +private: + Ui::AutoCookCheckWindow *ui; + + Cook cook; + + QPixmap steamModeIcon; + QPixmap dryModeIcon; + QPixmap combiModeIcon; + + int selectedStepIndex; + + Define::StepType lastViewDoorType; + Define::StepType lastViewCookType; + Define::Mode lastViewCookMode; + + void setupUi(); + + QTimer afterThreeSecsTimer; + + QWidget *pushed = NULL; + + void onEncoderLeft(); + void onEncoderRight(); + void onEncoderClicked(QWidget *clicked); + +private slots: + void updateView(); + void addFavorite(); + void afterThreeSecs(); + + void on_selectCookButton_clicked(); + void on_showPrevStepButton_clicked(); + void on_showNextStepButton_clicked(); + void on_backButton_clicked(); + void on_configButton_clicked(); + void on_favoritesButton_clicked(); + void on_washButton_clicked(); + void on_helpButton_clicked(); + +signals: + void back(); +}; + +#endif // AUTOCOOKCHECKWINDOW_H diff --git a/app/gui/oven_control/autocookcheckwindow.ui b/app/gui/oven_control/autocookcheckwindow.ui new file mode 100644 index 0000000..d74770b --- /dev/null +++ b/app/gui/oven_control/autocookcheckwindow.ui @@ -0,0 +1,907 @@ + + + AutoCookCheckWindow + + + + 0 + 0 + 900 + 1600 + + + + MainWindow + + + #centralwidget { background-image: url(:/images/background/auto_steps.png); } +#bottomBar { background-image: url(:/images/bottom_bar/background.png); } + +QPushButton { +background-repeat: no-repeat; +background-position: center; +border: none; +} + + + + + + 340 + 800 + 231 + 281 + + + + + + + + + + 10 + 715 + 60 + 400 + + + + QPushButton { background-image: url(:/images/auto_button/prev_step.png); } +QPushButton::pressed, QPushButton:focus { background-image: url(:/images/auto_button/prev_step_ov.png); } + + + + + + + + + 110 + 710 + 541 + 100 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 14 + + + + Preheat + + + + + + 0 + 0 + 900 + 426 + + + + + #clockContainer { background-image: url(:/images/clock/background.png); } + + + + + 272 + 36 + 356 + 355 + + + + + + + 800 + 320 + 80 + 84 + + + + + + + + + + 130 + 600 + 100 + 100 + + + + + + + :/images/symbol/time.png + + + Qt::AlignCenter + + + + + + 510 + 810 + 291 + 290 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + + + 584 + 480 + 288 + 70 + + + + + Roboto + 10 + 75 + true + + + + Qt::NoFocus + + + QPushButton { border-image: url(:/images/button/288.png); } +QPushButton::pressed, QPushButton:focus { border-image: url(:/images/button/288_ov.png); } + + + + + + + + + 80 + 1020 + 741 + 81 + + + + + + + :/images/images/auto/window_icon_06.png + + + Qt::AlignCenter + + + + + + 100 + 1130 + 700 + 50 + + + + + + + 460 + 600 + 100 + 100 + + + + + + + :/images/symbol/core_temp.png + + + Qt::AlignCenter + + + + + + 180 + 710 + 541 + 100 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 14 + + + + Preheat + + + + + + 490 + 960 + 321 + 100 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 10 + + + Qt::AlignCenter + + + + + + 560 + 600 + 231 + 100 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 000/000 + + + + + + 830 + 715 + 60 + 400 + + + + QPushButton { background-image: url(:/images/auto_button/next_step.png); } +QPushButton::pressed, QPushButton:focus { background-image: url(:/images/auto_button/next_step_ov.png); } + + + + + + + + + 0 + 430 + 250 + 150 + + + + + + + :/images/images/auto/005_auto_icon_01_ov.png + + + Qt::AlignCenter + + + + + + 230 + 600 + 231 + 100 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 00:00 + + + + + + 0 + 1450 + 900 + 150 + + + + + + 175 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/back.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/back_ov.png); } + + + + + + + + + 514 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/wash.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/wash_ov.png); } + + + + + + + + + 288 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/config.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/config_ov.png); } + + + + + + + + + 627 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/help.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); } + + + + + + + + + 401 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/favorites.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/favorites_ov.png); } + + + + + + + + + + 80 + 710 + 100 + 100 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 14 + + + + + + + :/images/cook_step_type/sys_icon_05.png + + + Qt::AlignCenter + + + + + + 100 + 810 + 291 + 290 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + + + 90 + 960 + 321 + 100 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 10 + + + Qt::AlignCenter + + + + + + + Clock + QWidget +
clock.h
+ 1 +
+ + WashWarnIcon + QLabel +
washwarnicon.h
+
+ + AnimatedImageBox + QLabel +
animatedimagebox.h
+
+ + HumidityCircularGauge + QWidget +
humiditycirculargauge.h
+ 1 +
+ + HeatCircularGauge + QWidget +
heatcirculargauge.h
+ 1 +
+ + BulletIndicator + QWidget +
bulletindicator.h
+ 1 +
+
+ + selectCookButton + showPrevStepButton + showNextStepButton + backButton + configButton + favoritesButton + washButton + helpButton + + + + + +
diff --git a/app/gui/oven_control/autocookconfigwindow.cpp b/app/gui/oven_control/autocookconfigwindow.cpp index 0b04cb5..8f3ae81 100644 --- a/app/gui/oven_control/autocookconfigwindow.cpp +++ b/app/gui/oven_control/autocookconfigwindow.cpp @@ -12,6 +12,7 @@ #include "washwindow.h" #include "mainwindow.h" #include "autocookselectionpopup.h" +#include "autocookcheckwindow.h" AutoCookConfigWindow::AutoCookConfigWindow(QWidget *parent, Cook cook) : QMainWindow(parent), @@ -325,6 +326,8 @@ void AutoCookConfigWindow::updateConfig() void AutoCookConfigWindow::start() { + setFocus(); + AutoCookWindow *w = new AutoCookWindow(parentWidget(), cook); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); @@ -412,11 +415,15 @@ void AutoCookConfigWindow::on_configButton_5_clicked() void AutoCookConfigWindow::on_selectCookButton_clicked() { + setFocus(); + AutoCookSelectionPopup *p = new AutoCookSelectionPopup(this, cook.type); p->showFullScreen(); p->raise(); connect(p, SIGNAL(selected(Cook)), SLOT(changeCook(Cook))); + connect(p, SIGNAL(selected(Cook)), SLOT(setFocus())); + connect(p, SIGNAL(canceled()), SLOT(setFocus())); if (afterThreeSecsTimer.isActive()) { @@ -425,3 +432,19 @@ void AutoCookConfigWindow::on_selectCookButton_clicked() connect(p, SIGNAL(canceled()), &afterThreeSecsTimer, SLOT(start())); } } + +void AutoCookConfigWindow::on_checkCookButton_clicked() +{ + setFocus(); + + AutoCookCheckWindow *w = new AutoCookCheckWindow(this, cook); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + if (afterThreeSecsTimer.isActive()) + { + afterThreeSecsTimer.stop(); + connect(w, SIGNAL(back()), &afterThreeSecsTimer, SLOT(start())); + } +} diff --git a/app/gui/oven_control/autocookconfigwindow.h b/app/gui/oven_control/autocookconfigwindow.h index 0b99047..b4edbbf 100644 --- a/app/gui/oven_control/autocookconfigwindow.h +++ b/app/gui/oven_control/autocookconfigwindow.h @@ -74,6 +74,7 @@ private slots: void on_configButton_4_clicked(); void on_configButton_5_clicked(); void on_selectCookButton_clicked(); + void on_checkCookButton_clicked(); }; #endif // AUTOCOOKCONFIGWINDOW_H diff --git a/app/gui/oven_control/autocookconfigwindow.ui b/app/gui/oven_control/autocookconfigwindow.ui index 68369d6..c9643e7 100644 --- a/app/gui/oven_control/autocookconfigwindow.ui +++ b/app/gui/oven_control/autocookconfigwindow.ui @@ -626,7 +626,7 @@ border-image: url(:/images/button/288_ov.png); Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - + 720 @@ -1410,7 +1410,7 @@ border-image: url(:/images/button/152_ov.png); selectCookButton - pushButton_4 + checkCookButton configButton_1 configButton_2 configButton_3 diff --git a/app/gui/oven_control/autocookwindow.cpp b/app/gui/oven_control/autocookwindow.cpp index a6e3d1a..ae1322b 100644 --- a/app/gui/oven_control/autocookwindow.cpp +++ b/app/gui/oven_control/autocookwindow.cpp @@ -15,6 +15,7 @@ #include "config.h" #include "errorpopupdlg.h" #include "autocookselectionpopup.h" +#include "autocookcheckconfigwindow.h" AutoCookWindow::AutoCookWindow(QWidget *parent, Cook cook) : QMainWindow(parent), @@ -938,7 +939,12 @@ void AutoCookWindow::on_homeButton_clicked() void AutoCookWindow::on_configCookButton_clicked() { + setFocus(); + AutoCookCheckConfigWindow *w = new AutoCookCheckConfigWindow(this, cook); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); } void AutoCookWindow::on_humidityGaugeButton_pressed() diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index 11a4b26..45c57ca 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -119,7 +119,9 @@ SOURCES += main.cpp\ configdoormonitoring.cpp \ config1digitsetandenablesetdlg.cpp \ slider.cpp \ - autocookselectionpopup.cpp + autocookselectionpopup.cpp \ + autocookcheckwindow.cpp \ + autocookcheckconfigwindow.cpp HEADERS += mainwindow.h \ cook.h \ @@ -228,7 +230,9 @@ HEADERS += mainwindow.h \ configdoormonitoring.h \ config1digitsetandenablesetdlg.h \ slider.h \ - autocookselectionpopup.h + autocookselectionpopup.h \ + autocookcheckwindow.h \ + autocookcheckconfigwindow.h FORMS += mainwindow.ui \ manualcookwindow.ui \ @@ -303,7 +307,9 @@ FORMS += mainwindow.ui \ reservedtimepopup.ui \ configdoormonitoring.ui \ config1digitsetandenablesetdlg.ui \ - autocookselectionpopup.ui + autocookselectionpopup.ui \ + autocookcheckwindow.ui \ + autocookcheckconfigwindow.ui RESOURCES += \ resources.qrc