fileprocessdlg.cpp
3.46 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
#include <QTimer>
#include <QFile>
#include "fileprocessdlg.h"
#include "ui_fileprocessdlg.h"
#include "fileprocessor.h"
#include "ovenstatics.h"
#include <QDebug>
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();
}
void FileProcessDlg::infodataDownload(){
}
void FileProcessDlg::servicedataDownload(){
}
void FileProcessDlg::programDownload(){
}
void FileProcessDlg::programUpload(){
}
void FileProcessDlg::configDownload(){
QString strUsbPath;
if(FileProcessor::detectUSB(strUsbPath)){
strUsbPath.append("/config.ini");
qDebug() << strUsbPath;
if(QFile::copy("/prime/config/config.ini", strUsbPath)){
ui->ctrWjProcess->setValue(100);
ui->ctrLbRemainTime->setText("남은 예상 시간 : 0초");
ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
QTimer::singleShot(1000,this,SLOT(close()));
}
else{
ui->ctrLbRemainTime->setText(tr("다운로드에 실패하였습니다."));
QTimer::singleShot(1000,this,SLOT(close()));
}
}
else{
ui->ctrLbRemainTime->setText(tr("다운로드에 실패하였습니다."));
QTimer::singleShot(1000,this,SLOT(close()));
}
}
void FileProcessDlg::configUpload(){
QString strUsbPath;
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")){
OvenStatistics* ovs = OvenStatistics::getInstance();
ovs->srvdata->loadServiceData();
ui->ctrWjProcess->setValue(100);
ui->ctrLbRemainTime->setText(tr("남은 예상 시간 : 완료"));
QTimer::singleShot(1000,this,SLOT(close()));
}
else{
ui->ctrLbRemainTime->setText(tr("업로드에 실패하였습니다."));
QTimer::singleShot(1000,this,SLOT(close()));
}
}
else{
ui->ctrLbRemainTime->setText(tr("업로드에 실패하였습니다."));
QTimer::singleShot(1000,this,SLOT(close()));
}
}