config.cpp
7.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#include <QDebug>
#include <QDateTime>
#include "config.h"
#include "configdatetimedlg.h"
#include "configlanguagedlg.h"
#include "configtemptypedlg.h"
#include "configbacklightdlg.h"
#include "configtimeformatdlg.h"
#include "configresttimeformatdlg.h"
#include "configmastervolumedlg.h"
#include "configsoundselelectdlg.h"
#include "yesnopopupdlg.h"
#include "usbcheckpopupdlg.h"
#include "configipdlg.h"
#include "configfileprocessdlg.h"
#include "confighalfenergydlg.h"
#include "config1digitsetdlg.h"
#include "configdutywashdlg.h"
using namespace Define;
Config* Config::instance = NULL;
Config::Config(QObject *parent) : QObject(parent)
{
memcpy(config_format,config_format_kr,MAX_CONFIG_COUNT*64);
// m_setFavorite.insert(2);
// m_setFavorite.insert(3);
// m_setFavorite.insert(1);
// QSetIterator<uint32_t> i = getConstBeginFavorite();
// while(i.hasNext()){
// temp = i.next();
// qDebug() << temp;
// }
// while(i.hasPrevious()){
// temp = i.previous();
// qDebug() << temp;
// }
}
Config::~Config(){
}
Config* Config::getInstance(QObject *parent){
if(instance ==NULL){
instance = new Config(parent);
}
return instance;
}
bool Config::saveConfig(){
return false;
}
bool Config::loadConfig(){
return false;
}
Define::config_item Config::getConfigValue(Define::ConfigType idx){
return configlist.values[idx];
}
void Config::setConfigValue(Define::ConfigType idx, Define::config_item& itemdata){
configlist.values[idx] = itemdata;
}
QString Config::getValueString(Define::ConfigType idx){
QString qstrTemp="";
if( (config_data_type[(uint32_t)idx] & 0x80) ==0){
switch(config_data_type[(uint32_t)idx]){
case 0:
qstrTemp.sprintf(config_format[(uint32_t)idx], configlist.values[(uint32_t)idx].d32);
break;
case 1:
qstrTemp.sprintf(config_format[(uint32_t)idx], configlist.values[(uint32_t)idx].f32);
break;
case 2:
qstrTemp = tr(config_format[(uint32_t)idx]);
case 3:
qstrTemp.sprintf(config_format[(uint32_t)idx], configlist.values[(uint32_t)idx].d32+1);
break;
}
return qstrTemp;
}
QDateTime qdt = QDateTime::currentDateTime();
switch(idx){
case config_language:
if(configlist.items.language.d32 >=3) configlist.items.language.d32 = 0;
qstrTemp = tr(language_menu[configlist.items.language.d32]);
break;
case config_datetime:
qstrTemp = qdt.toString("yyyy.MM.dd hh:mm");
break;
case config_temptype:
if(configlist.items.temptype.d32 >=2 ) configlist.items.temptype.d32 = 0;
qstrTemp = tr(temptype_menu[configlist.items.temptype.d32]);
break;
case config_best_dish_weight:
if(configlist.items.best_dish_weight.d32 >=4) configlist.items.best_dish_weight.d32 = 0;
qstrTemp = tr(best_dish_weight_menu[configlist.items.best_dish_weight.d32]);
break;
case config_party_dish_weight:
if(configlist.items.party_dish_weight.d32 >=4) configlist.items.party_dish_weight.d32 = 0;
qstrTemp = tr(best_dish_weight_menu[configlist.items.party_dish_weight.d32]);
break;
case config_time_type:
if(configlist.items.time_type.d32 >=2) configlist.items.time_type.d32 = 0;
qstrTemp = tr(time_type_menu[configlist.items.time_type.d32]);
break;
case config_resttime_format:
if(configlist.items.resttime_format.d32 >=2) configlist.items.resttime_format.d32 = 0;
qstrTemp = tr(rest_time_type_menu[configlist.items.resttime_format.d32]);
break;
case config_ip:
qstrTemp.sprintf("%3d.%3d.%3d.%3d", configlist.items.ip.d8.d8_0,configlist.items.ip.d8.d8_1,configlist.items.ip.d8.d8_2,configlist.items.ip.d8.d8_3);
case config_set_half_energy:
if(configlist.items.set_half_energy.d32 >=2) configlist.items.set_half_energy.d32 = 0;
qstrTemp = tr(on_off_menu[configlist.items.set_half_energy.d32]);
break;
case config_duty_wash:
if(configlist.items.duty_wash.d32 >=2) configlist.items.duty_wash.d32 = 0;
qDebug() << "duty wash is "<<configlist.items.duty_wash.d32;
qstrTemp = tr(active_on_off_menu[configlist.items.duty_wash.d32]);
break;
default:
qstrTemp = "";
break;
}
return qstrTemp;
}
QString Config::getTitleString(Define::ConfigType idx){
QString strTemp ="";
strTemp = tr(config_title[idx]);
return strTemp;
}
bool Config::isFavorite(Define::ConfigType idx){
return m_setFavorite.contains((uint32_t)idx);
return true;
}
QSetIterator<uint32_t> Config::getConstBeginFavorite(){
QSetIterator<uint32_t> i(m_setFavorite);
return i;
}
QList<uint32_t> Config::getConstSortedFavorite(){
QList<uint32_t> list = m_setFavorite.toList();
qSort(list);
return list;
}
bool Config::loadFavorite(void){
return false;
}
bool Config::saveFavorite(void){
return false;
}
void Config::insertFavorite(Define::ConfigType idx){
m_setFavorite.insert((uint32_t)idx);
}
void Config::removeFavorite(Define::ConfigType idx){
m_setFavorite.remove((uint32_t)idx);
}
QString Config::getDateTimeString(uint32_t sec){
Config* ins = getInstance();
QString strTemp="";
if(ins->configlist.items.temptype.d32==0){
}
return strTemp;
}
QString Config::getTempString(int cel_temp){
Config* ins = getInstance();
QString strTemp="";
if(ins->configlist.items.temptype.d32==0){
}
return strTemp;
}
void Config::execConfigWindow(QWidget *parent, Define::ConfigType idx){
QDialog *dlg;
bool bUsbDetect = false;
switch(idx){
case config_datetime:
dlg = new ConfigDateTimeDlg(parent);
break;
case config_language:
dlg = new ConfigLanguageDlg(parent);
break;
case config_temptype:
dlg = new ConfigTempTypeDlg(parent);
break;
case config_backlight:
dlg = new ConfigBackLightDlg(parent);
break;
case config_time_type:
dlg = new ConfigTimeFormatDlg(parent);
break;
case config_resttime_format:
dlg = new configResttimeFormatDlg(parent);
break;
case config_marster_vol:
dlg = new ConfigMasterVolumeDlg(parent);
break;
case config_keypad_sound1:
case config_keypad_sound2:
case config_request_loadexec:
case config_programstep_finish:
case config_cooktime_finish:
case config_stoperror_distinguish:
dlg = new ConfigSoundSelelectDlg(parent,idx);
break;
case config_sound_factory_reset:
dlg = new YesNoPopupDlg(parent, tr("모든 음향설정 값을 공장초기화\r하시겠습니까?"));
break;
case config_ip:
dlg=new ConfigIpDlg(parent);
break;
case config_info_data_download:
case config_service_data_download:
case config_program_download:
case config_set_download:
if(!bUsbDetect){
dlg = new UsbCheckPopupDlg(parent);
dlg->exec();
}
dlg = new ConfigFileProcessDlg(parent,idx);
dlg->exec();
return;
case config_set_upload:
case config_program_upload:
if(!bUsbDetect){
dlg = new UsbCheckPopupDlg(parent);
dlg->exec();
}
dlg = new ConfigFileProcessDlg(parent,idx,false);
dlg->exec();
return;
case config_set_half_energy:
dlg = new ConfigHalfEnergyDlg(parent);
break;
case config_set_auto_darkness:
dlg = new Config1DigitSetDlg(parent,idx);
break;
case config_duty_wash:
dlg = new ConfigDutyWashDlg(parent);
break;
default:
dlg=NULL;
}
if(dlg == NULL) return;
dlg->setWindowModality(Qt::WindowModal);
dlg->exec();
if(dlg->result() == QDialog::Accepted){
qDebug()<<"Accepted";
if(idx == config_sound_factory_reset){
//Sound Fatory Reset
qDebug() << "Process Sound Config Reset";
}
}
else{
qDebug() << "rejected";
}
}