From 17bb01c5be4b9e5d8c4d397dc1a605c76eaf5790 Mon Sep 17 00:00:00 2001 From: Flamingo Date: Fri, 26 Apr 2024 00:24:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8D=E6=89=93=E5=8C=85=E7=A9=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cigarette/exportData.cpp | 42 +++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/Cigarette/exportData.cpp b/Cigarette/exportData.cpp index ec98d29..7273f7b 100644 --- a/Cigarette/exportData.cpp +++ b/Cigarette/exportData.cpp @@ -345,21 +345,27 @@ void ExportDataThread::run() QStringList argsNg; QStringList argsOk; - zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-00_0.zip"); - zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-59_1.zip"); + zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-00_" + zipTimeStamp[0] + "-59_0.zip"); + zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-00_" + zipTimeStamp[0] + "-59_1.zip"); fileList.append(g_conf_path.save_pics_path + "/" + zipTimeStamp[0] + "ng.txt"); fileList.append(g_conf_path.save_pics_path + "/" + zipTimeStamp[0] + "ok.txt"); zipTimeStamp.clear(); - QFile fileNg(fileList[0]); - QFile fileOk(fileList[1]); + QFile* file[2] = { NULL }; - fileNg.open(QIODevice::WriteOnly); - fileOk.open(QIODevice::WriteOnly); + file[0] = new QFile(fileList[0]); + file[1] = new QFile(fileList[1]); - QTextStream ngStream(&fileNg); - QTextStream okStream(&fileOk); + + //QFile fileNg(fileList[0]); + // QFile fileOk(fileList[1]); + + file[0]->open(QIODevice::WriteOnly); + file[1]->open(QIODevice::WriteOnly); + + QTextStream ngStream(file[0]); + QTextStream okStream(file[1]); argsNg.append("a"); argsNg.append(zipFilePaths[0]); @@ -378,13 +384,6 @@ void ExportDataThread::run() ngStream << listToZip[i] << endl; } - /* - QDir dir; - if (!dir.exists(listToZip[i].mid(index - 1))) - { - dir.mkpath(listToZip[i].mid(index - 1)); - } - */ } argsNg.append("-i@" + fileList[0]); argsNg.append("-mx=3"); @@ -392,23 +391,26 @@ void ExportDataThread::run() argsOk.append("-i@" + fileList[1]); argsOk.append("-mx=3"); - fileNg.close(); - fileOk.close(); + file[0]->close(); + file[1]->close(); for (int i = 0; i < zipFilePaths.size(); i++) { + if (file[i]->size() == 0) { + continue; + } process.start(QApplication::applicationDirPath() + "/7z.exe", i == 0 ? argsNg : argsOk); process.waitForStarted(); process.waitForFinished(); //QString out = QString::fromLocal8Bit(process.readAllStandardOutput()); //qDebug() << out; remotePath = zipFilePaths[i].mid(zipFilePaths[i].indexOf("image") - 1); - //qDebug() << remotePath; + qDebug() << remotePath; ConnectServer(zipFilePaths[i], remotePath); QFile file(zipFilePaths[i]); file.remove(); } - fileNg.remove(); - fileOk.remove(); + file[0]->remove(); + file[1]->remove(); listToZip.clear(); readyToSendZip = false; }