From 382b586e92d032264d335544486c7fb59695890f Mon Sep 17 00:00:00 2001 From: victor Date: Mon, 29 May 2017 15:24:05 +0900 Subject: [PATCH] =?UTF-8?q?=ED=94=84=EB=A1=9C=EA=B7=B8=EB=9E=98=EB=B0=8D?= =?UTF-8?q?=20=EB=AA=A8=EB=93=9C=20=EC=9E=84=EC=8B=9C=20=EA=B5=AC=ED=98=84?= =?UTF-8?q?=20-=20=EC=9E=90=EB=8F=99=20=EC=9A=94=EB=A6=AC=20=EB=A7=8C?= =?UTF-8?q?=EB=93=A4=EA=B8=B0=20=EC=B6=94=EA=B0=80=20-=20=EC=97=B0?= =?UTF-8?q?=EC=86=8D=20=EC=9A=94=EB=A6=AC=20=EA=B8=B0=EB=8A=A5=20=EB=AF=B8?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/gui/oven_control/cookpanelbutton.cpp | 34 +- app/gui/oven_control/cookpanelbutton.h | 15 +- app/gui/oven_control/cookprogram.cpp | 12 +- app/gui/oven_control/cookprogram.h | 1 + app/gui/oven_control/oven_control.pro | 15 +- app/gui/oven_control/primewindow.cpp | 2 - .../oven_control/programmingautoconfigwindow.cpp | 198 +++ app/gui/oven_control/programmingautoconfigwindow.h | 54 + .../oven_control/programmingautoconfigwindow.ui | 1455 ++++++++++++++++++++ .../programmingautoselectionwindow.cpp | 94 ++ .../oven_control/programmingautoselectionwindow.h | 40 + .../oven_control/programmingautoselectionwindow.ui | 177 +++ .../programmingmanualcoretemppopup.cpp | 4 + app/gui/oven_control/programmingmanualwindow.cpp | 4 + app/gui/oven_control/programmingnamepopup.cpp | 14 + app/gui/oven_control/programmingnamepopup.h | 22 + app/gui/oven_control/programmingnamepopup.ui | 21 + .../oven_control/programmingselectionwindow.cpp | 39 +- app/gui/oven_control/programmingselectionwindow.h | 6 +- app/gui/oven_control/programmingselectionwindow.ui | 34 + app/gui/oven_control/programmingwindow.cpp | 44 +- app/gui/oven_control/programmingwindow.h | 4 + app/gui/oven_control/programmingwindow.ui | 2 +- 23 files changed, 2264 insertions(+), 27 deletions(-) create mode 100644 app/gui/oven_control/programmingautoconfigwindow.cpp create mode 100644 app/gui/oven_control/programmingautoconfigwindow.h create mode 100644 app/gui/oven_control/programmingautoconfigwindow.ui create mode 100644 app/gui/oven_control/programmingautoselectionwindow.cpp create mode 100644 app/gui/oven_control/programmingautoselectionwindow.h create mode 100644 app/gui/oven_control/programmingautoselectionwindow.ui create mode 100644 app/gui/oven_control/programmingnamepopup.cpp create mode 100644 app/gui/oven_control/programmingnamepopup.h create mode 100644 app/gui/oven_control/programmingnamepopup.ui diff --git a/app/gui/oven_control/cookpanelbutton.cpp b/app/gui/oven_control/cookpanelbutton.cpp index 4eb57a8..1ac15d9 100644 --- a/app/gui/oven_control/cookpanelbutton.cpp +++ b/app/gui/oven_control/cookpanelbutton.cpp @@ -8,7 +8,8 @@ CookPanelButton::CookPanelButton(CookRecord record, QWidget *parent) : QWidget(parent), record(record), ui(new Ui::CookPanelButton), - rendered(false) + rendered(false), + longPressEnabled(false) { ui->setupUi(this); @@ -16,6 +17,10 @@ CookPanelButton::CookPanelButton(CookRecord record, QWidget *parent) : foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); + + longPressedTimer.setSingleShot(true); + longPressedTimer.setInterval(2000); + connect(&longPressedTimer, SIGNAL(timeout()), SLOT(emitLongPressed())); } CookPanelButton::~CookPanelButton() @@ -64,14 +69,28 @@ void CookPanelButton::focusDeleteButton() ui->deleteButton->setFocus(); } +void CookPanelButton::setLongPressEnabled(bool enabled) +{ + longPressEnabled = enabled; +} + +void CookPanelButton::emitLongPressed() +{ + emitted = true; + emit longPressed(this); +} + -void CookPanelButton::on_showInfoButton_toggled(bool checked) +void CookPanelButton::on_showInfoButton_clicked() { emit infoClicked(this); } void CookPanelButton::on_pushButton_clicked() { + if (longPressEnabled && emitted) + return; + CookHistory::start(record, parentWidget()); } @@ -79,3 +98,14 @@ void CookPanelButton::on_deleteButton_clicked() { emit deleteClicked(this); } + +void CookPanelButton::on_pushButton_pressed() +{ + longPressedTimer.start(); + emitted = false; +} + +void CookPanelButton::on_pushButton_released() +{ + longPressedTimer.stop(); +} diff --git a/app/gui/oven_control/cookpanelbutton.h b/app/gui/oven_control/cookpanelbutton.h index e5d33f8..12ce7b8 100644 --- a/app/gui/oven_control/cookpanelbutton.h +++ b/app/gui/oven_control/cookpanelbutton.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "cookhistory.h" @@ -20,6 +21,7 @@ signals: void clicked(CookPanelButton *); void infoClicked(CookPanelButton *); void deleteClicked(CookPanelButton *); + void longPressed(CookPanelButton *); public: explicit CookPanelButton(CookRecord record, QWidget *parent = 0); @@ -33,22 +35,27 @@ public: void focusInfoButton(); void focusDeleteButton(); + void setLongPressEnabled(bool enabled); + CookRecord record; private slots: + void emitLongPressed(); - - void on_showInfoButton_toggled(bool checked); - + void on_pushButton_pressed(); + void on_pushButton_released(); void on_pushButton_clicked(); - + void on_showInfoButton_clicked(); void on_deleteButton_clicked(); private: Ui::CookPanelButton *ui; + QTimer longPressedTimer; bool rendered; QLabel *label; + bool emitted; + bool longPressEnabled; }; #endif // COOKPANELBUTTON_H diff --git a/app/gui/oven_control/cookprogram.cpp b/app/gui/oven_control/cookprogram.cpp index 1671936..3c17a75 100644 --- a/app/gui/oven_control/cookprogram.cpp +++ b/app/gui/oven_control/cookprogram.cpp @@ -709,6 +709,14 @@ void CookProgram::discard() { checkInitialized(); - currentAutoList = savedAutoList; - currentManualList = savedManualList; + if (isModified()) + { + currentAutoList = savedAutoList; + currentManualList = savedManualList; + } +} + +bool CookProgram::isModified() +{ + return currentAutoList != savedAutoList || currentManualList != savedManualList; } diff --git a/app/gui/oven_control/cookprogram.h b/app/gui/oven_control/cookprogram.h index a269949..55dab81 100644 --- a/app/gui/oven_control/cookprogram.h +++ b/app/gui/oven_control/cookprogram.h @@ -12,6 +12,7 @@ void remove(CookRecord record); void rename(CookRecord record, QString name); void save(); void discard(); +bool isModified(); QList listAuto(); QList listManual(); diff --git a/app/gui/oven_control/oven_control.pro b/app/gui/oven_control/oven_control.pro index fcdd7e6..9db4aea 100644 --- a/app/gui/oven_control/oven_control.pro +++ b/app/gui/oven_control/oven_control.pro @@ -110,7 +110,10 @@ SOURCES += main.cpp\ programmingselectionwindow.cpp \ programmingmanualwindow.cpp \ programmingmanualcoretemppopup.cpp \ - cookprogram.cpp + cookprogram.cpp \ + programmingautoselectionwindow.cpp \ + programmingautoconfigwindow.cpp \ + programmingnamepopup.cpp HEADERS += mainwindow.h \ cook.h \ @@ -210,7 +213,10 @@ HEADERS += mainwindow.h \ programmingselectionwindow.h \ programmingmanualwindow.h \ programmingmanualcoretemppopup.h \ - cookprogram.h + cookprogram.h \ + programmingautoselectionwindow.h \ + programmingautoconfigwindow.h \ + programmingnamepopup.h FORMS += mainwindow.ui \ manualcookwindow.ui \ @@ -277,7 +283,10 @@ FORMS += mainwindow.ui \ fileprocessdlg.ui \ programmingselectionwindow.ui \ programmingmanualwindow.ui \ - programmingmanualcoretemppopup.ui + programmingmanualcoretemppopup.ui \ + programmingautoselectionwindow.ui \ + programmingautoconfigwindow.ui \ + programmingnamepopup.ui RESOURCES += \ resources.qrc diff --git a/app/gui/oven_control/primewindow.cpp b/app/gui/oven_control/primewindow.cpp index a6a7c24..ef0d336 100644 --- a/app/gui/oven_control/primewindow.cpp +++ b/app/gui/oven_control/primewindow.cpp @@ -71,10 +71,8 @@ void PrimeWindow::focusFavorite(int id) { foreach (CookPanelButton *b, list) { - qDebug() << "Favorite ID" << b->record.id; if (b->record.id == id) { -// b->setFocus(); b->focusBar(); break; } diff --git a/app/gui/oven_control/programmingautoconfigwindow.cpp b/app/gui/oven_control/programmingautoconfigwindow.cpp new file mode 100644 index 0000000..4bb0879 --- /dev/null +++ b/app/gui/oven_control/programmingautoconfigwindow.cpp @@ -0,0 +1,198 @@ +#include "programmingautoconfigwindow.h" +#include "ui_programmingautoconfigwindow.h" + +#include "soundplayer.h" +#include "stringer.h" +#include "cookprogram.h" + +ProgrammingAutoConfigWindow::ProgrammingAutoConfigWindow(QWidget *parent, Cook cook) : + QMainWindow(parent), + ui(new Ui::ProgrammingAutoConfigWindow), + cook(cook) +{ + ui->setupUi(this); + + ui->clockContainer->setParent(ui->upperStack); + setAttribute(Qt::WA_DeleteOnClose); + + 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(); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); +} + +ProgrammingAutoConfigWindow::~ProgrammingAutoConfigWindow() +{ + delete ui; +} + +void ProgrammingAutoConfigWindow::setupUi() +{ + ui->cookTypeIcon->setPixmap(Define::icon(cook.type)); + ui->selectCookButton->setText(cook.name); + + for (int idx = 0; idx < 5; idx++) + { + CookConfig config = cook.configs[idx]; + if (config.type == Define::ConfigNotUsed) + { + ConfigWidget cw = configWidgets.at(idx); + cw.button->hide(); + cw.minimum->hide(); + cw.maximum->hide(); + cw.current->hide(); + cw.slider->hide(); + } + else + { + ConfigWidget cw = configWidgets.at(idx); + cw.button->setStyleSheet( + "QPushButton { image: url(" + + Define::icon(config.type) + + ") } QPushButton::pressed { image: url(" + + Define::iconOverlay(config.type) + + ") }"); + + cw.minimum->setText(Define::minimum(config.type)); + cw.maximum->setText(Define::maximum(config.type)); + cw.slider->blockSignals(true); + cw.slider->setMinimum(1); + cw.slider->setMaximum(config.maximum); + cw.slider->setValue(config.current); + cw.slider->blockSignals(false); + + switch (config.type) + { + case Define::Time: + cw.slider->setProperty("sliderColor", "white"); + break; + case Define::BurnDegree: + cw.slider->setProperty("sliderColor", "yellow"); + break; + case Define::Brightness: + cw.slider->setProperty("sliderColor", "red"); + break; + default: + cw.slider->setProperty("sliderColor", "blue"); + break; + } + + connect(cw.slider, SIGNAL(valueChanged(int)), SLOT(updateConfig())); + } + } + + updateView(); +} + +void ProgrammingAutoConfigWindow::updateView() +{ + for (int idx = 0; idx < 5; idx++) + { + CookConfig config = cook.configs[idx]; + if (config.type == Define::ConfigNotUsed) + continue; + + ConfigWidget cw = configWidgets.at(idx); + + 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 ProgrammingAutoConfigWindow::updateConfig() +{ + cook.setConfig(ui->configSlider_1->value(), + ui->configSlider_2->value(), + ui->configSlider_3->value(), + ui->configSlider_4->value(), + ui->configSlider_5->value()); + + updateView(); +} + +void ProgrammingAutoConfigWindow::on_backButton_clicked() +{ + close(); +} + +void ProgrammingAutoConfigWindow::on_configButton_clicked() +{ + +} + +void ProgrammingAutoConfigWindow::on_helpButton_clicked() +{ + +} + +void ProgrammingAutoConfigWindow::on_okButton_clicked() +{ + if (!cook.isLoaded()) + cook.load(); + + AutoCookSetting s; + s.type = cook.type; + s.name = cook.name; + s.root = cook.root; + for (int i = 0; i < 5; i++) + s.configs[i] = cook.configs[i].current; + + CookProgram::add(s); + + emit added(); + close(); +} diff --git a/app/gui/oven_control/programmingautoconfigwindow.h b/app/gui/oven_control/programmingautoconfigwindow.h new file mode 100644 index 0000000..90d1ce8 --- /dev/null +++ b/app/gui/oven_control/programmingautoconfigwindow.h @@ -0,0 +1,54 @@ +#ifndef PROGRAMMINGAUTOCONFIGWINDOW_H +#define PROGRAMMINGAUTOCONFIGWINDOW_H + +#include +#include +#include +#include + +#include "cookbook.h" + +namespace Ui { +class ProgrammingAutoConfigWindow; +} + +class ProgrammingAutoConfigWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit ProgrammingAutoConfigWindow(QWidget *parent, Cook cook); + ~ProgrammingAutoConfigWindow(); + +private: + Ui::ProgrammingAutoConfigWindow *ui; + Cook cook; + + struct ConfigWidget { + QPushButton *button; + QLabel *minimum; + QLabel *maximum; + QLabel *current; + QSlider *slider; + }; + + QList configWidgets; + +private slots: + void setupUi(); + void updateView(); + void updateConfig(); + + void on_backButton_clicked(); + + void on_configButton_clicked(); + + void on_helpButton_clicked(); + + void on_okButton_clicked(); + +signals: + void added(); +}; + +#endif // PROGRAMMINGAUTOCONFIGWINDOW_H diff --git a/app/gui/oven_control/programmingautoconfigwindow.ui b/app/gui/oven_control/programmingautoconfigwindow.ui new file mode 100644 index 0000000..9d52f0c --- /dev/null +++ b/app/gui/oven_control/programmingautoconfigwindow.ui @@ -0,0 +1,1455 @@ + + + ProgrammingAutoConfigWindow + + + + 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; +} + + + + + true + + + + 700 + 1130 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 720 + 480 + 152 + 70 + + + + QPushButton { +border-image: url(:/images/button/152.png); +} +QPushButton::pressed { +border-image: url(:/images/button/152_ov.png); +} + + + + + + + :/images/auto_button/btn_icon_01.png:/images/auto_button/btn_icon_01.png + + + + 40 + 51 + + + + + + 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 + 1130 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|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 + + + + + true + + + + 700 + 1300 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 185 + 663 + 666 + 33 + + + + 100 + + + 1 + + + 39 + + + true + + + Qt::Horizontal + + + QSlider::TicksBelow + + + 1 + + + + + true + + + + 185 + 1300 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 420 + 480 + 288 + 70 + + + + + Roboto + 10 + 75 + true + + + + QPushButton { +border-image: url(:/images/button/288.png); +} +QPushButton::pressed { +border-image: url(:/images/button/288_ov.png); +} + + + + + + + + + 0 + 0 + 900 + 426 + + + + + #clockContainer { background-image: url(:/images/clock/background.png); } + + + + + 272 + 36 + 356 + 355 + + + + + + + 800 + 320 + 80 + 84 + + + + + + + + + + 185 + 823 + 666 + 33 + + + + 100 + + + 1 + + + 10 + + + true + + + Qt::Horizontal + + + + + + 0 + 430 + 250 + 150 + + + + + + + :/images/images/auto/005_auto_icon_01_ov.png + + + Qt::AlignCenter + + + + + + 27 + 935 + 140 + 140 + + + + + + + icon + + + + + + 185 + 1173 + 666 + 33 + + + + 100 + + + 1 + + + 0 + + + true + + + Qt::Horizontal + + + + + true + + + + 185 + 780 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 27 + 765 + 140 + 140 + + + + + + + icon + + + + + + 185 + 993 + 666 + 33 + + + + 100 + + + 1 + + + 0 + + + true + + + Qt::Horizontal + + + + + true + + + + 199 + 1200 + 641 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Roboto + 16 + 75 + true + + + + 스팀 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + 0 + 1450 + 900 + 150 + + + + + + 232 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/back.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); } + + + + + + + + + 458 + 26 + 97 + 97 + + + + + 0 + 0 + + + + + 62 + 71 + + + + QPushButton { border-image: url(:/images/bottom_bar/help.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/help_ov.png); } + + + + + + + + + 571 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/006_sys_icon_16.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/006_sys_icon_16_ov.png); } + + + + + + + + + 345 + 26 + 97 + 97 + + + + + 0 + 0 + + + + + 62 + 71 + + + + QPushButton { border-image: url(:/images/bottom_bar/config.png); } +QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/config_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 + + + + + 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 + + + + 185 + 950 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 감소 + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + 27 + 1285 + 140 + 140 + + + + + + + icon + + + + + + 185 + 1343 + 666 + 33 + + + + 100 + + + 1 + + + 0 + + + true + + + Qt::Horizontal + + + + + true + + + + 700 + 950 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + 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 + + + + + + 27 + 605 + 140 + 140 + + + + + + + icon + + + + + + 27 + 1115 + 140 + 140 + + + + + + + icon + + + + + true + + + + 700 + 780 + 151 + 51 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 255 + 255 + 255 + + + + + + + + + 123 + 123 + 123 + + + + + + + + + Malgun Gothic + 9 + + + + 증가 + + + Qt::AlignRight|Qt::AlignTrailing|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 + + + + + + + Clock + QWidget +
clock.h
+ 1 +
+ + WashWarnIcon + QLabel +
washwarnicon.h
+
+
+ + + + +
diff --git a/app/gui/oven_control/programmingautoselectionwindow.cpp b/app/gui/oven_control/programmingautoselectionwindow.cpp new file mode 100644 index 0000000..80337eb --- /dev/null +++ b/app/gui/oven_control/programmingautoselectionwindow.cpp @@ -0,0 +1,94 @@ +#include "programmingautoselectionwindow.h" +#include "ui_programmingautoselectionwindow.h" + +#include + +#include "soundplayer.h" +#include "programmingautoconfigwindow.h" + +ProgrammingAutoSelectionWindow::ProgrammingAutoSelectionWindow(QWidget *parent, Define::CookType type) : + QMainWindow(parent), + ui(new Ui::ProgrammingAutoSelectionWindow), + type(type) +{ + ui->setupUi(this); + + ui->clockContainer->setParent(ui->upperStack); + setAttribute(Qt::WA_DeleteOnClose); + + ui->cookTypeIcon->setPixmap(Define::icon(type)); + + book = CookBook(type); + + QSignalMapper *sm = new QSignalMapper(this); + connect(sm, SIGNAL(mapped(int)), SLOT(onCookSelected(int))); + + QFont font; + font.setFamily(QStringLiteral("Roboto")); + font.setPointSize(10);; + font.setBold(true); + font.setWeight(75); + + QLatin1String stylesheet("\ +QPushButton {\ + border-image: url(:/images/button/288.png);\ +}\ +QPushButton:pressed {\ + border-image: url(:/images/button/288_ov.png);\ +}"); + + for (int idx = 0; idx < book.list.size(); idx++) + { + int x = 12 + (idx % 3) * 294; + int y = 615 + (idx / 3) * 80; + + QPushButton *pb = new QPushButton(this); + pb->setGeometry(QRect(x, y, 288, 70)); + pb->setFont(font); + pb->setStyleSheet(stylesheet); + pb->setText(book.list.at(idx)); + + sm->setMapping(pb, idx); + connect(pb, SIGNAL(clicked()), sm, SLOT(map())); + } + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); +} + +ProgrammingAutoSelectionWindow::~ProgrammingAutoSelectionWindow() +{ + delete ui; +} + +void ProgrammingAutoSelectionWindow::onCookSelected(int idx) +{ + ProgrammingAutoConfigWindow *w = new ProgrammingAutoConfigWindow(this, book.get(idx)); + connect(w, SIGNAL(added()), SIGNAL(added())); + connect(w, SIGNAL(added()), SLOT(hide())); + connect(w, SIGNAL(added()), SLOT(close())); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); +} + +void ProgrammingAutoSelectionWindow::on_backButton_clicked() +{ + close(); +} + +void ProgrammingAutoSelectionWindow::on_configButton_clicked() +{ + +} + +void ProgrammingAutoSelectionWindow::on_helpButton_clicked() +{ + +} + +void ProgrammingAutoSelectionWindow::on_okButton_clicked() +{ + emit added(); + close(); +} diff --git a/app/gui/oven_control/programmingautoselectionwindow.h b/app/gui/oven_control/programmingautoselectionwindow.h new file mode 100644 index 0000000..f5fd090 --- /dev/null +++ b/app/gui/oven_control/programmingautoselectionwindow.h @@ -0,0 +1,40 @@ +#ifndef PROGRAMMINGAUTOSELECTIONWINDOW_H +#define PROGRAMMINGAUTOSELECTIONWINDOW_H + +#include + +#include "cookbook.h" + +namespace Ui { +class ProgrammingAutoSelectionWindow; +} + +class ProgrammingAutoSelectionWindow : public QMainWindow +{ + Q_OBJECT + +public: + explicit ProgrammingAutoSelectionWindow(QWidget *parent, Define::CookType type); + ~ProgrammingAutoSelectionWindow(); + +private: + Ui::ProgrammingAutoSelectionWindow *ui; + Define::CookType type; + CookBook book; + +private slots: + void onCookSelected(int idx); + + void on_backButton_clicked(); + + void on_configButton_clicked(); + + void on_helpButton_clicked(); + + void on_okButton_clicked(); + +signals: + void added(); +}; + +#endif // PROGRAMMINGAUTOSELECTIONWINDOW_H diff --git a/app/gui/oven_control/programmingautoselectionwindow.ui b/app/gui/oven_control/programmingautoselectionwindow.ui new file mode 100644 index 0000000..acda156 --- /dev/null +++ b/app/gui/oven_control/programmingautoselectionwindow.ui @@ -0,0 +1,177 @@ + + + ProgrammingAutoSelectionWindow + + + + 0 + 0 + 900 + 1600 + + + + MainWindow + + + #centralwidget { background-image: url(:/images/background/auto.png); } +#bottomBar { background-image: url(:/images/bottom_bar/background.png); } + + + + + + 0 + 1450 + 900 + 150 + + + + + + 232 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/back.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); } + + + + + + 345 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/config.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/config_ov.png); } + + + + + + 458 + 26 + 97 + 97 + + + + + 0 + 0 + + + + QPushButton { border-image: url(:/images/bottom_bar/help.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/help_ov.png); } + + + + + + 571 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/006_sys_icon_16.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/006_sys_icon_16_ov.png); } + + + + + + + 0 + 0 + 900 + 426 + + + + + #clockContainer { background-image: url(:/images/clock/background.png); } + + + + + 272 + 36 + 356 + 355 + + + + + + + 800 + 320 + 80 + 84 + + + + + + + + + + 0 + 430 + 900 + 150 + + + + + + + :/images/images/auto/005_auto_icon_01_ov.png + + + Qt::AlignCenter + + + + + + + Clock + QWidget +
clock.h
+ 1 +
+ + WashWarnIcon + QLabel +
washwarnicon.h
+
+
+ + +
diff --git a/app/gui/oven_control/programmingmanualcoretemppopup.cpp b/app/gui/oven_control/programmingmanualcoretemppopup.cpp index da03bba..de806b1 100644 --- a/app/gui/oven_control/programmingmanualcoretemppopup.cpp +++ b/app/gui/oven_control/programmingmanualcoretemppopup.cpp @@ -2,6 +2,7 @@ #include "ui_programmingmanualcoretemppopup.h" #include "stringer.h" +#include "soundplayer.h" ProgrammingManualCoreTempPopup::ProgrammingManualCoreTempPopup(QWidget *parent) : QWidget(parent), @@ -14,6 +15,9 @@ ProgrammingManualCoreTempPopup::ProgrammingManualCoreTempPopup(QWidget *parent) connect(ui->coreTempSlider, SIGNAL(valueChanged(int)), SLOT(updateCoreTempLabel())); updateCoreTempLabel(); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); } ProgrammingManualCoreTempPopup::~ProgrammingManualCoreTempPopup() diff --git a/app/gui/oven_control/programmingmanualwindow.cpp b/app/gui/oven_control/programmingmanualwindow.cpp index 8e8a112..448317e 100644 --- a/app/gui/oven_control/programmingmanualwindow.cpp +++ b/app/gui/oven_control/programmingmanualwindow.cpp @@ -4,6 +4,7 @@ #include "stringer.h" #include "programmingmanualcoretemppopup.h" #include "cookprogram.h" +#include "soundplayer.h" ProgrammingManualWindow::ProgrammingManualWindow(QWidget *parent, Define::Mode mode) : QMainWindow(parent), @@ -20,6 +21,9 @@ ProgrammingManualWindow::ProgrammingManualWindow(QWidget *parent, Define::Mode m connect(ui->interTempSlider, SIGNAL(valueChanged(int)), SLOT(updateCoreTempLabel())); setDefault(mode); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); } ProgrammingManualWindow::~ProgrammingManualWindow() diff --git a/app/gui/oven_control/programmingnamepopup.cpp b/app/gui/oven_control/programmingnamepopup.cpp new file mode 100644 index 0000000..681b8d7 --- /dev/null +++ b/app/gui/oven_control/programmingnamepopup.cpp @@ -0,0 +1,14 @@ +#include "programmingnamepopup.h" +#include "ui_programmingnamepopup.h" + +ProgrammingNamePopup::ProgrammingNamePopup(QWidget *parent) : + QWidget(parent), + ui(new Ui::ProgrammingNamePopup) +{ + ui->setupUi(this); +} + +ProgrammingNamePopup::~ProgrammingNamePopup() +{ + delete ui; +} diff --git a/app/gui/oven_control/programmingnamepopup.h b/app/gui/oven_control/programmingnamepopup.h new file mode 100644 index 0000000..c1d50c4 --- /dev/null +++ b/app/gui/oven_control/programmingnamepopup.h @@ -0,0 +1,22 @@ +#ifndef PROGRAMMINGNAMEPOPUP_H +#define PROGRAMMINGNAMEPOPUP_H + +#include + +namespace Ui { +class ProgrammingNamePopup; +} + +class ProgrammingNamePopup : public QWidget +{ + Q_OBJECT + +public: + explicit ProgrammingNamePopup(QWidget *parent = 0); + ~ProgrammingNamePopup(); + +private: + Ui::ProgrammingNamePopup *ui; +}; + +#endif // PROGRAMMINGNAMEPOPUP_H diff --git a/app/gui/oven_control/programmingnamepopup.ui b/app/gui/oven_control/programmingnamepopup.ui new file mode 100644 index 0000000..6f8489e --- /dev/null +++ b/app/gui/oven_control/programmingnamepopup.ui @@ -0,0 +1,21 @@ + + + + + ProgrammingNamePopup + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + diff --git a/app/gui/oven_control/programmingselectionwindow.cpp b/app/gui/oven_control/programmingselectionwindow.cpp index cdb006c..a8efcb0 100644 --- a/app/gui/oven_control/programmingselectionwindow.cpp +++ b/app/gui/oven_control/programmingselectionwindow.cpp @@ -2,6 +2,8 @@ #include "ui_programmingselectionwindow.h" #include "programmingmanualwindow.h" +#include "programmingautoselectionwindow.h" +#include "soundplayer.h" ProgrammingSelectionWindow::ProgrammingSelectionWindow(QWidget *parent) : QMainWindow(parent), @@ -13,6 +15,9 @@ ProgrammingSelectionWindow::ProgrammingSelectionWindow(QWidget *parent) : setAttribute(Qt::WA_DeleteOnClose); setFocus(); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); } ProgrammingSelectionWindow::~ProgrammingSelectionWindow() @@ -42,18 +47,22 @@ void ProgrammingSelectionWindow::onModeClicked(Define::Mode mode) { ProgrammingManualWindow *w = new ProgrammingManualWindow(this, mode); connect(w, SIGNAL(added()), SIGNAL(added())); - connect(w, SIGNAL(destroyed(QObject*)), SLOT(deleteLater())); + connect(w, SIGNAL(added()), SLOT(hide())); + connect(w, SIGNAL(added()), SLOT(close())); w->setWindowModality(Qt::WindowModal); w->showFullScreen(); w->raise(); - - hide(); } void ProgrammingSelectionWindow::onCookTypeClicked(Define::CookType type) { - emit cookTypeSelected(type); - close(); + ProgrammingAutoSelectionWindow *w = new ProgrammingAutoSelectionWindow(this, type); + connect(w, SIGNAL(added()), SIGNAL(added())); + connect(w, SIGNAL(added()), SLOT(hide())); + connect(w, SIGNAL(added()), SLOT(close())); + w->setWindowModality(Qt::WindowModal); + w->showFullScreen(); + w->raise(); } void ProgrammingSelectionWindow::on_steamButton_clicked() @@ -105,3 +114,23 @@ void ProgrammingSelectionWindow::on_etcButton_clicked() { onCookTypeClicked(Define::Etc); } + +void ProgrammingSelectionWindow::on_backButton_clicked() +{ + close(); +} + +void ProgrammingSelectionWindow::on_configButton_clicked() +{ + +} + +void ProgrammingSelectionWindow::on_helpButton_clicked() +{ + +} + +void ProgrammingSelectionWindow::on_okButton_clicked() +{ + close(); +} diff --git a/app/gui/oven_control/programmingselectionwindow.h b/app/gui/oven_control/programmingselectionwindow.h index 23149f8..6f280f3 100644 --- a/app/gui/oven_control/programmingselectionwindow.h +++ b/app/gui/oven_control/programmingselectionwindow.h @@ -25,8 +25,6 @@ private: signals: void added(); - void modeSelected(Define::Mode); - void cookTypeSelected(Define::CookType); private slots: void onModeClicked(Define::Mode mode); @@ -42,6 +40,10 @@ private slots: void on_grainButton_clicked(); void on_breadButton_clicked(); void on_etcButton_clicked(); + void on_backButton_clicked(); + void on_configButton_clicked(); + void on_helpButton_clicked(); + void on_okButton_clicked(); }; #endif // PROGRAMMINGSELECTIONWINDOW_H diff --git a/app/gui/oven_control/programmingselectionwindow.ui b/app/gui/oven_control/programmingselectionwindow.ui index 01eae84..245a7a8 100644 --- a/app/gui/oven_control/programmingselectionwindow.ui +++ b/app/gui/oven_control/programmingselectionwindow.ui @@ -315,6 +315,40 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/h + + + + 232 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/back.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/back_ov.png); } + + + + + + + + + 571 + 26 + 97 + 97 + + + + QPushButton { border-image: url(:/images/bottom_bar/006_sys_icon_16.png); } +QPushButton:pressed { border-image: url(:/images/bottom_bar/006_sys_icon_16_ov.png); } + + + + + diff --git a/app/gui/oven_control/programmingwindow.cpp b/app/gui/oven_control/programmingwindow.cpp index 6ef92c3..34b371b 100644 --- a/app/gui/oven_control/programmingwindow.cpp +++ b/app/gui/oven_control/programmingwindow.cpp @@ -7,6 +7,9 @@ #include "programmingmanualwindow.h" #include "programmingselectionwindow.h" #include "cookprogram.h" +#include "soundplayer.h" +#include "confirmpopup.h" +#include "programmingnamepopup.h" ProgrammingWindow::ProgrammingWindow(QWidget *parent) : QMainWindow(parent), @@ -18,6 +21,9 @@ ProgrammingWindow::ProgrammingWindow(QWidget *parent) : setAttribute(Qt::WA_DeleteOnClose); setupUi(); + + foreach (QPushButton *button, findChildren()) + connect(button, &QPushButton::pressed, SoundPlayer::playClick); } ProgrammingWindow::~ProgrammingWindow() @@ -109,6 +115,9 @@ CookPanelButton *ProgrammingWindow::newButton(CookRecord record) CookPanelButton *button = new CookPanelButton(record, this); connect(button, SIGNAL(infoClicked(CookPanelButton*)), SLOT(onInfoButtonClicked(CookPanelButton*))); connect(button, SIGNAL(deleteClicked(CookPanelButton*)), SLOT(onDeleteButtonClicked(CookPanelButton*))); + connect(button, SIGNAL(longPressed(CookPanelButton*)), SLOT(onLongPressed(CookPanelButton*))); + + button->setLongPressEnabled(true); ui->verticalScrollLayout->addWidget(button); list.append(button); @@ -116,6 +125,17 @@ CookPanelButton *ProgrammingWindow::newButton(CookRecord record) return button; } +void ProgrammingWindow::back() +{ + CookProgram::discard(); + close(); +} + +void ProgrammingWindow::save() +{ + CookProgram::save(); +} + void ProgrammingWindow::onInfoButtonClicked(CookPanelButton *panelButton) { if (lastInfoDisplayed) @@ -158,6 +178,13 @@ void ProgrammingWindow::onDeleteButtonClicked(CookPanelButton *panelButton) panelButton->deleteLater(); } +void ProgrammingWindow::onLongPressed(CookPanelButton *panelButton) +{ + ProgrammingNamePopup *p = new ProgrammingNamePopup(this, panelButton->record); + connect(p, SIGNAL(changed()), SLOT(updateView())); + p->showFullScreen(); +} + void ProgrammingWindow::on_addButton_clicked() { ProgrammingSelectionWindow *w = new ProgrammingSelectionWindow(this); @@ -192,16 +219,21 @@ void ProgrammingWindow::on_manualButton_toggled(bool checked) void ProgrammingWindow::on_backButton_clicked() { - CookProgram::discard(); - - close(); + if (CookProgram::isModified()) + { + ConfirmPopup *p = new ConfirmPopup(this, "저장하지 않고 돌아가시겠습니까?"); + connect(p, SIGNAL(accepted()), SLOT(back())); + p->showFullScreen(); + } + else + close(); } void ProgrammingWindow::on_saveButton_clicked() { - CookProgram::save(); - - close(); + ConfirmPopup *p = new ConfirmPopup(this, "저장하시겠습니까?"); + connect(p, SIGNAL(accepted()), SLOT(save())); + p->showFullScreen(); } void ProgrammingWindow::on_helpButton_clicked() diff --git a/app/gui/oven_control/programmingwindow.h b/app/gui/oven_control/programmingwindow.h index b558749..bd5f989 100644 --- a/app/gui/oven_control/programmingwindow.h +++ b/app/gui/oven_control/programmingwindow.h @@ -28,8 +28,12 @@ private slots: void clear(); CookPanelButton *newButton(CookRecord record); + void back(); + void save(); + void onInfoButtonClicked(CookPanelButton *panelButton); void onDeleteButtonClicked(CookPanelButton *panelButton); + void onLongPressed(CookPanelButton *panelButton); void on_addButton_clicked(); diff --git a/app/gui/oven_control/programmingwindow.ui b/app/gui/oven_control/programmingwindow.ui index 3f0d6a0..e8c37c4 100644 --- a/app/gui/oven_control/programmingwindow.ui +++ b/app/gui/oven_control/programmingwindow.ui @@ -23,7 +23,6 @@ QPushButton { background-repeat: no-repeat; background-position: center; border: none; -color: white; } QPushButton[style="mode"] { background-clip: border; @@ -34,6 +33,7 @@ border-top: 130px; border-bottom: -50px; border-style: hidden; font-size: 30px; +color: white; } QPushButton[style="mode"]:checked { -- 2.1.4