Blame view

app/gui/oven_control/fileprocessdlg.cpp 19.9 KB
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
1
  #include <QTimer>
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
2
  #include <unistd.h>
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
3
4
5
6
  #include "fileprocessdlg.h"
  #include "ui_fileprocessdlg.h"
  #include "fileprocessor.h"
  #include "ovenstatics.h"
7fa4fdb0e   고영탁   인포 데이터 다운로드 기능 개발
7
  #include "stringer.h"
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
8
  #include <QDebug>
7fa4fdb0e   고영탁   인포 데이터 다운로드 기능 개발
9
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
10
11
12
13
14
  #define ERROR_LOG_FILE_TOP  "/GasErrorHistoryTop.csv"
  #define ERROR_LOG_FILE_STEAM  "/GasErrorHistorySteam.csv"
  #define ERROR_LOG_FILE_BOTTOM  "/GasErrorHistoryBottom.csv"
  #define ERROR_LOG_FILE_TOTAL    "/TotalError.csv"
  #define SERVICE_DATA_FILE   "/ServiceData.csv"
7fa4fdb0e   고영탁   인포 데이터 다운로드 기능 개발
15
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
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
  FileProcessDlg::FileProcessDlg(QWidget *parent, ConfigType type, bool isDown) :
      QDialog(parent),
      ui(new Ui::FileProcessDlg)
  {
      ui->setupUi(this);
      setAttribute(Qt::WA_DeleteOnClose);
      setAttribute(Qt::WA_TranslucentBackground);
      setWindowFlags(Qt::FramelessWindowHint);
  
      ui->ctrWjProcess->setMinimum(0);
      ui->ctrWjProcess->setMaximum(100);
  
      if(isDown){
          QPixmap pxmap;
          pxmap.load(":/images/config/102_usb_upload_icon.png");
          ui->label_2->setPixmap(pxmap);
      }
  
      switch(type){
      case config_info_data_download:
          QTimer::singleShot(100,this,SLOT(infodataDownload()));
          break;
      case config_service_data_download:
          QTimer::singleShot(100,this,SLOT(servicedataDownload()));
          break;
      case config_program_download:
          QTimer::singleShot(100,this,SLOT(programDownload()));
          break;
      case config_program_upload:
          QTimer::singleShot(100,this,SLOT(programUpload()));
          break;
      case config_set_download:
          QTimer::singleShot(100,this,SLOT(configDownload()));
          break;
      case config_set_upload:
          QTimer::singleShot(100,this,SLOT(configUpload()));
          break;
      default:
          QTimer::singleShot(200,this,SLOT(deleteLater()));
          break;
      }
  }
  
  FileProcessDlg::~FileProcessDlg()
  {
      delete ui;
  }
  
  void FileProcessDlg::on_ctrBtnCancel_clicked()
  {
      close();
  }
7fa4fdb0e   고영탁   인포 데이터 다운로드 기능 개발
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
  void FileProcessDlg::saveHistoryLineData(QTextStream &out, uint16_t i,  uint16_t fired_cnt, time_t first_fired, time_t last_fried){
      QString strLine;
      QDateTime dt;
      //for(int i =0;i<m_arrErrorMaxIdx[(uint16_t)type];i++){
     //     err_item = &(ovenst->srvdata->err_log.values[m_arrErrorIdxs[type][i]]);
          strLine = tr("erro%1,").arg(i);
          if(first_fired == 0){
              strLine += "-,0,-";
          }
          else{
              dt.setTime_t(first_fired);
              strLine+= Stringer::DateTimeString(dt,Stringer::datetime_string_type_oneline) + ",";
              strLine += QString("%1").arg(fired_cnt) + ",";
              dt.setTime_t(last_fried);
              strLine += Stringer::DateTimeString(dt,Stringer::datetime_string_type_oneline) + ",";
          }
          out << strLine << "
  ";
          qDebug() << strLine;
      //}
  }
  
  void FileProcessDlg::saveHistoryTotalData(QTextStream &out){
      int i = 0;
      error_item *item;
      time_t firsttimebuf=0,lasttimebuf=0;
      uint16_t firecntbuf=0;
      QString strLine;
      QDateTime dt;
      OvenStatistics *ovenst = OvenStatistics::getInstance();
  
      //01 상부 점화 장치 데이터 초기화
  //    for(i=0;i<m_arrErrorMaxIdx[ERROR_HISTORY_UPPERBUNNER];i++){
  //        item = &(ovenst->srvdata->err_log.values[m_arrErrorIdxs[ERROR_HISTORY_UPPERBUNNER][i]]);
  //       if(i==0) {firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;}
  //       else{
  //            if( firsttimebuf > item->first_fired && item->first_fired != 0 ) firsttimebuf = item->first_fired;
  //            if( lasttimebuf < item->last_fried ) lasttimebuf = item->last_fried;
  //            firecntbuf += item->fired_cnt;
  //       }
  
  //    }
  //    total_items[0].fired_cnt = firecntbuf;
  //    total_items[0].first_fired = firsttimebuf;
  //    total_items[0].last_fried = lasttimebuf;
  
  
  }
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
116
  void FileProcessDlg::infodataDownload(){
7fa4fdb0e   고영탁   인포 데이터 다운로드 기능 개발
117
118
119
120
121
122
123
124
125
      QString strUsbPath;
      QString strFile;
      QFile file;
      error_item *item;
      OvenStatistics *ovenst = OvenStatistics::getInstance();
      time_t firsttimebuf=0,lasttimebuf=0;
      uint16_t firecntbuf=0;
      uint16_t erridx = 0;
      int i;
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
126
7fa4fdb0e   고영탁   인포 데이터 다운로드 기능 개발
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
      if(FileProcessor::detectUSB(strUsbPath)){
          //Top
          strFile = strUsbPath + ERROR_LOG_FILE_TOP;
          qDebug() << strUsbPath;
          file.setFileName(strFile);
          if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){
              QTextStream out(&file);
              out << tr("Gas Error History
  ") << "Top Ignition Box" <<"
  ";
              out << tr("no,") << tr("First Appearance,") << tr("Counter,") << tr("Last Appearance
  ");
              for(i =0;i<m_arrErrorMaxIdx[ERROR_HISTORY_UPPERBUNNER];i++){
                  item = &(ovenst->srvdata->err_log.values[m_arrErrorIdxs[ERROR_HISTORY_UPPERBUNNER][i]]);
                  saveHistoryLineData(out,i+1,item->fired_cnt,item->first_fired,item->last_fried);
              }
              file.close();
          }
          ui->ctrWjProcess->setValue(25);
          ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초"));
          //Bottom
          strFile = strUsbPath + ERROR_LOG_FILE_BOTTOM;
          qDebug() << strUsbPath;
          file.setFileName(strFile);
          if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){
              QTextStream out(&file);
              out << tr("Gas Error History
  ") << "Bottom Ignition Box" <<"
  ";
              out << tr("no,") << tr("First Appearance,") << tr("Counter,") << tr("Last Appearance
  ");
              for(i =0;i<m_arrErrorMaxIdx[ERROR_HISTORY_LOWERBUNNER];i++){
                  item = &(ovenst->srvdata->err_log.values[m_arrErrorIdxs[ERROR_HISTORY_LOWERBUNNER][i]]);
                  saveHistoryLineData(out,i+1,item->fired_cnt,item->first_fired,item->last_fried);
              }
              file.close();
          }
          ui->ctrWjProcess->setValue(50);
          ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초"));
          //Steam
          strFile = strUsbPath + ERROR_LOG_FILE_STEAM;
          qDebug() << strUsbPath;
          file.setFileName(strFile);
          if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){
              QTextStream out(&file);
              out << tr("Gas Error History
  ") << "Steam Ignition Box" <<"
  ";
              out << tr("no,") << tr("First Appearance,") << tr("Counter,") << tr("Last Appearance
  ");
              for(i =0;i<m_arrErrorMaxIdx[ERROR_HISTORY_STEAMBUNNER];i++){
                  item = &(ovenst->srvdata->err_log.values[m_arrErrorIdxs[ERROR_HISTORY_STEAMBUNNER][i]]);
                  saveHistoryLineData(out,i+1,item->fired_cnt,item->first_fired,item->last_fried);
              }
              file.close();
          }
          ui->ctrWjProcess->setValue(75);
          ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초"));
          //Total
          strFile = strUsbPath + ERROR_LOG_FILE_TOTAL;
          qDebug() << strUsbPath;
          file.setFileName(strFile);
          if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){
              QTextStream out(&file);
              out << tr("Service Error History
  
  ");
              out << tr("no,") << tr("First Appearance,") << tr("Counter,") << tr("Last Appearance
  ");
              //01 상부 점화 장치 데이터 초기화
               firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              for(i=0;i<m_arrErrorMaxIdx[ERROR_HISTORY_UPPERBUNNER];i++){
                  item = &(ovenst->srvdata->err_log.values[m_arrErrorIdxs[ERROR_HISTORY_UPPERBUNNER][i]]);
                 if(i==0) {firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;}
                 else{
                      if( (firsttimebuf > item->first_fired && item->first_fired != 0) || firsttimebuf == 0 ) firsttimebuf = item->first_fired;
                      if( lasttimebuf < item->last_fried ) lasttimebuf = item->last_fried;
                      firecntbuf += item->fired_cnt;
                 }
              }
              saveHistoryLineData(out,erridx+1, firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              //02 스팀 점화 장치 데이터 초기화
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              for(i=0;i<m_arrErrorMaxIdx[ERROR_HISTORY_STEAMBUNNER];i++){
                  item = &(ovenst->srvdata->err_log.values[m_arrErrorIdxs[ERROR_HISTORY_STEAMBUNNER][i]]);
                 if(i==0) {firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;}
                 else{
                      if((firsttimebuf > item->first_fired && item->first_fired != 0) || firsttimebuf == 0 ) firsttimebuf = item->first_fired;
                      if( lasttimebuf < item->last_fried ) lasttimebuf = item->last_fried;
                      firecntbuf += item->fired_cnt;
                 }
              }
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              //03 하부 점화 장치 데이터 초기화
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              for(i=0;i<m_arrErrorMaxIdx[ERROR_HISTORY_LOWERBUNNER];i++){
                  item = &(ovenst->srvdata->err_log.values[m_arrErrorIdxs[ERROR_HISTORY_LOWERBUNNER][i]]);
                 if(i==0) {firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;}
                 else{
                      if((firsttimebuf > item->first_fired && item->first_fired != 0) || firsttimebuf == 0 ) firsttimebuf = item->first_fired;
                      if( lasttimebuf < item->last_fried ) lasttimebuf = item->last_fried;
                      firecntbuf += item->fired_cnt;
                 }
              }
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              //04 WATER
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              item = &(ovenst->srvdata->err_log.items.inner_temp_fail);
              firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;
              item = &(ovenst->srvdata->err_log.items.qunching_temp_fail);
              if( firsttimebuf > item->first_fired && item->first_fired != 0 ) firsttimebuf = item->first_fired;
              if( lasttimebuf < item->last_fried ) lasttimebuf = item->last_fried;
              firecntbuf += item->fired_cnt;
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              //05 구성품
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              //07 B1 센서 에러
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              item = &(ovenst->srvdata->err_log.items.inner_temp_high_alarm);
              firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              //08 B2 센서 에러
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              item = &(ovenst->srvdata->err_log.items.qunching_temp_high_alarm);
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              //10 B4 센서 에러
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              item = &(ovenst->srvdata->err_log.items.wall_temp1_high_alarm);
              firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              //11 B5 센서 에러
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              item = &(ovenst->srvdata->err_log.items.steam_gen_temp_high_alram);
              firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              firecntbuf = 0;firsttimebuf =  0; lasttimebuf=0;
              item = &(ovenst->srvdata->err_log.items.water_level_sensor_fail);
              firsttimebuf = item->first_fired;lasttimebuf = item->last_fried;firecntbuf=item->fired_cnt;
              saveHistoryLineData(out, erridx,firecntbuf,firsttimebuf,lasttimebuf);erridx++;
              file.close();
          }
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
269
          sync();
7fa4fdb0e   고영탁   인포 데이터 다운로드 기능 개발
270
271
272
273
          ui->ctrWjProcess->setValue(100);
          ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
          QTimer::singleShot(1000,this,SLOT(close()));
      }
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
274
275
276
  }
  
  void FileProcessDlg::servicedataDownload(){
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
      QString strUsbPath;
      QString strHeader = "no,name,time
  ";
      QString strFile;
      QFile file;
      error_item *item;
      uint32_t timetemp, totaltime=0;
      int i = 1;
      OvenStatistics *ovs = OvenStatistics::getInstance();
      if(FileProcessor::detectUSB(strUsbPath)){
          strFile = strUsbPath + SERVICE_DATA_FILE;
          file.setFileName(strFile);
          if(file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)){
              QTextStream out(&file);
              out.setCodec("UTF-8");
              out<< strHeader;
              timetemp = ovs->srvdata->use_log.items.steam_heat/3600;
              out << i++ << tr(",Steam Heating Time,") << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.dry_heat/3600;
              out << i++ << tr(",Hot Air Heating Time,") << timetemp << "h
  ";
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
299
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
              i=1;out<< strHeader;
              timetemp = ovs->srvdata->use_log.items.cook_dry_mode/3600;
              totaltime+= ovs->srvdata->use_log.items.cook_dry_mode;
              out << i++ << tr(",Hot Air Mode,") << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.cook_steam_mode/3600;
              totaltime +=  ovs->srvdata->use_log.items.cook_steam_mode;
              out << i++ << tr(",Steam Mode,") << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.cook_combi_mode/3600;
              totaltime += ovs->srvdata->use_log.items.cook_combi_mode;
              out << i++ << tr(",Combi Mode,") << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.wash_mode_nocleanser/3600;
              totaltime += ovs->srvdata->use_log.items.wash_mode_nocleanser;
              out << i++ << tr(",세제없이 헹굼,").toUtf8() << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.wash_mode_simple/3600;
              totaltime += ovs->srvdata->use_log.items.wash_mode_simple;
              out << i++ << tr(",간이세척,").toUtf8() << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.wash_mode_standard/3600;
              totaltime += ovs->srvdata->use_log.items.wash_mode_standard;
              out << i++ << tr(",표준세척,").toUtf8() << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.wash_mode_strong/3600;
              totaltime +=  ovs->srvdata->use_log.items.wash_mode_strong;
              out << i++ << tr(",강세척").toUtf8() << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.wash_mode_speed/3600;
              totaltime +=ovs->srvdata->use_log.items.wash_mode_speed;
              out << i++ << tr(",고속세척,").toUtf8() << timetemp << "h
  ";
              timetemp = ovs->srvdata->use_log.items.cooldown_mode/3600;
              totaltime += ovs->srvdata->use_log.items.cooldown_mode;
              out << i++ << tr(",쿨다운,").toUtf8() << timetemp << "h
  ";
              timetemp = totaltime/3600;
              out << i++ << tr(",전체작동시간,").toUtf8() << timetemp << "h
  ";
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
340
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
              i=1;out<< strHeader;
              timetemp = ovs->srvdata->use_log.items.door_open/60;
              out << i++ << tr(",도어 Open,").toUtf8() << timetemp << "min
  ";
              timetemp = ovs->srvdata->use_log.items.dv_open/60;
              out << i++ << tr(",볼밸브 Open,").toUtf8() << timetemp << "min
  ";
              timetemp = ovs->srvdata->use_log.items.ssv_open/60;
              out << i++ << tr(",S/G 급수 솔레노이드,").toUtf8() << timetemp << "min
  ";
              timetemp = ovs->srvdata->use_log.items.qnv_open/60;
              out << i++ << tr(",퀀칭 솔레노이드,").toUtf8() << timetemp << "min
  ";
              timetemp = ovs->srvdata->use_log.items.snv_open/60;
              out << i++ << tr(",고내살수 노즐 솔레노이드 ,").toUtf8() << timetemp << "min
  ";
              timetemp = 0;
              out << i++ << tr(",호스릴 솔레노이드,").toUtf8() << timetemp << "min
  ";
              timetemp = ovs->srvdata->use_log.items.ssp_open/60;
              out << i++ << tr(",세제공급장치,").toUtf8() << timetemp << "min
  ";
              timetemp = ovs->srvdata->use_log.items.hdm_open/60;
              out << i++ << tr(",배습댐퍼,").toUtf8() << timetemp << "min
  ";
              timetemp = ovs->srvdata->use_log.items.dp_open/60;
              out << i++ << tr(",소형펌프모터,").toUtf8() << timetemp << "min
  ";
              timetemp = ovs->srvdata->use_log.items.unp_open/60;
              out << i++ << tr(",중형펌프모터,").toUtf8() << timetemp << "min
  ";
              ui->ctrWjProcess->setValue(100);
              ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
              file.close();
              sync();
              QTimer::singleShot(1000,this,SLOT(close()));
          }
      }
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
  }
  
  void FileProcessDlg::programDownload(){
  
  }
  
  void FileProcessDlg::programUpload(){
  
  }
  
  void FileProcessDlg::configDownload(){
      QString strUsbPath;
      if(FileProcessor::detectUSB(strUsbPath)){
          strUsbPath.append("/config.ini");
          qDebug() << strUsbPath;
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
394
395
396
          QFile file;
          file.setFileName(strUsbPath);
          if(file.exists()) file.remove();
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
397
          if(QFile::copy("/prime/config/config.ini", strUsbPath)){
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
398
399
400
401
402
403
404
405
406
407
408
409
410
411
              sync();
              ui->ctrWjProcess->setValue(50);
              ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초"));
          }
          else{
              ui->ctrLbRemainTime->setText(tr("설정 다운로드에 실패하였습니다."));
              QTimer::singleShot(1000,this,SLOT(close()));
              return;
          }
          strUsbPath.replace("/config.ini","/favorite.ini");
          file.setFileName(strUsbPath);
          if(file.exists()) file.remove();
          if(QFile::copy("/prime/config/favorite.ini", strUsbPath)){
              sync();
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
412
413
414
415
416
417
              ui->ctrWjProcess->setValue(100);
              ui->ctrLbRemainTime->setText("남은 예상 시간 : 0초");
              ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
              QTimer::singleShot(1000,this,SLOT(close()));
          }
          else{
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
418
              ui->ctrLbRemainTime->setText(tr("즐겨찾기 다운로드에 실패하였습니다."));
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
419
420
421
422
              QTimer::singleShot(1000,this,SLOT(close()));
          }
      }
      else{
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
423
          ui->ctrLbRemainTime->setText(tr("USB 인식을 실패하였습니다."));
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
424
425
426
427
428
429
          QTimer::singleShot(1000,this,SLOT(close()));
      }
  }
  
  void FileProcessDlg::configUpload(){
      QString strUsbPath;
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
430
      Config *cfg = Config::getInstance();
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
431
432
433
434
435
436
      if(FileProcessor::detectUSB(strUsbPath)){
          strUsbPath.append("/config.ini");
          qDebug() << strUsbPath;
          QFile file("/prime/config/config.ini");
          file.remove();
          if(QFile::copy( strUsbPath , "/prime/config/config.ini")){
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
              sync();
              cfg->loadConfig();
              cfg->applyConfig();
              ui->ctrWjProcess->setValue(50);
              ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 1초"));
          }
          else{
              ui->ctrLbRemainTime->setText(tr("설정 업로드에 실패하였습니다."));
              QTimer::singleShot(1000,this,SLOT(close()));
              return;
          }
          QFile file2("/prime/config/favorite.ini");
          file2.remove();
          strUsbPath.replace("/config.ini", "/favorite.ini");
          qDebug() << strUsbPath;
          if(QFile::copy( strUsbPath , "/prime/config/favorite.ini")){
              sync();
              cfg->loadFavorite();
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
455
456
457
458
459
              ui->ctrWjProcess->setValue(100);
              ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
              QTimer::singleShot(1000,this,SLOT(close()));
          }
          else{
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
460
              ui->ctrLbRemainTime->setText(tr("즐겨찾기 업로드에 실패하였습니다."));
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
461
462
463
464
              QTimer::singleShot(1000,this,SLOT(close()));
          }
      }
      else{
1fe2b9973   고영탁   시스템 관리 기능 버그 수정
465
          ui->ctrLbRemainTime->setText(tr("USB 인식을 실패하였습니다."));
1f685a2a5   고영탁   설정 시스템 관리 기능 개발
466
467
468
          QTimer::singleShot(1000,this,SLOT(close()));
      }
  }