修改能量刻度保存逻辑。删除多余注释
This commit is contained in:
parent
68c2207110
commit
2b0af32bf1
|
|
@ -996,8 +996,15 @@ void EnergyScaleForm::on_pBtn_SaveAs_clicked()
|
||||||
void EnergyScaleForm::on_pBtn_Save_clicked()
|
void EnergyScaleForm::on_pBtn_Save_clicked()
|
||||||
{
|
{
|
||||||
systemEnble = false;
|
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, "成功", "数据保存成功");
|
QMessageBox::information(this, "成功", "数据保存成功");
|
||||||
|
QFile::remove(m_currentFilePath);
|
||||||
|
m_currentFilePath = newPath;
|
||||||
|
loadAllFilesInTheFolder();
|
||||||
} else {
|
} else {
|
||||||
QMessageBox::critical(this, "失败", "数据保存失败");
|
QMessageBox::critical(this, "失败", "数据保存失败");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,6 @@ ConformityHistoryItem ConformityHistoryItem::fromJson(const QJsonObject& obj)
|
||||||
item.firstParticleData[key] = firstParticleJson[key].toInt();
|
item.firstParticleData[key] = firstParticleJson[key].toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增:符合矩阵数据
|
|
||||||
memset(item.coincidenceMatrix, 0, sizeof(item.coincidenceMatrix));
|
memset(item.coincidenceMatrix, 0, sizeof(item.coincidenceMatrix));
|
||||||
QJsonArray matrixJson = obj["coincidenceMatrix"].toArray();
|
QJsonArray matrixJson = obj["coincidenceMatrix"].toArray();
|
||||||
for (int pBoard = 0; pBoard < MAX_BOARD && pBoard < matrixJson.size(); ++pBoard) {
|
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<QString, QVariant> &data_files_set)
|
void ConformityAnalysis::SetAnalyzeDataFilename(const QMap<QString, QVariant> &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;
|
if (data_files_set.isEmpty()) return;
|
||||||
clearAllCachedData();
|
clearAllCachedData();
|
||||||
m_conformFileMap.clear();
|
m_conformFileMap.clear();
|
||||||
|
|
@ -289,7 +252,6 @@ void ConformityAnalysis::SetAnalyzeDataFilename(const QMap<QString, QVariant> &d
|
||||||
QMutexLocker cacheLocker(&m_cacheMutex);
|
QMutexLocker cacheLocker(&m_cacheMutex);
|
||||||
m_calculatedCache[conformCount] = result;
|
m_calculatedCache[conformCount] = result;
|
||||||
canUseHistoryConformCounts.append(conformCount);
|
canUseHistoryConformCounts.append(conformCount);
|
||||||
qDebug() << "[ConformityAnalysis] " << conformCount << "重符合数据使用历史缓存,跳过解析";
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -307,7 +269,7 @@ void ConformityAnalysis::SetAnalyzeDataFilename(const QMap<QString, QVariant> &d
|
||||||
// 如果有需要解析的文件,启动后台解析
|
// 如果有需要解析的文件,启动后台解析
|
||||||
if (!needParseConformCounts.isEmpty()) {
|
if (!needParseConformCounts.isEmpty()) {
|
||||||
m_isParsing = true;
|
m_isParsing = true;
|
||||||
// 先解析2重符合(如果需要),保证界面快速显示
|
// 先解析2重符合,保证界面快速显示
|
||||||
if (needParseConformCounts.contains(2)) {
|
if (needParseConformCounts.contains(2)) {
|
||||||
ConformityCalculatedResult result = streamParseAndCalculate(2, m_conformFileMap[2]);
|
ConformityCalculatedResult result = streamParseAndCalculate(2, m_conformFileMap[2]);
|
||||||
QMutexLocker cacheLocker(&m_cacheMutex);
|
QMutexLocker cacheLocker(&m_cacheMutex);
|
||||||
|
|
@ -324,7 +286,6 @@ void ConformityAnalysis::SetAnalyzeDataFilename(const QMap<QString, QVariant> &d
|
||||||
parseRemainingConformDataInBackground(needParseConformCounts);
|
parseRemainingConformDataInBackground(needParseConformCounts);
|
||||||
} else {
|
} else {
|
||||||
m_isParsing = false;
|
m_isParsing = false;
|
||||||
qDebug() << "[ConformityAnalysis] 所有数据均使用历史缓存,无需解析";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -337,7 +298,6 @@ void ConformityAnalysis::parseRemainingConformDataInBackground(const QList<int>&
|
||||||
|
|
||||||
QList<int> sortedCounts = conformCounts;
|
QList<int> sortedCounts = conformCounts;
|
||||||
std::sort(sortedCounts.begin(), sortedCounts.end());
|
std::sort(sortedCounts.begin(), sortedCounts.end());
|
||||||
|
|
||||||
auto parseTask = [this, sortedCounts]() {
|
auto parseTask = [this, sortedCounts]() {
|
||||||
for (int conformCount : sortedCounts) {
|
for (int conformCount : sortedCounts) {
|
||||||
if (m_parseWatcher && m_parseWatcher->isCanceled())
|
if (m_parseWatcher && m_parseWatcher->isCanceled())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user