#include #include #include "operationtimeparts.h" #include "ui_operationtimeparts.h" #include "ovenstatics.h" #include "soundplayer.h" #include "manualviewerdlg.h" OperationTimeParts::OperationTimeParts(QWidget *parent) : QMainWindow(parent), ui(new Ui::OperationTimeParts) { int i=0; OvenStatistics* ovs = OvenStatistics::getInstance(); ui->setupUi(this); ui->clockContainer->setParent(ui->upperStack); setAttribute(Qt::WA_DeleteOnClose); foreach (QPushButton *button, findChildren()) connect(button, &QPushButton::pressed, SoundPlayer::playClick); m_arrTimeLabels[0] = ui->m_ctrlLbListTime_1; m_arrTimeLabels[1] = ui->m_ctrlLbListTime_2; m_arrTimeLabels[2] = ui->m_ctrlLbListTime_3; m_arrTimeLabels[3] = ui->m_ctrlLbListTime_4; m_arrTimeLabels[4] = ui->m_ctrlLbListTime_5; m_arrTimeLabels[5] = ui->m_ctrlLbListTime_6; m_arrTimeLabels[6] = ui->m_ctrlLbListTime_7; m_arrTimeLabels[7] = ui->m_ctrlLbListTime_8; m_arrTimeLabels[8] = ui->m_ctrlLbListTime_9; m_arrTimeLabels[9] = ui->m_ctrlLbListTime_10; m_arrTimeLabels[10] = ui->m_ctrlLbListTime_11; m_arrResetBtn[0] = ui->btnReset_1; m_arrResetBtn[1] = ui->btnReset_2; m_arrResetBtn[2] = ui->btnReset_3; m_arrResetBtn[3] = ui->btnReset_4; m_arrResetBtn[4] = ui->btnReset_5; m_arrResetBtn[5] = ui->btnReset_6; m_arrResetBtn[6] = ui->btnReset_7; m_arrResetBtn[7] = ui->btnReset_8; m_arrResetBtn[8] = ui->btnReset_9; m_arrResetBtn[9] = ui->btnReset_10; m_arrResetBtn[10] = ui->btnReset_11; m_btnGrops = new QButtonGroup(); for(i=0;iaddButton(m_arrResetBtn[i],i); } connect(m_btnGrops,SIGNAL(buttonClicked(int)),this,SLOT(onBtnResetsClicked(int))); if(ovs != NULL){ for( i =0;isrvdata->use_log.values[m_arrPartItemIdxs[i]]); } else m_arrUseItems[i] = NULL; } } reloadUi(); } OperationTimeParts::~OperationTimeParts() { delete ui; } void OperationTimeParts::on_backButton_clicked() { close(); } void OperationTimeParts::reloadUi(void){ uint32_t timetemp; OvenStatistics* ovs = OvenStatistics::getInstance(); QString strTemp=""; int i = 0; if(ovs != NULL){ for(i = 0; isetText(strTemp); } else{ m_arrTimeLabels[i]->setText("-"); } } } else{ for(i=0;isetText("-"); } } } void OperationTimeParts::onBtnResetsClicked(int idx){ qDebug() << "PUSH BUTTON " << idx; if(idx < OPERATION_TIME_CONTROL_MAX){ if(m_arrUseItems[idx] !=NULL){ *m_arrUseItems[idx]=0; reloadUi(); } } } void OperationTimeParts::keyPressEvent(QKeyEvent *event) { switch (event->key()) { case 0x01000032: // Turn left focusPreviousChild(); break; case 0x01000031: // Push break; case 0x01000030: // Turn right focusNextChild(); break; } } void OperationTimeParts::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; } } void OperationTimeParts::on_helpButton_clicked() { ManualViewerDlg* dlg = new ManualViewerDlg(this); dlg->showFullScreen(); dlg->raise(); }