diff --git a/src/EnergyScaleForm.cpp b/src/EnergyScaleForm.cpp index 362163f..2c6ae56 100644 --- a/src/EnergyScaleForm.cpp +++ b/src/EnergyScaleForm.cpp @@ -996,8 +996,15 @@ void EnergyScaleForm::on_pBtn_SaveAs_clicked() void EnergyScaleForm::on_pBtn_Save_clicked() { systemEnble = false; - if (saveChannelDataToJson(m_currentFilePath)) { + QString name = ui->lineEdit_name->text(); + QString ListName = ui->listWidget->currentItem()->text(); + QString newPath = m_currentFilePath; + newPath.replace(ListName,name); + if (saveChannelDataToJson(newPath)) { QMessageBox::information(this, "成功", "数据保存成功"); + QFile::remove(m_currentFilePath); + m_currentFilePath = newPath; + loadAllFilesInTheFolder(); } else { QMessageBox::critical(this, "失败", "数据保存失败"); } diff --git a/src/ThreeDimensionalConformityAnalysisView/ConformityAnalysis.cpp b/src/ThreeDimensionalConformityAnalysisView/ConformityAnalysis.cpp index fb3d28e..f19f068 100644 --- a/src/ThreeDimensionalConformityAnalysisView/ConformityAnalysis.cpp +++ b/src/ThreeDimensionalConformityAnalysisView/ConformityAnalysis.cpp @@ -103,7 +103,6 @@ ConformityHistoryItem ConformityHistoryItem::fromJson(const QJsonObject& obj) item.firstParticleData[key] = firstParticleJson[key].toInt(); } - // 新增:符合矩阵数据 memset(item.coincidenceMatrix, 0, sizeof(item.coincidenceMatrix)); QJsonArray matrixJson = obj["coincidenceMatrix"].toArray(); for (int pBoard = 0; pBoard < MAX_BOARD && pBoard < matrixJson.size(); ++pBoard) { @@ -211,42 +210,6 @@ void ConformityAnalysis::InitViewWorkspace(const QString &project_name) void ConformityAnalysis::SetAnalyzeDataFilename(const QMap &data_files_set) { - // if (data_files_set.isEmpty()) return; - - // clearAllCachedData(); - // freeEventVector(_currentSpectrumData); - // m_conformFileMap.clear(); - - // for (const QString& key : data_files_set.keys()) { - // bool ok; - // int cnt = key.toInt(&ok); - // if (ok && cnt >=2 && cnt <=9) { - // m_conformFileMap[cnt] = data_files_set[key].toString(); - // } - // } - - // if (m_conformFileMap.isEmpty()) { - // qWarning() << "[ConformityAnalysis] 未找到任何有效的符合数数据文件"; - // return; - // } - - // if (m_conformFileMap.contains(2)) { - - // ConformityCalculatedResult result = streamParseAndCalculate(2, m_conformFileMap[2]); - - // QMutexLocker cacheLocker(&m_cacheMutex); - // m_calculatedCache[2] = result; - // cacheLocker.unlock(); - - // displayConformData(2); - - // QMetaObject::invokeMethod(this, [=]() { - // saveResultToHistory(result); - // }, Qt::QueuedConnection); - // } - // m_isParsing = true; - // parseAllConformDataInBackground(); - if (data_files_set.isEmpty()) return; clearAllCachedData(); m_conformFileMap.clear(); @@ -289,7 +252,6 @@ void ConformityAnalysis::SetAnalyzeDataFilename(const QMap &d QMutexLocker cacheLocker(&m_cacheMutex); m_calculatedCache[conformCount] = result; canUseHistoryConformCounts.append(conformCount); - qDebug() << "[ConformityAnalysis] " << conformCount << "重符合数据使用历史缓存,跳过解析"; continue; } } @@ -307,7 +269,7 @@ void ConformityAnalysis::SetAnalyzeDataFilename(const QMap &d // 如果有需要解析的文件,启动后台解析 if (!needParseConformCounts.isEmpty()) { m_isParsing = true; - // 先解析2重符合(如果需要),保证界面快速显示 + // 先解析2重符合,保证界面快速显示 if (needParseConformCounts.contains(2)) { ConformityCalculatedResult result = streamParseAndCalculate(2, m_conformFileMap[2]); QMutexLocker cacheLocker(&m_cacheMutex); @@ -324,7 +286,6 @@ void ConformityAnalysis::SetAnalyzeDataFilename(const QMap &d parseRemainingConformDataInBackground(needParseConformCounts); } else { m_isParsing = false; - qDebug() << "[ConformityAnalysis] 所有数据均使用历史缓存,无需解析"; } } @@ -337,7 +298,6 @@ void ConformityAnalysis::parseRemainingConformDataInBackground(const QList& QList sortedCounts = conformCounts; std::sort(sortedCounts.begin(), sortedCounts.end()); - auto parseTask = [this, sortedCounts]() { for (int conformCount : sortedCounts) { if (m_parseWatcher && m_parseWatcher->isCanceled())