operationtimeheat.cpp 1.74 KB
#include "operationtimeheat.h"
#include "ui_operationtimeheat.h"
#include "ovenstatics.h"

OperationTimeHeat::OperationTimeHeat(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::OperationTimeHeat)
{
    ui->setupUi(this);

    ui->clockContainer->setParent(ui->upperStack);
    setAttribute(Qt::WA_DeleteOnClose);

    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();
}