#include #include "operationtimeheat.h" #include "ui_operationtimeheat.h" #include "ovenstatics.h" #include "soundplayer.h" OperationTimeHeat::OperationTimeHeat(QWidget *parent) : QMainWindow(parent), ui(new Ui::OperationTimeHeat) { ui->setupUi(this); ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); reloadUI(); } OperationTimeHeat::~OperationTimeHeat() { delete ui; } void OperationTimeHeat::on_btnReset1_clicked() { //스팀 가열 시간 초기화 OvenStatistics* ovs = OvenStatistics::getInstance(); if(ovs!=NULL){ ovs->srvdata->use_log.items.steam_heat=0; ovs->srvdata->saveServiceData(); reloadUI(); } } void OperationTimeHeat::on_btnReset2_clicked() { //건열 가열 시간 초기화 OvenStatistics* ovs = OvenStatistics::getInstance(); if(ovs!=NULL){ ovs->srvdata->use_log.items.dry_heat=0; ovs->srvdata->use_log.items.upper_heat=0; ovs->srvdata->use_log.items.lower_heat=0; ovs->srvdata->saveServiceData(); reloadUI(); } } void OperationTimeHeat::reloadUI(void){ uint32_t timetemp; OvenStatistics* ovs = OvenStatistics::getInstance(); QString strTemp=""; if(ovs!=NULL){ timetemp = ovs->srvdata->use_log.items.steam_heat; strTemp.sprintf("%d h", timetemp/3600); ui->m_ctrlLbListTime1->setText(strTemp); timetemp = ovs->srvdata->use_log.items.dry_heat; strTemp.sprintf("%d h", timetemp/3600); ui->m_ctrlLbListTime2->setText(strTemp); qDebug() << "Steam heat time : " << ovs->srvdata->use_log.items.steam_heat; qDebug() << "Dry heat time : " << ovs->srvdata->use_log.items.dry_heat; } } void OperationTimeHeat::on_backButton_clicked() { close(); } void OperationTimeHeat::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case 0x01000032: // Turn left focusPreviousChild(); break; case 0x01000031: // Push break; case 0x01000030: // Turn right focusNextChild(); break; } } void OperationTimeHeat::keyReleaseEvent(QKeyEvent *event) { switch (event->key()) { case 0x01000032: // Turn left focusPreviousChild(); break; case 0x01000031: // Push { QPushButton *btn = qobject_cast(focusWidget()); if(btn != NULL){ btn->click(); } break; } case 0x01000030: // Turn right focusNextChild(); break; } }