diff --git a/app/gui/oven_control/autocookconfigwindow.cpp b/app/gui/oven_control/autocookconfigwindow.cpp index e1bec1b..a78a78b 100644 --- a/app/gui/oven_control/autocookconfigwindow.cpp +++ b/app/gui/oven_control/autocookconfigwindow.cpp @@ -6,6 +6,9 @@ #include "stringer.h" #include "favoritenamepopup.h" #include "soundplayer.h" +#include "configwindow.h" +#include "washwindow.h" +#include "mainwindow.h" AutoCookConfigWindow::AutoCookConfigWindow(QWidget *parent, Cook cook) : QMainWindow(parent), @@ -219,6 +222,16 @@ void AutoCookConfigWindow::on_backButton_clicked() close(); } +void AutoCookConfigWindow::on_configButton_clicked() +{ + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + void AutoCookConfigWindow::on_favoritesButton_clicked() { ConfirmPopup *p = new ConfirmPopup(this, tr("즐겨찾기 항목에 추가하시겠습니까?")); @@ -232,3 +245,13 @@ void AutoCookConfigWindow::on_favoritesButton_clicked() connect(p, SIGNAL(rejected()), &cookStartTimer, SLOT(start())); } } + +void AutoCookConfigWindow::on_washButton_clicked() +{ + WashWindow *w = new WashWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} diff --git a/app/gui/oven_control/autocookconfigwindow.h b/app/gui/oven_control/autocookconfigwindow.h index b8f6c44..8960850 100644 --- a/app/gui/oven_control/autocookconfigwindow.h +++ b/app/gui/oven_control/autocookconfigwindow.h @@ -50,7 +50,9 @@ private slots: void addFavorite(); void on_backButton_clicked(); + void on_configButton_clicked(); void on_favoritesButton_clicked(); + void on_washButton_clicked(); }; #endif // AUTOCOOKCONFIGWINDOW_H diff --git a/app/gui/oven_control/autocookselectionwindow.cpp b/app/gui/oven_control/autocookselectionwindow.cpp index 29f69fc..289c0ce 100644 --- a/app/gui/oven_control/autocookselectionwindow.cpp +++ b/app/gui/oven_control/autocookselectionwindow.cpp @@ -6,6 +6,9 @@ #include "autocookconfigwindow.h" #include "soundplayer.h" +#include "configwindow.h" +#include "washwindow.h" +#include "mainwindow.h" AutoCookSelectionWindow::AutoCookSelectionWindow(QWidget *parent, Define::CookType type) : QMainWindow(parent), @@ -63,20 +66,38 @@ AutoCookSelectionWindow::~AutoCookSelectionWindow() void AutoCookSelectionWindow::onCookSelected(int idx) { - if (autoCookWindowOpened) - return; - - autoCookWindowOpened = true; + AutoCookConfigWindow *w = new AutoCookConfigWindow(this, book.get(idx)); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); +} +void AutoCookSelectionWindow::on_backButton_clicked() +{ close(); +} + +void AutoCookSelectionWindow::on_configButton_clicked() +{ + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} - AutoCookConfigWindow *w = new AutoCookConfigWindow(parentWidget(), book.get(idx)); +void AutoCookSelectionWindow::on_washButton_clicked() +{ + WashWindow *w = new WashWindow(MainWindow::getInstance()); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + MainWindow::jump(w); } -void AutoCookSelectionWindow::on_backButton_clicked() +void AutoCookSelectionWindow::on_helpButton_clicked() { - close(); + } diff --git a/app/gui/oven_control/autocookselectionwindow.h b/app/gui/oven_control/autocookselectionwindow.h index db99bb5..3e5f507 100644 --- a/app/gui/oven_control/autocookselectionwindow.h +++ b/app/gui/oven_control/autocookselectionwindow.h @@ -23,6 +23,12 @@ private slots: void on_backButton_clicked(); + void on_configButton_clicked(); + + void on_washButton_clicked(); + + void on_helpButton_clicked(); + private: Ui::AutoCookSelectionWindow *ui; Define::CookType type; diff --git a/app/gui/oven_control/autocookwindow.cpp b/app/gui/oven_control/autocookwindow.cpp index 75625ac..e2dc5d7 100644 --- a/app/gui/oven_control/autocookwindow.cpp +++ b/app/gui/oven_control/autocookwindow.cpp @@ -7,6 +7,9 @@ #include "favoritenamepopup.h" #include "stringer.h" #include "soundplayer.h" +#include "configwindow.h" +#include "washwindow.h" +#include "mainwindow.h" AutoCookWindow::AutoCookWindow(QWidget *parent, Cook cook) : QMainWindow(parent), @@ -642,6 +645,30 @@ void AutoCookWindow::addFavorite() p->showFullScreen(); } +void AutoCookWindow::jumpConfig() +{ + Oven::getInstance()->stop(); + + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + +void AutoCookWindow::jumpWash() +{ + Oven::getInstance()->stop(); + + WashWindow *w = new WashWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + void AutoCookWindow::on_humidityGaugeButton_pressed() { showCurrentHumidityTimer.start(); @@ -676,12 +703,6 @@ void AutoCookWindow::on_heatGaugeButton_released() } } -void AutoCookWindow::on_backButton_clicked() -{ - Oven::getInstance()->stop(); - close(); -} - void AutoCookWindow::on_showPrevStepButton_clicked() { returnToCurrentStepTimer.start(); @@ -704,6 +725,32 @@ void AutoCookWindow::on_showNextStepButton_clicked() } } +void AutoCookWindow::on_backButton_clicked() +{ + Oven::getInstance()->stop(); + close(); +} + +void AutoCookWindow::on_configButton_clicked() +{ + if (autocook.done()) + { + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); + } + else + { + ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 환경 설정 모드로 들어갑니다. 진행할까요?")); + p->showFullScreen(); + + connect(p, SIGNAL(accepted()), SLOT(jumpConfig())); + } +} + void AutoCookWindow::on_favoritesButton_clicked() { if (!autocook.done()) @@ -714,3 +761,28 @@ void AutoCookWindow::on_favoritesButton_clicked() connect(p, SIGNAL(accepted()), SLOT(addFavorite())); } + +void AutoCookWindow::on_washButton_clicked() +{ + if (autocook.done()) + { + WashWindow *w = new WashWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); + } + else + { + ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 자동 세척 모드로 들어갑니다. 진행할까요?")); + p->showFullScreen(); + + connect(p, SIGNAL(accepted()), SLOT(jumpWash())); + } +} + +void AutoCookWindow::on_helpButton_clicked() +{ + +} diff --git a/app/gui/oven_control/autocookwindow.h b/app/gui/oven_control/autocookwindow.h index 6d840ae..dafb7f5 100644 --- a/app/gui/oven_control/autocookwindow.h +++ b/app/gui/oven_control/autocookwindow.h @@ -67,6 +67,10 @@ private slots: void showCurrentHumidity(); void showCurrentTemp(); void addFavorite(); + + void jumpConfig(); + void jumpWash(); + void on_humidityGaugeButton_pressed(); void on_humidityGaugeButton_released(); void on_heatGaugeButton_pressed(); @@ -75,6 +79,9 @@ private slots: void on_showPrevStepButton_clicked(); void on_showNextStepButton_clicked(); void on_favoritesButton_clicked(); + void on_configButton_clicked(); + void on_washButton_clicked(); + void on_helpButton_clicked(); }; #endif // AUTOCOOKWINDOW_H diff --git a/app/gui/oven_control/configwindow.cpp b/app/gui/oven_control/configwindow.cpp index ae8e769..a0984a9 100644 --- a/app/gui/oven_control/configwindow.cpp +++ b/app/gui/oven_control/configwindow.cpp @@ -11,6 +11,8 @@ #include "servicepassinputdlg.h" #include "fileprocessor.h" #include "soundplayer.h" +#include "washwindow.h" +#include "mainwindow.h" ConfigWindow::ConfigWindow(QWidget *parent) : QMainWindow(parent), @@ -254,3 +256,32 @@ void ConfigWindow::onDeleteFavoriteBtnClicked(uint16_t id){ } } } + +void ConfigWindow::on_washButton_clicked() +{ + Config* cfg = Config::getInstance(); + QDialog* dlg = new YesNoPopupDlg(this,tr("현재 설정을 적용하시겠습니까?")); + dlg->setModal(true); + dlg->exec(); + if(dlg->result() == QDialog::Accepted){ + cfg->saveConfig(); + cfg->saveFavorite(); + } + else{ + cfg->loadConfig(); + cfg->loadFavorite(); + } + cfg->applyConfig(); + + WashWindow *w = new WashWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + +void ConfigWindow::on_helpButton_clicked() +{ + +} diff --git a/app/gui/oven_control/configwindow.h b/app/gui/oven_control/configwindow.h index b686a51..6180ade 100644 --- a/app/gui/oven_control/configwindow.h +++ b/app/gui/oven_control/configwindow.h @@ -68,6 +68,10 @@ private slots: void on_pushButton_5_clicked(); + void on_washButton_clicked(); + + void on_helpButton_clicked(); + public slots: void onConfigBtnClicked(uint16_t id); void onConfigCheckBtnClicked(uint16_t id, bool checked); diff --git a/app/gui/oven_control/favoritenamepopup.cpp b/app/gui/oven_control/favoritenamepopup.cpp index 7e02f52..2019274 100644 --- a/app/gui/oven_control/favoritenamepopup.cpp +++ b/app/gui/oven_control/favoritenamepopup.cpp @@ -3,6 +3,7 @@ #include "soundplayer.h" #include "primewindow.h" +#include "mainwindow.h" FavoriteNamePopup::FavoriteNamePopup(QWidget *parent) : QWidget(parent), @@ -49,14 +50,14 @@ void FavoriteNamePopup::ok() return; } - PrimeWindow *w = new PrimeWindow(parentWidget()); + PrimeWindow *w = new PrimeWindow(MainWindow::getInstance()); w->setWindowModality(Qt::WindowModal); w->listFavorites(); w->focusFavorite(id); w->showFullScreen(); w->raise(); - deleteLater(); + MainWindow::jump(w); } void FavoriteNamePopup::cancel() diff --git a/app/gui/oven_control/mainwindow.cpp b/app/gui/oven_control/mainwindow.cpp index 02aa4c7..1b4325f 100644 --- a/app/gui/oven_control/mainwindow.cpp +++ b/app/gui/oven_control/mainwindow.cpp @@ -17,12 +17,17 @@ #include "programmingwindow.h" #include "primewindow.h" +MainWindow *MainWindow::instance = NULL; + MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); + instance = this; + child = NULL; + setFocus(); QList buttons = findChildren(); @@ -38,6 +43,14 @@ MainWindow::~MainWindow() delete ui; } +void MainWindow::jump(QMainWindow *newChild) +{ + if (instance->child) + instance->child->deleteLater(); + + instance->child = newChild; +} + static QPushButton *pushedChild = NULL; void MainWindow::keyPressEvent(QKeyEvent *event) @@ -82,6 +95,8 @@ void MainWindow::showManualCookWindow(Define::Mode mode) w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + child = w; } void MainWindow::showAutoCookSelectionWindow(Define::CookType type) @@ -90,6 +105,8 @@ void MainWindow::showAutoCookSelectionWindow(Define::CookType type) w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + child = w; } void MainWindow::on_steamButton_clicked() @@ -148,6 +165,8 @@ void MainWindow::on_primeButton_clicked() w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + child = w; } void MainWindow::on_multiButton_clicked() @@ -161,6 +180,8 @@ void MainWindow::on_programmingButton_clicked() w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + child = w; } void MainWindow::on_washButton_clicked() @@ -169,6 +190,8 @@ void MainWindow::on_washButton_clicked() w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + child = w; } void MainWindow::on_configButton_clicked() @@ -177,6 +200,8 @@ void MainWindow::on_configButton_clicked() w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); + + child = w; } void MainWindow::on_helpButton_clicked() diff --git a/app/gui/oven_control/mainwindow.h b/app/gui/oven_control/mainwindow.h index 2ee8004..3c5ab85 100644 --- a/app/gui/oven_control/mainwindow.h +++ b/app/gui/oven_control/mainwindow.h @@ -14,10 +14,15 @@ class MainWindow : public QMainWindow { Q_OBJECT + static MainWindow *instance; + public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); + static MainWindow *getInstance() { return instance; } + static void jump(QMainWindow *newChild); + protected: void keyPressEvent(QKeyEvent *event); void keyReleaseEvent(QKeyEvent *event); @@ -48,6 +53,7 @@ private slots: private: Ui::MainWindow *ui; + QMainWindow *child; }; #endif // MAINWINDOW_H diff --git a/app/gui/oven_control/manualcookwindow.cpp b/app/gui/oven_control/manualcookwindow.cpp index d1c1bde..f5c3719 100644 --- a/app/gui/oven_control/manualcookwindow.cpp +++ b/app/gui/oven_control/manualcookwindow.cpp @@ -16,6 +16,10 @@ #include "coretempsettingpopup.h" #include "reservetimepopup.h" #include "reservedtimepopup.h" +#include "mainwindow.h" +#include "configwindow.h" +#include "primewindow.h" +#include "washwindow.h" #include @@ -378,6 +382,58 @@ void ManualCookWindow::stop() startCookingTimer.stop(); } +void ManualCookWindow::addFavorite() +{ + ManualCookSetting s; + s.mode = oven->mode(); + s.humidity = oven->humidity(); + s.temp = oven->temp(); + s.time = oven->time(); + s.fan = oven->fan(); + s.coreTempEnabled = oven->interTempEnabled(); + s.coreTemp = oven->interTemp(); + + FavoriteNamePopup *p = new FavoriteNamePopup(this, s); + p->showFullScreen(); +} + +void ManualCookWindow::jumpConfig() +{ + stop(); + + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + +void ManualCookWindow::jumpFavorites() +{ + stop(); + + PrimeWindow *w = new PrimeWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->listFavorites(); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + +void ManualCookWindow::jumpWash() +{ + stop(); + + WashWindow *w = new WashWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + void ManualCookWindow::on_steamButton_clicked() { setOvenDefault(Define::SteamMode); @@ -551,17 +607,68 @@ void ManualCookWindow::on_backButton_clicked() close(); } -void ManualCookWindow::addFavorite() +void ManualCookWindow::on_configButton_clicked() +{ + if (oven->cooking()) + { + ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 환경 설정 모드로 들어갑니다. 진행할까요?")); + p->showFullScreen(); + + connect(p, SIGNAL(accepted()), SLOT(jumpConfig())); + } + else + { + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); + } +} + +void ManualCookWindow::on_favoritesButton_clicked() +{ + if (oven->cooking()) + { + ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 즐겨찾기 모드로 들어갑니다. 진행할까요?")); + p->showFullScreen(); + + connect(p, SIGNAL(accepted()), SLOT(jumpFavorites())); + } + else + { + PrimeWindow *w = new PrimeWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->listFavorites(); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); + } +} + +void ManualCookWindow::on_washButton_clicked() +{ + if (oven->cooking()) + { + ConfirmPopup *p = new ConfirmPopup(this, tr("요리가 중단되고 자동 세척 모드로 들어갑니다. 진행할까요?")); + p->showFullScreen(); + + connect(p, SIGNAL(accepted()), SLOT(jumpWash())); + } + else + { + WashWindow *w = new WashWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); + } +} + +void ManualCookWindow::on_helpButton_clicked() { - ManualCookSetting s; - s.mode = oven->mode(); - s.humidity = oven->humidity(); - s.temp = oven->temp(); - s.time = oven->time(); - s.fan = oven->fan(); - s.coreTempEnabled = oven->interTempEnabled(); - s.coreTemp = oven->interTemp(); - FavoriteNamePopup *p = new FavoriteNamePopup(this, s); - p->showFullScreen(); } diff --git a/app/gui/oven_control/manualcookwindow.h b/app/gui/oven_control/manualcookwindow.h index 5d45304..1d6d40a 100644 --- a/app/gui/oven_control/manualcookwindow.h +++ b/app/gui/oven_control/manualcookwindow.h @@ -39,6 +39,11 @@ private slots: void onOvenUpdated(Oven *oven); + void addFavorite(); + void jumpConfig(); + void jumpFavorites(); + void jumpWash(); + void on_steamButton_clicked(); void on_combiButton_clicked(); void on_dryheatButton_clicked(); @@ -62,8 +67,10 @@ private slots: void on_goFrontStackButton_clicked(); void on_backButton_clicked(); - - void addFavorite(); + void on_configButton_clicked(); + void on_favoritesButton_clicked(); + void on_washButton_clicked(); + void on_helpButton_clicked(); private: Ui::ManualCookWindow *ui; diff --git a/app/gui/oven_control/primewindow.cpp b/app/gui/oven_control/primewindow.cpp index ef0d336..03485f7 100644 --- a/app/gui/oven_control/primewindow.cpp +++ b/app/gui/oven_control/primewindow.cpp @@ -8,6 +8,9 @@ #include "manualcooksettingwidget.h" #include "cookhistory.h" #include "soundplayer.h" +#include "configwindow.h" +#include "washwindow.h" +#include "mainwindow.h" PrimeWindow::PrimeWindow(QWidget *parent) : QMainWindow(parent), @@ -184,3 +187,28 @@ void PrimeWindow::on_backButton_clicked() { close(); } + +void PrimeWindow::on_configButton_clicked() +{ + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + +void PrimeWindow::on_washButton_clicked() +{ + WashWindow *w = new WashWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + + MainWindow::jump(w); +} + +void PrimeWindow::on_helpButton_clicked() +{ + +} diff --git a/app/gui/oven_control/primewindow.h b/app/gui/oven_control/primewindow.h index acb26dc..31b99c5 100644 --- a/app/gui/oven_control/primewindow.h +++ b/app/gui/oven_control/primewindow.h @@ -41,6 +41,12 @@ private slots: + void on_configButton_clicked(); + + void on_washButton_clicked(); + + void on_helpButton_clicked(); + private: Ui::PrimeWindow *ui; diff --git a/app/gui/oven_control/washwindow.cpp b/app/gui/oven_control/washwindow.cpp index b7cf8d6..508a98d 100644 --- a/app/gui/oven_control/washwindow.cpp +++ b/app/gui/oven_control/washwindow.cpp @@ -5,6 +5,8 @@ #include "soundplayer.h" #include "dirtylevel.h" +#include "configwindow.h" +#include "mainwindow.h" WashWindow::WashWindow(QWidget *parent) : QMainWindow(parent), @@ -254,7 +256,17 @@ void WashWindow::on_backButton_clicked() void WashWindow::on_configButton_clicked() { + if (started) + stop(); + else + { + ConfigWindow *w = new ConfigWindow(MainWindow::getInstance()); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); + MainWindow::jump(w); + } } void WashWindow::on_helpButton_clicked()