diff --git a/app/gui/oven_control/manualcookwindow.cpp b/app/gui/oven_control/manualcookwindow.cpp index fd1832a..0fa862d 100644 --- a/app/gui/oven_control/manualcookwindow.cpp +++ b/app/gui/oven_control/manualcookwindow.cpp @@ -158,6 +158,11 @@ ManualCookWindow::ManualCookWindow(QWidget *parent, Define::Mode mode) : connect(oven, SIGNAL(changed(Oven*)), this, SLOT(onOvenUpdated(Oven*))); oven->setDefault(mode); + ui->infoTextLabel->setAttribute(Qt::WA_TransparentForMouseEvents); + ui->infoTextLabel->hide(); + showInfoTextTimer.setInterval(1500); + showInfoTextTimer.setSingleShot(true); + connect(&updateViewTimer, SIGNAL(timeout()), SLOT(updateView())); updateViewTimer.start(100); @@ -447,10 +452,27 @@ QPushButton:checked\ } bool damper = oven->damper(); - ui->damperButton->setChecked(damper); + if (damper != ui->damperButton->isChecked()) + { + ui->damperButton->setChecked(damper); + + if (damper) + showInfoText("ON"); + else + showInfoText("OFF"); + } bool humidification = oven->humidification(); - ui->humidificationButton->setChecked(humidification); + if (humidification != ui->humidificationButton->isChecked()) + { + ui->humidificationButton->setChecked(humidification); + qDebug() << "humidification" << humidification; + + if (humidification) + showInfoText("ON"); + else + showInfoText("OFF"); + } QString fanStyleSheet("\ QPushButton { background-image: url(%1); }\ @@ -496,7 +518,15 @@ QPushButton:focus { background-image: url(%2); }"); } } - ui->repeatButton->setChecked(repeat); + if (repeat != ui->repeatButton->isChecked()) + { + ui->repeatButton->setChecked(repeat); + + if (repeat) + showInfoText("ON"); + else + showInfoText("OFF"); + } if (cookDone) { @@ -512,6 +542,24 @@ QPushButton:focus { background-image: url(%2); }"); else ui->upperStack->setCurrentIndex(0); // Clock } + + int remainingTime = showInfoTextTimer.remainingTime(); + if (remainingTime > 500) + { + ui->infoTextLabel->setStyleSheet("color: rgb(255, 255, 255);"); + ui->infoTextLabel->show(); + } + else if (remainingTime > 0) + { + ui->infoTextLabel->setStyleSheet( + QString("color: rgba(255, 255, 255, %1);") + .arg(qBound(0, remainingTime * 255 / 500, 255))); + ui->infoTextLabel->show(); + } + else + { + ui->infoTextLabel->hide(); + } } void ManualCookWindow::showCurrentHumidity() @@ -538,6 +586,12 @@ void ManualCookWindow::hideCurrentTemp() updateView(); } +void ManualCookWindow::showInfoText(QString text) +{ + ui->infoTextLabel->setText(text); + showInfoTextTimer.start(); +} + void ManualCookWindow::onOvenUpdated(Oven *oven) { updateView(); @@ -981,6 +1035,8 @@ void ManualCookWindow::on_fanButton_clicked() fan = oven->minFan(); oven->setFan(fan); + + showInfoText(QString("%1").arg(fan)); } void ManualCookWindow::on_preheatButton_clicked() @@ -998,17 +1054,29 @@ void ManualCookWindow::on_preheatButton_clicked() void ManualCookWindow::on_damperButton_clicked() { if (oven->damper()) + { oven->closeDamper(); + showInfoText("OFF"); + } else + { oven->openDamper(); + showInfoText("ON"); + } } void ManualCookWindow::on_humidificationButton_clicked() { if (oven->humidification()) + { oven->stopHumidification(); + showInfoText("OFF"); + } else + { oven->startHumidification(5); + showInfoText("ON"); + } } void ManualCookWindow::on_repeatButton_clicked() @@ -1016,11 +1084,13 @@ void ManualCookWindow::on_repeatButton_clicked() if (repeat) { repeat = false; + showInfoText("OFF"); updateView(); } else { repeat = true; + showInfoText("ON"); updateView(); repeatSetting.mode = oven->mode(); diff --git a/app/gui/oven_control/manualcookwindow.h b/app/gui/oven_control/manualcookwindow.h index da33588..6a15bed 100644 --- a/app/gui/oven_control/manualcookwindow.h +++ b/app/gui/oven_control/manualcookwindow.h @@ -41,6 +41,7 @@ private slots: void hideCurrentHumidity(); void showCurrentTemp(); void hideCurrentTemp(); + void showInfoText(QString text); void onOvenUpdated(Oven *oven); @@ -107,6 +108,7 @@ private: QTimer showCurrentHumidityTimer; QTimer showCurrentTempTimer; + QTimer showInfoTextTimer; int humidity; int temp; diff --git a/app/gui/oven_control/manualcookwindow.ui b/app/gui/oven_control/manualcookwindow.ui index 3ed2504..f7c5d36 100644 --- a/app/gui/oven_control/manualcookwindow.ui +++ b/app/gui/oven_control/manualcookwindow.ui @@ -1300,6 +1300,32 @@ QPushButton:checked:focus background-image: url(:/images/line/manual_button.png); + + + + 0 + 720 + 900 + 600 + + + + + 48 + 75 + true + + + + color: rgba(255, 255, 255, 255); + + + ON + + + Qt::AlignCenter + + sysLine_8 sysLine_7 sysLine_9 @@ -1334,6 +1360,7 @@ QPushButton:checked:focus humiditySlider timeSlider interTempSlider + infoTextLabel