Commit 097e5e14a0305b3201feafe4c1e372360c4637d9
1 parent
68c06e96f1
Exists in
master
and in
2 other branches
프로그래밍 모드 세부 사항 구현
- 선택한 요리가 끝나면 다음 요리 시작
Showing
13 changed files
with
429 additions
and
29 deletions
Show diff stats
app/gui/oven_control/autocookwindow.cpp
| @@ -644,7 +644,10 @@ void AutoCookWindow::checkCook() | @@ -644,7 +644,10 @@ void AutoCookWindow::checkCook() | ||
| 644 | selectedStepIndex = autocook.currentStepIndex; | 644 | selectedStepIndex = autocook.currentStepIndex; |
| 645 | 645 | ||
| 646 | if (autocook.done()) | 646 | if (autocook.done()) |
| 647 | + { | ||
| 647 | checkCookTimer.stop(); | 648 | checkCookTimer.stop(); |
| 649 | + emit done(); | ||
| 650 | + } | ||
| 648 | } | 651 | } |
| 649 | 652 | ||
| 650 | updateView(); | 653 | updateView(); |
app/gui/oven_control/autocookwindow.h
| @@ -122,6 +122,7 @@ private slots: | @@ -122,6 +122,7 @@ private slots: | ||
| 122 | signals: | 122 | signals: |
| 123 | void back(); | 123 | void back(); |
| 124 | void newWindow(AutoCookWindow *); | 124 | void newWindow(AutoCookWindow *); |
| 125 | + void done(); | ||
| 125 | }; | 126 | }; |
| 126 | 127 | ||
| 127 | #endif // AUTOCOOKWINDOW_H | 128 | #endif // AUTOCOOKWINDOW_H |
app/gui/oven_control/cookhistory.cpp
| @@ -1294,7 +1294,7 @@ QPixmap CookHistory::render(CookRecord record) | @@ -1294,7 +1294,7 @@ QPixmap CookHistory::render(CookRecord record) | ||
| 1294 | return QPixmap(); | 1294 | return QPixmap(); |
| 1295 | } | 1295 | } |
| 1296 | 1296 | ||
| 1297 | -void CookHistory::start(CookRecord record, QWidget *parent) | 1297 | +QMainWindow *CookHistory::start(CookRecord record, QWidget *parent) |
| 1298 | { | 1298 | { |
| 1299 | if (record.type == CookRecord::Manual) | 1299 | if (record.type == CookRecord::Manual) |
| 1300 | { | 1300 | { |
| @@ -1302,6 +1302,8 @@ void CookHistory::start(CookRecord record, QWidget *parent) | @@ -1302,6 +1302,8 @@ void CookHistory::start(CookRecord record, QWidget *parent) | ||
| 1302 | w->setWindowModality(Qt::WindowModal); | 1302 | w->setWindowModality(Qt::WindowModal); |
| 1303 | w->showFullScreen(); | 1303 | w->showFullScreen(); |
| 1304 | w->raise(); | 1304 | w->raise(); |
| 1305 | + | ||
| 1306 | + return w; | ||
| 1305 | } | 1307 | } |
| 1306 | else if (record.type == CookRecord::Auto) | 1308 | else if (record.type == CookRecord::Auto) |
| 1307 | { | 1309 | { |
| @@ -1317,7 +1319,11 @@ void CookHistory::start(CookRecord record, QWidget *parent) | @@ -1317,7 +1319,11 @@ void CookHistory::start(CookRecord record, QWidget *parent) | ||
| 1317 | w->setWindowModality(Qt::WindowModal); | 1319 | w->setWindowModality(Qt::WindowModal); |
| 1318 | w->showFullScreen(); | 1320 | w->showFullScreen(); |
| 1319 | w->raise(); | 1321 | w->raise(); |
| 1322 | + | ||
| 1323 | + return w; | ||
| 1320 | } | 1324 | } |
| 1325 | + | ||
| 1326 | + return NULL; | ||
| 1321 | } | 1327 | } |
| 1322 | 1328 | ||
| 1323 | void CookHistory::removeMostCooked(CookRecord record) | 1329 | void CookHistory::removeMostCooked(CookRecord record) |
app/gui/oven_control/cookhistory.h
| @@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
| 3 | 3 | ||
| 4 | 4 | ||
| 5 | #include <QList> | 5 | #include <QList> |
| 6 | +#include <QMainWindow> | ||
| 6 | 7 | ||
| 7 | #include "cook.h" | 8 | #include "cook.h" |
| 8 | 9 | ||
| @@ -62,7 +63,7 @@ QList<CookRecord> listRecents(); | @@ -62,7 +63,7 @@ QList<CookRecord> listRecents(); | ||
| 62 | QList<CookRecord> listFavorites(); | 63 | QList<CookRecord> listFavorites(); |
| 63 | 64 | ||
| 64 | QPixmap render(CookRecord record); | 65 | QPixmap render(CookRecord record); |
| 65 | -void start(CookRecord record, QWidget *parent = 0); | 66 | +QMainWindow *start(CookRecord record, QWidget *parent = 0); |
| 66 | } | 67 | } |
| 67 | 68 | ||
| 68 | #endif // COOKHISTORY_H | 69 | #endif // COOKHISTORY_H |
app/gui/oven_control/cookpanelbutton.cpp
| @@ -5,13 +5,16 @@ | @@ -5,13 +5,16 @@ | ||
| 5 | 5 | ||
| 6 | #include "soundplayer.h" | 6 | #include "soundplayer.h" |
| 7 | #include "manualcooksettingwidget.h" | 7 | #include "manualcooksettingwidget.h" |
| 8 | +#include "autocookwindow.h" | ||
| 9 | +#include "manualcookwindow.h" | ||
| 8 | 10 | ||
| 9 | CookPanelButton::CookPanelButton(CookRecord record, QWidget *parent) : | 11 | CookPanelButton::CookPanelButton(CookRecord record, QWidget *parent) : |
| 10 | QWidget(parent), | 12 | QWidget(parent), |
| 11 | record(record), | 13 | record(record), |
| 12 | ui(new Ui::CookPanelButton), | 14 | ui(new Ui::CookPanelButton), |
| 13 | rendered(false), | 15 | rendered(false), |
| 14 | - longPressEnabled(false) | 16 | + longPressEnabled(false), |
| 17 | + emitted(false) | ||
| 15 | { | 18 | { |
| 16 | ui->setupUi(this); | 19 | ui->setupUi(this); |
| 17 | 20 | ||
| @@ -155,7 +158,24 @@ void CookPanelButton::on_pushButton_clicked() | @@ -155,7 +158,24 @@ void CookPanelButton::on_pushButton_clicked() | ||
| 155 | if (longPressEnabled && emitted) | 158 | if (longPressEnabled && emitted) |
| 156 | return; | 159 | return; |
| 157 | 160 | ||
| 158 | - CookHistory::start(record, parentWidget()); | 161 | + QMainWindow *w = CookHistory::start(record, parentWidget()); |
| 162 | + | ||
| 163 | + if (next == NULL) | ||
| 164 | + return; | ||
| 165 | + | ||
| 166 | + AutoCookWindow *a = qobject_cast<AutoCookWindow *>(w); | ||
| 167 | + if (a) | ||
| 168 | + { | ||
| 169 | + connect(a, SIGNAL(done()), next, SLOT(on_pushButton_clicked())); | ||
| 170 | + connect(a, SIGNAL(done()), a, SLOT(deleteLater())); | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + ManualCookWindow *m = qobject_cast<ManualCookWindow *>(w); | ||
| 174 | + if (m) | ||
| 175 | + { | ||
| 176 | + connect(m, SIGNAL(done()), next, SLOT(on_pushButton_clicked())); | ||
| 177 | + connect(m, SIGNAL(done()), m, SLOT(deleteLater())); | ||
| 178 | + } | ||
| 159 | } | 179 | } |
| 160 | 180 | ||
| 161 | void CookPanelButton::on_deleteButton_clicked() | 181 | void CookPanelButton::on_deleteButton_clicked() |
app/gui/oven_control/cookpanelbutton.h
| @@ -43,6 +43,7 @@ public: | @@ -43,6 +43,7 @@ public: | ||
| 43 | QPushButton *deleteButton(); | 43 | QPushButton *deleteButton(); |
| 44 | 44 | ||
| 45 | CookRecord record; | 45 | CookRecord record; |
| 46 | + CookPanelButton *next = NULL; | ||
| 46 | 47 | ||
| 47 | public slots: | 48 | public slots: |
| 48 | void setEnabled(bool enabled = true); | 49 | void setEnabled(bool enabled = true); |
app/gui/oven_control/manualcookwindow.cpp
| @@ -82,6 +82,7 @@ ManualCookWindow::ManualCookWindow(QWidget *parent, Define::Mode mode) : | @@ -82,6 +82,7 @@ ManualCookWindow::ManualCookWindow(QWidget *parent, Define::Mode mode) : | ||
| 82 | lastViewDamper = false; | 82 | lastViewDamper = false; |
| 83 | lastViewHumidification = false; | 83 | lastViewHumidification = false; |
| 84 | lastViewFan = -1; | 84 | lastViewFan = -1; |
| 85 | + lastCheckedCooking = false; | ||
| 85 | 86 | ||
| 86 | Config *config = Config::getInstance(); | 87 | Config *config = Config::getInstance(); |
| 87 | config_item item = config->getConfigValue(Define::config_cooking_door_monitoring); | 88 | config_item item = config->getConfigValue(Define::config_cooking_door_monitoring); |
| @@ -421,31 +422,9 @@ void ManualCookWindow::updateView() | @@ -421,31 +422,9 @@ void ManualCookWindow::updateView() | ||
| 421 | 422 | ||
| 422 | bool damper = oven->damper(); | 423 | bool damper = oven->damper(); |
| 423 | ui->damperButton->setChecked(damper); | 424 | ui->damperButton->setChecked(damper); |
| 424 | -// if (damper != lastViewDamper) | ||
| 425 | -// { | ||
| 426 | -// lastViewDamper = damper; | ||
| 427 | - | ||
| 428 | -// if (damper) | ||
| 429 | -// ui->damperButton->setStyleSheet( | ||
| 430 | -// "background-image: url(:/images/manual_button/damper_open.png)"); | ||
| 431 | -// else | ||
| 432 | -// ui->damperButton->setStyleSheet( | ||
| 433 | -// "background-image: url(:/images/manual_button/damper_close.png)"); | ||
| 434 | -// } | ||
| 435 | 425 | ||
| 436 | bool humidification = oven->humidification(); | 426 | bool humidification = oven->humidification(); |
| 437 | ui->humidificationButton->setChecked(humidification); | 427 | ui->humidificationButton->setChecked(humidification); |
| 438 | -// if (humidification != lastViewHumidification) | ||
| 439 | -// { | ||
| 440 | -// lastViewHumidification = humidification; | ||
| 441 | - | ||
| 442 | -// if (humidification) | ||
| 443 | -// ui->humidificationButton->setStyleSheet( | ||
| 444 | -// "background-image: url(:/images/manual_button/side_nozzle_open.png)"); | ||
| 445 | -// else | ||
| 446 | -// ui->humidificationButton->setStyleSheet( | ||
| 447 | -// "background-image: url(:/images/manual_button/side_nozzle_close.png)"); | ||
| 448 | -// } | ||
| 449 | 428 | ||
| 450 | int fan = oven->fan(); | 429 | int fan = oven->fan(); |
| 451 | if (fan != lastViewFan) | 430 | if (fan != lastViewFan) |
| @@ -533,6 +512,16 @@ QPushButton:pressed { background-image: url(:/images/manual_button/repeat_ov.png | @@ -533,6 +512,16 @@ QPushButton:pressed { background-image: url(:/images/manual_button/repeat_ov.png | ||
| 533 | oven->setInterTempEnabled(repeatSetting.coreTempEnabled); | 512 | oven->setInterTempEnabled(repeatSetting.coreTempEnabled); |
| 534 | oven->setInterTemp(repeatSetting.coreTemp); | 513 | oven->setInterTemp(repeatSetting.coreTemp); |
| 535 | } | 514 | } |
| 515 | + else if (lastCheckedCooking && !oven->cooking()){ | ||
| 516 | + if ((oven->interTempEnabled() && oven->currentInterTemp() >= oven->interTemp()) | ||
| 517 | + || oven->time() == 0) | ||
| 518 | + { | ||
| 519 | + lastCheckedCooking = oven->cooking(); | ||
| 520 | + emit done(); | ||
| 521 | + } | ||
| 522 | + } | ||
| 523 | + | ||
| 524 | + lastCheckedCooking = oven->cooking(); | ||
| 536 | 525 | ||
| 537 | if (oven->paused() && oven->door()) | 526 | if (oven->paused() && oven->door()) |
| 538 | { | 527 | { |
app/gui/oven_control/manualcookwindow.h
| @@ -27,6 +27,7 @@ protected: | @@ -27,6 +27,7 @@ protected: | ||
| 27 | 27 | ||
| 28 | signals: | 28 | signals: |
| 29 | void cookStopRequested(); | 29 | void cookStopRequested(); |
| 30 | + void done(); | ||
| 30 | 31 | ||
| 31 | public slots: | 32 | public slots: |
| 32 | 33 | ||
| @@ -111,6 +112,7 @@ private: | @@ -111,6 +112,7 @@ private: | ||
| 111 | int temp; | 112 | int temp; |
| 112 | int time; | 113 | int time; |
| 113 | int interTemp; | 114 | int interTemp; |
| 115 | + bool lastCheckedCooking = false; | ||
| 114 | 116 | ||
| 115 | bool showCurrentHumidity_ = false; | 117 | bool showCurrentHumidity_ = false; |
| 116 | bool showCurrentTemp_ = false; | 118 | bool showCurrentTemp_ = false; |
app/gui/oven_control/oven_control.pro
| @@ -121,7 +121,8 @@ SOURCES += main.cpp\ | @@ -121,7 +121,8 @@ SOURCES += main.cpp\ | ||
| 121 | slider.cpp \ | 121 | slider.cpp \ |
| 122 | autocookselectionpopup.cpp \ | 122 | autocookselectionpopup.cpp \ |
| 123 | autocookcheckwindow.cpp \ | 123 | autocookcheckwindow.cpp \ |
| 124 | - autocookcheckconfigwindow.cpp | 124 | + autocookcheckconfigwindow.cpp \ |
| 125 | + programmedcookpanelbutton.cpp | ||
| 125 | 126 | ||
| 126 | HEADERS += mainwindow.h \ | 127 | HEADERS += mainwindow.h \ |
| 127 | cook.h \ | 128 | cook.h \ |
| @@ -232,7 +233,8 @@ HEADERS += mainwindow.h \ | @@ -232,7 +233,8 @@ HEADERS += mainwindow.h \ | ||
| 232 | slider.h \ | 233 | slider.h \ |
| 233 | autocookselectionpopup.h \ | 234 | autocookselectionpopup.h \ |
| 234 | autocookcheckwindow.h \ | 235 | autocookcheckwindow.h \ |
| 235 | - autocookcheckconfigwindow.h | 236 | + autocookcheckconfigwindow.h \ |
| 237 | + programmedcookpanelbutton.h | ||
| 236 | 238 | ||
| 237 | FORMS += mainwindow.ui \ | 239 | FORMS += mainwindow.ui \ |
| 238 | manualcookwindow.ui \ | 240 | manualcookwindow.ui \ |
| @@ -309,7 +311,8 @@ FORMS += mainwindow.ui \ | @@ -309,7 +311,8 @@ FORMS += mainwindow.ui \ | ||
| 309 | config1digitsetandenablesetdlg.ui \ | 311 | config1digitsetandenablesetdlg.ui \ |
| 310 | autocookselectionpopup.ui \ | 312 | autocookselectionpopup.ui \ |
| 311 | autocookcheckwindow.ui \ | 313 | autocookcheckwindow.ui \ |
| 312 | - autocookcheckconfigwindow.ui | 314 | + autocookcheckconfigwindow.ui \ |
| 315 | + programmedcookpanelbutton.ui | ||
| 313 | 316 | ||
| 314 | RESOURCES += \ | 317 | RESOURCES += \ |
| 315 | resources.qrc | 318 | resources.qrc |
app/gui/oven_control/programmedcookpanelbutton.cpp
| @@ -0,0 +1,175 @@ | @@ -0,0 +1,175 @@ | ||
| 1 | +#include "programmedcookpanelbutton.h" | ||
| 2 | +#include "ui_programmedcookpanelbutton.h" | ||
| 3 | + | ||
| 4 | +#include <QKeyEvent> | ||
| 5 | + | ||
| 6 | +#include "soundplayer.h" | ||
| 7 | + | ||
| 8 | +ProgrammedCookPanelButton::ProgrammedCookPanelButton(CookRecord record, QWidget *parent) : | ||
| 9 | + QWidget(parent), | ||
| 10 | + record(record), | ||
| 11 | + ui(new Ui::ProgrammedCookPanelButton), | ||
| 12 | + rendered(false), | ||
| 13 | + longPressEnabled(false) | ||
| 14 | +{ | ||
| 15 | + ui->setupUi(this); | ||
| 16 | + | ||
| 17 | + setText(record.name); | ||
| 18 | + | ||
| 19 | + foreach (QPushButton *button, findChildren<QPushButton *>()) | ||
| 20 | + connect(button, &QPushButton::pressed, SoundPlayer::playClick); | ||
| 21 | + | ||
| 22 | + longPressedTimer.setSingleShot(true); | ||
| 23 | + longPressedTimer.setInterval(3000); | ||
| 24 | + connect(&longPressedTimer, SIGNAL(timeout()), SLOT(emitLongPressed())); | ||
| 25 | +} | ||
| 26 | + | ||
| 27 | +ProgrammedCookPanelButton::~ProgrammedCookPanelButton() | ||
| 28 | +{ | ||
| 29 | + delete ui; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +void ProgrammedCookPanelButton::setText(QString text) | ||
| 33 | +{ | ||
| 34 | + ui->pushButton->setText(text); | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +void ProgrammedCookPanelButton::showInfo() | ||
| 38 | +{ | ||
| 39 | + if (!rendered) | ||
| 40 | + { | ||
| 41 | + QPixmap p = CookHistory::render(record); | ||
| 42 | + | ||
| 43 | + label = new QLabel(this); | ||
| 44 | + label->setPixmap(p); | ||
| 45 | + label->setGeometry((width() - p.width()) / 2, 65, p.width(), p.height()); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + label->show(); | ||
| 49 | + setMinimumHeight(ui->pushButton->height() + label->height()); | ||
| 50 | +} | ||
| 51 | + | ||
| 52 | +void ProgrammedCookPanelButton::hideInfo() | ||
| 53 | +{ | ||
| 54 | + label->hide(); | ||
| 55 | + setMinimumHeight(ui->pushButton->height()); | ||
| 56 | +} | ||
| 57 | + | ||
| 58 | +void ProgrammedCookPanelButton::setLongPressEnabled(bool enabled) | ||
| 59 | +{ | ||
| 60 | + longPressEnabled = enabled; | ||
| 61 | +} | ||
| 62 | + | ||
| 63 | +QPushButton *ProgrammedCookPanelButton::bar() | ||
| 64 | +{ | ||
| 65 | + return ui->pushButton; | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +QPushButton *ProgrammedCookPanelButton::infoButton() | ||
| 69 | +{ | ||
| 70 | + return ui->showInfoButton; | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +QPushButton *ProgrammedCookPanelButton::deleteButton() | ||
| 74 | +{ | ||
| 75 | + return ui->deleteButton; | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +void ProgrammedCookPanelButton::setEnabled(bool enabled) | ||
| 79 | +{ | ||
| 80 | + ui->pushButton->setEnabled(enabled); | ||
| 81 | + ui->showInfoButton->setEnabled(enabled); | ||
| 82 | + ui->deleteButton->setEnabled(enabled); | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +void ProgrammedCookPanelButton::keyPressEvent(QKeyEvent *event) | ||
| 86 | +{ | ||
| 87 | + switch (event->key()) | ||
| 88 | + { | ||
| 89 | + case 0x01000030: // Turn left | ||
| 90 | + event->ignore(); | ||
| 91 | + break; | ||
| 92 | + case 0x01000031: // Push | ||
| 93 | + pushed = focusWidget(); | ||
| 94 | + if (pushed == ui->pushButton) | ||
| 95 | + on_pushButton_pressed(); | ||
| 96 | + break; | ||
| 97 | + case 0x01000032: // Turn right | ||
| 98 | + event->ignore(); | ||
| 99 | + break; | ||
| 100 | + } | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +void ProgrammedCookPanelButton::keyReleaseEvent(QKeyEvent *event) | ||
| 104 | +{ | ||
| 105 | + switch (event->key()) | ||
| 106 | + { | ||
| 107 | + case 0x01000030: // Turn left | ||
| 108 | + event->ignore(); | ||
| 109 | + break; | ||
| 110 | + case 0x01000031: // Push | ||
| 111 | + if (pushed == ui->pushButton) | ||
| 112 | + on_pushButton_released(); | ||
| 113 | + | ||
| 114 | + if (focusWidget() == pushed) | ||
| 115 | + onEncoderClicked(pushed); | ||
| 116 | + | ||
| 117 | + pushed = NULL; | ||
| 118 | + break; | ||
| 119 | + case 0x01000032: // Turn right | ||
| 120 | + event->ignore(); | ||
| 121 | + break; | ||
| 122 | + } | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | +void ProgrammedCookPanelButton::onEncoderLeft() | ||
| 126 | +{ | ||
| 127 | + | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +void ProgrammedCookPanelButton::onEncoderRight() | ||
| 131 | +{ | ||
| 132 | + | ||
| 133 | +} | ||
| 134 | + | ||
| 135 | +void ProgrammedCookPanelButton::onEncoderClicked(QWidget *clicked) | ||
| 136 | +{ | ||
| 137 | + QPushButton *b = qobject_cast<QPushButton *>(clicked); | ||
| 138 | + if (b) | ||
| 139 | + b->click(); | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +void ProgrammedCookPanelButton::emitLongPressed() | ||
| 143 | +{ | ||
| 144 | + emitted = true; | ||
| 145 | + emit longPressed(this); | ||
| 146 | +} | ||
| 147 | + | ||
| 148 | +void ProgrammedCookPanelButton::on_pushButton_pressed() | ||
| 149 | +{ | ||
| 150 | + longPressedTimer.start(); | ||
| 151 | + emitted = false; | ||
| 152 | +} | ||
| 153 | + | ||
| 154 | +void ProgrammedCookPanelButton::on_pushButton_released() | ||
| 155 | +{ | ||
| 156 | + longPressedTimer.stop(); | ||
| 157 | +} | ||
| 158 | + | ||
| 159 | +void ProgrammedCookPanelButton::on_pushButton_clicked() | ||
| 160 | +{ | ||
| 161 | + if (longPressEnabled && emitted) | ||
| 162 | + return; | ||
| 163 | + | ||
| 164 | + emit clicked(this); | ||
| 165 | +} | ||
| 166 | + | ||
| 167 | +void ProgrammedCookPanelButton::on_showInfoButton_clicked() | ||
| 168 | +{ | ||
| 169 | + emit infoClicked(this); | ||
| 170 | +} | ||
| 171 | + | ||
| 172 | +void ProgrammedCookPanelButton::on_deleteButton_clicked() | ||
| 173 | +{ | ||
| 174 | + emit deleteClicked(this); | ||
| 175 | +} |
app/gui/oven_control/programmedcookpanelbutton.h
| @@ -0,0 +1,74 @@ | @@ -0,0 +1,74 @@ | ||
| 1 | +#ifndef PROGRAMMEDCOOKPANELBUTTON_H | ||
| 2 | +#define PROGRAMMEDCOOKPANELBUTTON_H | ||
| 3 | + | ||
| 4 | +#include <QWidget> | ||
| 5 | +#include <QLabel> | ||
| 6 | +#include <QButtonGroup> | ||
| 7 | +#include <QTimer> | ||
| 8 | +#include <QPushButton> | ||
| 9 | + | ||
| 10 | +#include "cookhistory.h" | ||
| 11 | + | ||
| 12 | +namespace Ui { | ||
| 13 | +class ProgrammedCookPanelButton; | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +class ProgrammedCookPanelButton : public QWidget | ||
| 17 | +{ | ||
| 18 | + Q_OBJECT | ||
| 19 | + | ||
| 20 | +public: | ||
| 21 | + explicit ProgrammedCookPanelButton(CookRecord record, QWidget *parent = 0); | ||
| 22 | + ~ProgrammedCookPanelButton(); | ||
| 23 | + | ||
| 24 | + void setText(QString text); | ||
| 25 | + void showInfo(); | ||
| 26 | + void hideInfo(); | ||
| 27 | + | ||
| 28 | + void setLongPressEnabled(bool enabled); | ||
| 29 | + | ||
| 30 | + QPushButton *bar(); | ||
| 31 | + QPushButton *infoButton(); | ||
| 32 | + QPushButton *deleteButton(); | ||
| 33 | + | ||
| 34 | + CookRecord record; | ||
| 35 | + | ||
| 36 | +public slots: | ||
| 37 | + void setEnabled(bool enabled = true); | ||
| 38 | + | ||
| 39 | +protected: | ||
| 40 | + void keyPressEvent(QKeyEvent *event); | ||
| 41 | + void keyReleaseEvent(QKeyEvent *event); | ||
| 42 | + | ||
| 43 | +private: | ||
| 44 | + Ui::ProgrammedCookPanelButton *ui; | ||
| 45 | + | ||
| 46 | + QTimer longPressedTimer; | ||
| 47 | + bool rendered; | ||
| 48 | + QLabel *label; | ||
| 49 | + bool emitted; | ||
| 50 | + bool longPressEnabled; | ||
| 51 | + | ||
| 52 | + QWidget *pushed = NULL; | ||
| 53 | + | ||
| 54 | + void onEncoderLeft(); | ||
| 55 | + void onEncoderRight(); | ||
| 56 | + void onEncoderClicked(QWidget *clicked); | ||
| 57 | + | ||
| 58 | +private slots: | ||
| 59 | + void emitLongPressed(); | ||
| 60 | + | ||
| 61 | + void on_pushButton_pressed(); | ||
| 62 | + void on_pushButton_released(); | ||
| 63 | + void on_pushButton_clicked(); | ||
| 64 | + void on_showInfoButton_clicked(); | ||
| 65 | + void on_deleteButton_clicked(); | ||
| 66 | + | ||
| 67 | +signals: | ||
| 68 | + void clicked(ProgrammedCookPanelButton *); | ||
| 69 | + void infoClicked(ProgrammedCookPanelButton *); | ||
| 70 | + void deleteClicked(ProgrammedCookPanelButton *); | ||
| 71 | + void longPressed(ProgrammedCookPanelButton *); | ||
| 72 | +}; | ||
| 73 | + | ||
| 74 | +#endif // PROGRAMMEDCOOKPANELBUTTON_H |
app/gui/oven_control/programmedcookpanelbutton.ui
| @@ -0,0 +1,118 @@ | @@ -0,0 +1,118 @@ | ||
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<ui version="4.0"> | ||
| 3 | + <class>ProgrammedCookPanelButton</class> | ||
| 4 | + <widget class="QWidget" name="ProgrammedCookPanelButton"> | ||
| 5 | + <property name="geometry"> | ||
| 6 | + <rect> | ||
| 7 | + <x>0</x> | ||
| 8 | + <y>0</y> | ||
| 9 | + <width>821</width> | ||
| 10 | + <height>65</height> | ||
| 11 | + </rect> | ||
| 12 | + </property> | ||
| 13 | + <property name="windowTitle"> | ||
| 14 | + <string>Form</string> | ||
| 15 | + </property> | ||
| 16 | + <property name="styleSheet"> | ||
| 17 | + <string notr="true">QPushButton { | ||
| 18 | +background-position: center; | ||
| 19 | +background-repeat: no-repeat; | ||
| 20 | +border: none; | ||
| 21 | +}</string> | ||
| 22 | + </property> | ||
| 23 | + <widget class="QPushButton" name="showInfoButton"> | ||
| 24 | + <property name="geometry"> | ||
| 25 | + <rect> | ||
| 26 | + <x>670</x> | ||
| 27 | + <y>0</y> | ||
| 28 | + <width>70</width> | ||
| 29 | + <height>65</height> | ||
| 30 | + </rect> | ||
| 31 | + </property> | ||
| 32 | + <property name="styleSheet"> | ||
| 33 | + <string notr="true">QPushButton { background-image: url(:/images/etc/bar_icon_01.png); } | ||
| 34 | +QPushButton:pressed { background-image: url(:/images/etc/bar_icon_01_ov.png); } | ||
| 35 | +QPushButton:focus { background-image: url(:/images/etc/bar_icon_01_ov.png); }</string> | ||
| 36 | + </property> | ||
| 37 | + <property name="text"> | ||
| 38 | + <string/> | ||
| 39 | + </property> | ||
| 40 | + <property name="checkable"> | ||
| 41 | + <bool>true</bool> | ||
| 42 | + </property> | ||
| 43 | + <property name="autoExclusive"> | ||
| 44 | + <bool>true</bool> | ||
| 45 | + </property> | ||
| 46 | + </widget> | ||
| 47 | + <widget class="QPushButton" name="deleteButton"> | ||
| 48 | + <property name="geometry"> | ||
| 49 | + <rect> | ||
| 50 | + <x>750</x> | ||
| 51 | + <y>0</y> | ||
| 52 | + <width>60</width> | ||
| 53 | + <height>65</height> | ||
| 54 | + </rect> | ||
| 55 | + </property> | ||
| 56 | + <property name="styleSheet"> | ||
| 57 | + <string notr="true">QPushButton { background-image: url(:/images/etc/bar_icon_02.png); } | ||
| 58 | +QPushButton:pressed { background-image: url(:/images/etc/bar_icon_02_ov.png); } | ||
| 59 | +QPushButton:focus { background-image: url(:/images/etc/bar_icon_02_ov.png); }</string> | ||
| 60 | + </property> | ||
| 61 | + <property name="text"> | ||
| 62 | + <string/> | ||
| 63 | + </property> | ||
| 64 | + </widget> | ||
| 65 | + <widget class="QPushButton" name="pushButton"> | ||
| 66 | + <property name="geometry"> | ||
| 67 | + <rect> | ||
| 68 | + <x>0</x> | ||
| 69 | + <y>0</y> | ||
| 70 | + <width>821</width> | ||
| 71 | + <height>65</height> | ||
| 72 | + </rect> | ||
| 73 | + </property> | ||
| 74 | + <property name="sizePolicy"> | ||
| 75 | + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> | ||
| 76 | + <horstretch>0</horstretch> | ||
| 77 | + <verstretch>0</verstretch> | ||
| 78 | + </sizepolicy> | ||
| 79 | + </property> | ||
| 80 | + <property name="minimumSize"> | ||
| 81 | + <size> | ||
| 82 | + <width>821</width> | ||
| 83 | + <height>65</height> | ||
| 84 | + </size> | ||
| 85 | + </property> | ||
| 86 | + <property name="maximumSize"> | ||
| 87 | + <size> | ||
| 88 | + <width>821</width> | ||
| 89 | + <height>65</height> | ||
| 90 | + </size> | ||
| 91 | + </property> | ||
| 92 | + <property name="font"> | ||
| 93 | + <font> | ||
| 94 | + <family>Roboto</family> | ||
| 95 | + <pointsize>11</pointsize> | ||
| 96 | + </font> | ||
| 97 | + </property> | ||
| 98 | + <property name="styleSheet"> | ||
| 99 | + <string notr="true">QPushButton { | ||
| 100 | +background-image: url(:/images/etc/bar_03.png); | ||
| 101 | +color: white; | ||
| 102 | +text-align: left; | ||
| 103 | +padding: 0px 40px; | ||
| 104 | +} | ||
| 105 | +QPushButton:pressed { background-image: url(:/images/etc/bar_02.png); } | ||
| 106 | +QPushButton:focus { background-image: url(:/images/etc/bar_02.png); }</string> | ||
| 107 | + </property> | ||
| 108 | + <property name="text"> | ||
| 109 | + <string/> | ||
| 110 | + </property> | ||
| 111 | + </widget> | ||
| 112 | + <zorder>pushButton</zorder> | ||
| 113 | + <zorder>showInfoButton</zorder> | ||
| 114 | + <zorder>deleteButton</zorder> | ||
| 115 | + </widget> | ||
| 116 | + <resources/> | ||
| 117 | + <connections/> | ||
| 118 | +</ui> |
app/gui/oven_control/programmingwindow.cpp
| @@ -147,6 +147,7 @@ void ProgrammingWindow::listButtons(QList<CookRecord> record) | @@ -147,6 +147,7 @@ void ProgrammingWindow::listButtons(QList<CookRecord> record) | ||
| 147 | setTabOrder(ui->manualButton, ui->addButton); | 147 | setTabOrder(ui->manualButton, ui->addButton); |
| 148 | 148 | ||
| 149 | QWidget *last = ui->addButton; | 149 | QWidget *last = ui->addButton; |
| 150 | + CookPanelButton *prev = NULL; | ||
| 150 | foreach (CookRecord r, record) | 151 | foreach (CookRecord r, record) |
| 151 | { | 152 | { |
| 152 | CookPanelButton *b = newButton(r); | 153 | CookPanelButton *b = newButton(r); |
| @@ -154,6 +155,12 @@ void ProgrammingWindow::listButtons(QList<CookRecord> record) | @@ -154,6 +155,12 @@ void ProgrammingWindow::listButtons(QList<CookRecord> record) | ||
| 154 | setTabOrder(b->bar(), b->infoButton()); | 155 | setTabOrder(b->bar(), b->infoButton()); |
| 155 | setTabOrder(b->infoButton(), b->deleteButton()); | 156 | setTabOrder(b->infoButton(), b->deleteButton()); |
| 156 | last = b->deleteButton(); | 157 | last = b->deleteButton(); |
| 158 | + | ||
| 159 | + CookPanelButton *p = qobject_cast<CookPanelButton *>(prev); | ||
| 160 | + if (p) | ||
| 161 | + p->next = b; | ||
| 162 | + | ||
| 163 | + prev = b; | ||
| 157 | } | 164 | } |
| 158 | 165 | ||
| 159 | setTabOrder(last, ui->backButton); | 166 | setTabOrder(last, ui->backButton); |