Commit 00fd78596e70d5c646f24afcc61229e6565ff408

Authored by 고영탁
1 parent 0603c0b431
Exists in master and in 2 other branches fhd, fhd-demo

설정 기능 구현(엔지니어링 모드 적용)

- 날짜와 시간
 - 온도 단위
 - 실시간 포맷
app/gui/oven_control/config.cpp
@@ -192,7 +192,6 @@ QString Config::getValueString(Define::ConfigType idx){ @@ -192,7 +192,6 @@ QString Config::getValueString(Define::ConfigType idx){
192 case config_datetime: 192 case config_datetime:
193 qstrTemp = qdt.toString("yyyy.MM.dd hh:mm"); 193 qstrTemp = qdt.toString("yyyy.MM.dd hh:mm");
194 break; 194 break;
195 -  
196 case config_temptype: 195 case config_temptype:
197 if(configlist.items.temptype.d32 >=2 ) configlist.items.temptype.d32 = 0; 196 if(configlist.items.temptype.d32 >=2 ) configlist.items.temptype.d32 = 0;
198 qstrTemp = tr(temptype_menu[configlist.items.temptype.d32]); 197 qstrTemp = tr(temptype_menu[configlist.items.temptype.d32]);
app/gui/oven_control/configwindow.cpp
@@ -105,7 +105,7 @@ void ConfigWindow::onConfigBtnClicked(uint16_t id){ @@ -105,7 +105,7 @@ void ConfigWindow::onConfigBtnClicked(uint16_t id){
105 switch(id){ 105 switch(id){
106 case config_datetime: 106 case config_datetime:
107 dlg = new ConfigDateTimeDlg(this); 107 dlg = new ConfigDateTimeDlg(this);
108 - dlg->show(); 108 + dlg->exec();
109 if(m_nCurConfigPos != config_menu_favorite) reloadValue(); 109 if(m_nCurConfigPos != config_menu_favorite) reloadValue();
110 break; 110 break;
111 case config_enter_engineer_mode: 111 case config_enter_engineer_mode:
app/gui/oven_control/historylistwindow.cpp
1 #include <QDebug> 1 #include <QDebug>
2 #include <QStandardItemModel> 2 #include <QStandardItemModel>
3 #include <QHBoxLayout> 3 #include <QHBoxLayout>
  4 +#include <QDateTime>
4 #include <time.h> 5 #include <time.h>
5 #include "historylistwindow.h" 6 #include "historylistwindow.h"
6 #include "ui_historylistwindow.h" 7 #include "ui_historylistwindow.h"
7 #include "ovenstatics.h" 8 #include "ovenstatics.h"
  9 +#include "stringer.h"
8 10
9 11
10 12
@@ -100,12 +102,11 @@ void HistoryListWindow::reloadDataset(void){ @@ -100,12 +102,11 @@ void HistoryListWindow::reloadDataset(void){
100 item = err_items[m_nCurDpStartPos+i]; 102 item = err_items[m_nCurDpStartPos+i];
101 m_ctrlErrBtns[i]->setText(strTemp); 103 m_ctrlErrBtns[i]->setText(strTemp);
102 m_ctrlCountLabels[i] ->setText(strTemp.sprintf("%d",item->fired_cnt)); 104 m_ctrlCountLabels[i] ->setText(strTemp.sprintf("%d",item->fired_cnt));
103 - timeptr = localtime(&(item->first_fired));  
104 - strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr);  
105 - m_ctrlFirstTimeLabels[i]->setText(strTime);  
106 - timeptr = localtime(&(item->last_fried));  
107 - strftime(strTime,64,"%y-%m-%d %H:%M:%S",timeptr);  
108 - m_ctrlLastTimeLabels[i]->setText(strTime); 105 + QDateTime dt;
  106 + dt.setTime_t(item->first_fired);
  107 + m_ctrlFirstTimeLabels[i]->setText(Stringer::DateTimeString(dt, Stringer::datetime_string_type_oneline));
  108 + dt.setTime_t(item->last_fried);
  109 + m_ctrlLastTimeLabels[i]->setText(Stringer::DateTimeString(dt, Stringer::datetime_string_type_oneline));
109 } 110 }
110 } 111 }
111 else{ 112 else{
app/gui/oven_control/realtimesensorwindow.cpp
1 #include "realtimesensorwindow.h" 1 #include "realtimesensorwindow.h"
2 #include "ui_realtimesensorwindow.h" 2 #include "ui_realtimesensorwindow.h"
3 #include "ovenstatics.h" 3 #include "ovenstatics.h"
  4 +#include "stringer.h"
  5 +#include "QDateTime"
4 6
5 RealtimeSensorWindow::RealtimeSensorWindow(QWidget *parent) : 7 RealtimeSensorWindow::RealtimeSensorWindow(QWidget *parent) :
6 QMainWindow(parent), 8 QMainWindow(parent),
@@ -88,33 +90,35 @@ void RealtimeSensorWindow::reloadUi(void){ @@ -88,33 +90,35 @@ void RealtimeSensorWindow::reloadUi(void){
88 temp_temp = ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]); 90 temp_temp = ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]);
89 91
90 if(ovs->getSensorTypeByIdx(m_arrSensorItemIdxs[i]) == 2 ) 92 if(ovs->getSensorTypeByIdx(m_arrSensorItemIdxs[i]) == 2 )
91 - strTemp.sprintf("%d℃",ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]).itemp/10); 93 + strTemp = Stringer::temperature(ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]).itemp/10);// strTemp.sprintf("%d℃",ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]).itemp/10);
92 else if(ovs->getSensorTypeByIdx(m_arrSensorItemIdxs[i]) == 1 ) 94 else if(ovs->getSensorTypeByIdx(m_arrSensorItemIdxs[i]) == 1 )
93 - strTemp.sprintf("%d℃",ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]).utemp);  
94 - else strTemp.sprintf("%d℃",ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]).itemp); 95 + strTemp = Stringer::temperature(ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]).utemp);
  96 + else strTemp = Stringer::temperature(ovs->getCurSensorValueByIdx(m_arrSensorItemIdxs[i]).itemp);
95 m_arrLbState[0][i]->setText(strTemp); 97 m_arrLbState[0][i]->setText(strTemp);
96 } 98 }
97 99
98 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){ 100 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){
99 if(ovs->getSensorTypeByIdx(m_arrSensorItemIdxs[i]) == 2 ) 101 if(ovs->getSensorTypeByIdx(m_arrSensorItemIdxs[i]) == 2 )
100 - strTemp.sprintf("%d℃",m_arrSensorItems[i]->high_temp.itemp/10); 102 + strTemp = Stringer::temperature(m_arrSensorItems[i]->high_temp.itemp/10);
101 else if(ovs->getSensorTypeByIdx(m_arrSensorItemIdxs[i]) == 1) 103 else if(ovs->getSensorTypeByIdx(m_arrSensorItemIdxs[i]) == 1)
102 - strTemp.sprintf("%d℃",m_arrSensorItems[i]->high_temp.utemp);  
103 - else strTemp.sprintf("%d℃",m_arrSensorItems[i]->high_temp.itemp); 104 + strTemp = Stringer::temperature(m_arrSensorItems[i]->high_temp.utemp);
  105 + else strTemp= Stringer::temperature(m_arrSensorItems[i]->high_temp.itemp);
104 m_arrLbState[1][i]->setText(strTemp); 106 m_arrLbState[1][i]->setText(strTemp);
105 } 107 }
106 108
107 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){ 109 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){
108 - strTemp.sprintf("%d℃", m_arrCriticalValue[i]); 110 + strTemp = Stringer::temperature(m_arrCriticalValue[i]);
109 m_arrLbState[2][i]->setText(strTemp); 111 m_arrLbState[2][i]->setText(strTemp);
110 } 112 }
111 113
112 114
113 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){ 115 for(i=0;i<REALSENSOR_CONTROL_LIST_ITEM_MAX;i++){
114 if(m_arrSensorItems[i]->last_high_time !=0){ 116 if(m_arrSensorItems[i]->last_high_time !=0){
115 - timeptr = localtime(&(m_arrSensorItems[i]->last_high_time));  
116 - strftime(strTime,64,"%y-%m-%d\n%H:%M:%S",timeptr);  
117 - m_arrLbState[3][i]->setText(strTime); 117 + QDateTime dt_tm;
  118 + dt_tm.setTime_t(m_arrSensorItems[i]->last_high_time);
  119 + //timeptr = localtime(&(m_arrSensorItems[i]->last_high_time));
  120 + //strftime(strTime,64,"%y-%m-%d\n%H:%M:%S",timeptr);
  121 + m_arrLbState[3][i]->setText(Stringer::DateTimeString(dt_tm));
118 } 122 }
119 else{ 123 else{
120 m_arrLbState[3][i]->setText("-"); 124 m_arrLbState[3][i]->setText("-");
app/gui/oven_control/stringer.cpp
@@ -189,3 +189,21 @@ QString Stringer::unusedTemperature(QString style) @@ -189,3 +189,21 @@ QString Stringer::unusedTemperature(QString style)
189 return style + lightSpan.arg("℃"); 189 return style + lightSpan.arg("℃");
190 } 190 }
191 } 191 }
  192 +
  193 +
  194 +QString Stringer::DateTimeString(const QDateTime &dt_tm, datetime_string_type type){
  195 + QString strTemp;
  196 + Define::config_item item = Config::getInstance()->getConfigValue(Define::config_time_type);
  197 + switch(item.d32){
  198 + case Define::time_type_12h:
  199 + if(type == datetime_string_type_oneline) strTemp = dt_tm.toString("yy-MM-dd a hh:mm" );
  200 + else strTemp = dt_tm.toString("yy-MM-dd\na hh:mm" );
  201 + break;
  202 + case Define::time_type_24h:
  203 + default:
  204 + if(type == datetime_string_type_oneline) strTemp = dt_tm.toString("yy-MM-dd HH:mm" );
  205 + else strTemp = dt_tm.toString("yy-MM-dd\nHH:mm" );
  206 + break;
  207 + }
  208 + return strTemp;
  209 +}
app/gui/oven_control/stringer.h
@@ -3,8 +3,15 @@ @@ -3,8 +3,15 @@
3 3
4 4
5 #include <QtCore> 5 #include <QtCore>
  6 +#include <QDateTime>
6 7
7 namespace Stringer { 8 namespace Stringer {
  9 +
  10 +enum datetime_string_type{
  11 + datetime_string_type_oneline=0,
  12 + datetime_string_type_twoline
  13 +};
  14 +
8 const QString fontSize14("\ 15 const QString fontSize14("\
9 <style>\ 16 <style>\
10 span { font-size: 14pt; }\ 17 span { font-size: 14pt; }\
@@ -21,6 +28,9 @@ QString temperature(int current, int target); @@ -21,6 +28,9 @@ QString temperature(int current, int target);
21 QString temperature(int current, int target, QString style); 28 QString temperature(int current, int target, QString style);
22 QString unusedTemperature(); 29 QString unusedTemperature();
23 QString unusedTemperature(QString style); 30 QString unusedTemperature(QString style);
  31 +QString DateTimeString(const QDateTime &dt_tm, datetime_string_type type=datetime_string_type_twoline);
  32 +
  33 +
24 } 34 }
25 35
26 #endif // STRINGER_H 36 #endif // STRINGER_H