Commit c3b0bdeacf14f54bca6db3e4ea00b377681f2890

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

설정 프로그램 업로드 버그 수정

- 파일 목록 리스트 복사 루틴 디버그
app/gui/oven_control/fileprocessdlg.cpp
... ... @@ -48,20 +48,32 @@ void ProgramCopyWorker::workerMain(){
48 48 qDebug() << "Target Path is " << m_strDestDir;
49 49  
50 50  
51   - foreach(QString filepath, m_arrSrcFileList){
  51 + foreach(QString strinfo, m_arrSrcFileList){
  52 + QString filepath = strinfo.left(strinfo.indexOf(',',0));
52 53 QFileInfo finfo(filepath);
53   - nTotalFileSize+= finfo.size();
  54 + nTotalFileSize+= finfo.size();
54 55 }
  56 + qDebug() << "File List info : count = " << m_arrSrcFileList.size() << ", File Total Size = " << nTotalFileSize;
55 57  
56 58 foreach(QString srcpath, m_arrSrcDirList){
57 59 nTotalFileSize += FileProcessor::getDirSize(srcpath);
58 60 }
59   - qDebug()<<"Total Size : " << nTotalFileSize;
  61 + qDebug() << " Dir List info : count = " << m_arrSrcFileList.size() << ", File Total Size = " << nTotalFileSize;
  62 + if(nTotalFileSize <=0 ){
  63 + emit finished();
  64 + progressed(0,0);
  65 + return;
  66 + }
  67 +
60 68  
61   - foreach(QString filepath, m_arrSrcFileList){
  69 + foreach(QString strinfo, m_arrSrcFileList){
  70 + QString filepath = strinfo.left(strinfo.indexOf(',',0));
  71 + QString destfiledir = strinfo.right(strinfo.size() - (strinfo.indexOf(',',0)+1));
  72 + QDir destdir(destfiledir);
  73 + if(destdir.exists() == false) destdir.mkpath(destfiledir);
62 74 QFileInfo finfo(filepath);
63 75 srcFilepath = filepath;
64   - destFilePath = QString("%1/%2").arg(m_strDestDir).arg(finfo.fileName());
  76 + destFilePath = QString("%1/%2").arg(destfiledir).arg(finfo.fileName());
65 77 if(QFile::exists(destFilePath)){
66 78 QFile::rename(destFilePath, QString("%1.bak").arg(destFilePath));
67 79 }
... ... @@ -72,12 +84,12 @@ void ProgramCopyWorker::workerMain(){
72 84 emit progressed(nCurProgress,nRemainSec);
73 85 if(QThread::currentThread()->isInterruptionRequested()){
74 86 sync();
75   - emit finished();
76 87 QThread::currentThread()->quit();
77 88 break;
78 89 }
79 90 QThread::currentThread()->msleep(10);
80 91 }
  92 + qDebug() << "File List Copy Finished";
81 93  
82 94 if(QThread::currentThread()->isInterruptionRequested() == false){
83 95 foreach(QString srcpath, m_arrSrcDirList){
... ... @@ -93,31 +105,27 @@ void ProgramCopyWorker::workerMain(){
93 105  
94 106 QDir destDir(targetpath);
95 107 if(destDir.exists()) {
96   - qDebug() << "remove target path";
  108 + qDebug() << "rename target path";
97 109 QDir().rename(targetpath, QString("%1_").arg(targetpath));
98 110 }
99 111  
100 112 foreach(QString strDir, strdirlist){
101 113 QDir srcItem(strDir);
102 114 srcItem.mkpath( QString(strDir).replace(srcpath,targetpath));
103   - qDebug() << "make path : " << QString(strDir).replace(srcpath,targetpath);
104   - strFilelist = srcItem.entryList(QDir::NoDotAndDotDot | QDir::Files );
105   - foreach(QString filename, strFilelist){
106   - srcFilepath = QString("%1/%2").arg(strDir).arg(filename);
107   - destFilePath = QString("%1/%2").arg(QString(strDir).replace(srcpath,targetpath)).arg(filename);
108   - QFile::copy(srcFilepath, destFilePath);
109   - qDebug() << srcFilepath << destFilePath;
110   - QFileInfo finfo(srcFilepath);
  115 + QFileInfoList strFileInfolist = srcItem.entryInfoList(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
  116 + foreach(QFileInfo finfo, strFileInfolist){
  117 + srcFilepath = finfo.absoluteFilePath();
  118 + destFilePath = QString("%1/%2").arg(QString(strDir).replace(srcpath,targetpath)).arg(finfo.fileName());
111 119 nCpyFileSize += finfo.size();
112 120 nCurProgress = (nCpyFileSize *100) / nTotalFileSize;
113 121 nRemainSec = (nTotalFileSize-nCpyFileSize)/200000;
  122 + //qDebug() << srcFilepath << destFilePath << "total size " << nTotalFileSize << "nCpyFileSize " << nCpyFileSize;
114 123 emit progressed(nCurProgress,nRemainSec);
115 124 if(QThread::currentThread()->isInterruptionRequested()){
116 125 sync();
117   - emit finished();
118 126 break;
119 127 }
120   - QThread::currentThread()->msleep(100);
  128 + //QThread::currentThread()->msleep(100);
121 129 }
122 130 if(QThread::currentThread()->isInterruptionRequested()) break;
123 131 }
... ... @@ -125,12 +133,15 @@ void ProgramCopyWorker::workerMain(){
125 133 if(QThread::currentThread()->isInterruptionRequested()) break;
126 134 }
127 135 }
  136 + qDebug() << "File Copy Complete! SRC File Size = " << nTotalFileSize << "DEST File Size = " << nCpyFileSize;
128 137  
129 138 if(QThread::currentThread()->isInterruptionRequested()){
130   - foreach(QString filepath, m_arrSrcFileList){
  139 + foreach(QString strinfo, m_arrSrcFileList){
  140 + QString filepath = strinfo.left(strinfo.indexOf(',',0)+1);
  141 + QString destfiledir = strinfo.right(strinfo.size() - (strinfo.indexOf(',',0)+1));
131 142 QFileInfo finfo(filepath);
132 143 srcFilepath = filepath;
133   - destFilePath = QString("%1/%2").arg(m_strDestDir).arg(finfo.fileName());
  144 + destFilePath = QString("%1/%2").arg(destfiledir).arg(finfo.fileName());
134 145 if(QFile::exists( QString("%1.bak").arg(destFilePath))){
135 146 QFile::remove(destFilePath);
136 147 QFile::rename(QString("%1.bak").arg(destFilePath), destFilePath);
... ... @@ -160,12 +171,9 @@ void ProgramCopyWorker::workerMain(){
160 171 else{
161 172 foreach(QString srcpath, m_arrSrcDirList){
162 173 qDebug() << "src dir : " << srcpath;
163   -
164 174 QDir srcdir(srcpath);
165   -
166 175 QString targetpath =QString("%1%2").arg(m_strDestDir).arg(srcpath.mid(srcpath.lastIndexOf('/')));
167 176 qDebug() << "target dir : " << targetpath;
168   -
169 177 QDir destDir(targetpath);
170 178 QDir renameDir(QString("%1_").arg(targetpath));
171 179 if(renameDir.exists()) {
... ... @@ -576,7 +584,36 @@ void FileProcessDlg::onProgressed(int progress, int sec){
576 584 }
577 585  
578 586 void FileProcessDlg::programUpload(){
  587 + QString strDescPath;
  588 + QString strSrcPath;
  589 +
  590 + if(FileProcessor::detectUSB(strSrcPath)){
  591 + worker.addSrcFile(QString("%1/prime/falinux/run.sh,/falinux").arg(strSrcPath));
  592 + worker.addSrcFile(QString("%1/prime/falinux/app-prime-modbus,/falinux").arg(strSrcPath));
  593 + worker.addSrcFile(QString("%1/prime/falinux/app-prime-gui,/falinux").arg(strSrcPath));
  594 + worker.addSrcFile(QString("%1/prime/falinux/service-web,/falinux").arg(strSrcPath));
  595 + worker.addSrcFile(QString("%1/prime/falinux/templates/main.tmpl,/falinux/templates").arg(strSrcPath));
  596 + worker.addSrcFile(QString("%1/prime/falinux/system.ini,/falinux").arg(strSrcPath));
  597 + //worker.addSrcFile(QString("%1/prime/falinux/superdaemon,/falinux").arg(strSrcPath));
  598 + //worker.addSrcFile(QString("%1/prime/falinux/superdaemon.ini,/falinux").arg(strSrcPath));
  599 + worker.setDestPath("/prime");
  600 + worker.addSrcDir(QString("%1/%2").arg(strSrcPath,"cookbook"));
  601 + worker.moveToThread(&programCopyThd);
  602 +
  603 + connect(&programCopyThd,SIGNAL(started()), &worker, SLOT(workerMain()));
  604 + connect(&worker, SIGNAL(progressed(int,int)), this, SLOT(onProgressed(int,int)));
  605 + connect(this, SIGNAL(stopcopy()), &worker, SLOT(workerStop()));
  606 + connect(&worker, SIGNAL(finished()), &programCopyThd,SLOT(quit()));
  607 + connect(&programCopyThd, SIGNAL(finished()), this, SLOT(onProgressFinished()));
  608 + //connect(ui->ctrBtnCancel, SIGNAL(clicked(bool)), &worker, SLOT(workerStop()));
579 609  
  610 + programCopyThd.start();
  611 + qDebug() << "thread start";
  612 + }
  613 + else{
  614 + ui->ctrLbRemainTime->setText(tr("USB 인식을 실패하였습니다."));
  615 + QTimer::singleShot(1000,this,SLOT(close()));
  616 + }
580 617 }
581 618  
582 619 void FileProcessDlg::configDownload(){
... ...
app/gui/oven_control/fileprocessor.cpp
... ... @@ -65,7 +65,7 @@ quint64 FileProcessor::getDirSize(const QString &amp;str){
65 65 sizex += getDirSize(fileInfo.absoluteFilePath());
66 66 }
67 67 else{
68   - qDebug() << fileInfo.absoluteFilePath() << fileInfo.size();
  68 + //qDebug() << fileInfo.absoluteFilePath() << fileInfo.size();
69 69 sizex += fileInfo.size();
70 70 }
71 71 }
... ...