diff --git a/app/gui/oven_control/coretempsettingpopup.cpp b/app/gui/oven_control/coretempsettingpopup.cpp index 6626ec2..e76701d 100644 --- a/app/gui/oven_control/coretempsettingpopup.cpp +++ b/app/gui/oven_control/coretempsettingpopup.cpp @@ -87,6 +87,7 @@ CoreTempSettingPopup::CoreTempSettingPopup(QWidget *parent) : connect(&focusCoreTempButtonTimer, SIGNAL(timeout()), SLOT(focusCoreTempButton())); connect(ui->coreTempSlider, SIGNAL(sliderMoved(int)), &focusCoreTempButtonTimer, SLOT(start())); + connect(ui->coreTempSlider, SIGNAL(sliderPressed()), SLOT(updateView())); } CoreTempSettingPopup::~CoreTempSettingPopup() diff --git a/app/gui/oven_control/coretempsettingpopup.ui b/app/gui/oven_control/coretempsettingpopup.ui index 6d8a4dd..20bfecd 100644 --- a/app/gui/oven_control/coretempsettingpopup.ui +++ b/app/gui/oven_control/coretempsettingpopup.ui @@ -445,9 +445,13 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/manual_b - QPushButton { image: url(:/images/slider_icon/core_temp_enabled.png); } -QPushButton:checked { image: url(:/images/slider_icon/core_temp_ov.png); } -QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/core_temp_ov.png); } + QPushButton +{ image: url(:/images/slider_icon/core_temp_enabled); } +QPushButton:pressed, +QPushButton:focus +{ image: url(:/images/slider_icon/011_icon_04_active.png); } +QPushButton:checked +{ image: url(:/images/slider_icon/core_temp_ov.png); } true diff --git a/app/gui/oven_control/manualcookwindow.cpp b/app/gui/oven_control/manualcookwindow.cpp index a2281c3..9505219 100644 --- a/app/gui/oven_control/manualcookwindow.cpp +++ b/app/gui/oven_control/manualcookwindow.cpp @@ -147,6 +147,11 @@ ManualCookWindow::ManualCookWindow(QWidget *parent, Define::Mode mode) : connect(ui->timeSlider, SIGNAL(sliderMoved(int)), &focusTimeButtonTimer, SLOT(start())); connect(ui->interTempSlider, SIGNAL(sliderMoved(int)), &focusInterTempButtonTimer, SLOT(start())); + connect(ui->humiditySlider, SIGNAL(sliderPressed()), SLOT(updateView())); + connect(ui->tempSlider, SIGNAL(sliderPressed()), SLOT(updateView())); + connect(ui->timeSlider, SIGNAL(sliderPressed()), SLOT(updateView())); + connect(ui->interTempSlider, SIGNAL(sliderPressed()), SLOT(updateView())); + connect(oven, SIGNAL(changed(Oven*)), this, SLOT(onOvenUpdated(Oven*))); oven->setDefault(mode); @@ -345,33 +350,41 @@ void ManualCookWindow::updateView() else interTemp = oven->interTemp(); - ui->interTempButton->setChecked(oven->interTempEnabled()); + QString interTempButtonStyleSheet("\ +QPushButton\ +{ image: url(%1); }\ +QPushButton:pressed,\ +QPushButton:focus\ +{ image: url(:/images/slider_icon/011_icon_04_active.png); }\ +QPushButton:checked\ +{ image: url(:/images/slider_icon/core_temp_ov.png); }"); bool interTempEnabled = oven->interTempEnabled(); - if (interTempEnabled != lastViewInterTempEnabled || interTemp != lastViewInterTemp) + if (interTempEnabled != lastViewInterTempEnabled) { - if (interTempEnabled != lastViewInterTempEnabled) -// { - lastViewInterTempEnabled = oven->interTempEnabled(); -// ui->interTempButton->setChecked(interTempEnabled); -// } - - lastViewInterTemp = interTemp; - - bool old = ui->interTempSlider->blockSignals(true); - ui->interTempSlider->setEnabled(interTempEnabled); - ui->interTempSlider->setSubVisible(interTempEnabled); - ui->interTempSlider->setRange(oven->minInterTemp(), oven->maxInterTemp()); - if (ui->interTempSlider->sliderPosition() != interTemp) - ui->interTempSlider->setValue(interTemp); - ui->interTempSlider->blockSignals(old); - + lastViewInterTempEnabled = interTempEnabled; if (interTempEnabled) - ui->interTempLabel->setText(Stringer::temperature(interTemp, Stringer::fontSize14)); + ui->interTempButton->setStyleSheet(interTempButtonStyleSheet.arg(":/images/slider_icon/core_temp_enabled.png")); else - ui->interTempLabel->setText(Stringer::unusedTemperature(Stringer::fontSize14)); + ui->interTempButton->setStyleSheet(interTempButtonStyleSheet.arg(":/images/slider_icon/core_temp.png")); } + ui->interTempButton->setChecked(focusWidget() == ui->interTempSlider); + + + old = ui->interTempSlider->blockSignals(true); + ui->interTempSlider->setEnabled(interTempEnabled); + ui->interTempSlider->setSubVisible(interTempEnabled); + ui->interTempSlider->setRange(oven->minInterTemp(), oven->maxInterTemp()); + if (ui->interTempSlider->sliderPosition() != interTemp) + ui->interTempSlider->setValue(interTemp); + ui->interTempSlider->blockSignals(old); + + if (interTempEnabled) + ui->interTempLabel->setText(Stringer::temperature(interTemp, Stringer::fontSize14)); + else + ui->interTempLabel->setText(Stringer::unusedTemperature(Stringer::fontSize14)); + ui->runStopButton->setChecked(oven->cooking()); if (showFrontButtons) diff --git a/app/gui/oven_control/manualcookwindow.ui b/app/gui/oven_control/manualcookwindow.ui index d707116..ad92dfd 100644 --- a/app/gui/oven_control/manualcookwindow.ui +++ b/app/gui/oven_control/manualcookwindow.ui @@ -756,9 +756,13 @@ QPushButton:checked { image: url(:/images/slider_icon/humidity_ov.png); } - QPushButton { image: url(:/images/slider_icon/core_temp.png); } -QPushButton:checked { image: url(:/images/slider_icon/core_temp_enabled.png); } -QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/core_temp_ov.png); } + QPushButton +{ image: url(:/images/slider_icon/core_temp.png); } +QPushButton:pressed, +QPushButton:focus +{ image: url(:/images/slider_icon/011_icon_04_active.png); } +QPushButton:checked +{ image: url(:/images/slider_icon/core_temp_ov.png); } true diff --git a/app/gui/oven_control/programmingmanualcoretemppopup.cpp b/app/gui/oven_control/programmingmanualcoretemppopup.cpp index e82d0a2..55ddd8e 100644 --- a/app/gui/oven_control/programmingmanualcoretemppopup.cpp +++ b/app/gui/oven_control/programmingmanualcoretemppopup.cpp @@ -32,6 +32,8 @@ ProgrammingManualCoreTempPopup::ProgrammingManualCoreTempPopup(QWidget *parent) ticks.append(bigTicks.at(1) + i * (bigTicks.at(2) - bigTicks.at(1)) / 3); connect(ui->coreTempSlider, SIGNAL(sliderMoved(int)), SLOT(updateCoreTempLabel())); + connect(ui->coreTempSlider, SIGNAL(sliderPressed()), SLOT(updateCoreTempButton())); + connect(ui->coreTempSlider, SIGNAL(sliderMoved(int)), SLOT(updateCoreTempButton())); updateCoreTempLabel(); @@ -108,6 +110,11 @@ void ProgrammingManualCoreTempPopup::keyReleaseEvent(QKeyEvent *event) } } +void ProgrammingManualCoreTempPopup::updateCoreTempButton() +{ + ui->coreTempButton->setChecked(focusWidget() == ui->coreTempSlider); +} + void ProgrammingManualCoreTempPopup::updateCoreTempLabel() { ui->coreTempLabel->setText(Stringer::temperature(ui->coreTempSlider->sliderPosition(), Stringer::fontSize14)); @@ -120,21 +127,29 @@ void ProgrammingManualCoreTempPopup::afterThreeSecs() { if (slider == ui->coreTempSlider) ui->coreTempButton->setFocus(); + + updateCoreTempButton(); } } void ProgrammingManualCoreTempPopup::on_coreTempButton_clicked() { ui->coreTempSlider->setFocus(); + + updateCoreTempButton(); } void ProgrammingManualCoreTempPopup::on_cancelButton_clicked() { + updateCoreTempButton(); + close(); } void ProgrammingManualCoreTempPopup::on_applyButton_clicked() { + updateCoreTempButton(); + emit coreTempEnabled(ui->coreTempSlider->sliderPosition()); close(); @@ -176,6 +191,8 @@ void ProgrammingManualCoreTempPopup::onEncoderClicked(QWidget *clicked) { if (slider == ui->coreTempSlider) ui->coreTempButton->setFocus(); + + updateCoreTempButton(); } } } diff --git a/app/gui/oven_control/programmingmanualcoretemppopup.h b/app/gui/oven_control/programmingmanualcoretemppopup.h index 65964c3..2723a43 100644 --- a/app/gui/oven_control/programmingmanualcoretemppopup.h +++ b/app/gui/oven_control/programmingmanualcoretemppopup.h @@ -23,6 +23,7 @@ protected: void keyReleaseEvent(QKeyEvent *event); private slots: + void updateCoreTempButton(); void updateCoreTempLabel(); void afterThreeSecs(); diff --git a/app/gui/oven_control/programmingmanualcoretemppopup.ui b/app/gui/oven_control/programmingmanualcoretemppopup.ui index 587fd87..006b42d 100644 --- a/app/gui/oven_control/programmingmanualcoretemppopup.ui +++ b/app/gui/oven_control/programmingmanualcoretemppopup.ui @@ -68,8 +68,16 @@ height: 33px; - QPushButton { image: url(:/images/slider_icon/core_temp_enabled.png); } -QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/core_temp_ov.png); } + QPushButton +{ image: url(:/images/slider_icon/core_temp_enabled.png); } +QPushButton:pressed, +QPushButton:focus +{ image: url(:/images/slider_icon/011_icon_04_active.png); } +QPushButton:checked +{ image: url(:/images/slider_icon/core_temp_ov.png); } + + + true icon @@ -201,6 +209,9 @@ QPushButton:pressed, QPushButton:focus { background-image: url(:/images/manual_b 140 + + Qt::ClickFocus + background coreTempButton diff --git a/app/gui/oven_control/programmingmanualwindow.cpp b/app/gui/oven_control/programmingmanualwindow.cpp index a6dbb01..942c1f0 100644 --- a/app/gui/oven_control/programmingmanualwindow.cpp +++ b/app/gui/oven_control/programmingmanualwindow.cpp @@ -58,10 +58,18 @@ ProgrammingManualWindow::ProgrammingManualWindow(QWidget *parent, Define::Mode m for (int i = 1; i < 3; i++) ticks.append(bigTicks.at(1) + i * (bigTicks.at(2) - bigTicks.at(1)) / 3); - connect(ui->humiditySlider, SIGNAL(sliderMoved(int)), SLOT(updateHumidityLabel())); - connect(ui->tempSlider, SIGNAL(sliderMoved(int)), SLOT(updateTempLabel())); - connect(ui->timeSlider, SIGNAL(sliderMoved(int)), SLOT(updateTimeLabel())); - connect(ui->interTempSlider, SIGNAL(sliderMoved(int)), SLOT(updateCoreTempLabel())); + connect(ui->humiditySlider, SIGNAL(sliderMoved(int)), SLOT(updateView())); + connect(ui->tempSlider, SIGNAL(sliderMoved(int)), SLOT(updateView())); + connect(ui->timeSlider, SIGNAL(sliderMoved(int)), SLOT(updateView())); + connect(ui->interTempSlider, SIGNAL(sliderMoved(int)), SLOT(updateView())); + + connect(ui->humiditySlider, SIGNAL(sliderPressed()), SLOT(updateView())); + connect(ui->tempSlider, SIGNAL(sliderPressed()), SLOT(updateView())); + connect(ui->timeSlider, SIGNAL(sliderPressed()), SLOT(updateView())); + connect(ui->interTempSlider, SIGNAL(sliderPressed()), SLOT(updateView())); + + lastFan = -1; + lastInterTempEnabled = true; setDefault(mode); @@ -244,6 +252,8 @@ void ProgrammingManualWindow::onEncoderClicked(QWidget *clicked) ui->timeButton->setFocus(); else if (slider == ui->interTempSlider) ui->interTempButton->setFocus(); + + updateView(); } } } @@ -265,8 +275,7 @@ void ProgrammingManualWindow::setDefault(Define::Mode mode) ui->interTempSlider->setSubVisible(false); ui->interTempSlider->setValue(30); setFan(4); - updateCoreTempButton(); - updateCoreTempLabel(); + updateView(); this->mode = mode; break; case Define::CombiMode: @@ -282,8 +291,7 @@ void ProgrammingManualWindow::setDefault(Define::Mode mode) ui->interTempSlider->setSubVisible(false); ui->interTempSlider->setValue(30); setFan(4); - updateCoreTempButton(); - updateCoreTempLabel(); + updateView(); this->mode = mode; break; case Define::DryMode: @@ -299,8 +307,7 @@ void ProgrammingManualWindow::setDefault(Define::Mode mode) ui->interTempSlider->setSubVisible(false); ui->interTempSlider->setValue(30); setFan(4); - updateCoreTempButton(); - updateCoreTempLabel(); + updateView(); this->mode = mode; break; default: @@ -315,6 +322,24 @@ void ProgrammingManualWindow::setFan(int level) updateFanButton(); } +void ProgrammingManualWindow::updateView() +{ + updateHumidityLabel(); + updateTempLabel(); + updateTimeLabel(); + updateCoreTempButton(); + updateCoreTempLabel(); + updateFanButton(); + + QWidget *focused = focusWidget(); + ui->humidityButton->setChecked(focused == ui->humiditySlider); + ui->tempButton->setChecked(focused == ui->tempSlider); + ui->timeButton->setChecked(focused == ui->timeSlider); + ui->interTempButton->setChecked(focused == ui->interTempSlider); + + qDebug() << "up" << focused; +} + void ProgrammingManualWindow::updateHumidityLabel() { ui->humidityLabel->setText(QString("%1%").arg(ui->humiditySlider->sliderPosition())); @@ -332,7 +357,26 @@ void ProgrammingManualWindow::updateTimeLabel() void ProgrammingManualWindow::updateCoreTempButton() { - ui->interTempButton->setChecked(ui->interTempSlider->isEnabled()); + if (ui->interTempSlider->isEnabled() == lastInterTempEnabled) + return; + + lastInterTempEnabled = ui->interTempSlider->isEnabled(); + + QString interTempButtonStyleSheet("\ +QPushButton\ +{ image: url(%1); }\ +QPushButton:pressed,\ +QPushButton:focus\ +{ image: url(:/images/slider_icon/011_icon_04_active.png); }\ +QPushButton:checked\ +{ image: url(:/images/slider_icon/core_temp_ov.png); }"); + + if (ui->interTempSlider->isEnabled()) + ui->interTempButton->setStyleSheet(interTempButtonStyleSheet.arg(":/images/slider_icon/core_temp_enabled.png")); + else + ui->interTempButton->setStyleSheet(interTempButtonStyleSheet.arg(":/images/slider_icon/core_temp.png")); + + ui->interTempButton->setChecked(focusWidget() == ui->interTempSlider); } void ProgrammingManualWindow::updateCoreTempLabel() @@ -345,31 +389,45 @@ void ProgrammingManualWindow::updateCoreTempLabel() void ProgrammingManualWindow::updateFanButton() { + if (fan == lastFan) + return; + + lastFan = fan; + QString fanStyleSheet("\ +QPushButton { background-image: url(%1); }\ +QPushButton:focus { background-image: url(%2); }"); + switch (fan) { case 1: - ui->fanButton->setStyleSheet( - "background-image: url(:/images/manual_button/fan_1.png)"); + ui->fanButton->setStyleSheet(fanStyleSheet + .arg(":/images/manual_button/fan_1.png") + .arg(":/images/manual_button/013_sys_icon_06_active.png")); break; case 2: - ui->fanButton->setStyleSheet( - "background-image: url(:/images/manual_button/fan_2.png)"); + ui->fanButton->setStyleSheet(fanStyleSheet + .arg(":/images/manual_button/fan_2.png") + .arg(":/images/manual_button/013_sys_icon_06_01_active.png")); break; case 3: - ui->fanButton->setStyleSheet( - "background-image: url(:/images/manual_button/fan_3.png)"); + ui->fanButton->setStyleSheet(fanStyleSheet + .arg(":/images/manual_button/fan_3.png") + .arg(":/images/manual_button/013_sys_icon_06_02_active.png")); break; case 4: - ui->fanButton->setStyleSheet( - "background-image: url(:/images/manual_button/fan_4.png)"); + ui->fanButton->setStyleSheet(fanStyleSheet + .arg(":/images/manual_button/fan_4.png") + .arg(":/images/manual_button/013_sys_icon_06_03_active.png")); break; case 5: - ui->fanButton->setStyleSheet( - "background-image: url(:/images/manual_button/fan_5.png)"); + ui->fanButton->setStyleSheet(fanStyleSheet + .arg(":/images/manual_button/fan_5.png") + .arg(":/images/manual_button/013_sys_icon_06_04_active.png")); break; default: - ui->fanButton->setStyleSheet( - "background-image: url(:/images/manual_button/fan_1.png)"); + ui->fanButton->setStyleSheet(fanStyleSheet + .arg(":/images/manual_button/fan_6.png") + .arg(":/images/manual_button/013_sys_icon_06_active.png")); break; } } @@ -388,7 +446,7 @@ void ProgrammingManualWindow::afterThreeSecs() else if (slider == ui->interTempSlider) ui->interTempButton->setFocus(); - afterThreeSecsTimer.start(); + updateView(); } } @@ -397,8 +455,8 @@ void ProgrammingManualWindow::onCoreTempEnabled(int celsius) ui->interTempSlider->setEnabled(true); ui->interTempSlider->setSubVisible(true); ui->interTempSlider->setValue(celsius); - updateCoreTempButton(); - updateCoreTempLabel(); + + updateView(); } void ProgrammingManualWindow::on_steamButton_clicked() @@ -419,16 +477,22 @@ void ProgrammingManualWindow::on_dryheatButton_clicked() void ProgrammingManualWindow::on_humidityButton_clicked() { ui->humiditySlider->setFocus(); + + updateView(); } void ProgrammingManualWindow::on_tempButton_clicked() { ui->tempSlider->setFocus(); + + updateView(); } void ProgrammingManualWindow::on_timeButton_clicked() { ui->timeSlider->setFocus(); + + updateView(); } void ProgrammingManualWindow::on_interTempButton_clicked() @@ -437,8 +501,8 @@ void ProgrammingManualWindow::on_interTempButton_clicked() { ui->interTempSlider->setEnabled(false); ui->interTempSlider->setSubVisible(false); - updateCoreTempButton(); - updateCoreTempLabel(); + + updateView(); } else { diff --git a/app/gui/oven_control/programmingmanualwindow.h b/app/gui/oven_control/programmingmanualwindow.h index e9a6524..12bf098 100644 --- a/app/gui/oven_control/programmingmanualwindow.h +++ b/app/gui/oven_control/programmingmanualwindow.h @@ -28,6 +28,9 @@ private: Define::Mode mode; int fan; + int lastFan; + + bool lastInterTempEnabled; int sliderToTime(int value); int timeToSlider(int secs); @@ -43,6 +46,7 @@ private: private slots: void setDefault(Define::Mode mode); void setFan(int level); + void updateView(); void updateHumidityLabel(); void updateTempLabel(); void updateTimeLabel(); diff --git a/app/gui/oven_control/programmingmanualwindow.ui b/app/gui/oven_control/programmingmanualwindow.ui index ace88a5..988c7aa 100644 --- a/app/gui/oven_control/programmingmanualwindow.ui +++ b/app/gui/oven_control/programmingmanualwindow.ui @@ -242,7 +242,12 @@ QPushButton:checked { background-image: url(:/images/cook_mode/big_dryheat.png); QPushButton { image: url(:/images/slider_icon/time.png); } -QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/time_ov.png); } +QPushButton:pressed, +QPushButton:focus { image: url(:/images/slider_icon/011_icon_03_active.png); } +QPushButton:checked { image: url(:/images/slider_icon/time_ov.png); } + + + true icon @@ -587,7 +592,12 @@ QPushButton:pressed, QPushButton:focus { border-image: url(:/images/bottom_bar/h QPushButton { image: url(:/images/slider_icon/temp.png); } -QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/temp_ov.png); } +QPushButton:pressed, +QPushButton:focus { image: url(:/images/slider_icon/011_icon_02_active.png); } +QPushButton:checked { image: url(:/images/slider_icon/temp_ov.png); } + + + true icon @@ -754,7 +764,12 @@ QPushButton:checked { background-image: url(:/images/cook_mode/big_steam.png); } QPushButton { image: url(:/images/slider_icon/humidity.png); } -QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/humidity_ov.png); } +QPushButton:pressed, +QPushButton:focus { image: url(:/images/slider_icon/011_icon_01_active.png); } +QPushButton:checked { image: url(:/images/slider_icon/humidity_ov.png); } + + + true icon @@ -770,9 +785,13 @@ QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/humidit - QPushButton { image: url(:/images/slider_icon/core_temp.png); } -QPushButton:checked { image: url(:/images/slider_icon/core_temp_enabled.png); } -QPushButton:pressed, QPushButton:focus { image: url(:/images/slider_icon/core_temp_ov.png); } + QPushButton +{ image: url(:/images/slider_icon/core_temp.png); } +QPushButton:pressed, +QPushButton:focus +{ image: url(:/images/slider_icon/011_icon_04_active.png); } +QPushButton:checked +{ image: url(:/images/slider_icon/core_temp_ov.png); } true