#include #include #include "fileprocessdlg.h" #include "ui_fileprocessdlg.h" #include "fileprocessor.h" #include "ovenstatics.h" #include 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())); } }