From cefd483e4066e4ba94dbaede9080b21ed5161e1b Mon Sep 17 00:00:00 2001 From: byloveletter Date: Mon, 24 Apr 2017 18:35:10 +0900 Subject: [PATCH] =?UTF-8?q?=EC=97=90=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 시간 오표시 에러 수정(로컬 타임 적용) - 팝업 표시 알고리즘 수정(Modal -> Modaless) --- app/gui/oven_control/historylistwindow.cpp | 4 +- app/gui/oven_control/ovenstatics.cpp | 77 +++++++++++++++++++++------ app/gui/oven_control/ovenstatics.h | 13 +++++ app/gui/oven_control/realtimesensorwindow.cpp | 2 +- 4 files changed, 76 insertions(+), 20 deletions(-) diff --git a/app/gui/oven_control/historylistwindow.cpp b/app/gui/oven_control/historylistwindow.cpp index b0661a6..ee7870e 100644 --- a/app/gui/oven_control/historylistwindow.cpp +++ b/app/gui/oven_control/historylistwindow.cpp @@ -97,10 +97,10 @@ void HistoryListWindow::reloadDataset(void){ item = err_items[m_nCurDpStartPos+i]; m_ctrlErrBtns[i]->setText(strTemp); m_ctrlCountLabels[i] ->setText(strTemp.sprintf("%d",item->fired_cnt)); - timeptr = gmtime(&(item->first_fired)); + timeptr = localtime(&(item->first_fired)); strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr); m_ctrlFirstTimeLabels[i]->setText(strTime); - timeptr = gmtime(&(item->last_fried)); + timeptr = localtime(&(item->last_fried)); strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr); m_ctrlLastTimeLabels[i]->setText(strTime); } diff --git a/app/gui/oven_control/ovenstatics.cpp b/app/gui/oven_control/ovenstatics.cpp index 7187ca0..2ad435b 100644 --- a/app/gui/oven_control/ovenstatics.cpp +++ b/app/gui/oven_control/ovenstatics.cpp @@ -41,6 +41,9 @@ OvenStatistics::OvenStatistics(QObject* parent) :QObject(parent) curSensorErrorState = 0; bDataRefreshed = false; realdata.d32 = 0; + m_bPopupShow = false; + m_nLastPopupidx = MAX_ERROR_TYPE_CNT; + for(i=0;ierr_log.items.steam_fire_fail); strMsg = tr("스팀 버너 착하가 되지 않습니다."); - strMsg = tr("스팀 버너 착하 이상 발생"); + strTitle = tr("스팀 버너 착하 이상 발생"); processErrorItems(item, sys_err_type_def[state][SYS_ERR_FIRE_TRIGGER3],strMsg,strTitle,ltime); } if(errflag & MAKE_MASK(SYS_ERR_OVNE_TEMP_ALARM)){ @@ -491,8 +494,8 @@ void OvenStatistics::oneSecTimerFired(void){ } void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype, const QString &MsgDesc, const QString &MsgTitle, time_t ltime){ - - qDebug() << (int) (item - &(srvdata->err_log.values[0])) << "ERROR Fired!"; + uint32_t erridx = (uint32_t) (item - &(srvdata->err_log.values[0])); + qDebug() << (uint32_t) (item - &(srvdata->err_log.values[0])) << "ERROR Fired!"; if(m_pLastErrItem == item ){ srvdata->err_log.items.repeat_error.fired_cnt =item->fired_cnt; srvdata->err_log.items.repeat_error.first_fired = item->first_fired; @@ -505,13 +508,41 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype, if(item->first_fired == 0) item->first_fired = ltime; item->last_fried = ltime; } + + if(errtype > error_type_clrsplit){ + //에러 클리어 명령 송신 + if(errtype == error_type_engclr){ + //확인 후 송신 + bNeedErrorClear = true; + } + else{ + //에러클리어 메시지 즉시 송신 + //udp->set(TG_ERROR_CLEAR,0xCECE); + bNeedErrorClear=true; + } + } + switch(errtype){ case error_type_onlypop: case error_type_popclr: case error_type_popnonclr: { - ErrorPopupDlg *dlg = new ErrorPopupDlg(QApplication::activeWindow(),MsgDesc,MsgTitle); - dlg->exec(); + if(m_bPopupShow==false){ + m_bPopupShow = true; + ErrorPopupDlg *dlg = new ErrorPopupDlg(QApplication::activeWindow(),MsgDesc,MsgTitle); + connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed())); + dlg->showFullScreen(); + m_nLastPopupidx = erridx; + } + else{ + if(erridx != m_nLastPopupidx && m_mapPopupList.contains(erridx) ==false){ + popup_list_item popitem; + popitem.bNeedClear = bNeedErrorClear; + popitem.strDesc = MsgDesc; + popitem.strTitle = MsgTitle; + m_mapPopupList.insert(erridx,popitem); + } + } break; } case error_type_engclr: @@ -525,18 +556,7 @@ void OvenStatistics::processErrorItems(error_item *item, error_exe_type errtype, default: break; } - if(errtype > error_type_clrsplit){ - //에러 클리어 명령 송신 - qDebug() << "send error clear command"; - if(errtype == error_type_engclr){ - //확인 후 송신 - bNeedErrorClear = true; - } - else{ - //에러클리어 메시지 즉시 송신 - udp->set(TG_ERROR_CLEAR,0xCECE); - } - } + } @@ -552,3 +572,26 @@ uint8_t OvenStatistics::getSensorTypeByIdx(uint16_t idx){ type_temp OvenStatistics::getCurSensorValueByIdx(uint16_t idx){ return curSensorValue[idx]; } + +void OvenStatistics::onErrorPopupClosed(void){ + qDebug() << "Error Popup Closed!"; + if(bNeedErrorClear) { + qDebug() << "send error clear command"; + bNeedErrorClear = false; + udp->set(TG_ERROR_CLEAR,0xCECE); + } + if(m_mapPopupList.isEmpty()==false){ + popup_list_item item; + item = m_mapPopupList.first(); + m_nLastPopupidx = m_mapPopupList.firstKey(); + bNeedErrorClear = item.bNeedClear; + ErrorPopupDlg *dlg = new ErrorPopupDlg(QApplication::activeWindow(),item.strDesc,item.strTitle); + m_mapPopupList.remove(m_nLastPopupidx); + connect(dlg,SIGNAL(destroyed(QObject*)),this, SLOT(onErrorPopupClosed())); + dlg->showFullScreen(); + } + else{ + m_bPopupShow = false; + m_nLastPopupidx = MAX_ERROR_TYPE_CNT; + } +} diff --git a/app/gui/oven_control/ovenstatics.h b/app/gui/oven_control/ovenstatics.h index 8680183..997b923 100644 --- a/app/gui/oven_control/ovenstatics.h +++ b/app/gui/oven_control/ovenstatics.h @@ -3,6 +3,7 @@ #include #include +#include #include "../../app-prime-modbus/include/all_share.h" #include "udphandler.h" #include "oven.h" @@ -160,6 +161,12 @@ typedef union }b; }realtime_data; +typedef struct _popup_list_item{ + QString strTitle; + QString strDesc; + bool bNeedClear; +}popup_list_item; + class OvenStatistics : public QObject { Q_OBJECT @@ -219,6 +226,10 @@ private: oven_control_t control; oven_state_t state; error_item* m_pLastErrItem; + QMap m_mapPopupList; + uint32_t m_nLastPopupidx; + bool m_bPopupShow; + @@ -229,6 +240,7 @@ private: bool bNeedErrorClear; bool bDataRefreshed; realtime_data realdata; + explicit OvenStatistics(QObject* parent); ~OvenStatistics(); void processSystemError(uint16_t errflag,time_t ltime); @@ -240,6 +252,7 @@ private: public slots: void onDataChanged(); void oneSecTimerFired(void); + void onErrorPopupClosed(void); }; #endif // OVENSTATICS_H diff --git a/app/gui/oven_control/realtimesensorwindow.cpp b/app/gui/oven_control/realtimesensorwindow.cpp index 88346e5..096e350 100644 --- a/app/gui/oven_control/realtimesensorwindow.cpp +++ b/app/gui/oven_control/realtimesensorwindow.cpp @@ -106,7 +106,7 @@ void RealtimeSensorWindow::reloadUi(void){ for(i=0;ilast_high_time !=0){ - timeptr = gmtime(&(m_arrSensorItems[i]->last_high_time)); + timeptr = localtime(&(m_arrSensorItems[i]->last_high_time)); strftime(strTime,64,"%y-%m-%d\n%H:%M:%S",timeptr); m_arrLbState[3][i]->setText(strTime); } -- 2.1.4